You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2008/05/30 07:00:07 UTC

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

Author: lektran
Date: Thu May 29 22:00:07 2008
New Revision: 661566

URL: http://svn.apache.org/viewvc?rev=661566&view=rev
Log:
Switched some more scripts to groovy, also started using groovy's 'each' iterator

Added:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/EditGlobalGlAccount.groovy
      - copied, changed from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/EditGlobalGlAccount.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/FindGlobalGlAccount.groovy
      - copied, changed from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/FindGlobalGlAccount.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy
      - copied, changed from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/editGlJournalEntry.groovy
      - copied, changed from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/editGlJournalEntry.bsh
Removed:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/EditGlobalGlAccount.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/FindGlobalGlAccount.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.bsh
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/editGlJournalEntry.bsh
Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.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=661566&r1=661565&r2=661566&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 Thu May 29 22:00:07 2008
@@ -32,9 +32,8 @@
 
 List invoiceItemTypes = delegator.findList("InvoiceItemType", EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.LIKE, invItemTypePrefix), null, null, null, false);
 List allTypes = new LinkedList();
-i = invoiceItemTypes.iterator();
-while(i) {
-    GenericValue invoiceItemType = i.next();
+invoiceItemTypes.each {
+    GenericValue invoiceItemType = it;
     String activeGlDescription = "";
     String remove = " ";
     List glAccounts = null;

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.groovy?rev=661566&r1=661565&r2=661566&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.groovy Thu May 29 22:00:07 2008
@@ -31,8 +31,6 @@
 payments = new ArrayList();
 
 // first ensure ability to print
-security = request.getAttribute("security");
-context.security = security;
 if (!security.hasEntityPermission("ACCOUNTING", "_PRINT_CHECKS", session)) {
     context.payments = []; // if no permission, just pass an empty list for now
     return;
@@ -49,11 +47,8 @@
 
 // in the case of a multi form, parse the multi data and get all of the selected payments
 selected = UtilHttp.parseMultiFormData(parameters);
-iter = selected.iterator();
-while (iter) {
-    row = iter.next(); 
-    payment = delegator.findByPrimaryKey("Payment", [paymentId : row.paymentId]);
-    if (!payment) continue;
-    payments.add(payment);
+selected.each {
+    payment = delegator.findByPrimaryKey("Payment", [paymentId : it.paymentId]);
+    if (payment) payments.add(payment);    
 }
 context.payments = payments;

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/EditGlobalGlAccount.groovy (from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/EditGlobalGlAccount.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/EditGlobalGlAccount.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/EditGlobalGlAccount.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/EditGlobalGlAccount.bsh&r1=661218&r2=661566&rev=661566&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/EditGlobalGlAccount.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/EditGlobalGlAccount.groovy Thu May 29 22:00:07 2008
@@ -21,23 +21,20 @@
 import org.ofbiz.entity.*;
 import org.ofbiz.widget.html.*;
 
-security = request.getAttribute("security");
-delegator = request.getAttribute("delegator");
-
 if(security.hasEntityPermission("ACCOUNTING", "_VIEW", session)) {
-    context.put("hasPermission", Boolean.TRUE);
+    context.hasPermission = true;
 } else {
-    context.put("hasPermission", Boolean.FALSE);
+    context.hasPermission = false;
 }
 
 glAccountId = request.getParameter("glAccountId");
-glAccount = delegator.findByPrimaryKey("GlAccount", UtilMisc.toMap("glAccountId", glAccountId));
+glAccount = delegator.findByPrimaryKey("GlAccount", [glAccountId : glAccountId]);
 
 HtmlFormWrapper editGlAccountWrapper = new HtmlFormWrapper("component://accounting/widget/GlobalGlAccountsForms.xml", "EditGlAccount", request, response);
 editGlAccountWrapper.putInContext("glAccount", glAccount);
 editGlAccountWrapper.putInContext("glAccountId", glAccountId);
 editGlAccountWrapper.putInContext("uiLabelMap", request.getAttribute("uiLabelMap"));
 
-context.put("glAccountId", glAccountId);
-context.put("glAccount", glAccount);
-context.put("editGlAccountWrapper", editGlAccountWrapper);
+context.glAccountId = glAccountId;
+context.glAccount = glAccount;
+context.editGlAccountWrapper = editGlAccountWrapper;

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/FindGlobalGlAccount.groovy (from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/FindGlobalGlAccount.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/FindGlobalGlAccount.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/FindGlobalGlAccount.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/FindGlobalGlAccount.bsh&r1=661218&r2=661566&rev=661566&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/FindGlobalGlAccount.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/FindGlobalGlAccount.groovy Thu May 29 22:00:07 2008
@@ -17,17 +17,11 @@
  * under the License.
  */
 
-//import org.ofbiz.entity.*;
-//import org.ofbiz.base.util.*;
-
-delegator = request.getAttribute("delegator");
-security = request.getAttribute("security");
-
-if(security.hasEntityPermission("ACCOUNTING", "_VIEW", session)) {
-    context.put("hasPermission", Boolean.TRUE);
+if (security.hasEntityPermission("ACCOUNTING", "_VIEW", session)) {
+    context.hasPermission = true;
 } else {
-    context.put("hasPermission", Boolean.FALSE);
+    context.hasPermission = false;
 }
 
 glAccounts = delegator.findList("GlAccount", null, null, null, null, false);
-context.put("glAccounts", glAccounts);
+context.glAccounts = glAccounts;

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy (from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.bsh&r1=661218&r2=661566&rev=661566&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy Thu May 29 22:00:07 2008
@@ -21,13 +21,12 @@
 import javolution.util.FastList;
 
 taxAuthorityHavingNoGlAccountList = FastList.newInstance();
-taxAuthorities = delegator.findList("TaxAuthority", null, null, UtilMisc.toList("taxAuthGeoId", "taxAuthPartyId"), null, false);
-iter = taxAuthorities.iterator();
-while (iter.hasNext()) {
-    taxAuthority = iter.next();
-    taxAuthorityGlAccount = delegator.findByPrimaryKey("TaxAuthorityGlAccount", UtilMisc.toMap("taxAuthGeoId", taxAuthority.getString("taxAuthGeoId"), "taxAuthPartyId", taxAuthority.getString("taxAuthPartyId"), "organizationPartyId", organizationPartyId));
-    if (taxAuthorityGlAccount == null) {
+taxAuthorities = delegator.findList("TaxAuthority", null, null, ["taxAuthGeoId", "taxAuthPartyId"], null, false);
+taxAuthorities.each {
+    taxAuthority = it;
+    taxAuthorityGlAccount = delegator.findByPrimaryKey("TaxAuthorityGlAccount", [taxAuthGeoId : taxAuthority.taxAuthGeoId, taxAuthPartyId : taxAuthority.taxAuthPartyId, organizationPartyId : organizationPartyId]);
+    if (!taxAuthorityGlAccount) {
         taxAuthorityHavingNoGlAccountList.add(taxAuthority);
     }
 }
-context.put("taxAuthorityHavingNoGlAccountList", taxAuthorityHavingNoGlAccountList);
\ No newline at end of file
+context.taxAuthorityHavingNoGlAccountList = taxAuthorityHavingNoGlAccountList;
\ No newline at end of file

Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/editGlJournalEntry.groovy (from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/editGlJournalEntry.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/editGlJournalEntry.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/editGlJournalEntry.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/editGlJournalEntry.bsh&r1=661218&r2=661566&rev=661566&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/editGlJournalEntry.bsh (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/editGlJournalEntry.groovy Thu May 29 22:00:07 2008
@@ -20,10 +20,10 @@
  import org.ofbiz.entity.*;
 
  acctgTransId = request.getParameter("acctgTransId");
- if(acctgTransId !=null){
-     acctgTrans = delegator.findByPrimaryKey("AcctgTrans", UtilMisc.toMap("acctgTransId", acctgTransId));
-     isPosted = acctgTrans.get("isPosted");
-     if (isPosted !=null && isPosted.equals("Y")){
-         parameters.put("isPosted", isPosted);
+ if (acctgTransId) {
+     acctgTrans = delegator.findByPrimaryKey("AcctgTrans", [acctgTransId : acctgTransId]);
+     isPosted = acctgTrans.isPosted;
+     if ("Y".equals(isPosted)) {
+         parameters.isPosted = isPosted;
      }
  }