Hi Pierre,

This is not a new patch, this is updated version of two years old patch
which has been already reviewed if you follow comments on ticket.
We need to add updated patch as well since many file path have been changed
and we have data files refactoring as well.

HTH.
--
Best Regards,
Suraj Khurana | Omni-channel OMS Technical Expert
HotWax Commerce  by  HotWax Systems

On Sat, Aug 18, 2018 at 2:13 PM, Pierre Smits <pierresm...@apache.org>
wrote:

> Hi Suraj,
>
> Please revert! Within 10 minutes you posted a new patch and committed it to
> trunk and closed the issue. It is customary to follow the 72 hr delay rule
> to allow the community to review the changes and assess the impact.
>
>
> Best regards,
>
> Pierre Smits
>
> Apache Trafodion <https://trafodion.apache.org>, Vice President
> Apache Directory <https://directory.apache.org>, PMC Member
> Apache Incubator <https://incubator.apache.org>, committer
> Apache OFBiz <https://ofbiz.apache.org>, contributor since 2008
> Apache Steve <https://steve.apache.org>, committer
>
> On Sat, Aug 18, 2018 at 10:34 AM, <sur...@apache.org> wrote:
>
> > Author: surajk
> > Date: Sat Aug 18 08:34:18 2018
> > New Revision: 1838320
> >
> > URL: http://svn.apache.org/viewvc?rev=1838320&view=rev
> > Log:
> > Improved: Added support to calculate deposit price as well while creating
> > shopping cart item.
> > (OFBIZ-7482)
> >
> > Modified:
> >     ofbiz/ofbiz-framework/trunk/applications/datamodel/data/
> > seed/OrderSeedData.xml
> >     ofbiz/ofbiz-framework/trunk/applications/datamodel/data/
> > seed/ProductSeedData.xml
> >     ofbiz/ofbiz-framework/trunk/applications/order/src/main/
> > java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java
> >
> > Modified: ofbiz/ofbiz-framework/trunk/applications/datamodel/data/
> > seed/OrderSeedData.xml
> > URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/
> > applications/datamodel/data/seed/OrderSeedData.xml?rev=
> > 1838320&r1=1838319&r2=1838320&view=diff
> > ============================================================
> > ==================
> > --- ofbiz/ofbiz-framework/trunk/applications/datamodel/data/
> seed/OrderSeedData.xml
> > (original)
> > +++ ofbiz/ofbiz-framework/trunk/applications/datamodel/data/
> seed/OrderSeedData.xml
> > Sat Aug 18 08:34:18 2018
> > @@ -49,6 +49,7 @@ under the License.
> >      <OrderAdjustmentType description="Additional Feature" hasTable="N"
> > orderAdjustmentTypeId="ADDITIONAL_FEATURE"/>
> >      <OrderAdjustmentType description="Warranty" hasTable="N"
> > orderAdjustmentTypeId="WARRANTY_ADJUSTMENT"/>
> >      <OrderAdjustmentType description="Marketing Package Adjustment"
> > hasTable="N" orderAdjustmentTypeId="MKTG_PKG_AUTO_ADJUST"/>
> > +    <OrderAdjustmentType description="Deposit" hasTable="N"
> > orderAdjustmentTypeId="DEPOSIT_ADJUSTMENT"/>
> >
> >      <OrderBlacklistType orderBlacklistTypeId="BLACKLIST_ADDRESS"
> > description="Addresss"/>
> >      <OrderBlacklistType orderBlacklistTypeId="BLACKLIST_CREDITCARD"
> > description="Credit Card"/>
> >
> > Modified: ofbiz/ofbiz-framework/trunk/applications/datamodel/data/
> > seed/ProductSeedData.xml
> > URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/
> > applications/datamodel/data/seed/ProductSeedData.xml?rev=
> > 1838320&r1=1838319&r2=1838320&view=diff
> > ============================================================
> > ==================
> > --- ofbiz/ofbiz-framework/trunk/applications/datamodel/data/
> seed/ProductSeedData.xml
> > (original)
> > +++ ofbiz/ofbiz-framework/trunk/applications/datamodel/data/
> seed/ProductSeedData.xml
> > Sat Aug 18 08:34:18 2018
> > @@ -281,6 +281,7 @@ under the License.
> >      <ProductPriceType description="Minimum Order Price"
> > productPriceTypeId="MINIMUM_ORDER_PRICE"/>
> >      <ProductPriceType description="Shipping Allowance Price"
> > productPriceTypeId="SHIPPING_ALLOWANCE"/>
> >
> > +    <ProductPricePurpose description="Deposit price"
> > productPricePurposeId="DEPOSIT"/>
> >      <ProductPricePurpose description="Purchase/Initial"
> > productPricePurposeId="PURCHASE"/>
> >      <ProductPricePurpose description="Recurring Charge"
> > productPricePurposeId="RECURRING_CHARGE"/>
> >      <ProductPricePurpose description="Usage Charge"
> > productPricePurposeId="USAGE_CHARGE"/>
> >
> > Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/
> > java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java
> > URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/
> > applications/order/src/main/java/org/apache/ofbiz/order/
> > shoppingcart/ShoppingCartItem.java?rev=1838320&r1=1838319&
> > r2=1838320&view=diff
> > ============================================================
> > ==================
> > --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/
> > java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java
> (original)
> > +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/
> > java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java Sat Aug
> 18
> > 08:34:18 2018
> > @@ -1038,6 +1038,7 @@ public class ShoppingCartItem implements
> >              ProductPromoWorker.doPromotions(cart, dispatcher);
> >          }
> >
> > +        calcDepositAdjustments();
> >          if (!"PURCHASE_ORDER".equals(cart.getOrderType())) {
> >              // store the auto-save cart
> >              if (triggerExternalOps && ProductStoreWorker.
> autoSaveCart(delegator,
> > productStoreId)) {
> > @@ -1061,6 +1062,33 @@ public class ShoppingCartItem implements
> >          }
> >      }
> >
> > +    public void calcDepositAdjustments() {
> > +        List<GenericValue>itemAdjustments = this.getAdjustments();
> > +        try {
> > +            GenericValue depositAmount = EntityQuery.use(delegator).
> > from("ProductPrice").where("productId", this.getProductId(),
> > "productPricePurposeId", "DEPOSIT", "productPriceTypeId",
> > "DEFAULT_PRICE").filterByDate().queryFirst();
> > +            if (UtilValidate.isNotEmpty(depositAmount)) {
> > +                Boolean updatedDepositAmount = false;
> > +                BigDecimal adjustmentAmount =
> > depositAmount.getBigDecimal("price").multiply(this.getQuantity(),
> > generalRounding);
> > +                // itemAdjustments is a reference so directly setting
> > updated amount to the same.
> > +                    for(GenericValue itemAdjustment : itemAdjustments) {
> > +                    if("DEPOSIT_ADJUSTMENT".equals(itemAdjustment.
> > getString("orderAdjustmentTypeId"))) {
> > +                            itemAdjustment.set("amount",
> > adjustmentAmount);
> > +                            updatedDepositAmount = true;
> > +                        }
> > +                }
> > +                if (!updatedDepositAmount) {
> > +                    GenericValue orderAdjustment = delegator.makeValue("
> > OrderAdjustment");
> > +                    orderAdjustment.set("orderAdjustmentTypeId",
> > "DEPOSIT_ADJUSTMENT");
> > +                    orderAdjustment.set("description", "Surcharge
> > Adjustment");
> > +                    orderAdjustment.set("amount", adjustmentAmount);
> > +                    this.addAdjustment(orderAdjustment);
> > +                }
> > +            }
> > +        } catch (GenericEntityException e){
> > +            Debug.logError("Error in fetching deposite price details!!",
> > module);
> > +        }
> > +    }
> > +
> >      public void updatePrice(LocalDispatcher dispatcher, ShoppingCart
> > cart) throws CartItemModifyException {
> >          // set basePrice using the calculateProductPrice service
> >          if (_product != null && isModifiedPrice == false) {
> >
> >
> >
>

Reply via email to