Author: lektran
Date: Thu May 29 03:33:31 2008 New Revision: 661285 URL: http://svn.apache.org/viewvc?rev=661285&view=rev Log: Convert a few bsh scripts to groovy, also condensed two scripts into 1 because the only real difference between them was 1 letter Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy - copied, changed from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy - copied, changed from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.groovy - copied, changed from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.bsh Removed: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listPurInvoiceItemTypesGlAccount.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.bsh Modified: ofbiz/trunk/applications/accounting/widget/GlScreens.xml ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy (from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.bsh&r1=661218&r2=661285&rev=661285&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy Thu May 29 03:33:31 2008 @@ -16,11 +16,11 @@ * specific language governing permissions and limitations * under the License. */ - // simple beanshell to filter out receipts in a list of payments + // simple script to filter out receipts in a list of payments import org.ofbiz.accounting.util.UtilAccounting; -payments = context.get("payments"); +payments = context.payments; iter = payments.iterator(); while (iter.hasNext()) { payment = iter.next(); Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy (from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.bsh&r1=661218&r2=661285&rev=661285&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy Thu May 29 03:33:31 2008 @@ -24,10 +24,13 @@ import org.ofbiz.base.util.*; import org.ofbiz.base.util.UtilMisc; -delegator = parameters.get("delegator"); -organizationPartyId = parameters.get("organizationPartyId"); +// Optional prefix parameter to filter InvoiceItemTypes by (i.e. "INV" or "PINV") defaults to INV +invItemTypePrefix = context.invItemTypePrefix != null ? context.invItemTypePrefix : "INV"; +invItemTypePrefix += "_%" -List invoiceItemTypes = delegator.findList("InvoiceItemType", EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.LIKE, "INV_%"), null, null, null, false); +organizationPartyId = parameters.organizationPartyId; + +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()) { @@ -36,30 +39,30 @@ String remove = " "; List glAccounts = null; GenericValue glAccount = null; - List invoiceItemTypeOrgs = invoiceItemType.getRelatedByAnd("InvoiceItemTypeGlAccount",UtilMisc.toMap("organizationPartyId", organizationPartyId)); + List invoiceItemTypeOrgs = invoiceItemType.getRelatedByAnd("InvoiceItemTypeGlAccount", [organizationPartyId : organizationPartyId]); String overrideGlAccountId = " "; - if (invoiceItemTypeOrgs != null && invoiceItemTypeOrgs.size() > 0) { - invoiceItemTypeOrg = invoiceItemTypeOrgs.get(0); - overrideGlAccountId = invoiceItemTypeOrg.getString("glAccountId"); + if (UtilValidate.isNotEmpty(invoiceItemTypeOrgs)) { + invoiceItemTypeOrg = invoiceItemTypeOrgs[0]; + overrideGlAccountId = invoiceItemTypeOrg.glAccountId; glAccounts = invoiceItemTypeOrg.getRelated("GlAccount"); - if (glAccounts != null && glAccounts.size() > 0) { - glAccount = glAccounts.get(0); + if (UtilValidate.isNotEmpty(glAccounts)) { + glAccount = glAccounts[0]; } } else { glAccount = invoiceItemType.getRelatedOne("DefaultGlAccount"); } if (glAccount != null) { - activeGlDescription = glAccount.getString("accountName"); + activeGlDescription = glAccount.accountName; remove = "Remove"; } - allTypes.add(UtilMisc.toMap("invoiceItemTypeId",invoiceItemType.getString("invoiceItemTypeId"), - "description",invoiceItemType.getString("description"), - "defaultGlAccountId",invoiceItemType.getString("defaultGlAccountId"), - "overrideGlAccountId",overrideGlAccountId, - "remove",remove, - "activeGlDescription",activeGlDescription)); + allTypes.add([invoiceItemTypeId : invoiceItemType.invoiceItemTypeId, + description : invoiceItemType.description, + defaultGlAccountId : invoiceItemType.defaultGlAccountId, + overrideGlAccountId : overrideGlAccountId, + remove : remove, + activeGlDescription : activeGlDescription]); } -context.put("invoiceItemTypes",allTypes); +context.invoiceItemTypes = allTypes; Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.groovy (from r661218, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.bsh&r1=661218&r2=661285&rev=661285&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/admin/printChecks.groovy Thu May 29 03:33:31 2008 @@ -24,26 +24,26 @@ // rounding mode int decimals = UtilAccounting.getBigDecimalScale("invoice.decimals"); int rounding = UtilAccounting.getBigDecimalRoundingMode("invoice.rounding"); -context.put("decimals", decimals); -context.put("rounding", rounding); +context.decimals = decimals; +context.rounding = rounding; // list of payments payments = new ArrayList(); // first ensure ability to print security = request.getAttribute("security"); -context.put("security", security); +context.security = security; if (!security.hasEntityPermission("ACCOUNTING", "_PRINT_CHECKS", session)) { - context.put("payments", payments); // if no permission, just pass an empty list for now + context.payments = []; // if no permission, just pass an empty list for now return; } // in the case of a single payment, the paymentId will be supplied -paymentId = context.get("paymentId"); +paymentId = context.paymentId; if (paymentId != null) { - payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", paymentId)); + payment = delegator.findByPrimaryKey("Payment", [paymentId : paymentId]); if (payment != null) payments.add(payment); - context.put("payments", payments); + context.payments = payments; return; } @@ -52,9 +52,8 @@ iter = selected.iterator(); while (iter.hasNext()) { row = iter.next(); - payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", row.get("paymentId"))); + payment = delegator.findByPrimaryKey("Payment", [paymentId : row.paymentId]); if (payment == null) continue; payments.add(payment); } -context.put("payments", payments); - +context.payments = payments; Modified: ofbiz/trunk/applications/accounting/widget/GlScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlScreens.xml?rev=661285&r1=661284&r2=661285&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/GlScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/GlScreens.xml Thu May 29 03:33:31 2008 @@ -388,7 +388,7 @@ </condition-list> <order-by field-name="effectiveDate"/> </entity-condition> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy"/> </actions> <widgets> <decorator-screen name="CommonAdminChecksDecorator" location="${parameters.mainDecoratorLocation}"> @@ -437,7 +437,7 @@ </condition-list> <order-by field-name="effectiveDate"/> </entity-condition> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/admin/filterOutReceipts.groovy"/> </actions> <widgets> <decorator-screen name="CommonAdminChecksDecorator" location="${parameters.mainDecoratorLocation}"> Modified: ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml?rev=661285&r1=661284&r2=661285&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml Thu May 29 03:33:31 2008 @@ -381,7 +381,7 @@ <form name="ListSalInvoiceItemTypeGlAssignments" type="list" list-name="invoiceItemTypes" odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> <actions> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy"/> </actions> <field name="organizationPartyId"><hidden value="${organizationPartyId}"/></field> <field name="invoiceItemTypeId"><hidden/></field> @@ -423,16 +423,17 @@ </form> <!-- forms for Purchase invoice Itemtypes to GLAccount number --> - <form name="ListPurInvoiceItemTypeGlAssignments" type="list" list-name="purinvoiceItemTypes" default-map-name="iTypes" + <form name="ListPurInvoiceItemTypeGlAssignments" type="list" list-name="invoiceItemTypes" default-map-name="iTypes" odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> <actions> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/admin/listPurInvoiceItemTypesGlAccount.bsh"/> + <set field="invItemTypePrefix" value="PINV"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/admin/listInvoiceItemTypesGlAccount.groovy"/> </actions> <field name="organizationPartyId"><hidden value="${organizationPartyId}"/></field> <field name="invoiceItemTypeId"><hidden/></field> <field name="description"><display/></field> <field name="defaultGlAccountId"><display/></field> - <field name="glAccountId" title="${uiLabelMap.AccountingInvoiceOverrideExpenseGlAccountId}"><display/></field> + <field name="overrideGlAccountId" title="${uiLabelMap.AccountingInvoiceOverrideExpenseGlAccountId}"><display/></field> <field name="activeGlDescription"><display/></field> <field name="remove" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext"><hyperlink target="removePurInvoiceItemTypeGlAssignment?organizationPartyId=${organizationPartyId}&invoiceItemTypeId=${invoiceItemTypeId}" description="${uiLabelMap.CommonRemove}"/></field> </form> Modified: ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml?rev=661285&r1=661284&r2=661285&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml Thu May 29 03:33:31 2008 @@ -523,7 +523,7 @@ <set field="paymentId" from-field="parameters.paymentId" /> <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/> <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.groovy"/> </actions> <widgets> <platform-specific> |
Free forum by Nabble | Edit this page |