Author: lektran
Date: Thu May 29 03:50:19 2008 New Revision: 661289 URL: http://svn.apache.org/viewvc?rev=661289&view=rev Log: This is pretty cool, groovy coerces objects into booleans: An empty string,list,map = false otherwise true An iterator with no more elements = false otherwise true null = false Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy 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/filterOutReceipts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy?rev=661289&r1=661288&r2=661289&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy Thu May 29 03:50:19 2008 @@ -22,7 +22,7 @@ payments = context.payments; iter = payments.iterator(); -while (iter.hasNext()) { +while (iter) { payment = iter.next(); if (UtilAccounting.isReceipt(payment)) { iter.remove(); 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=661289&r1=661288&r2=661289&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 03:50:19 2008 @@ -25,7 +25,7 @@ import org.ofbiz.base.util.UtilMisc; // Optional prefix parameter to filter InvoiceItemTypes by (i.e. "INV" or "PINV") defaults to INV -invItemTypePrefix = context.invItemTypePrefix != null ? context.invItemTypePrefix : "INV"; +invItemTypePrefix = context.invItemTypePrefix ? context.invItemTypePrefix : "INV"; invItemTypePrefix += "_%" organizationPartyId = parameters.organizationPartyId; @@ -33,7 +33,7 @@ List invoiceItemTypes = delegator.findList("InvoiceItemType", EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.LIKE, invItemTypePrefix), null, null, null, false); List allTypes = new LinkedList(); i = invoiceItemTypes.iterator(); -while(i.hasNext()) { +while(i) { GenericValue invoiceItemType = i.next(); String activeGlDescription = ""; String remove = " "; @@ -41,19 +41,19 @@ GenericValue glAccount = null; List invoiceItemTypeOrgs = invoiceItemType.getRelatedByAnd("InvoiceItemTypeGlAccount", [organizationPartyId : organizationPartyId]); String overrideGlAccountId = " "; - if (UtilValidate.isNotEmpty(invoiceItemTypeOrgs)) { + if (invoiceItemTypeOrgs) { invoiceItemTypeOrg = invoiceItemTypeOrgs[0]; overrideGlAccountId = invoiceItemTypeOrg.glAccountId; glAccounts = invoiceItemTypeOrg.getRelated("GlAccount"); - if (UtilValidate.isNotEmpty(glAccounts)) { + if (glAccounts) { glAccount = glAccounts[0]; } } else { glAccount = invoiceItemType.getRelatedOne("DefaultGlAccount"); } - if (glAccount != null) { + if (glAccount) { activeGlDescription = glAccount.accountName; remove = "Remove"; } 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=661289&r1=661288&r2=661289&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 03:50:19 2008 @@ -40,9 +40,9 @@ // in the case of a single payment, the paymentId will be supplied paymentId = context.paymentId; -if (paymentId != null) { +if (paymentId) { payment = delegator.findByPrimaryKey("Payment", [paymentId : paymentId]); - if (payment != null) payments.add(payment); + if (payment) payments.add(payment); context.payments = payments; return; } @@ -50,10 +50,10 @@ // 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.hasNext()) { +while (iter) { row = iter.next(); payment = delegator.findByPrimaryKey("Payment", [paymentId : row.paymentId]); - if (payment == null) continue; + if (!payment) continue; payments.add(payment); } context.payments = payments; |
Free forum by Nabble | Edit this page |