svn commit: r661623 - in /ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions: admin/ chartofaccounts/ invoice/

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

svn commit: r661623 - in /ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions: admin/ chartofaccounts/ invoice/

lektran
Author: lektran
Date: Fri May 30 02:58:12 2008
New Revision: 661623

URL: http://svn.apache.org/viewvc?rev=661623&view=rev
Log:
Some more bsh -> groovy conversions

Added:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addAmountToInvoiceList.groovy
      - copied, changed from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addAmountToInvoiceList.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addTotalAmount.groovy
      - copied, changed from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addTotalAmount.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.groovy
      - copied, changed from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createItemList.groovy
      - copied, changed from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createItemList.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.groovy
      - copied, changed from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/findInvoices.groovy
      - copied, changed from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/findInvoices.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.groovy
      - copied, changed from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/invoicePayments.groovy
      - copied, changed from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/invoicePayments.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.groovy
      - copied, changed from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/orderListInvoiceItem.groovy
      - copied, changed from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/orderListInvoiceItem.bsh
Removed:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addAmountToInvoiceList.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addTotalAmount.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createItemList.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/findInvoices.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/invoicePayments.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/orderListInvoiceItem.bsh
Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy?rev=661623&r1=661622&r2=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy Fri May 30 02:58:12 2008
@@ -32,8 +32,7 @@
 
 List invoiceItemTypes = delegator.findList("InvoiceItemType", EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.LIKE, invItemTypePrefix), null, null, null, false);
 List allTypes = new LinkedList();
