Stock isn't decrease on admin/store/orders/create

Project:Ubercart Contributions
Component:Code
Category:
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
Ubercart

I don't know if it is a philosophy, but when I create order by administration interface (admin/store/orders/create), stock level is never decrease...

Do you have some advice how to easy repair it (I am able to write patch, but can you give me a direction)?

AND - It has to be repaired in new versions in my opinion - in my project are often orders created by this way (by call center operator...).

THX, PEpe

ludde's picture
Offline
Joined: 09/30/2008
Juice: 12
Workaround

Here is a ugly workaround.. I'm not a programmer so the solutions are pretty simplistic but it works.

If anyone knows how I can put this in template.php instead of editing the code, please let me know.

in ubercart/uc_order/uc_order.module edit
function uc_order_edit_products($order_id)

After line 1792 add: uc_stock_adjust($product->model, "-".$product->qty);

and add the following after "case 'remove':" on line 1797:
for ($i = 0; $i < 40; $i++) {
if($_POST['products'][$i]['order_product_id'] == intval($_POST['opid'])) uc_stock_adjust($_POST['products'][$i]['model'], $_POST['products'][$i]['qty']);
}

//Ludvig

noira@drupal.org's picture
Offline
Joined: 01/01/2009
Juice: 73
Re: Stock isn't decrease on admin/store/orders/create
Assigned to:ludde» noira@drupal.org

Crap. I can confirm. Need to implement the code change, but this should really be comitted to the core!

noira@drupal.org's picture
Offline
Joined: 01/01/2009
Juice: 73
Re: Workaround

i could not find the function nor the line. perhaps the core has been changed in between?

cfab's picture
Offline
Joined: 06/30/2009
Juice: 70
ludde's code is good
Assigned to:noira@drupal.org» cfab

Hi,

I confirm the hack is efficient.

Will this be corrected on 2.0? It seems to be an annoying bug...

cfab