Author: lektran
Date: Sat May 31 17:21:18 2008 New Revision: 662109 URL: http://svn.apache.org/viewvc?rev=662109&view=rev Log: Some more bsh -> groovy conversions, accounting app is complete Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.groovy - copied, changed from r661962, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.groovy - copied, changed from r661962, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.groovy - copied, changed from r661962, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.bsh Removed: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeList.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureList.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.bsh Modified: ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml ofbiz/trunk/applications/accounting/widget/TransactionScreens.xml Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.groovy (from r661962, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.bsh&r1=661962&r2=662109&rev=662109&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.groovy Sat May 31 17:21:18 2008 @@ -20,29 +20,29 @@ import org.ofbiz.order.order.OrderReadHelper; import org.ofbiz.base.util.UtilMisc; -orderId = context.get("orderId"); -orderPaymentPreferenceId = context.get("orderPaymentPreferenceId"); +orderId = context.orderId; +orderPaymentPreferenceId = context.orderPaymentPreferenceId; -if ((orderId == null) || (orderPaymentPreferenceId == null)) return; +if ((!orderId) || (!orderPaymentPreferenceId)) return; -if(orderId != null){ - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); - context.put("orderHeader", orderHeader); +if(orderId) { + orderHeader = delegator.findByPrimaryKey("OrderHeader", [orderId : orderId]); + context.orderHeader = orderHeader; } -if(orderHeader != null){ +if(orderHeader) { orh = new OrderReadHelper(orderHeader); - context.put("orh", orh); - context.put("overrideAmount", new Double(orh.getOrderGrandTotal().doubleValue())); + context.orh = orh; + context.overrideAmount = new Double(orh.getOrderGrandTotal().doubleValue()); } -if(orderPaymentPreferenceId != null){ - orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId)); - context.put("orderPaymentPreference", orderPaymentPreference); +if(orderPaymentPreferenceId) { + orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", [orderPaymentPreferenceId : orderPaymentPreferenceId]); + context.orderPaymentPreference = orderPaymentPreference; } -if(orderPaymentPreference != null){ +if(orderPaymentPreference) { paymentMethodType = orderPaymentPreference.getRelatedOneCache("PaymentMethodType"); - context.put("paymentMethodType", paymentMethodType); - context.put("overrideAmount", orderPaymentPreference.getDouble("maxAmount")); + context.paymentMethodType = paymentMethodType; + context.overrideAmount = orderPaymentPreference.getDouble("maxAmount"); } Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.groovy (from r661962, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.bsh&r1=661962&r2=662109&rev=662109&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.groovy Sat May 31 17:21:18 2008 @@ -22,39 +22,39 @@ import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.util.EntityUtil; -orderId = context.get("orderId"); -orderPaymentPreferenceId = context.get("orderPaymentPreferenceId"); +orderId = context.orderId; +orderPaymentPreferenceId = context.orderPaymentPreferenceId; -if ((orderId == null) || (orderPaymentPreferenceId == null)) return; +if ((!orderId) || (!orderPaymentPreferenceId)) return; -if(orderId != null){ - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); - context.put("orderHeader", orderHeader); +if (orderId){ + orderHeader = delegator.findByPrimaryKey("OrderHeader", [orderId : orderId]); + context.orderHeader = orderHeader; } -if(orderPaymentPreferenceId != null){ - orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId)); - context.put("orderPaymentPreference", orderPaymentPreference); +if (orderPaymentPreferenceId) { + orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", [orderPaymentPreferenceId : orderPaymentPreferenceId]); + context.orderPaymentPreference = orderPaymentPreference; } -if(orderPaymentPreference != null){ +if (orderPaymentPreference) { paymentMethodType = orderPaymentPreference.getRelatedOneCache("PaymentMethodType"); - context.put("paymentMethodType", paymentMethodType); + context.paymentMethodType = paymentMethodType; } -if (orderPaymentPrefrence != null) { - context.put("paymentTypeId", "CUSTOMER_PAYMENT"); +if (orderPaymentPrefrence) { + context.paymentTypeId = "CUSTOMER_PAYMENT"; } -if(orderPaymentPreference != null){ -// we retrieve the captureAmount by looking at the latest authorized gateway response for this orderPaymentPreference -gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", UtilMisc.toList("transactionDate DESC")); -EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition("transCodeEnumId", EntityOperator.EQUALS, "PGT_AUTHORIZE")); - -if (gatewayResponses != null && gatewayResponses.size() > 0) { - latestAuth = gatewayResponses.get(0); - context.put("captureAmount", latestAuth.getDouble("amount")); -} else { - // todo: some kind of error telling user to re-authorize -} +if (orderPaymentPreference) { + // we retrieve the captureAmount by looking at the latest authorized gateway response for this orderPaymentPreference + gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", ["transactionDate DESC"]); + EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition("transCodeEnumId", EntityOperator.EQUALS, "PGT_AUTHORIZE")); + + if (gatewayResponses) { + latestAuth = gatewayResponses[0]; + context.captureAmount = latestAuth.getDouble("amount"); + } else { + // todo: some kind of error telling user to re-authorize + } } \ No newline at end of file Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.groovy (from r661962, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.bsh&r1=661962&r2=662109&rev=662109&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.groovy Sat May 31 17:21:18 2008 @@ -31,27 +31,27 @@ import org.ofbiz.entity.util.EntityUtil; // get this field first, it determines which purpose this script satisfies -orderPaymentPreferenceId = context.get("orderPaymentPreferenceId"); +orderPaymentPreferenceId = context.orderPaymentPreferenceId; // first purpose: retrieve orderId and pamentPreferenceId -if (orderPaymentPreferenceId == null) { - paymentGatewayResponse = context.get("paymentGatewayResponse"); +if (!orderPaymentPreferenceId) { + paymentGatewayResponse = context.paymentGatewayResponse; orderPaymentPreference = paymentGatewayResponse.getRelatedOne("OrderPaymentPreference"); - context.put("orderId", orderPaymentPreference.getString("orderId")); - context.put("orderPaymentPreferenceId", orderPaymentPreference.getString("orderPaymentPreferenceId")); + context.orderId = orderPaymentPreference.orderId; + context.orderPaymentPreferenceId = orderPaymentPreference.orderPaymentPreferenceId; return; -} +} // second purpose: grab the latest gateway response of the orderaymentpreferenceId -orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId)); -gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", UtilMisc.toList("transactionDate DESC")); +orderPaymentPreference = delegator.findByPrimaryKey("OrderPaymentPreference", [orderPaymentPreferenceId : orderPaymentPreferenceId]); +gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", ["transactionDate DESC"]); EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition("transCodeEnumId", EntityOperator.EQUALS, "PGT_AUTHORIZE")); -if (gatewayResponses.size() > 0) { - latestAuth = gatewayResponses.get(0); - context.put("paymentGatewayResponse", latestAuth); +if (gatewayResponses) { + latestAuth = gatewayResponses[0]; + context.paymentGatewayResponse = latestAuth; } else { // todo: some kind of error telling user to re-authorize } -context.put("orderId", orderPaymentPreference.getString("orderId")); +context.orderId = orderPaymentPreference.orderId; Modified: ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml?rev=662109&r1=662108&r2=662109&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml Sat May 31 17:21:18 2008 @@ -326,7 +326,7 @@ <set field="billingAccountId" from-field="parameters.billingAccountId"/> <entity-one entity-name="BillingAccount" value-name="billingAccount"/> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.groovy"/> </actions> <widgets> <decorator-screen name="CommonBillingAccountDecorator"> Modified: ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml?rev=662109&r1=662108&r2=662109&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml Sat May 31 17:21:18 2008 @@ -169,8 +169,8 @@ <set field="notAppliedAmountStr" type="String" value="${bsh: import java.text.NumberFormat; return(NumberFormat.getCurrencyInstance(context.get("locale")).format(org.ofbiz.accounting.payment.PaymentWorker.getPaymentNotAppliedBd(payment)));}"/> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.bsh"/> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.groovy"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.groovy"/> <entity-one entity-name="PartyNameView" value-name="partyNameViewTo"> <field-map field-name="partyId" env-name="payment.partyIdTo"/> </entity-one> @@ -470,7 +470,7 @@ <set field="titleProperty" value="AccountingManualTransaction"/> <set field="headerItem" value="transaction"/> <set field="tabButtonItem" value="manualtransactiontab"/> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.groovy"/> </actions> <widgets> <decorator-screen name="GenericTransactionDecorator" location="component://accounting/widget/TransactionScreens.xml"> Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=662109&r1=662108&r2=662109&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml Sat May 31 17:21:18 2008 @@ -129,7 +129,7 @@ <field-map field-name="productCategoryId" env-name="rootProductCategoryId"/> </entity-one> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy"/> </actions> <widgets> <decorator-screen name="CommonFinAccountDecorator" location="${parameters.mainDecoratorLocation}"> @@ -533,7 +533,7 @@ <set field="organizationPartyId" from-field="parameters.organizationPartyId"/> <set field="fromDate" from-field="parameters.fromDate"/> <set field="thruDate" from-field="parameters.thruDate"/> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrganizationAccountingReportsDecorator" location="${parameters.mainDecoratorLocation}"> Modified: ofbiz/trunk/applications/accounting/widget/TransactionScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/TransactionScreens.xml?rev=662109&r1=662108&r2=662109&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/TransactionScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/TransactionScreens.xml Sat May 31 17:21:18 2008 @@ -109,7 +109,7 @@ <entity-one entity-name="PaymentGatewayResponse" value-name="paymentGatewayResponse" auto-field-map="true"/> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/transaction/viewGatewayResponse.groovy"/> </actions> <widgets> <decorator-screen name="GenericTransactionDecorator"> @@ -163,7 +163,7 @@ </entity-one> <set field="paymentMethodTypeId" from-field="opp.paymentMethodTypeId"/> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/transaction/authorizeTransaction.groovy"/> </actions> <widgets> <decorator-screen name="GenericTransactionDecorator"> @@ -203,7 +203,7 @@ </entity-one> <set field="paymentMethodTypeId" from-field="opp.paymentMethodTypeId"/> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.bsh"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/transaction/captureTransaction.groovy"/> </actions> <widgets> <decorator-screen name="GenericTransactionDecorator"> |
Free forum by Nabble | Edit this page |