-invoiceItemTypes.each {
-    GenericValue invoiceItemType = it;
+invoiceItemTypes.each { invoiceItemType ->
     String activeGlDescription = "";
     String remove = " ";
     List glAccounts = null;

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy?rev=661623&r1=661622&r2=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy Fri May 30 02:58:12 2008
@@ -22,8 +22,7 @@
 
 taxAuthorityHavingNoGlAccountList = FastList.newInstance();
 taxAuthorities = delegator.findList("TaxAuthority", null, null, ["taxAuthGeoId", "taxAuthPartyId"], null, false);
-taxAuthorities.each {
-    taxAuthority = it;
+taxAuthorities.each { taxAuthority ->
     taxAuthorityGlAccount = delegator.findByPrimaryKey("TaxAuthorityGlAccount", [taxAuthGeoId : taxAuthority.taxAuthGeoId, taxAuthPartyId : taxAuthority.taxAuthPartyId, organizationPartyId : organizationPartyId]);
     if (!taxAuthorityGlAccount) {
         taxAuthorityHavingNoGlAccountList.add(taxAuthority);

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addAmountToInvoiceList.groovy (from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addAmountToInvoiceList.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addAmountToInvoiceList.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addAmountToInvoiceList.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addAmountToInvoiceList.bsh&r1=661565&r2=661623&rev=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addAmountToInvoiceList.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addAmountToInvoiceList.groovy Fri May 30 02:58:12 2008
@@ -24,18 +24,12 @@
 import org.ofbiz.accounting.invoice.*;
 import java.text.DateFormat;
 
-delegator = request.getAttribute("delegator");
-// if (invoiceId == null)  return;
-// invoice = delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", invoiceId));
-
-ArrayList newInvoices = new ArrayList();    //create new list, cannot modify existing one
-Iterator i = (Iterator) context.get("listIt");  // get iterator existing list
-while (i.hasNext())    {
-    item = i.next();
-    Map itemmap = new HashMap();
-    itemmap.putAll((Map) item);
-    itemmap.put("total", InvoiceWorker.getInvoiceTotal(item));
+newInvoices = [];    //create new list, cannot modify existing one
+context.listIt.each { item ->
+    itemmap = [:];
+    itemmap.putAll(item);
+    itemmap.total = InvoiceWorker.getInvoiceTotal(item);
      //create new list
     newInvoices.add(itemmap);
 }
-context.put("newListIt",newInvoices.iterator());
+context.newListIt = newInvoices.iterator();

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addTotalAmount.groovy (from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addTotalAmount.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addTotalAmount.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addTotalAmount.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addTotalAmount.bsh&r1=661565&r2=661623&rev=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addTotalAmount.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/addTotalAmount.groovy Fri May 30 02:58:12 2008
@@ -28,24 +28,20 @@
 import org.ofbiz.accounting.invoice.*;
 import java.text.DateFormat;
 
-delegator = request.getAttribute("delegator");
 invoiceId = request.getParameter("invoiceId");
 
 double invoiceTotal = 0;
-invoice = delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", invoiceId));
-Map newInvoice = new HashMap();
+invoice = delegator.findByPrimaryKey("Invoice", [invoiceId : invoiceId]);
+newInvoice = [:];
 
-if (invoice != null) {
+if (invoice) {
     invoiceItems = invoice.getRelated("InvoiceItem");
-    if (invoiceItems != null) {
+    if (invoiceItems) {
         invoiceTotal = InvoiceWorker.getInvoiceTotal(invoice);
     }
-    else {
-        invoiceTotal = 0;
-    }
     newInvoice.putAll(invoice);
 }
 
-newInvoice.put("invoiceAmount", new Double(invoiceTotal));
-context.put("invoiceExt",newInvoice);
-context.put("invoiceId",invoiceId);
+newInvoice.invoiceAmount = new Double(invoiceTotal);
+context.invoiceExt = newInvoice;
+context.invoiceId = invoiceId;

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.groovy (from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.bsh&r1=661565&r2=661623&rev=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createApplicationList.groovy Fri May 30 02:58:12 2008
@@ -30,67 +30,58 @@
 
 int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
 int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
-NULL = BigDecimal.ZERO;
+ZERO = BigDecimal.ZERO;
 
-delegator = request.getAttribute("delegator");
 invoiceId = request.getParameter("invoiceId");
-locale = context.get("locale");
-if (invoiceId == null)  invoiceId = context.get("invoiceId");
-invoice = delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", invoiceId));
-tabButtonItem = context.get("tabButtonItem");
+if (!invoiceId) invoiceId = context.invoiceId;
+invoice = delegator.findByPrimaryKey("Invoice", [invoiceId : invoiceId]);
+tabButtonItem = context.tabButtonItem;
 
-ArrayList invoiceItems = new ArrayList();  // to pass back to the screeen with payment applications added
-if (invoice != null) {    
+invoiceItems = [];  // to pass back to the screeen with payment applications added
+if (invoice) {    
     // retrieve related applications with null itemnumber
     invoiceAppl = null;  
-    invoiceAppls = delegator.findByAnd("PaymentApplication", UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId", null));
-    Iterator q = invoiceAppls.iterator();
-    while (q.hasNext()) {
-        invoiceAppl = q.next();
-        Map itemmap = new HashMap();
-        itemmap.put("invoiceId",invoiceId);
-        itemmap.put("invoiceItemSeqId",invoiceAppl.getString("invoiceItemSeqId"));
-        itemmap.put("total",InvoiceWorker.getInvoiceTotalBd(invoice).doubleValue());
-        itemmap.put("paymentApplicationId",invoiceAppl.getString("paymentApplicationId"));
-        itemmap.put("paymentId",invoiceAppl.getString("paymentId"));
-        itemmap.put("billingAccountId",invoiceAppl.getString("billingAccountId"));
-        itemmap.put("taxAuthGeoId",invoiceAppl.getString("taxAuthGeoId"));
-        itemmap.put("amountToApply",invoiceAppl.get("amountApplied"));
-        itemmap.put("amountApplied",invoiceAppl.get("amountApplied"));
+    invoiceAppls = delegator.findByAnd("PaymentApplication", [invoiceId : invoiceId, invoiceItemSeqId : null]);
+    invoiceAppls.each { invoiceAppl ->
+        itemmap = [:];
+        itemmap.invoiceId = invoiceId;
+        itemmap.invoiceItemSeqId = invoiceAppl.getString("invoiceItemSeqId"));
+        itemmap.total = InvoiceWorker.getInvoiceTotalBd(invoice).doubleValue();
+        itemmap.paymentApplicationId = invoiceAppl.paymentApplicationId;
+        itemmap.paymentId = invoiceAppl.paymentId;
+        itemmap.billingAccountId = invoiceAppl.billingAccountId;
+        itemmap.taxAuthGeoId = invoiceAppl.taxAuthGeoId;
+        itemmap.amountToApply = invoiceAppl.amountApplied;
+        itemmap.amountApplied = invoiceAppl.amountApplied;
         invoiceItems.add(itemmap);
     }
 
 
  // retrieve related applications with an existing itemnumber
-    Iterator i = invoice.getRelated("InvoiceItem").iterator();
-    while (i.hasNext()) {
-        item = i.next();
+    invoice.getRelated("InvoiceItem").each { item ->
         BigDecimal itemTotal = null;
-        if (item.get("amount") != null) {
-              if (item.get("quantity") == null || item.getBigDecimal("quantity").compareTo(NULL) == 0) {
+        if (item.amount != null) {
+              if (item.quantity == null || item.getBigDecimal("quantity").compareTo(ZERO) == 0) {
                   itemTotal = item.getBigDecimal("amount");
-              }
-              else {
+              } else {
                   itemTotal = item.getBigDecimal("amount").multiply(item.getBigDecimal("quantity"));
               }
         }
-          
+
         // get relation payment applications for every item(can be more than 1 per item number)
         paymentApplications = item.getRelated("PaymentApplication");
-        if (paymentApplications != null && paymentApplications.size() > 0)    {
-              Iterator p = paymentApplications.iterator();
-              while (p.hasNext())  {
-                  paymentApplication = p.next();
-                  Map itemmap = new HashMap();
+        if (paymentApplications) {
+              paymentApplications.each { paymentApplication ->
+                  itemmap = [:];
                   itemmap.putAll(item);
-                  itemmap.put("total",NumberFormat.getInstance(locale).format(itemTotal));
-                  itemmap.put("paymentApplicationId",paymentApplication.getString("paymentApplicationId"));
-                  itemmap.put("paymentId",paymentApplication.getString("paymentId"));
-                  itemmap.put("toPaymentId",paymentApplication.getString("toPaymentId"));
-                  itemmap.put("amountApplied",paymentApplication.getBigDecimal("amountApplied"));
-                  itemmap.put("amountToApply",paymentApplication.getBigDecimal("amountApplied"));
-                  itemmap.put("billingAccountId",paymentApplication.getString("billingAccountId"));
-                  itemmap.put("taxAuthGeoId",paymentApplication.getString("taxAuthGeoId"));
+                  itemmap.total = NumberFormat.getInstance(locale).format(itemTotal);
+                  itemmap.paymentApplicationId = paymentApplication.paymentApplicationId;
+                  itemmap.paymentId = paymentApplication.paymentId;
+                  itemmap.toPaymentId = paymentApplication.toPaymentId;
+                  itemmap.amountApplied = paymentApplication.getBigDecimal("amountApplied");
+                  itemmap.amountToApply = paymentApplication.getBigDecimal("amountApplied");
+                  itemmap.billingAccountId = paymentApplication.billingAccountId;
+                  itemmap.taxAuthGeoId = paymentApplication.taxAuthGeoId;
                   invoiceItems.add(itemmap);
               }
         }
@@ -112,8 +103,8 @@
         }
 */
     }
- context.put("invoice",invoice);
- context.put("invoiceId",invoiceId);
+ context.invoice = invoice;
+ context.invoiceId = invoiceId;
 }
 
-if(invoiceItems.size() > 0) context.put("invoiceApplications",invoiceItems);
+if(invoiceItems) context.put("invoiceApplications",invoiceItems);

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createItemList.groovy (from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createItemList.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createItemList.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createItemList.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createItemList.bsh&r1=661565&r2=661623&rev=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createItemList.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/createItemList.groovy Fri May 30 02:58:12 2008
@@ -36,20 +36,18 @@
 BigDecimal invoiceAmount = BigDecimal.ZERO;
 BigDecimal total = BigDecimal.ZERO;
 BigDecimal quantity = BigDecimal.ZERO;
-if ((invoiceId != null) && (invoice != null)) {    
-    invoiceItemsDb = invoice.getRelated("InvoiceItem", UtilMisc.toList("invoiceItemSeqId"));
-    if (invoiceItemsDb != null && invoiceItemsDb.size() > 0) {
+if (invoiceId && invoice) {    
+    invoiceItemsDb = invoice.getRelated("InvoiceItem", ["invoiceItemSeqId"]);
+    if (invoiceItemsDb) {
         // create totals
-        Iterator i = invoiceItemsDb.iterator();
-        while (i.hasNext())    {
-            item = i.next();
-            if (item.get("quantity") == null || item.getDouble("quantity").doubleValue() == 0.00) {
+        invoiceItemsDb.each { item ->
+            if (!item.quantity) {
                quantity = BigDecimal.ONE;
             } else {
                 quantity = item.getBigDecimal("quantity");
             }
-            if (item.get("amount")!= null) {
-                total = item.getBigDecimal("amount").multiply(quantity).setScale(decimals,rounding);
+            if (item.amount) {
+                total = (item.getBigDecimal("amount") * quantity).setScale(decimals, rounding);
             } else {
                 total = BigDecimal.ZERO;
             }

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.groovy (from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh&r1=661565&r2=661623&rev=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/editInvoice.groovy Fri May 30 02:58:12 2008
@@ -29,133 +29,127 @@
 import javolution.util.FastList;
 
 
-// delegator = parameters.get("delegator");
 invoiceId = parameters.get("invoiceId");
 
-invoice = delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", invoiceId));
-context.put("invoice", invoice);
+invoice = delegator.findByPrimaryKey("Invoice", [invoiceId : invoiceId]);
+context.invoice = invoice;
 
-other = parameters.get("other"); // allow the display of the invoice in the currency of the other party. sales: partyId, purch: partyIdFrom using the convertUom service.
-BigDecimal conversionRate = BigDecimal.ONE;
-private static BigDecimal ZERO = BigDecimal.ZERO;
-private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
-private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
-if (other != null && other.equalsIgnoreCase("y")) {
-  otherCurrency = null;
-  if ((invoice.getRelatedOne("InvoiceType")).getString("parentTypeId").equals("SALES_INVOICE"))
-    otherCurrency = invoice.getRelatedOne("Party").getString("preferredCurrencyUomId");
-  else
-    otherCurrency = invoice.getRelatedOne("FromParty").getString("preferredCurrencyUomId");
-  
+other = parameters.other; // allow the display of the invoice in the currency of the other party. sales: partyId, purch: partyIdFrom using the convertUom service.
+conversionRate = BigDecimal.ONE;
+ZERO = BigDecimal.ZERO;
+decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
+rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+if ("Y".equalsIgnoreCase(other)) {
+  if ((invoice.getRelatedOne("InvoiceType")).parentTypeId.equals("SALES_INVOICE")) {
+    otherCurrency = invoice.getRelatedOne("Party").preferredCurrencyUomId;
+  } else {
+    otherCurrency = invoice.getRelatedOne("FromParty").preferredCurrencyUomId;
+  }
   result = null;
-  if (otherCurrency != null && invoice.get("currencyUomId") != null && !otherCurrency.equals(invoice.getString("currencyUomId"))) {
-    result = dispatcher.runSync("convertUom", UtilMisc.toMap("uomId", invoice.getString("currencyUomId"), "uomIdTo", otherCurrency, "originalValue", 1.00, "asOfDate", invoice.getTimestamp("invoiceDate")));
-    
-    if (result.get("convertedValue") != null) {
-      conversionRate = new BigDecimal(result.get("convertedValue").doubleValue());
-      invoice.put("invoiceMessage",
-        invoice.get("invoiceMessage") != null?
-          invoice.getString("invoiceMessage").concat(" Converted from " + invoice.getString("currencyUomId") + " Rate: " + conversionRate.setScale(6, rounding).toString()) :
-            "Converted from " + invoice.getString("currencyUomId") + " Rate: " + conversionRate.setScale(6, rounding).toString());
-      invoice.put("currencyUomId", otherCurrency);
+  if (otherCurrency && invoice.currencyUomId && !otherCurrency.equals(invoice.currencyUomId)) {
+    result = dispatcher.runSync("convertUom", [uomId : invoice.currencyUomId,
+                                               uomIdTo : otherCurrency,
+                                               originalValue : 1.00,
+                                               asOfDate : invoice.invoiceDate]);
+    
+    if (result.convertedValue != null) {
+      conversionRate = new BigDecimal(result.convertedValue.doubleValue());
+      invoice.invoiceMessage = invoice.get("invoiceMessage") ?
+                          invoice.invoiceMessage.concat(" Converted from " + invoice.currencyUomId + " Rate: " + conversionRate.setScale(6, rounding).toString()) :
+                          "Converted from " + invoice.currencyUomId + " Rate: " + conversionRate.setScale(6, rounding).toString());
+      invoice.currencyUomId = otherCurrency;
     }
   }
-
 }
 
-if (invoice != null) {
-    invoiceItems = invoice.getRelatedOrderBy("InvoiceItem",UtilMisc.toList("invoiceItemSeqId"));
+if (invoice) {
+    invoiceItems = invoice.getRelatedOrderBy("InvoiceItem", ["invoiceItemSeqId"]);
     invoiceItemsConv = FastList.newInstance();
-    Iterator it = invoiceItems.iterator();
-    while (it.hasNext()) {
-      invoiceItem = it.next();
-      invoiceItem.put("amount", new Double((invoiceItem.getBigDecimal("amount").multiply(conversionRate).setScale(decimals, rounding)).doubleValue()));
+    invoiceItems.each { invoiceItem ->
+      invoiceItem.amount = new Double((invoiceItem.getBigDecimal("amount").multiply(conversionRate).setScale(decimals, rounding)).doubleValue()));
       invoiceItemsConv.add(invoiceItem);
     }
     
 
-    context.put("invoiceItems", invoiceItemsConv);
+    context.invoiceItems = invoiceItemsConv;
     
     invoiceTotal = InvoiceWorker.getInvoiceTotalBd(invoice).multiply(conversionRate).setScale(decimals, rounding).doubleValue();
     invoiceNoTaxTotal = InvoiceWorker.getInvoiceNoTaxTotalBd(invoice).multiply(conversionRate).setScale(decimals, rounding).doubleValue();
-    context.put("invoiceTotal", new Double(invoiceTotal));    
-    context.put("invoiceNoTaxTotal", new Double(invoiceNoTaxTotal));
+    context.invoiceTotal = new Double(invoiceTotal));    
+    context.invoiceNoTaxTotal = new Double(invoiceNoTaxTotal));
     
     // each invoice of course has two billing addresses, but the one that is relevant for purchase invoices is the PAYMENT_LOCATION of the invoice
     // (ie Accounts Payable address for the supplier), while the right one for sales invoices is the BILLING_LOCATION (ie Accounts Receivable or
     // home of the customer.)
-    billingAddress = null;
-    if ((invoice.getString("invoiceTypeId") != null) && (invoice.getString("invoiceTypeId").equals("PURCHASE_INVOICE"))) {
+    if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) {
         billingAddress = InvoiceWorker.getSendFromAddress(invoice);
     } else {
         billingAddress = InvoiceWorker.getBillToAddress(invoice);
     }
-    if (billingAddress != null) {
-        context.put("billingAddress", billingAddress);
+    if (billingAddress) {
+        context.billingAddress = billingAddress;
     }
     billingParty = InvoiceWorker.getBillToParty(invoice);
-    context.put("billingParty", billingParty);
+    context.billingParty = billingParty;
     sendingParty = InvoiceWorker.getSendFromParty(invoice);
-    context.put("sendingParty", sendingParty);
+    context.sendingParty = sendingParty;
 
                 //*________________this snippet was added for adding Tax ID in invoice header if needed _________________
                 
-               sendingTaxInfos=sendingParty.getRelated("PartyTaxAuthInfo");
-               billingTaxInfos=billingParty.getRelated("PartyTaxAuthInfo");
-               sendingPartyTaxId=null;
-               billingPartyTaxId=null;
+               sendingTaxInfos = sendingParty.getRelated("PartyTaxAuthInfo");
+               billingTaxInfos = billingParty.getRelated("PartyTaxAuthInfo");
+               sendingPartyTaxId = null;
+               billingPartyTaxId = null;
             
-               if (billingAddress != null) {
-                   for (Iterator i=sendingTaxInfos.iterator();i.hasNext();) {
-                       if (i.next().get("taxAuthGeoId").equals(billingAddress.get("countryGeoId"))) {
-                            sendingPartyTaxId=sendingTaxInfos.get(i.previousIndex()).get("partyTaxId");
+               if (billingAddress) {
+                   sendingTaxInfos.eachWithIndex { sendingTaxInfo, i ->
+                       if (sendingTaxInfo.taxAuthGeoId.equals(billingAddress.countryGeoId)) {
+                            sendingPartyTaxId = sendingTaxInfos[i-1].partyTaxId;
                        }
                    }
-                   for (i=billingTaxInfos.iterator(); i.hasNext(); ) {
-                       if (i.next().get("taxAuthGeoId").equals(billingAddress.get("countryGeoId"))) {
-                            billingPartyTaxId=billingTaxInfos.get(i.previousIndex()).get("partyTaxId");
+                   billingTaxInfos.eachWithIndex { billingTaxInfo, i ->
+                       if (billingTaxInfo.taxAuthGeoId.equals(billingAddress.countryGeoId)) {
+                            billingPartyTaxId = billingTaxInfos[i-1].partyTaxId;
                        }
                    }
                }
-               if (sendingPartyTaxId != null ) {
-                   context.put("sendingPartyTaxId",sendingPartyTaxId);
+               if (sendingPartyTaxId) {
+                   context.sendingPartyTaxId = sendingPartyTaxId;
                }
-               if (billingPartyTaxId != null ) {
-                   context.put("billingPartyTaxId",billingPartyTaxId);
+               if (billingPartyTaxId) {
+                   context.billingPartyTaxId = billingPartyTaxId;
                }
                //________________this snippet was added for adding Tax ID in invoice header if needed _________________*/
   
 
     terms = invoice.getRelated("InvoiceTerm");
-    context.put("terms", terms);
+    context.terms = terms;
     
-    paymentAppls = delegator.findByAnd("PaymentApplication", UtilMisc.toMap("invoiceId", invoiceId));
-    context.put("payments", paymentAppls);
+    paymentAppls = delegator.findByAnd("PaymentApplication", [invoiceId : invoiceId]);
+    context.payments = paymentAppls;
     
-    orderItemBillings = delegator.findByAnd("OrderItemBilling", UtilMisc.toMap("invoiceId", invoiceId), UtilMisc.toList("orderId"));
+    orderItemBillings = delegator.findByAnd("OrderItemBilling", [invoiceId : invoiceId], [orderId]);
     orders = new LinkedHashSet();
-    oibIter = orderItemBillings.iterator();
-    while (oibIter.hasNext()) {
-        orderIb = oibIter.next();
-        orders.add(orderIb.getString("orderId"));
+    orderItemBillings.each { orderIb ->
+        orders.add(orderIb.orderId);
     }
-    context.put("orders", orders);
+    context.orders = orders;
     
     invoiceStatus = invoice.getRelatedOne("StatusItem");            
-    context.put("invoiceStatus", invoiceStatus);
+    context.invoiceStatus = invoiceStatus;
     
-    edit = parameters.get("editInvoice");
-    if (edit != null && edit.equalsIgnoreCase("true")) {            
+    edit = parameters.editInvoice;
+    if ("true".equalsIgnoreCase(edit)) {            
         invoiceItemTypes = delegator.findList("InvoiceItemType", null, null, null, null, false);
-        context.put("invoiceItemTypes", invoiceItemTypes);  
-        context.put("editInvoice", new Boolean(true));  
+        context.invoiceItemTypes = invoiceItemTypes;
+        context.editInvoice = true;  
     }
 
     // format the date
-    if (invoice.get("invoiceDate") != null) {
-        invoiceDate = DateFormat.getDateInstance(DateFormat.LONG).format(invoice.get("invoiceDate"));
-        context.put("invoiceDate", invoiceDate);
+    if (invoice.invoiceDate) {
+        invoiceDate = DateFormat.getDateInstance(DateFormat.LONG).format(invoice.invoiceDate);
+        context.invoiceDate = invoiceDate;
     } else {
-        context.put("invoiceDate", "N/A");
-    }      
+        context.invoiceDate = "N/A";
+    }
 }

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/findInvoices.groovy (from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/findInvoices.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/findInvoices.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/findInvoices.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/findInvoices.bsh&r1=661565&r2=661623&rev=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/findInvoices.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/findInvoices.groovy Fri May 30 02:58:12 2008
@@ -23,21 +23,19 @@
 import org.ofbiz.entity.condition.*;
 import org.ofbiz.base.util.*;
 
-delegator = request.getAttribute("delegator");
-
 // get the invoice types
-invoiceTypes = delegator.findList("InvoiceType", null, null, UtilMisc.toList("description"), null, false);
-context.put("invoiceTypes", invoiceTypes);
+invoiceTypes = delegator.findList("InvoiceType", null, null, ["description"], null, false);
+context.invoiceTypes = invoiceTypes;
 
 // get the invoice statuses
-invoiceStatuses = delegator.findByAnd("StatusItem", UtilMisc.toMap("statusTypeId", "INVOICE_STATUS"), UtilMisc.toList("sequenceId", "description"));
-context.put("invoiceStatuses", invoiceStatuses);
+invoiceStatuses = delegator.findByAnd("StatusItem", [statusTypeId : INVOICE_STATUS], ["sequenceId", "description"]);
+context.invoiceStatuses = invoiceStatuses;
 
 // current selected status
 currentStatusId = request.getParameter("invoiceStatusId");
-if (currentStatusId != null && currentStatusId.length() > 0) {
-    currentStatus = delegator.findByPrimaryKeyCache("StatusItem", UtilMisc.toMap("statusId", currentStatusId));
-    context.put("currentStatus", currentStatus);
+if (currentStatusId) {
+    currentStatus = delegator.findByPrimaryKeyCache("StatusItem", [statusId : currentStatusId]);
+    context.currentStatus = currentStatus;
 }
 
 // create the fromDate for calendar
@@ -51,7 +49,7 @@
 fromTs = new Timestamp(fromCal.getTimeInMillis());
 fromStr = fromTs.toString();
 fromStr = fromStr.substring(0, fromStr.indexOf('.'));
-context.put("fromDateStr", fromStr);
+context.fromDateStr = fromStr;
 
 // create the thruDate for calendar
 toCal = Calendar.getInstance();
@@ -63,7 +61,7 @@
 toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND));
 toTs = new Timestamp(toCal.getTimeInMillis());
 toStr = toTs.toString();
-context.put("thruDateStr", toStr);
+context.thruDateStr = toStr;
 
 // get the lookup flag
 lookupFlag = request.getParameter("lookupFlag");
@@ -72,69 +70,68 @@
 paramList = "";
 
 invoiceList = null;
-if (lookupFlag != null) {
-    paramList = paramList + "&lookupFlag=" + lookupFlag;
+if (lookupFlag) {
+    paramList += "&lookupFlag=" + lookupFlag;
     lookupErrorMessage = null;  
-    andExprs = new ArrayList();
+    andExprs = [];
     entityName = "Invoice";
           
     // define the main condition
     mainCond = null;
     
     // now do the filtering
-    if (lookupErrorMessage == null) {              
-        invoiceType = request.getParameter("invoiceTypeId");
-        invoiceStatus = request.getParameter("invoiceStatusId");      
-        billAcct = request.getParameter("billingAccountId");
-        minDate = request.getParameter("minDate");
-        maxDate = request.getParameter("maxDate");
-                
-        if (invoiceType == null) invoiceType = "ANY";
-        if (invoiceStatus == null) invoiceStatus = "ANY";
+    invoiceType = request.getParameter("invoiceTypeId");
+    invoiceStatus = request.getParameter("invoiceStatusId");      
+    billAcct = request.getParameter("billingAccountId");
+    minDate = request.getParameter("minDate");
+    maxDate = request.getParameter("maxDate");
+            
+    invoiceType = invoiceType ?: "ANY";
+    invoiceStatus = invoiceStatus ?: "ANY";
                 
-        paramList = paramList + "&invoiceTypeId=" + invoiceType;        
-        if (!"ANY".equals(invoiceType)) {            
-            andExprs.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, invoiceType));
-        }
-        paramList = paramList + "&invoiceStatusId=" + invoiceStatus;
-        if (!"ANY". equals(invoiceStatus)) {            
-            andExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, invoiceStatus));
-        }
-        if (billAcct != null && billAcct.length() > 0) {
-            paramList = paramList + "&billingAccountId=" + billAcct;
-            andExprs.add(EntityCondition.makeCondition("billingAccountId", EntityOperator.EQUALS, billAcct));
-        }    
-      
-        if (minDate != null && minDate.length() > 8) {            
-            minDate = minDate.trim();
-            if (minDate.length() < 14) minDate = minDate + " " + "00:00:00.000";
-            paramList = paramList + "&minDate=" + minDate;
-            andExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, ObjectType.simpleTypeConvert(minDate, "Timestamp", null, null)));        
-        }
-        if (maxDate != null && maxDate.length() > 8) {
-            maxDate = maxDate.trim();
-            if (maxDate.length() < 14) maxDate = maxDate + " " + "23:59:59.999";
-            paramList = paramList + "&maxDate=" + maxDate;
-            andExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN_EQUAL_TO, ObjectType.simpleTypeConvert(maxDate, "Timestamp", null, null)));
-        }
-                
-        mainCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);        
-                                                      
+    paramList += "&invoiceTypeId=" + invoiceType;        
+    if (!"ANY".equals(invoiceType)) {            
+       andExprs.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, invoiceType));
+    }
+    paramList += "&invoiceStatusId=" + invoiceStatus;
+    if (!"ANY".equals(invoiceStatus)) {            
+        andExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, invoiceStatus));
     }
+    if (billAcct) {
+        paramList += "&billingAccountId=" + billAcct;
+        andExprs.add(EntityCondition.makeCondition("billingAccountId", EntityOperator.EQUALS, billAcct));
+    }    
+  
+    if (minDate && minDate.length() > 8) {            
+        minDate = minDate.trim();
+        if (minDate.length() < 14) minDate = minDate + " " + "00:00:00.000";
+        paramList += "&minDate=" + minDate;
+        andExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, ObjectType.simpleTypeConvert(minDate, "Timestamp", null, null)));
+    }
+    if (maxDate && maxDate.length() > 8) {
+        maxDate = maxDate.trim();
+        if (maxDate.length() < 14) maxDate = maxDate + " " + "23:59:59.999";
+        paramList += "&maxDate=" + maxDate;
+        andExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN_EQUAL_TO, ObjectType.simpleTypeConvert(maxDate, "Timestamp", null, null)));
+    }
+            
+    mainCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);        
+                                                  
+
     
-    if (lookupErrorMessage == null && mainCond != null) {
+    if ((!lookupErrorMessage) && mainCond) {
         // do the lookup
-        invoiceList = delegator.findList(entityName, mainCond, null, UtilMisc.toList("-invoiceDate"), null, false);            
+        invoiceList = delegator.findList(entityName, mainCond, null, ["-invoiceDate"], null, false);            
     }
     
-    context.put("invoiceList", invoiceList);
+    context.invoiceList = invoiceList;
     
-    if (lookupErrorMessage != null) {
-        context.put("lookupErrorMessage", lookupErrorMessage);
+    if (lookupErrorMessage) {
+        context.lookupErrorMessage = lookupErrorMessage;
     }
 }
 
-context.put("paramList", paramList);
+context.paramList = paramList;
 
 // set the page parameters
 viewIndex = 0;
@@ -152,7 +149,7 @@
 }
 
 listSize = 0;
-if (invoiceList != null) {
+if (invoiceList) {
     listSize = invoiceList.size();
 }
 
@@ -162,8 +159,8 @@
 if (listSize < highIndex) {
     highIndex = listSize;
 }
-context.put("viewIndex", viewIndex);
-context.put("listSize", listSize);
-context.put("highIndex", highIndex);
-context.put("lowIndex", lowIndex);
-context.put("viewSize", viewSize);
+context.viewIndex = viewIndex;
+context.listSize = listSize;
+context.highIndex = highIndex;
+context.lowIndex = lowIndex;
+context.viewSize = viewSize;

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.groovy (from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh&r1=661565&r2=661623&rev=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/getInvoiceItemTypes.groovy Fri May 30 02:58:12 2008
@@ -26,29 +26,29 @@
 
 import javolution.util.FastList;
 
-invoice = context.get("invoice");
-if (invoice == null) return;
+invoice = context.invoice;
+if (!invoice) return;
 glAccountOrganizationAndClassList = null;
-if ("SALES_INVOICE".equals(invoice.get("invoiceTypeId"))) {
+if ("SALES_INVOICE".equals(invoice.invoiceTypeId)) {
     List parentTypes = FastList.newInstance();
     parentTypes.add(EntityCondition.makeCondition("parentTypeId", EntityOperator.EQUALS, "INVOICE_ADJ"));
     parentTypes.add(EntityCondition.makeCondition("parentTypeId", EntityOperator.EQUALS, "INVOICE_ITM_ADJ"));
     parentTypes.add(EntityCondition.makeCondition("parentTypeId", EntityOperator.EQUALS, "INV_PROD_ITEM"));
     parentTypesCond = EntityCondition.makeCondition(parentTypes, EntityOperator.OR);
-    invoiceItemTypes = delegator.findList("InvoiceItemType", parentTypesCond, null, UtilMisc.toList("parentTypeId", "invoiceItemTypeId"), null, false);
-    glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", UtilMisc.toMap("organizationPartyId", invoice.get("partyIdFrom")));
-} else if ("PURCHASE_INVOICE".equals(invoice.get("invoiceTypeId"))) {
+    invoiceItemTypes = delegator.findList("InvoiceItemType", parentTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false);
+    glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyIdFrom]);
+} else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) {
     List parentTypes = FastList.newInstance();
     parentTypes.add(EntityCondition.makeCondition("parentTypeId", EntityOperator.EQUALS, "PINVOICE_ADJ"));
     parentTypes.add(EntityCondition.makeCondition("parentTypeId", EntityOperator.EQUALS, "PINVOICE_ITM_ADJ"));
     parentTypes.add(EntityCondition.makeCondition("parentTypeId", EntityOperator.EQUALS, "PINV_PROD_ITEM"));
     parentTypesCond = EntityCondition.makeCondition(parentTypes, EntityOperator.OR);
-    invoiceItemTypes = delegator.findList("InvoiceItemType", parentTypesCond, null, UtilMisc.toList("parentTypeId", "invoiceItemTypeId"), null, false);
-    glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", UtilMisc.toMap("organizationPartyId", invoice.get("partyId")));
+    invoiceItemTypes = delegator.findList("InvoiceItemType", parentTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false);
+    glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId]);
 } else {
-    map = delegator.findByAndCache("InvoiceItemTypeMap", UtilMisc.toMap("invoiceTypeId", invoice.get("invoiceTypeId")));
+    map = delegator.findByAndCache("InvoiceItemTypeMap", [invoiceTypeId : invoice.invoiceTypeId]);
     invoiceItemTypes = EntityUtil.getRelated("InvoiceItemType", map);
 }
-context.put("invoiceItemTypes", invoiceItemTypes);
+context.invoiceItemTypes = invoiceItemTypes;
 
-context.put("glAccountOrganizationAndClassList", glAccountOrganizationAndClassList);
\ No newline at end of file
+context.glAccountOrganizationAndClassList = glAccountOrganizationAndClassList;

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/invoicePayments.groovy (from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/invoicePayments.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/invoicePayments.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/invoicePayments.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/invoicePayments.bsh&r1=661565&r2=661623&rev=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/invoicePayments.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/invoicePayments.groovy Fri May 30 02:58:12 2008
@@ -23,8 +23,7 @@
 import org.ofbiz.accounting.invoice.*;
 
 invoiceId = request.getParameter("invoiceId");
-delegator = request.getAttribute("delegator");
 
-payments = delegator.findByAnd("PaymentAndApplication", UtilMisc.toMap("invoiceId", invoiceId));
-context.put("payments", payments);
-context.put("invoiceId", invoiceId);
+payments = delegator.findByAnd("PaymentAndApplication", [invoiceId : invoiceId]);
+context.payments = payments;
+context.invoiceId : invoiceId;

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.groovy (from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.bsh&r1=661565&r2=661623&rev=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/listNotAppliedPayments.groovy Fri May 30 02:58:12 2008
@@ -32,26 +32,25 @@
 import org.ofbiz.entity.model.*;
 import java.text.NumberFormat;
 
-invoiceId = parameters.get("invoiceId");
-invoice = delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", invoiceId));
+invoiceId = parameters.invoiceId;
+invoice = delegator.findByPrimaryKey("Invoice", [invoiceId : invoiceId]);
 
-int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
-int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
-Locale locale = context.get("locale");
+decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
+rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
 
-ArrayList paymentsMapList = new ArrayList();  // to pass back to the screeen list of unapplied payments
+paymentsMapList = [];  // to pass back to the screeen list of unapplied payments
 
 // retrieve payments for the related parties which have not been (fully) applied yet
 List payments = null;
 GenericValue payment = null;
-exprList = new ArrayList();
-expr = EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, invoice.getString("partyIdFrom"));
+exprList = [];
+expr = EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, invoice.partyIdFrom);
 exprList.add(expr);
-expr = EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, invoice.getString("partyId"));
+expr = EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, invoice.partyId);
 exprList.add(expr);
 
 // only payments with received and sent and not paid
-exprListStatus = new ArrayList();
+exprListStatus = [];
 expr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_NOT_PAID");
 exprListStatus.add(expr);
 expr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED");
@@ -63,33 +62,30 @@
 
 topCond = EntityCondition.makeCondition(exprList, EntityOperator.AND);
 
-payments = delegator.findList("Payment", topCond, null, UtilMisc.toList("effectiveDate"), null, false);
-if (payments != null && payments.size() > 0)    {
+payments = delegator.findList("Payment", topCond, null, ["effectiveDate"], null, false);
+if (payments)    {
     List paymentApplications = null;
     GenericValue paymentApplication = null;
-    BigDecimal invoiceApplied = InvoiceWorker.getInvoiceAppliedBd(invoice);
-    BigDecimal invoiceAmount = InvoiceWorker.getInvoiceTotalBd(invoice);
-    BigDecimal invoiceToApply = InvoiceWorker.getInvoiceNotApplied(invoice);
-    Iterator p = payments.iterator();
-    while(p.hasNext())    {
-        payment = p.next();
+    invoiceApplied = InvoiceWorker.getInvoiceAppliedBd(invoice);
+    invoiceAmount = InvoiceWorker.getInvoiceTotalBd(invoice);
+    invoiceToApply = InvoiceWorker.getInvoiceNotApplied(invoice);
+    payments.each { payment ->
         if (PaymentWorker.getPaymentNotAppliedBd(payment).signum() == 1) {
            // put in the map
-           Map paymentMap = new HashMap();
-           paymentMap.put("paymentId", payment.getString("paymentId"));
-           paymentMap.put("effectiveDate", payment.getString("effectiveDate").substring(0,10)); // list as YYYY-MM-DD
-           paymentMap.put("amount", payment.getBigDecimal("amount"));
-           paymentMap.put("currencyUomId", payment.getString("currencyUomId"));
-           paymentMap.put("amountApplied", PaymentWorker.getPaymentAppliedBd(payment));
+           Map paymentMap = [:];
+           paymentMap.paymentId = payment.paymentId;
+           paymentMap.effectiveDate = payment.effectiveDate.substring(0,10); // list as YYYY-MM-DD
+           paymentMap.amount = payment.getBigDecimal("amount");
+           paymentMap.currencyUomId = payment.currencyUomId;
+           paymentMap.amountApplied = PaymentWorker.getPaymentAppliedBd(payment);
            BigDecimal paymentToApply = PaymentWorker.getPaymentNotAppliedBd(payment);
            if (paymentToApply.compareTo(invoiceToApply) < 0 ) {
-                paymentMap.put("amountToApply",paymentToApply);
-           }
-           else {
-                paymentMap.put("amountToApply",invoiceToApply);
+                paymentMap.amountToApply = paymentToApply;
+           } else {
+                paymentMap.amountToApply = invoiceToApply;
            }
            paymentsMapList.add(paymentMap);
         }
     }
-}      
-context.put("payments", paymentsMapList);
+}
+context.payments = paymentsMapList;

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/orderListInvoiceItem.groovy (from r661565, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/orderListInvoiceItem.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/orderListInvoiceItem.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/orderListInvoiceItem.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/orderListInvoiceItem.bsh&r1=661565&r2=661623&rev=661623&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/orderListInvoiceItem.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/orderListInvoiceItem.groovy Fri May 30 02:58:12 2008
@@ -23,25 +23,23 @@
 import org.ofbiz.entity.util.EntityUtil;
 import javolution.util.FastMap;
 
-invoiceId = context.get("invoiceId");
-if(invoiceId != null) {
-    List invoiceItems = new LinkedList();
-    invoiceItemList = delegator.findByAnd("InvoiceItem", UtilMisc.toMap("invoiceId", invoiceId), UtilMisc.toList("invoiceItemSeqId"));
-    if(invoiceItemList != null) {
-        itr = invoiceItemList.iterator();
-        while(itr.hasNext()) {
-            GenericValue invoiceItem = itr.next();
-            invoiceItemSeqId = invoiceItem.get("invoiceItemSeqId");
-            invoiceId = invoiceItem.get("invoiceId");            
-            orderItemBilling = EntityUtil.getFirst(delegator.findByAnd("OrderItemBilling", UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId)));
-            Map invoiceItemMap = FastMap.newInstance();
-            invoiceItemMap.putAll((Map) invoiceItem);
-            if(orderItemBilling != null) {
-                orderId = orderItemBilling.get("orderId");
-                invoiceItemMap.put("orderId", orderId);
-            }
-            invoiceItems.add(invoiceItemMap);
+invoiceId = context.invoiceId;
+if (invoiceId) return;
+
+List invoiceItems = [];
+invoiceItemList = delegator.findByAnd("InvoiceItem", [invoiceId : invoiceId], ["invoiceItemSeqId"]);
+if (invoiceItemList) {
+    invoiceItemList.each { invoiceItem ->
+        invoiceItemSeqId = invoiceItem.invoiceItemSeqId;
+        invoiceId = invoiceItem.invoiceId;            
+        orderItemBilling = EntityUtil.getFirst(delegator.findByAnd("OrderItemBilling", [invoiceId : invoiceId, invoiceItemSeqId : invoiceItemSeqId]));
+        Map invoiceItemMap = FastMap.newInstance();
+        invoiceItemMap.putAll((Map) invoiceItem);
+        if(orderItemBilling) {
+            orderId = orderItemBilling.orderId;
+            invoiceItemMap.orderId = orderId;
         }
-        context.put("invoiceItems", invoiceItems);
+        invoiceItems.add(invoiceItemMap);
     }
+    context.invoiceItems = invoiceItems;
 }
\ No newline at end of file