Description
This is a patch to add a parameter to forbid order decimal quantity
Behavior before the patch :
- you can add decimal quantity on shopping cart item (front office and back office) even if the product is a unit
- there is no rounding on quantity on shopping cart item thus you get amount with a large number of decimal
- reorder widget display quantity to reorder with a large number of decimal
What does this patch :
- a new field "orderDecimalQuantity" is added into ProducStore entity. The value of this field can be set from EditProducStore form (into shopping cart section). Value can be "Y", "N" or empty.
- a new field "orderDecimalQuantity" is added into Product entity. The value of this field can be set from EditProduc form (into shopping cart section). Value can be "Y", "N" or empty.
- a new method "isDecimalQuantityOrderAllowed" have been add into productWorker class. This method test if order decimal quantity is allow for a product and a productStore. Product is superior on producStore. Here is the table of value :
- ProductStore.orderDecimalQuantity = "Y" && Product.orderDecimalQuantity = "Y" => return True
- ProductStore.orderDecimalQuantity = "N" && Product.orderDecimalQuantity = "Y" => return True
- ProductStore.orderDecimalQuantity = empty && Product.orderDecimalQuantity = "Y" => return True
- ProductStore.orderDecimalQuantity = "Y" && Product.orderDecimalQuantity = "N" => return False
- ProductStore.orderDecimalQuantity = "N" && Product.orderDecimalQuantity = "N" => return False
- ProductStore.orderDecimalQuantity = empty && Product.orderDecimalQuantity = "N" => return False
- ProductStore.orderDecimalQuantity = "Y" && Product.orderDecimalQuantity = empty => return True
- ProductStore.orderDecimalQuantity = "N" && Product.orderDecimalQuantity = empty => return False
- ProductStore.orderDecimalQuantity = empty && Product.orderDecimalQuantity = empty => return True
- addToCat and modifyCart car method have been modify to call isDecimalQuantityOrderAllowed. If result is true then quantity is rounding with order config value. If result is false then quantity is rounding to 0. No message is return.
- to fix reorder quantity, then getQuickReorderProducts method have been modify to call isDecimalQuantityOrderAllowed. If result is true then quantity is rounding with order config value. If result is false then quantity is rounding to 0.
What the result :
- You can forbid or accept to manage order decimal quantity for all product
- You can forbid or accept to manage order decimal quantity for one product
- Decimal quantity are now rounded with order config value.
- reorder quantity is rounded with order config value or rounding to 0
Attachments
Attachments
Issue Links
- is related to
-
OFBIZ-5962 If orderDecimalQuantity set to N then system should return error if user add partial quantity in order
- Closed