You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/03/31 10:36:59 UTC
svn commit: r1583265 [1/2] - in
/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./
applications/accounting/script/org/ofbiz/accounting/payment/
applications/accounting/script/org/ofbiz/accounting/test/
applications/accounting/src/org/ofbiz/a...
Author: jleroux
Date: Mon Mar 31 08:36:58 2014
New Revision: 1583265
URL: http://svn.apache.org/r1583265
Log:
Merges trunk HEAD in SEO branch
Added:
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/cert/demoCA/certs/README
- copied unchanged from r1583263, ofbiz/trunk/framework/base/cert/demoCA/certs/README
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/cert/demoCA/crl/README
- copied unchanged from r1583263, ofbiz/trunk/framework/base/cert/demoCA/crl/README
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/runtime/indexes/README
- copied unchanged from r1583263, ofbiz/trunk/runtime/indexes/README
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/runtime/output/README
- copied unchanged from r1583263, ofbiz/trunk/runtime/output/README
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/runtime/patches/README
- copied unchanged from r1583263, ofbiz/trunk/runtime/patches/README
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/runtime/tempfiles/README
- copied unchanged from r1583263, ofbiz/trunk/runtime/tempfiles/README
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/runtime/tmp/README
- copied unchanged from r1583263, ofbiz/trunk/runtime/tmp/README
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/birt/lib/scriptlib/README
- copied unchanged from r1583263, ofbiz/trunk/specialpurpose/birt/lib/scriptlib/README
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/birt/webapp/birt/WEB-INF/attachments/README
- copied unchanged from r1583263, ofbiz/trunk/specialpurpose/birt/webapp/birt/WEB-INF/attachments/README
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/example/webapp/exampleext/WEB-INF/README
- copied unchanged from r1583263, ofbiz/trunk/specialpurpose/example/webapp/exampleext/WEB-INF/README
Removed:
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/images/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/lookup/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/test/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/marketing/script/org/ofbiz/sfa/opportunity/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/marketing/webapp/sfa/account/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/marketing/webapp/sfa/party/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/report/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/includes/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/includes/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/product/EditProductParties.ftl
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/project/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/test/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/webapp/webtools/component/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webtools/webapp/webtools/includes/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/birt/src/org/ofbiz/birt/report/context/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/crowd/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/oagis/webapp/oagis/WEB-INF/actions/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/scrum/dtd/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/scrum/lib/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/scrum/patches/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/scrum/webapp/demotest/WEB-INF/actions/
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/scrum/webapp/demotest/actions/
Modified:
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/ (props changed)
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/widget/AgreementForms.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/widget/BillingAccountForms.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/widget/compdoc/CompDocScreens.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/widget/manufacturing/BomForms.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/widget/manufacturing/BomScreens.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/ProductForms.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/ProductScreens.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/build.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/cert/demoCA/crl/ (props changed)
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/config/CommonUiLabels.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/templates/htmlFormMacroLibrary.ftl
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/birt/lib/scriptlib/ (props changed)
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/birt/webapp/birt/WEB-INF/attachments/ (props changed)
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/build.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/example/webapp/exampleext/WEB-INF/ (props changed)
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/scrum/templates/CancelledBacklogNotification.ftl
Propchange: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/
------------------------------------------------------------------------------
Merged /ofbiz/trunk:r1580328-1583263
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Mon Mar 31 08:36:58 2014
@@ -247,12 +247,7 @@ under the License.
<entity-one value-field="paymentType" entity-name="PaymentType">
<field-map field-name="paymentTypeId" from-field="payment.paymentTypeId"/>
</entity-one>
- <if-compare-field operator="equals" field="toPayment.parentTypeId" to-field="payment.parentTypeId">
- <add-error>
- <fail-property resource="AccountingUiLabels" property="AccountingPaymentParentTypesNotCompatible"/>
- </add-error>
- </if-compare-field>
-
+
<!-- when amount not provided use the the lowest value available -->
<if-empty field="parameters.amountApplied">
<call-class-method method-name="getPaymentNotApplied" class-name="org.ofbiz.accounting.payment.PaymentWorker" ret-field="notAppliedPayment">
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml Mon Mar 31 08:36:58 2014
@@ -106,9 +106,11 @@ under the License.
<field field="delegator" type="org.ofbiz.entity.Delegator"/>
<field field="serviceInMap.paymentId"/>
</call-class-method>
- <call-class-method method-name="getBillingAccountBalance" class-name="org.ofbiz.accounting.payment.BillingAccountWorker" ret-field="appliedBillling">
- <field field="delegator" type="org.ofbiz.entity.Delegator"/>
- <field field="serviceInMap.billingAccountId"/>
+ <entity-one entity-name="BillingAccount" value-field="billingAccount">
+ <field-map field-name="billingAccountId" from-field="serviceInMap.billingAccountId"/>
+ </entity-one>
+ <call-class-method method-name="getBillingAccountBalance" class-name="org.ofbiz.order.order.OrderReadHelper" ret-field="appliedBillling">
+ <field field="billingAccount" type="GenericValue"/>
</call-class-method>
<set field="zero" value="0" type="BigDecimal"/>
<assert>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java Mon Mar 31 08:36:58 2014
@@ -44,6 +44,7 @@ import org.ofbiz.entity.condition.Entity
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.order.order.OrderReadHelper;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ServiceUtil;
@@ -92,10 +93,10 @@ public class BillingAccountWorker {
if ((thruDate != null) && UtilDateTime.nowTimestamp().after(thruDate)) continue;
if (currencyUomId.equals(billingAccountVO.getString("accountCurrencyUomId"))) {
- BigDecimal accountBalance = BillingAccountWorker.getBillingAccountBalance(billingAccountVO);
+ BigDecimal accountBalance = OrderReadHelper.getBillingAccountBalance(billingAccountVO);
Map<String, Object> billingAccount = new HashMap<String, Object>(billingAccountVO);
- BigDecimal accountLimit = getAccountLimit(billingAccountVO);
+ BigDecimal accountLimit = OrderReadHelper.getAccountLimit(billingAccountVO);
billingAccount.put("accountBalance", accountBalance);
BigDecimal accountAvailable = accountLimit.subtract(accountBalance);
@@ -109,101 +110,6 @@ public class BillingAccountWorker {
}
/**
- * Returns the accountLimit of the BillingAccount or BigDecimal ZERO if it is null
- * @param billingAccount
- * @throws GenericEntityException
- */
- public static BigDecimal getAccountLimit(GenericValue billingAccount) throws GenericEntityException {
- if (billingAccount.getBigDecimal("accountLimit") != null) {
- return billingAccount.getBigDecimal("accountLimit");
- } else {
- Debug.logWarning("Billing Account [" + billingAccount.getString("billingAccountId") + "] does not have an account limit defined, assuming zero.", module);
- return ZERO;
- }
- }
-
- /**
- * Calculates the "available" balance of a billing account, which is the
- * net balance minus amount of pending (not cancelled, rejected, or received) order payments.
- * When looking at using a billing account for a new order, you should use this method.
- * @param billingAccountId the billing account id
- * @param delegator the delegato
- * @return return the "available" balance of a billing account
- * @throws GenericEntityException
- */
- public static BigDecimal getBillingAccountBalance(Delegator delegator, String billingAccountId) throws GenericEntityException {
- GenericValue billingAccount = delegator.findOne("BillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), false);
- return getBillingAccountBalance(billingAccount);
- }
-
- public static BigDecimal getBillingAccountBalance(GenericValue billingAccount) throws GenericEntityException {
-
- Delegator delegator = billingAccount.getDelegator();
- String billingAccountId = billingAccount.getString("billingAccountId");
-
- BigDecimal balance = ZERO;
- BigDecimal accountLimit = getAccountLimit(billingAccount);
- balance = balance.add(accountLimit);
- // pending (not cancelled, rejected, or received) order payments
- EntityConditionList<EntityExpr> whereConditions = EntityCondition.makeCondition(UtilMisc.toList(
- EntityCondition.makeCondition("billingAccountId", EntityOperator.EQUALS, billingAccountId),
- EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_BILLACT"),
- EntityCondition.makeCondition("statusId", EntityOperator.NOT_IN, UtilMisc.toList("ORDER_CANCELLED", "ORDER_REJECTED")),
- EntityCondition.makeCondition("preferenceStatusId", EntityOperator.NOT_IN, UtilMisc.toList("PAYMENT_SETTLED", "PAYMENT_RECEIVED", "PAYMENT_DECLINED", "PAYMENT_CANCELLED")) // PAYMENT_NOT_AUTH
- ), EntityOperator.AND);
-
- List<GenericValue> orderPaymentPreferenceSums = delegator.findList("OrderPurchasePaymentSummary", whereConditions, UtilMisc.toSet("maxAmount"), null, null, false);
- for (Iterator<GenericValue> oppsi = orderPaymentPreferenceSums.iterator(); oppsi.hasNext();) {
- GenericValue orderPaymentPreferenceSum = oppsi.next();
- BigDecimal maxAmount = orderPaymentPreferenceSum.getBigDecimal("maxAmount");
- balance = maxAmount != null ? balance.subtract(maxAmount) : balance;
- }
-
- List<GenericValue> paymentAppls = delegator.findByAnd("PaymentApplication", UtilMisc.toMap("billingAccountId", billingAccountId), null, false);
- // TODO: cancelled payments?
- for (Iterator<GenericValue> pAi = paymentAppls.iterator(); pAi.hasNext();) {
- GenericValue paymentAppl = pAi.next();
- if (paymentAppl.getString("invoiceId") == null) {
- BigDecimal amountApplied = paymentAppl.getBigDecimal("amountApplied");
- balance = balance.add(amountApplied);
- }
- }
-
- balance = balance.setScale(decimals, rounding);
- return balance;
- /*
- Delegator delegator = billingAccount.getDelegator();
- String billingAccountId = billingAccount.getString("billingAccountId");
-
- // first get the net balance of invoices - payments
- BigDecimal balance = getBillingAccountNetBalance(delegator, billingAccountId);
-
- // now the amounts of all the pending orders (not cancelled, rejected or completed)
- List orderHeaders = getBillingAccountOpenOrders(delegator, billingAccountId);
-
- if (orderHeaders != null) {
- Iterator ohi = orderHeaders.iterator();
- while (ohi.hasNext()) {
- GenericValue orderHeader = (GenericValue) ohi.next();
- OrderReadHelper orh = new OrderReadHelper(orderHeader);
- balance = balance.add(orh.getOrderGrandTotal());
- }
- }
-
- // set the balance to BillingAccount.accountLimit if it is greater. This is necessary because nowhere do we track the amount of BillingAccount
- // to be charged to an order, such as FinAccountAuth entity does for FinAccount. As a result, we must assume that the system is doing things correctly
- // and use the accountLimit
- BigDecimal accountLimit = billingAccount.getBigDecimal("accountLimit");
- if (balance.compareTo(accountLimit) > 0) {
- balance = accountLimit;
- } else {
- balance = balance.setScale(decimals, rounding);
- }
- return balance;
- */
- }
-
- /**
* Returns list of orders which are currently open against a billing account
*/
public static List<GenericValue> getBillingAccountOpenOrders(Delegator delegator, String billingAccountId) throws GenericEntityException {
@@ -226,7 +132,7 @@ public class BillingAccountWorker {
public static BigDecimal getBillingAccountAvailableBalance(GenericValue billingAccount) throws GenericEntityException {
if ((billingAccount != null) && (billingAccount.get("accountLimit") != null)) {
BigDecimal accountLimit = billingAccount.getBigDecimal("accountLimit");
- BigDecimal availableBalance = accountLimit.subtract(getBillingAccountBalance(billingAccount)).setScale(decimals, rounding);
+ BigDecimal availableBalance = accountLimit.subtract(OrderReadHelper.getBillingAccountBalance(billingAccount)).setScale(decimals, rounding);
return availableBalance;
} else {
Debug.logWarning("Available balance requested for null billing account, returning zero", module);
@@ -298,7 +204,7 @@ public class BillingAccountWorker {
}
result.put("billingAccount", billingAccount);
- result.put("accountBalance", getBillingAccountBalance(delegator, billingAccountId));
+ result.put("accountBalance", OrderReadHelper.getBillingAccountBalance(billingAccount));
result.put("netAccountBalance", getBillingAccountNetBalance(delegator, billingAccountId));
result.put("availableBalance", getBillingAccountAvailableBalance(billingAccount));
result.put("availableToCapture", availableToCapture(billingAccount));
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/widget/AgreementForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/widget/AgreementForms.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/widget/AgreementForms.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/widget/AgreementForms.xml Mon Mar 31 08:36:58 2014
@@ -61,6 +61,18 @@ under the License.
<field-map field-name="viewSize" from-field="viewSize"/>
</service>
</actions>
+ <row-actions>
+ <service service-name="getPartyNameForDate" result-map="partyNameResultFrom">
+ <field-map field-name="partyId" from-field="partyIdFrom"/>
+ <field-map field-name="compareDate" from-field="agreementDate"/>
+ <field-map field-name="lastNameFirst" value="Y"/>
+ </service>
+ <service service-name="getPartyNameForDate" result-map="partyNameResultTo">
+ <field-map field-name="partyId" from-field="partyIdTo"/>
+ <field-map field-name="compareDate" from-field="agreementDate"/>
+ <field-map field-name="lastNameFirst" value="Y"/>
+ </service>
+ </row-actions>
<auto-fields-entity entity-name="Agreement" default-field-type="display"/>
<field name="agreementId" title="${uiLabelMap.CommonEdit}" widget-style="buttontext" sort-field="true">
<hyperlink also-hidden="false" description="${agreementId}" target="EditAgreement">
@@ -69,12 +81,12 @@ under the License.
</field>
<field name="productId" sort-field="true"></field>
<field name="partyIdFrom" sort-field="true">
- <hyperlink target="/partymgr/control/viewprofile" description="${partyIdFrom}" target-type="inter-app">
+ <hyperlink target="/partymgr/control/viewprofile" description="${partyNameResultFrom.fullName} [${partyIdFrom}]" target-type="inter-app">
<parameter param-name="partyId" from-field="partyIdFrom"/>
</hyperlink>
</field>
<field name="partyIdTo" sort-field="true">
- <hyperlink target="/partymgr/control/viewprofile" description="${partyIdTo}" target-type="inter-app">
+ <hyperlink target="/partymgr/control/viewprofile" description="${partyNameResultTo.fullName} [${partyIdTo}]" target-type="inter-app">
<parameter param-name="partyId" from-field="partyIdTo"/>
</hyperlink>
</field>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/widget/BillingAccountForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/widget/BillingAccountForms.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/widget/BillingAccountForms.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/widget/BillingAccountForms.xml Mon Mar 31 08:36:58 2014
@@ -119,7 +119,7 @@ under the License.
<form name="EditBillingAccount" type="single" target="updateBillingAccount" title=""
header-row-style="header-row" default-table-style="basic-table">
<actions>
- <set field="availableBalance" value="${bsh:billingAccount != null ? org.ofbiz.accounting.payment.BillingAccountWorker.getBillingAccountBalance(billingAccount) : 0}" type="BigDecimal"/>
+ <set field="availableBalance" value="${bsh:billingAccount != null ? org.ofbiz.order.order.OrderReadHelper.getBillingAccountBalance(billingAccount) : 0}" type="BigDecimal"/>
</actions>
<alt-target use-when="billingAccount==null" target="createBillingAccount"/>
<auto-fields-service service-name="updateBillingAccount" map-name="billingAccount"/>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/widget/compdoc/CompDocScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/widget/compdoc/CompDocScreens.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/widget/compdoc/CompDocScreens.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/widget/compdoc/CompDocScreens.xml Mon Mar 31 08:36:58 2014
@@ -425,7 +425,7 @@ under the License.
</condition>
<actions>
<set field="title" value="${uiLabelMap.PageTitleEditCompDocTemplate} ${rootContentId}"/>
- <set from-field="parameters.contentRevisionSeqId" default-value="${parameters.rootContentRevisionSeqId}" field="rootContentRevisionSeqId"/>
+ <set from-field="parameters.contentRevisionSeqId" default-value="${contentRevisions[0].contentRevisionSeqId}" field="rootContentRevisionSeqId"/>
</actions>
<widgets>
<decorator-screen name="commonCompDocDecorator" location="component://content/widget/CommonScreens.xml">
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml Mon Mar 31 08:36:58 2014
@@ -273,9 +273,11 @@ under the License.
<if-compare-field field="productionRunTask.estimatedStartDate" operator="equals" to-field="productionRunNewStartDate" type="Timestamp"/>
<or>
<if-compare field="taskTimeDifference" operator="equals" value="0.0" type="Double"/>
- <!-- a difference of +1 or -1 is accepted because it could be caused by DST change happening in one of the two time periods -->
- <if-compare field="taskTimeDifference" operator="equals" value="1.0" type="Double"/>
- <if-compare field="taskTimeDifference" operator="equals" value="-1.0" type="Double"/>
+ <!-- a difference of +/- 1 or 2 hours is accepted because it could be caused by DST change happening in one of the two time periods -->
+ <if-compare field="taskTimeDifference" operator="equals" value="3600000.0" type="Double"/>
+ <if-compare field="taskTimeDifference" operator="equals" value="-3600000.0" type="Double"/>
+ <if-compare field="taskTimeDifference" operator="equals" value="7200000.0" type="Double"/>
+ <if-compare field="taskTimeDifference" operator="equals" value="-7200000.0" type="Double"/>
</or>
</assert>
<check-errors/>
@@ -996,7 +998,7 @@ under the License.
</entity-condition>
<first-from-list entry="productionRunHeader" list="workEfforts"/>
<entity-and list="productionRunTasks" entity-name="WorkEffort">
- <field-map field-name="workEffortParentId" from-field="productionRunHeader.productionRunId"/>
+ <field-map field-name="workEffortParentId" from-field="productionRunHeader.workEffortId"/>
</entity-and>
<first-from-list entry="productionRunTask" list="productionRunTasks"/>
@@ -1011,7 +1013,7 @@ under the License.
</assert>
<entity-and list="productionRunProducts" entity-name="WorkEffortGoodStandard">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
+ <field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
</entity-and>
<first-from-list entry="productionRunProduct" list="productionRunProducts"/>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml Mon Mar 31 08:36:58 2014
@@ -385,16 +385,6 @@ under the License.
<security https="true" auth="true"/>
<response name="success" type="view" value="FindBom"/>
</request-map>
- <request-map uri="CreateProductBom">
- <security https="true" auth="true"/>
- <response name="success" type="view" value="CreateProductBom"/>
- </request-map>
- <request-map uri="createProductBom">
- <security https="true" auth="true"/>
- <event type="simple" path="component://manufacturing/script/org/ofbiz/manufacturing/bom/BomSimpleMethods.xml" invoke="createBOMAssoc"/>
- <response name="success" type="view" value="EditProductBom"/>
- <response name="error" type="view" value="CreateProductBom"/>
- </request-map>
<request-map uri="EditProductManufacturingRules">
<security https="true" auth="true"/>
@@ -797,7 +787,6 @@ under the License.
<view-map name="EditProductManufacturingRules" page="component://manufacturing/widget/manufacturing/BomScreens.xml#EditProductManufacturingRules" type="screen"/>
<view-map name="BomSimulation" page="component://manufacturing/widget/manufacturing/BomScreens.xml#BomSimulation" type="screen"/>
<view-map name="FindBom" page="component://manufacturing/widget/manufacturing/BomScreens.xml#FindBom" type="screen"/>
- <view-map name="CreateProductBom" page="component://manufacturing/widget/manufacturing/BomScreens.xml#CreateProductBom" type="screen"/>
<!-- Costs view mappings -->
<view-map name="EditCostCalcs" page="component://manufacturing/widget/manufacturing/CostScreens.xml#EditCostCalcs" type="screen"/>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/widget/manufacturing/BomForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/widget/manufacturing/BomForms.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/widget/manufacturing/BomForms.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/widget/manufacturing/BomForms.xml Mon Mar 31 08:36:58 2014
@@ -152,20 +152,4 @@ under the License.
<display-entity entity-name="ProductAssocType" key-field-name="productAssocTypeId" description="${description}"/>
</field>
</form>
- <form name="CreateProductBom" target="createProductBom" title="" type="single"
- header-row-style="header-row" default-table-style="basic-table">
- <field name="productId" title="${uiLabelMap.ProductProductId}"><lookup target-form-name="LookupProduct" size="16"/></field>
- <field name="productIdTo" title="${uiLabelMap.ProductProductIdTo}"><lookup target-form-name="LookupProduct" size="16"/></field>
- <field name="productAssocTypeId" title="${uiLabelMap.ManufacturingBomType}">
- <drop-down>
- <option key="MANUF_COMPONENT" description="${uiLabelMap.ManufacturingBillOfMaterials}"/>
- <option key="ENGINEER_COMPONENT" description="${uiLabelMap.ManufacturingEngineeringBillOfMaterials}"/>
- </drop-down>
- </field>
- <field name="quantity" title="${uiLabelMap.ManufacturingQuantity}"><text size="6"/></field>
- <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><date-time/></field>
- <field name="submitButton" title="${uiLabelMap.CommonSubmit}">
- <submit button-type="button"/>
- </field>
- </form>
</forms>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/widget/manufacturing/BomScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/widget/manufacturing/BomScreens.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/widget/manufacturing/BomScreens.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/manufacturing/widget/manufacturing/BomScreens.xml Mon Mar 31 08:36:58 2014
@@ -143,7 +143,7 @@ under the License.
<decorator-section name="body">
<decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
<decorator-section name="menu-bar">
- <container style="button-bar"><link target="CreateProductBom" text="${uiLabelMap.ManufacturingCreateBom}" style="buttontext"/></container>
+ <container style="button-bar"><link target="EditProductBom" text="${uiLabelMap.ManufacturingCreateBom}" style="buttontext"/></container>
</decorator-section>
<decorator-section name="search-options">
<include-form name="findBom" location="component://manufacturing/widget/manufacturing/BomForms.xml"/>
@@ -157,21 +157,4 @@ under the License.
</widgets>
</section>
</screen>
- <screen name="CreateProductBom">
- <section>
- <actions>
- <set field="titleProperty" value="ManufacturingCreateProductBom"/>
- <set field="headerItem" value="bom"/>
- </actions>
- <widgets>
- <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
- <decorator-section name="body">
- <screenlet title="${uiLabelMap.ManufacturingCreateProductBom}">
- <include-form name="CreateProductBom" location="component://manufacturing/widget/manufacturing/BomForms.xml"/>
- </screenlet>
- </decorator-section>
- </decorator-screen>
- </widgets>
- </section>
- </screen>
</screens>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Mon Mar 31 08:36:58 2014
@@ -218,14 +218,14 @@ public class OrderReadHelper {
List<GenericValue> payments = FastList.newInstance();
try {
List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"),
- EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_CONFIRMED"));
+ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_CONFIRMED"));
payments = paymentPref.getRelated("Payment", null, null, false);
payments = EntityUtil.filterByOr(payments, exprs);
List<EntityExpr> conds = UtilMisc.toList(EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "CUSTOMER_PAYMENT"),
- EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "CUSTOMER_DEPOSIT"),
- EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "INTEREST_RECEIPT"),
- EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "GC_DEPOSIT"),
- EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "POS_PAID_IN"));
+ EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "CUSTOMER_DEPOSIT"),
+ EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "INTEREST_RECEIPT"),
+ EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "GC_DEPOSIT"),
+ EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "POS_PAID_IN"));
payments = EntityUtil.filterByOr(payments, conds);
} catch (GenericEntityException e) {
Debug.logError(e, module);
@@ -319,7 +319,7 @@ public class OrderReadHelper {
public List<GenericValue> getOrderTerms() {
try {
- return orderHeader.getRelated("OrderTerm", null, null, false);
+ return orderHeader.getRelated("OrderTerm", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
return null;
@@ -1185,7 +1185,7 @@ public class OrderReadHelper {
return piecesIncluded;
}
- public List<Map<String, Object>> getShippableItemInfo(String shipGroupSeqId) {
+ public List<Map<String, Object>> getShippableItemInfo(String shipGroupSeqId) {
List<Map<String, Object>> shippableInfo = FastList.newInstance();
List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId);
@@ -1649,7 +1649,7 @@ public class OrderReadHelper {
if (orderItem.get("productId") != null) {
productIds.add(orderItem.getString("productId"));
}
- }
+ }
return productIds;
}
@@ -1666,42 +1666,42 @@ public class OrderReadHelper {
return this.orderReturnItems;
}
- /**
- * Get the quantity returned per order item.
- * In other words, this method will count the ReturnItems
- * related to each OrderItem.
- *
- * @return Map of returned quantities as BigDecimals keyed to the orderItemSeqId
- */
- public Map<String, BigDecimal> getOrderItemReturnedQuantities() {
- List<GenericValue> returnItems = getOrderReturnItems();
-
- // since we don't have a handy grouped view entity, we'll have to group the return items by hand
- Map<String, BigDecimal> returnMap = FastMap.newInstance();
- for (GenericValue orderItem : this.getValidOrderItems()) {
- List<GenericValue> group = EntityUtil.filterByAnd(returnItems, UtilMisc.toList(
- EntityCondition.makeCondition("orderId", orderItem.get("orderId")),
- EntityCondition.makeCondition("orderItemSeqId", orderItem.get("orderItemSeqId")),
- EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "RETURN_CANCELLED")));
-
- // add up the returned quantities for this group TODO: received quantity should be used eventually
- BigDecimal returned = BigDecimal.ZERO;
- for (GenericValue returnItem : group) {
- if (returnItem.getBigDecimal("returnQuantity") != null) {
- returned = returned.add(returnItem.getBigDecimal("returnQuantity"));
- }
- }
-
- // the quantity returned per order item
- returnMap.put(orderItem.getString("orderItemSeqId"), returned);
- }
- return returnMap;
- }
-
- /**
- * Get the total quantity of returned items for an order. This will count
- * only the ReturnItems that are directly correlated to an OrderItem.
- */
+ /**
+ * Get the quantity returned per order item.
+ * In other words, this method will count the ReturnItems
+ * related to each OrderItem.
+ *
+ * @return Map of returned quantities as BigDecimals keyed to the orderItemSeqId
+ */
+ public Map<String, BigDecimal> getOrderItemReturnedQuantities() {
+ List<GenericValue> returnItems = getOrderReturnItems();
+
+ // since we don't have a handy grouped view entity, we'll have to group the return items by hand
+ Map<String, BigDecimal> returnMap = FastMap.newInstance();
+ for (GenericValue orderItem : this.getValidOrderItems()) {
+ List<GenericValue> group = EntityUtil.filterByAnd(returnItems, UtilMisc.toList(
+ EntityCondition.makeCondition("orderId", orderItem.get("orderId")),
+ EntityCondition.makeCondition("orderItemSeqId", orderItem.get("orderItemSeqId")),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "RETURN_CANCELLED")));
+
+ // add up the returned quantities for this group TODO: received quantity should be used eventually
+ BigDecimal returned = BigDecimal.ZERO;
+ for (GenericValue returnItem : group) {
+ if (returnItem.getBigDecimal("returnQuantity") != null) {
+ returned = returned.add(returnItem.getBigDecimal("returnQuantity"));
+ }
+ }
+
+ // the quantity returned per order item
+ returnMap.put(orderItem.getString("orderItemSeqId"), returned);
+ }
+ return returnMap;
+ }
+
+ /**
+ * Get the total quantity of returned items for an order. This will count
+ * only the ReturnItems that are directly correlated to an OrderItem.
+ */
public BigDecimal getOrderReturnedQuantity() {
List<GenericValue> returnedItemsBase = getOrderReturnItems();
List<GenericValue> returnedItems = new ArrayList<GenericValue>(returnedItemsBase.size());
@@ -2442,7 +2442,7 @@ public class OrderReadHelper {
BigDecimal promoAdjTotal = ZERO;
List<GenericValue> promoAdjustments = EntityUtil.filterByAnd(allOrderAdjustments, UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT"));
-
+
if (UtilValidate.isNotEmpty(promoAdjustments)) {
Iterator<GenericValue> promoAdjIter = promoAdjustments.iterator();
while (promoAdjIter.hasNext()) {
@@ -2495,7 +2495,7 @@ public class OrderReadHelper {
rentalAdjustment = rentalAdjustment.divide(new BigDecimal(100), scale, rounding).multiply(new BigDecimal(String.valueOf(length)));
// Debug.logInfo("rental parameters....Nbr of persons:" + persons + " extra% 2nd person:" + secondPersonPerc + " extra% Nth person:" + nthPersonPerc + " Length: " + length + " total rental adjustment:" + rentalAdjustment ,module);
return rentalAdjustment; // return total rental adjustment
- }
+ }
public static BigDecimal getAllOrderItemsAdjustmentsTotal(List<GenericValue> orderItems, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping) {
BigDecimal result = ZERO;
@@ -2736,39 +2736,39 @@ public class OrderReadHelper {
return isTax ? value.setScale(taxCalcScale, taxRounding) : value.setScale(scale, rounding);
}
- /** Get the quantity of order items that have been invoiced */
- public static BigDecimal getOrderItemInvoicedQuantity(GenericValue orderItem) {
- BigDecimal invoiced = BigDecimal.ZERO;
- try {
- // this is simply the sum of quantity billed in all related OrderItemBillings
- List<GenericValue> billings = orderItem.getRelated("OrderItemBilling", null, null, false);
- for (GenericValue billing : billings) {
- BigDecimal quantity = billing.getBigDecimal("quantity");
- if (quantity != null) {
- invoiced = invoiced.add(quantity);
- }
- }
- } catch (GenericEntityException e) {
- Debug.logError(e, e.getMessage(), module);
- }
- return invoiced;
- }
-
- public List<GenericValue> getOrderPaymentStatuses() {
- return getOrderPaymentStatuses(getOrderStatuses());
- }
-
- public static List<GenericValue> getOrderPaymentStatuses(List<GenericValue> orderStatuses) {
- List<EntityExpr> contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null));
- contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
- contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, ""));
-
- List<EntityExpr> contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.NOT_EQUAL, null));
- List<GenericValue> newOrderStatuses = FastList.newInstance();
- newOrderStatuses.addAll(EntityUtil.filterByOr(orderStatuses, contraints1));
+ /** Get the quantity of order items that have been invoiced */
+ public static BigDecimal getOrderItemInvoicedQuantity(GenericValue orderItem) {
+ BigDecimal invoiced = BigDecimal.ZERO;
+ try {
+ // this is simply the sum of quantity billed in all related OrderItemBillings
+ List<GenericValue> billings = orderItem.getRelated("OrderItemBilling", null, null, false);
+ for (GenericValue billing : billings) {
+ BigDecimal quantity = billing.getBigDecimal("quantity");
+ if (quantity != null) {
+ invoiced = invoiced.add(quantity);
+ }
+ }
+ } catch (GenericEntityException e) {
+ Debug.logError(e, e.getMessage(), module);
+ }
+ return invoiced;
+ }
+
+ public List<GenericValue> getOrderPaymentStatuses() {
+ return getOrderPaymentStatuses(getOrderStatuses());
+ }
+
+ public static List<GenericValue> getOrderPaymentStatuses(List<GenericValue> orderStatuses) {
+ List<EntityExpr> contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null));
+ contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA));
+ contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, ""));
+
+ List<EntityExpr> contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.NOT_EQUAL, null));
+ List<GenericValue> newOrderStatuses = FastList.newInstance();
+ newOrderStatuses.addAll(EntityUtil.filterByOr(orderStatuses, contraints1));
- return EntityUtil.orderBy(EntityUtil.filterByAnd(newOrderStatuses, contraints2), UtilMisc.toList("-statusDatetime"));
- }
+ return EntityUtil.orderBy(EntityUtil.filterByAnd(newOrderStatuses, contraints2), UtilMisc.toList("-statusDatetime"));
+ }
public static String getOrderItemAttribute(GenericValue orderItem, String attributeName) {
String attributeValue = null;
@@ -2799,118 +2799,175 @@ public class OrderReadHelper {
}
return attributeValue;
}
-
- public static Map<String, Object> getOrderTaxByTaxAuthGeoAndParty(List<GenericValue> orderAdjustments) {
- BigDecimal taxGrandTotal = BigDecimal.ZERO;
- List<Map<String, Object>> taxByTaxAuthGeoAndPartyList = FastList.newInstance();
- if (UtilValidate.isNotEmpty(orderAdjustments)) {
- // get orderAdjustment where orderAdjustmentTypeId is SALES_TAX.
- orderAdjustments = EntityUtil.filterByAnd(orderAdjustments, UtilMisc.toMap("orderAdjustmentTypeId","SALES_TAX"));
- orderAdjustments = EntityUtil.orderBy(orderAdjustments, UtilMisc.toList("taxAuthGeoId","taxAuthPartyId"));
-
- // get the list of all distinct taxAuthGeoId and taxAuthPartyId. It is for getting the number of taxAuthGeo and taxAuthPartyId in adjustments.
- List<String> distinctTaxAuthGeoIdList = EntityUtil.getFieldListFromEntityList(orderAdjustments, "taxAuthGeoId", true);
- List<String> distinctTaxAuthPartyIdList = EntityUtil.getFieldListFromEntityList(orderAdjustments, "taxAuthPartyId", true);
-
- // Keep a list of amount that have been added to make sure none are missed (if taxAuth* information is missing)
- List<GenericValue> processedAdjustments = FastList.newInstance();
- // For each taxAuthGeoId get and add amount from orderAdjustment
- for (String taxAuthGeoId : distinctTaxAuthGeoIdList) {
- for (String taxAuthPartyId : distinctTaxAuthPartyIdList) {
- //get all records for orderAdjustments filtered by taxAuthGeoId and taxAurhPartyId
- List<GenericValue> orderAdjByTaxAuthGeoAndPartyIds = EntityUtil.filterByAnd(orderAdjustments, UtilMisc.toMap("taxAuthGeoId", taxAuthGeoId, "taxAuthPartyId", taxAuthPartyId));
- if (UtilValidate.isNotEmpty(orderAdjByTaxAuthGeoAndPartyIds)) {
- BigDecimal totalAmount = BigDecimal.ZERO;
- //Now for each orderAdjustment record get and add amount.
- for (GenericValue orderAdjustment : orderAdjByTaxAuthGeoAndPartyIds) {
- BigDecimal amount = orderAdjustment.getBigDecimal("amount");
- if (amount == null) {
- amount = ZERO;
- }
- totalAmount = totalAmount.add(amount).setScale(taxCalcScale, taxRounding);
- processedAdjustments.add(orderAdjustment);
- }
- totalAmount = totalAmount.setScale(taxFinalScale, taxRounding);
- taxByTaxAuthGeoAndPartyList.add(UtilMisc.<String, Object>toMap("taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId", taxAuthGeoId, "totalAmount", totalAmount));
- taxGrandTotal = taxGrandTotal.add(totalAmount);
- }
- }
- }
- // Process any adjustments that got missed
- List<GenericValue> missedAdjustments = FastList.newInstance();
- missedAdjustments.addAll(orderAdjustments);
- missedAdjustments.removeAll(processedAdjustments);
- for (GenericValue orderAdjustment : missedAdjustments) {
- taxGrandTotal = taxGrandTotal.add(orderAdjustment.getBigDecimal("amount").setScale(taxCalcScale, taxRounding));
- }
- taxGrandTotal = taxGrandTotal.setScale(taxFinalScale, taxRounding);
- }
- Map<String, Object> result = FastMap.newInstance();
- result.put("taxByTaxAuthGeoAndPartyList", taxByTaxAuthGeoAndPartyList);
- result.put("taxGrandTotal", taxGrandTotal);
- return result;
- }
-
- public static Map<String, Object> getOrderItemTaxByTaxAuthGeoAndPartyForDisplay(GenericValue orderItem, List<GenericValue> orderAdjustmentsOriginal) {
- return getOrderTaxByTaxAuthGeoAndPartyForDisplay(getOrderItemAdjustmentList(orderItem, orderAdjustmentsOriginal));
- }
-
- public static Map<String, Object> getOrderTaxByTaxAuthGeoAndPartyForDisplay(List<GenericValue> orderAdjustmentsOriginal) {
- BigDecimal taxGrandTotal = BigDecimal.ZERO;
- List<Map<String, Object>> taxByTaxAuthGeoAndPartyList = FastList.newInstance();
- List<GenericValue> orderAdjustmentsToUse = FastList.newInstance();
- if (UtilValidate.isNotEmpty(orderAdjustmentsOriginal)) {
- // get orderAdjustment where orderAdjustmentTypeId is SALES_TAX.
- orderAdjustmentsToUse.addAll(EntityUtil.filterByAnd(orderAdjustmentsOriginal, UtilMisc.toMap("orderAdjustmentTypeId", "SALES_TAX")));
- orderAdjustmentsToUse.addAll(EntityUtil.filterByAnd(orderAdjustmentsOriginal, UtilMisc.toMap("orderAdjustmentTypeId", "VAT_TAX")));
- orderAdjustmentsToUse = EntityUtil.orderBy(orderAdjustmentsToUse, UtilMisc.toList("taxAuthGeoId","taxAuthPartyId"));
-
- // get the list of all distinct taxAuthGeoId and taxAuthPartyId. It is for getting the number of taxAuthGeo and taxAuthPartyId in adjustments.
- List<String> distinctTaxAuthGeoIdList = EntityUtil.getFieldListFromEntityList(orderAdjustmentsToUse, "taxAuthGeoId", true);
- List<String> distinctTaxAuthPartyIdList = EntityUtil.getFieldListFromEntityList(orderAdjustmentsToUse, "taxAuthPartyId", true);
-
- // Keep a list of amount that have been added to make sure none are missed (if taxAuth* information is missing)
- List<GenericValue> processedAdjustments = FastList.newInstance();
- // For each taxAuthGeoId get and add amount from orderAdjustment
- for (String taxAuthGeoId : distinctTaxAuthGeoIdList) {
- for (String taxAuthPartyId : distinctTaxAuthPartyIdList) {
- //get all records for orderAdjustments filtered by taxAuthGeoId and taxAurhPartyId
- List<GenericValue> orderAdjByTaxAuthGeoAndPartyIds = EntityUtil.filterByAnd(orderAdjustmentsToUse, UtilMisc.toMap("taxAuthGeoId", taxAuthGeoId, "taxAuthPartyId", taxAuthPartyId));
- if (UtilValidate.isNotEmpty(orderAdjByTaxAuthGeoAndPartyIds)) {
- BigDecimal totalAmount = BigDecimal.ZERO;
- //Now for each orderAdjustment record get and add amount.
- for (GenericValue orderAdjustment : orderAdjByTaxAuthGeoAndPartyIds) {
- BigDecimal amount = orderAdjustment.getBigDecimal("amount");
- if (amount != null) {
- totalAmount = totalAmount.add(amount);
- }
- if ("VAT_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId")) &&
- orderAdjustment.get("amountAlreadyIncluded") != null) {
- // this is the only case where the VAT_TAX amountAlreadyIncluded should be added in, and should just be for display and not to calculate the order grandTotal
- totalAmount = totalAmount.add(orderAdjustment.getBigDecimal("amountAlreadyIncluded"));
- }
- totalAmount = totalAmount.setScale(taxCalcScale, taxRounding);
- processedAdjustments.add(orderAdjustment);
- }
- totalAmount = totalAmount.setScale(taxFinalScale, taxRounding);
- taxByTaxAuthGeoAndPartyList.add(UtilMisc.<String, Object>toMap("taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId", taxAuthGeoId, "totalAmount", totalAmount));
- taxGrandTotal = taxGrandTotal.add(totalAmount);
- }
- }
- }
- // Process any adjustments that got missed
- List<GenericValue> missedAdjustments = FastList.newInstance();
- missedAdjustments.addAll(orderAdjustmentsToUse);
- missedAdjustments.removeAll(processedAdjustments);
- for (GenericValue orderAdjustment : missedAdjustments) {
- taxGrandTotal = taxGrandTotal.add(orderAdjustment.getBigDecimal("amount").setScale(taxCalcScale, taxRounding));
- }
- taxGrandTotal = taxGrandTotal.setScale(taxFinalScale, taxRounding);
- }
- Map<String, Object> result = FastMap.newInstance();
- result.put("taxByTaxAuthGeoAndPartyList", taxByTaxAuthGeoAndPartyList);
- result.put("taxGrandTotal", taxGrandTotal);
- return result;
- }
+ public static Map<String, Object> getOrderTaxByTaxAuthGeoAndParty(List<GenericValue> orderAdjustments) {
+ BigDecimal taxGrandTotal = BigDecimal.ZERO;
+ List<Map<String, Object>> taxByTaxAuthGeoAndPartyList = FastList.newInstance();
+ if (UtilValidate.isNotEmpty(orderAdjustments)) {
+ // get orderAdjustment where orderAdjustmentTypeId is SALES_TAX.
+ orderAdjustments = EntityUtil.filterByAnd(orderAdjustments, UtilMisc.toMap("orderAdjustmentTypeId", "SALES_TAX"));
+ orderAdjustments = EntityUtil.orderBy(orderAdjustments, UtilMisc.toList("taxAuthGeoId", "taxAuthPartyId"));
+
+ // get the list of all distinct taxAuthGeoId and taxAuthPartyId. It is for getting the number of taxAuthGeo and taxAuthPartyId in adjustments.
+ List<String> distinctTaxAuthGeoIdList = EntityUtil.getFieldListFromEntityList(orderAdjustments, "taxAuthGeoId", true);
+ List<String> distinctTaxAuthPartyIdList = EntityUtil.getFieldListFromEntityList(orderAdjustments, "taxAuthPartyId", true);
+
+ // Keep a list of amount that have been added to make sure none are missed (if taxAuth* information is missing)
+ List<GenericValue> processedAdjustments = FastList.newInstance();
+ // For each taxAuthGeoId get and add amount from orderAdjustment
+ for (String taxAuthGeoId : distinctTaxAuthGeoIdList) {
+ for (String taxAuthPartyId : distinctTaxAuthPartyIdList) {
+ //get all records for orderAdjustments filtered by taxAuthGeoId and taxAurhPartyId
+ List<GenericValue> orderAdjByTaxAuthGeoAndPartyIds = EntityUtil.filterByAnd(orderAdjustments, UtilMisc.toMap("taxAuthGeoId", taxAuthGeoId, "taxAuthPartyId", taxAuthPartyId));
+ if (UtilValidate.isNotEmpty(orderAdjByTaxAuthGeoAndPartyIds)) {
+ BigDecimal totalAmount = BigDecimal.ZERO;
+ //Now for each orderAdjustment record get and add amount.
+ for (GenericValue orderAdjustment : orderAdjByTaxAuthGeoAndPartyIds) {
+ BigDecimal amount = orderAdjustment.getBigDecimal("amount");
+ if (amount == null) {
+ amount = ZERO;
+ }
+ totalAmount = totalAmount.add(amount).setScale(taxCalcScale, taxRounding);
+ processedAdjustments.add(orderAdjustment);
+ }
+ totalAmount = totalAmount.setScale(taxFinalScale, taxRounding);
+ taxByTaxAuthGeoAndPartyList.add(UtilMisc.<String, Object>toMap("taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId", taxAuthGeoId, "totalAmount", totalAmount));
+ taxGrandTotal = taxGrandTotal.add(totalAmount);
+ }
+ }
+ }
+ // Process any adjustments that got missed
+ List<GenericValue> missedAdjustments = FastList.newInstance();
+ missedAdjustments.addAll(orderAdjustments);
+ missedAdjustments.removeAll(processedAdjustments);
+ for (GenericValue orderAdjustment : missedAdjustments) {
+ taxGrandTotal = taxGrandTotal.add(orderAdjustment.getBigDecimal("amount").setScale(taxCalcScale, taxRounding));
+ }
+ taxGrandTotal = taxGrandTotal.setScale(taxFinalScale, taxRounding);
+ }
+ Map<String, Object> result = FastMap.newInstance();
+ result.put("taxByTaxAuthGeoAndPartyList", taxByTaxAuthGeoAndPartyList);
+ result.put("taxGrandTotal", taxGrandTotal);
+ return result;
+ }
+
+ public static Map<String, Object> getOrderItemTaxByTaxAuthGeoAndPartyForDisplay(GenericValue orderItem, List<GenericValue> orderAdjustmentsOriginal) {
+ return getOrderTaxByTaxAuthGeoAndPartyForDisplay(getOrderItemAdjustmentList(orderItem, orderAdjustmentsOriginal));
+ }
+
+ public static Map<String, Object> getOrderTaxByTaxAuthGeoAndPartyForDisplay(List<GenericValue> orderAdjustmentsOriginal) {
+ BigDecimal taxGrandTotal = BigDecimal.ZERO;
+ List<Map<String, Object>> taxByTaxAuthGeoAndPartyList = FastList.newInstance();
+ List<GenericValue> orderAdjustmentsToUse = FastList.newInstance();
+ if (UtilValidate.isNotEmpty(orderAdjustmentsOriginal)) {
+ // get orderAdjustment where orderAdjustmentTypeId is SALES_TAX.
+ orderAdjustmentsToUse.addAll(EntityUtil.filterByAnd(orderAdjustmentsOriginal, UtilMisc.toMap("orderAdjustmentTypeId", "SALES_TAX")));
+ orderAdjustmentsToUse.addAll(EntityUtil.filterByAnd(orderAdjustmentsOriginal, UtilMisc.toMap("orderAdjustmentTypeId", "VAT_TAX")));
+ orderAdjustmentsToUse = EntityUtil.orderBy(orderAdjustmentsToUse, UtilMisc.toList("taxAuthGeoId", "taxAuthPartyId"));
+
+ // get the list of all distinct taxAuthGeoId and taxAuthPartyId. It is for getting the number of taxAuthGeo and taxAuthPartyId in adjustments.
+ List<String> distinctTaxAuthGeoIdList = EntityUtil.getFieldListFromEntityList(orderAdjustmentsToUse, "taxAuthGeoId", true);
+ List<String> distinctTaxAuthPartyIdList = EntityUtil.getFieldListFromEntityList(orderAdjustmentsToUse, "taxAuthPartyId", true);
+
+ // Keep a list of amount that have been added to make sure none are missed (if taxAuth* information is missing)
+ List<GenericValue> processedAdjustments = FastList.newInstance();
+ // For each taxAuthGeoId get and add amount from orderAdjustment
+ for (String taxAuthGeoId : distinctTaxAuthGeoIdList) {
+ for (String taxAuthPartyId : distinctTaxAuthPartyIdList) {
+ //get all records for orderAdjustments filtered by taxAuthGeoId and taxAurhPartyId
+ List<GenericValue> orderAdjByTaxAuthGeoAndPartyIds = EntityUtil.filterByAnd(orderAdjustmentsToUse, UtilMisc.toMap("taxAuthGeoId", taxAuthGeoId, "taxAuthPartyId", taxAuthPartyId));
+ if (UtilValidate.isNotEmpty(orderAdjByTaxAuthGeoAndPartyIds)) {
+ BigDecimal totalAmount = BigDecimal.ZERO;
+ //Now for each orderAdjustment record get and add amount.
+ for (GenericValue orderAdjustment : orderAdjByTaxAuthGeoAndPartyIds) {
+ BigDecimal amount = orderAdjustment.getBigDecimal("amount");
+ if (amount != null) {
+ totalAmount = totalAmount.add(amount);
+ }
+ if ("VAT_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId")) &&
+ orderAdjustment.get("amountAlreadyIncluded") != null) {
+ // this is the only case where the VAT_TAX amountAlreadyIncluded should be added in, and should just be for display and not to calculate the order grandTotal
+ totalAmount = totalAmount.add(orderAdjustment.getBigDecimal("amountAlreadyIncluded"));
+ }
+ totalAmount = totalAmount.setScale(taxCalcScale, taxRounding);
+ processedAdjustments.add(orderAdjustment);
+ }
+ totalAmount = totalAmount.setScale(taxFinalScale, taxRounding);
+ taxByTaxAuthGeoAndPartyList.add(UtilMisc.<String, Object>toMap("taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId", taxAuthGeoId, "totalAmount", totalAmount));
+ taxGrandTotal = taxGrandTotal.add(totalAmount);
+ }
+ }
+ }
+ // Process any adjustments that got missed
+ List<GenericValue> missedAdjustments = FastList.newInstance();
+ missedAdjustments.addAll(orderAdjustmentsToUse);
+ missedAdjustments.removeAll(processedAdjustments);
+ for (GenericValue orderAdjustment : missedAdjustments) {
+ taxGrandTotal = taxGrandTotal.add(orderAdjustment.getBigDecimal("amount").setScale(taxCalcScale, taxRounding));
+ }
+ taxGrandTotal = taxGrandTotal.setScale(taxFinalScale, taxRounding);
+ }
+ Map<String, Object> result = FastMap.newInstance();
+ result.put("taxByTaxAuthGeoAndPartyList", taxByTaxAuthGeoAndPartyList);
+ result.put("taxGrandTotal", taxGrandTotal);
+ return result;
+ }
+
+ /**
+ * Calculates the "available" balance of a billing account, which is the
+ * net balance minus amount of pending (not cancelled, rejected, or received) order payments.
+ * When looking at using a billing account for a new order, you should use this method.
+ * @param billingAccount the billing account record
+ * @return return the "available" balance of a billing account
+ * @throws GenericEntityException
+ */
+ public static BigDecimal getBillingAccountBalance(GenericValue billingAccount) throws GenericEntityException {
+
+ Delegator delegator = billingAccount.getDelegator();
+ String billingAccountId = billingAccount.getString("billingAccountId");
+
+ BigDecimal balance = ZERO;
+ BigDecimal accountLimit = getAccountLimit(billingAccount);
+ balance = balance.add(accountLimit);
+ // pending (not cancelled, rejected, or received) order payments
+ EntityConditionList<EntityExpr> whereConditions = EntityCondition.makeCondition(UtilMisc.toList(
+ EntityCondition.makeCondition("billingAccountId", EntityOperator.EQUALS, billingAccountId),
+ EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_BILLACT"),
+ EntityCondition.makeCondition("statusId", EntityOperator.NOT_IN, UtilMisc.toList("ORDER_CANCELLED", "ORDER_REJECTED")),
+ EntityCondition.makeCondition("preferenceStatusId", EntityOperator.NOT_IN, UtilMisc.toList("PAYMENT_SETTLED", "PAYMENT_RECEIVED", "PAYMENT_DECLINED", "PAYMENT_CANCELLED")) // PAYMENT_NOT_AUTH
+ ), EntityOperator.AND);
+
+ List<GenericValue> orderPaymentPreferenceSums = delegator.findList("OrderPurchasePaymentSummary", whereConditions, UtilMisc.toSet("maxAmount"), null, null, false);
+ for (GenericValue orderPaymentPreferenceSum : orderPaymentPreferenceSums) {
+ BigDecimal maxAmount = orderPaymentPreferenceSum.getBigDecimal("maxAmount");
+ balance = maxAmount != null ? balance.subtract(maxAmount) : balance;
+ }
+
+ List<GenericValue> paymentAppls = delegator.findByAnd("PaymentApplication", UtilMisc.toMap("billingAccountId", billingAccountId), null, false);
+ // TODO: cancelled payments?
+ for (GenericValue paymentAppl : paymentAppls) {
+ if (paymentAppl.getString("invoiceId") == null) {
+ BigDecimal amountApplied = paymentAppl.getBigDecimal("amountApplied");
+ balance = balance.add(amountApplied);
+ }
+ }
+
+ balance = balance.setScale(scale, rounding);
+ return balance;
+ }
+
+ /**
+ * Returns the accountLimit of the BillingAccount or BigDecimal ZERO if it is null
+ * @param billingAccount
+ * @throws GenericEntityException
+ */
+ public static BigDecimal getAccountLimit(GenericValue billingAccount) throws GenericEntityException {
+ if (billingAccount.getBigDecimal("accountLimit") != null) {
+ return billingAccount.getBigDecimal("accountLimit");
+ } else {
+ Debug.logWarning("Billing Account [" + billingAccount.getString("billingAccountId") + "] does not have an account limit defined, assuming zero.", module);
+ return ZERO;
+ }
+ }
+
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Mon Mar 31 08:36:58 2014
@@ -780,7 +780,8 @@ public class OrderReturnServices {
String thisBillingAccountId = billingAccountItr.next().getString("billingAccountId");
BigDecimal billingAccountBalance = ZERO;
try {
- billingAccountBalance = getBillingAccountBalance(thisBillingAccountId, dctx);
+ GenericValue billingAccount = delegator.findOne("BillingAccount", UtilMisc.toMap("billingAccountId", thisBillingAccountId), false);
+ billingAccountBalance = OrderReadHelper.getBillingAccountBalance(billingAccount);
} catch (GenericEntityException e) {
return ServiceUtil.returnError(e.getMessage());
}
@@ -1005,51 +1006,6 @@ public class OrderReturnServices {
}
/**
- * Helper method to get billing account balance, cannot use BillingAccountWorker.getBillingAccountBalance()
- * due to circular build dependency.
- * @param billingAccountId the billing account id
- * @param dctx the dispatch context
- * @return returns the billing account balance
- * @throws GenericEntityException
- */
- public static BigDecimal getBillingAccountBalance(String billingAccountId, DispatchContext dctx) throws GenericEntityException {
- Delegator delegator = dctx.getDelegator();
- GenericValue billingAccount = delegator.findOne("BillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), false);
-
- BigDecimal balance = ZERO;
- BigDecimal accountLimit = ZERO;
- if (billingAccount.getBigDecimal("accountLimit") != null) {
- accountLimit = billingAccount.getBigDecimal("accountLimit");
- }
- balance = balance.add(accountLimit);
- // pending (not cancelled, rejected, or received) order payments
- EntityConditionList<EntityExpr> whereConditions = EntityCondition.makeCondition(UtilMisc.toList(
- EntityCondition.makeCondition("billingAccountId", EntityOperator.EQUALS, billingAccountId),
- EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_BILLACT"),
- EntityCondition.makeCondition("statusId", EntityOperator.NOT_IN, UtilMisc.toList("ORDER_CANCELLED", "ORDER_REJECTED")),
- EntityCondition.makeCondition("preferenceStatusId", EntityOperator.NOT_IN, UtilMisc.toList("PAYMENT_SETTLED", "PAYMENT_RECEIVED", "PAYMENT_DECLINED", "PAYMENT_CANCELLED")) // PAYMENT_NOT_AUTH
- ), EntityOperator.AND);
-
- List<GenericValue> orderPaymentPreferenceSums = delegator.findList("OrderPurchasePaymentSummary", whereConditions, UtilMisc.toSet("maxAmount"), null, null, false);
- for (GenericValue orderPaymentPreferenceSum : orderPaymentPreferenceSums) {
- BigDecimal maxAmount = orderPaymentPreferenceSum.getBigDecimal("maxAmount");
- balance = maxAmount != null ? balance.subtract(maxAmount) : balance;
- }
-
- List<GenericValue> paymentAppls = delegator.findByAnd("PaymentApplication", UtilMisc.toMap("billingAccountId", billingAccountId), null, false);
- // TODO: cancelled payments?
- for (GenericValue paymentAppl : paymentAppls) {
- if (paymentAppl.getString("invoiceId") == null) {
- BigDecimal amountApplied = paymentAppl.getBigDecimal("amountApplied");
- balance = balance.add(amountApplied);
- }
- }
-
- balance = balance.setScale(decimals, rounding);
- return balance;
- }
-
- /**
* Helper method to generate a BillingAccount (store credit) from a return
* header. This method takes care of all business logic relating to
* the initialization of a Billing Account from the Return data.
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy Mon Mar 31 08:36:58 2014
@@ -36,8 +36,6 @@ if (action) {
conditions.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null));
conditionList = EntityCondition.makeCondition(conditions, EntityOperator.OR);
try {
- // create resultMap to stop issue with the first puts in the while loop
- resultMap = [:];
beganTransaction = TransactionUtil.begin();
invItemListItr = delegator.find("InventoryItem", conditionList, null, null, ['productId'], null);
while ((inventoryItem = invItemListItr.next()) != null) {
@@ -49,6 +47,8 @@ if (action) {
availableToPromiseTotal = inventoryItem.getDouble("availableToPromiseTotal");
costPrice = inventoryItem.getDouble("unitCost");
retailPrice = 0.0;
+ totalCostPrice = 0.0;
+ totalRetailPrice = 0.0;
productPrices = product.getRelated("ProductPrice", null, null, false);
if (productPrices) {
productPrices.each { productPrice ->
@@ -59,12 +59,10 @@ if (action) {
}
if (costPrice && quantityOnHandTotal) {
totalCostPrice = costPrice * quantityOnHandTotal;
- resultMap.totalCostPrice = totalCostPrice;
totalCostPriceGrandTotal += totalCostPrice;
}
if (retailPrice && quantityOnHandTotal) {
totalRetailPrice = retailPrice * quantityOnHandTotal;
- resultMap.totalRetailPrice = totalRetailPrice;
totalRetailPriceGrandTotal += totalRetailPrice;
}
if (quantityOnHandTotal) {
@@ -81,7 +79,7 @@ if (action) {
}
resultMap = [productId : product.productId, quantityOnHand : quantityOnHandTotal, availableToPromise : availableToPromiseTotal,
- costPrice : costPrice, retailPrice : retailPrice];
+ costPrice : costPrice, retailPrice : retailPrice, totalCostPrice : totalCostPrice, totalRetailPrice : totalRetailPrice];
inventoryItemTotals.add(resultMap);
}
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/ProductForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/ProductForms.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/ProductForms.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/ProductForms.xml Mon Mar 31 08:36:58 2014
@@ -2129,7 +2129,36 @@ under the License.
<form name="EditCommEvent" extends="EditCommEvent" extends-resource="component://party/widget/partymgr/CommunicationEventForms.xml">
<field name="productId" map-name="parameters"><hidden/></field>
</form>
-
+
+ <form name="UpdateProductRole" type="list" target="updatePartyToProduct" title="" list-name="productRoles"
+ odd-row-style="alternate-row" default-table-style="basic-table">
+ <auto-fields-service service-name="updatePartyToProduct"/>
+ <field name="productId"><hidden/></field>
+ <field name="sequenceNum"><text size="5"/></field>
+ <field name="comments"><text size="30"/></field>
+
+ <!-- three possibilities for the Party: person, partyGroup, neither... just print everything and if it's empty, no biggie -->
+ <field name="partyId" title="${uiLabelMap.PartyParty}">
+ <display-entity entity-name="PartyNameView" description="${personalTitle} ${firstName} ${middleName} ${lastName} ${suffix} ${groupName}" also-hidden="true" cache="false">
+ <sub-hyperlink target-type="inter-app" link-style="buttontext" target="/partymgr/control/viewprofile" description="${partyId}">
+ <parameter param-name="party_id" from-field="partyId"/>
+ </sub-hyperlink>
+ </display-entity>
+ </field>
+ <field name="roleTypeId" title="${uiLabelMap.PartyRole}"><display-entity entity-name="RoleType"/></field>
+ <field name="fromDate" title="${uiLabelMap.CommonFromDateTime}" red-when="after-now"><display/></field>
+ <field name="thruDate" title="${uiLabelMap.CommonThruDateTime}" red-when="before-now"></field>
+ <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
+ <field name="deleteLink" title=" " widget-style="buttontext">
+ <hyperlink target="removePartyFromProduct" description="${uiLabelMap.CommonDelete}" also-hidden="false">
+ <parameter param-name="productId"/>
+ <parameter param-name="partyId"/>
+ <parameter param-name="roleTypeId"/>
+ <parameter param-name="fromDate"/>
+ </hyperlink>
+ </field>
+ </form>
+
<form name="AddProductRole" type="single" target="addPartyToProduct" title=""
header-row-style="header-row" default-table-style="basic-table">
<auto-fields-service service-name="addPartyToProduct"/>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/ProductScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/ProductScreens.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/ProductScreens.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/widget/catalog/ProductScreens.xml Mon Mar 31 08:36:58 2014
@@ -1233,10 +1233,9 @@ under the License.
<decorator-screen name="CommonProductDecorator" location="${parameters.productDecoratorLocation}">
<decorator-section name="body">
<screenlet title="${uiLabelMap.PageTitleEditProductParties}">
- <platform-specific>
- <html><html-template location="component://product/webapp/catalog/product/EditProductParties.ftl"/></html>
- </platform-specific>
+ <include-form name="UpdateProductRole" location="component://product/widget/catalog/ProductForms.xml"/>
</screenlet>
+
<screenlet title="${uiLabelMap.ProductAssociatePartyToProduct}">
<include-form name="AddProductRole" location="component://product/widget/catalog/ProductForms.xml"/>
</screenlet>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/build.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/build.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/build.xml Mon Mar 31 08:36:58 2014
@@ -129,7 +129,9 @@ under the License.
<target name="clean-output"
description="Clean runtime/output directory">
<delete verbose="on" includeemptydirs="true">
- <fileset dir="runtime/output" includes="**/*"/>
+ <fileset dir="runtime/output" includes="**/*">
+ <exclude name="README"/>
+ </fileset>
</delete>
</target>
@@ -155,14 +157,18 @@ under the License.
<target name="clean-tempfiles"
description="Remove files located in runtime/tempfiles (captcha, etc...)">
<delete includeemptydirs="true">
- <fileset dir="./runtime/tempfiles" includes="**/*"/>
+ <fileset dir="./runtime/tempfiles" includes="**/*">
+ <exclude name="README"/>
+ </fileset>
</delete>
</target>
<target name="clean-search-indexes"
description="Remove search indexes (e.g. Lucene indexes) created under runtime/indexes">
<delete includeemptydirs="true">
- <fileset dir="./runtime/indexes" includes="**/*" erroronmissingdir="false" />
+ <fileset dir="./runtime/indexes" includes="**/*" erroronmissingdir="false" >
+ <exclude name="README"/>
+ </fileset>
</delete>
</target>
@@ -1237,7 +1243,6 @@ under the License.
<echo>======================================================</echo>
<echo>Please check that this version is appropriate for you!</echo>
</target>
- <mkdir dir="${basedir}/hot-deploy/${component-name}/patches/qa"/>
<target name="download-sonar-ant-task" description="Download sonar related files">
<ivy:retrieve pattern="framework/base/lib/[artifact]-[revision].[ext]" conf="sonar-ant-task"/>
Propchange: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/cert/demoCA/crl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 31 08:36:58 2014
@@ -0,0 +1 @@
+.GITplaceholder
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/config/CommonUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/config/CommonUiLabels.xml?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/config/CommonUiLabels.xml Mon Mar 31 08:36:58 2014
@@ -14396,7 +14396,6 @@
<value xml:lang="en">Danish</value>
<value xml:lang="es">Danés</value>
<value xml:lang="fr">Danois</value>
- <value xml:lang="fy">Danysk</value>
<value xml:lang="ja">ãã³ãã¼ã¯èª</value>
<value xml:lang="pt-BR">Dinamarquês</value>
<value xml:lang="ru">ÐаÑÑкий</value>
@@ -14430,7 +14429,6 @@
<value xml:lang="en">English</value>
<value xml:lang="es">Inglés</value>
<value xml:lang="fr">Anglais</value>
- <value xml:lang="fy">Frisian</value>
<value xml:lang="hi-IN">à¤
à¤à¤à¥à¤°à¥à¤à¥</value>
<value xml:lang="it">Inglese</value>
<value xml:lang="ja">è±èª</value>
@@ -14513,7 +14511,6 @@
<value xml:lang="en">Frisian</value>
<value xml:lang="es">Frisio</value>
<value xml:lang="fr">Frison</value>
- <value xml:lang="fy">Frysk</value>
<value xml:lang="ja">ããªã¼ã¸ã¢èª</value>
<value xml:lang="pt-BR">FrÃsio</value>
<value xml:lang="ru">ФÑизÑкий</value>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Mon Mar 31 08:36:58 2014
@@ -317,6 +317,9 @@ public class ServiceDispatcher {
boolean needsLockRetry = false;
do {
+ // Ensure this is reset to false on each pass
+ needsLockRetry = false;
+
lockRetriesRemaining--;
// NOTE: general pattern here is to do everything up to the main service call, and retry it all if
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java?rev=1583265&r1=1583264&r2=1583265&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java Mon Mar 31 08:36:58 2014
@@ -141,9 +141,11 @@ public class OfbizCurrencyTransform impl
Delegator delegator = (Delegator) request.getAttribute("delegator");
// Get rounding from SystemProperty
if (UtilValidate.isNotEmpty(delegator)) {
- String roundingString = EntityUtilProperties.getPropertyValue("general.properties", "currency.rounding.default", "10", delegator);
scaleEnabled = EntityUtilProperties.getPropertyValue("general.properties", "currency.scale.enabled", "N", delegator);
- if (UtilValidate.isInteger(roundingString)) roundingNumber = Integer.parseInt(roundingString);
+ if (UtilValidate.isEmpty(roundingNumber)) {
+ String roundingString = EntityUtilProperties.getPropertyValue("general.properties", "currency.rounding.default", "10", delegator);
+ if (UtilValidate.isInteger(roundingString)) roundingNumber = Integer.parseInt(roundingString);
+ }
}
}
if (roundingNumber == null) roundingNumber = 10;