So, the commerce_cart_commerce_line_item_presave() function should do a few checks against changes in the line items before it resets the status of an order.
Currently, only a check against changes in the quantity is made. We also need to check against changes in the unit price: the amount and the unit code.
The code itself does need some revision too...
* $line_item and $unchanged_line_item should go through entity_metadata_wrapper to cope with changes (translation,...) before checking those values.
* We do this: commerce_order_load($line_item->order_id); but we don't need to since the changes in #1035006: Create entity properties for orders in line items will load the $order object as a separate entity property of the $line_item.
Comments
Comment #1
netsensei commentedCode revision:
https://github.com/netsensei/drupalcommerce/commit/889dce314035fb3a20b84...
The quantity works, but for unit_price, the amount differs since their both floats but each with a different precision. This makes checking for changes in the unit_price field with i.e. array_diff() difficult.
Comment #2
pcambraComment #3
rszrama commentedMarking this one fixed as part of my work integrating netsensei's pull requests. Some of this code shuffled around, because it's no longer possible to make direct changes to the unit price / currency code of line items on cart orders via the order edit form. Additionally, the quantity property data isn't translatable, so a wrapper here isn't necessary.
Therefore, in the code's current state, I don't believe the original issues exist any more.