Each time an order is edited through the admin interface, even when no changes are made to the products, a message is added to the order log stating that the stock level has been decreased. If between edits, other orders are made, the order log will look like this:

2010/02/28 The stock level for DBRD10 has been decreased to 55.
2010/02/28 The stock level for DBRD10 has been decreased to 55.
2010/03/02 The stock level for DBRD10 has been decreased to 54.
2010/03/02 The stock level for DBRD10 has been decreased to 54.

It looks like stock has been decremented twice, plus some duplicate messages, while only the first one is relevant.

CommentFileSizeAuthor
#1 uc_order.admin_.inc_.732482.patch619 byteswimh
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wimh’s picture

Status: Active » Needs review
FileSize
619 bytes

uc_stock_decrement_product_stock() is called for each product and for each order edit, with the change in quantity for this product as argument. So the stock quantity is always correct, we should just remove the message when the quantity did not change.

The attached patch does this: when $product->qty (defined as new quantity minus quantity before edit) equals zero, uc_stock_decrement_product_stock() is not called.

TR’s picture

Status: Needs review » Closed (duplicate)