Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

storeRulesPerItem function deletes too much?
(1 viewing) (1) Guest
If you have suggestion for a new feature you would need or that other may appreciate, or you have suggestion for improvemnt or change, you may post such ideas in this category.
  • Page:
  • 1

TOPIC: storeRulesPerItem function deletes too much?

storeRulesPerItem function deletes too much? 10 years ago #45923

VM Invoice version is 2.0.45

When I edit an order and save it, it calls the storeRulesPerItem function. At the end of the function it deletes "rules for this order/item/shipping/payment that [were] not saved now".

It may be me misunderstanding the actual use of the calculation rules, but it seems to me the function deletes too much. The function is called 3 times, once for general rules, shipments and then payments. The WHERE part of the query for each time looks like this:
-General(-1): WHERE (`virtuemart_order_item_id` IS NULL OR `virtuemart_order_item_id`=0) AND `calc_kind` != 'shipment' AND `calc_kind` != 'payment' AND virtuemart_order_calc_rule_id NOT IN (42, 43)
-Shipment(-2): WHERE `calc_kind` = 'shipment' AND virtuemart_order_calc_rule_id NOT IN (41)
-payment(-3): WHERE `calc_kind` = 'payment' AND virtuemart_order_calc_rule_id NOT IN (40)

At the present time it deletes almost every calculation rules except the #40, #41, #42 and #43. That includes calculation rules linked with other orders, that's where my problem lies. I fail to understand why it does so. Shouldn't the delete just affect the calculation rules linked with the order saved? If so, shouldn't the delete queries have another condition to do so(like "AND `virtuemart_order_id`='.$this->virtuemart_order_id").

Is there a reason why every other calculation rules without a order_item_id attached to it are deleted each time I save an order from the vm_invoice admin? Is it some kind of "garbage collecting" method so that the DB is not filled too much? I'd really like to know why it does act like this because with every other calculation rules being deleted, it also deletes the taxes off my invoices. Adding the query condition I just mentioned seems to me like it would work, but, before doing so, I'd like to be sure that I am right in doing so or if it's just me missing the point.

Thank you.
The topic has been locked.

Re: storeRulesPerItem function deletes too much? 10 years ago #45928

  • mitk
Hello,

this described problem is bug and it will be fixed in the next version.

Thank you for the report and I am sorry for the inconvenience.
The topic has been locked.
  • Page:
  • 1
User Login Empty