svn commit: r935402 - in /ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions: invoice/EditInvoice.groovy invoice/OrderListInvoiceItem.groovy order/BillingAccountOrders.groovy reports/TransactionTotals.groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r935402 - in /ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions: invoice/EditInvoice.groovy invoice/OrderListInvoiceItem.groovy order/BillingAccountOrders.groovy reports/TransactionTotals.groovy

lektran
Author: lektran
Date: Sun Apr 18 20:20:41 2010
New Revision: 935402

URL: http://svn.apache.org/viewvc?rev=935402&view=rev
Log:
As it turns out, Groovy's List.first() method doesn't quite behave as I'd assumed.  Fixes bug report by Blas Rodriguez Somoza in OFBIZ-3711.

Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/OrderListInvoiceItem.groovy
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy?rev=935402&r1=935401&r2=935402&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy Sun Apr 18 20:20:41 2010
@@ -78,7 +78,7 @@ if (invoice) {
         taxRate = invoiceItem.getRelatedOne("TaxAuthorityRateProduct");
         if (taxRate && "VAT_TAX".equals(taxRate.taxAuthorityRateTypeId)) {
             taxInfos = EntityUtil.filterByDate(delegator.findByAnd("PartyTaxAuthInfo", [partyId : billingParty.partyId, taxAuthGeoId : taxRate.taxAuthGeoId, taxAuthPartyId : taxRate.taxAuthPartyId]), invoice.invoiceDate);
-            taxInfo = taxInfos.first();
+            taxInfo = EntityUtil.getFirst(taxInfos);
             if (taxInfo) {
                 context.billingPartyTaxId = taxInfo.partyTaxId;
             }

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/OrderListInvoiceItem.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/OrderListInvoiceItem.groovy?rev=935402&r1=935401&r2=935402&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/OrderListInvoiceItem.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/OrderListInvoiceItem.groovy Sun Apr 18 20:20:41 2010
@@ -32,7 +32,7 @@ if (invoiceItemList) {
     invoiceItemList.each { invoiceItem ->
         invoiceItemSeqId = invoiceItem.invoiceItemSeqId;
         invoiceId = invoiceItem.invoiceId;
-        orderItemBilling = delegator.findByAnd("OrderItemBilling", [invoiceId : invoiceId, invoiceItemSeqId : invoiceItemSeqId]).first();
+        orderItemBilling = EntityUtil.getFirst(delegator.findByAnd("OrderItemBilling", [invoiceId : invoiceId, invoiceItemSeqId : invoiceItemSeqId]));
         Map invoiceItemMap = FastMap.newInstance();
         invoiceItemMap.putAll((Map) invoiceItem);
         if (orderItemBilling) {

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy?rev=935402&r1=935401&r2=935402&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy Sun Apr 18 20:20:41 2010
@@ -27,7 +27,7 @@ if (billingAccountId) {
     if (orderList) {
         orderList.each { orderHeader ->
             orderId = orderHeader.orderId;
-            orderBillingAcc = delegator.findByAnd("OrderHeaderAndPaymentPref", [orderId : orderId]).first();
+            orderBillingAcc = EntityUtil.getFirst(delegator.findByAnd("OrderHeaderAndPaymentPref", [orderId : orderId]));
             orderBillingAccMap = FastMap.newInstance();
             if (orderBillingAcc.paymentMethodTypeId.equals("EXT_BILLACT") && orderBillingAcc.paymentStatusId.equals("PAYMENT_NOT_RECEIVED")) {
                 orderBillingAccMap.putAll(orderBillingAcc);

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy?rev=935402&r1=935401&r2=935402&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy Sun Apr 18 20:20:41 2010
@@ -76,7 +76,7 @@ if (postedTransactionTotals) {
                         timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
                         timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, postedTransactionTotal.glAccountId));
                         timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-                        lastTimePeriodHistory = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false).first();
+                        lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
                         if (lastTimePeriodHistory) {
                             accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
                         }
@@ -173,7 +173,7 @@ if (unpostedTransactionTotals) {
                         timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
                         timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, unpostedTransactionTotal.glAccountId));
                         timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-                        lastTimePeriodHistory = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false).first();
+                        lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
                         if (lastTimePeriodHistory) {
                             accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
                         }
@@ -269,7 +269,7 @@ if (allTransactionTotals) {
                         timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
                         timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, allTransactionTotal.glAccountId));
                         timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-                        lastTimePeriodHistory = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false).first();
+                        lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
                         if (lastTimePeriodHistory) {
                             accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
                         }