1 (edited by p2409 12/22/2008 11:08:54 am)

Topic: Sales Order - quantity stays at zero FOR 2.1

I'm not sure whether you want these on Mantis or not - but Mantis has no 2.1 section, so I'll post it here.

When you enter a sales order, regardless of what you put in the quantity, it remains zero when you add the line. The total stays $0.00 too. I think this is because on the table item_codes, the quantity for products is always zero.

I debugged it and found that when you add a new item, items_db.inc calls

add_item_code($stock_id, $stock_id, $description, 1, 0);

However, in item_codes_db.inc, this results in the $qty being passed in as zero. This ends up on the database.
When you add an item to a sales order now, it's always zeroed out because of the code in sales_order_ui.inc at lines 40 or 65:

$order->add_to_cart (count($order->line_items),    $item['stock_id'],$new_item_qty*$item['quantity'], $item_price, $discount);

It's the $new_item_qty * $item['quantity'] that's the problem. $item['quantity'] is always zero.

I'm not 100% sure what you're getting at with this code, but I suspect maybe you meant:
add_item_code($stock_id, $stock_id, $description, $category_id, 1, 0);
on line 44 of items_db.inc.

ie. you forgot to pass the $category_id parameter in.

When I make this change, it looks like everything works ok again on sales orders.

Cheers
Pete

Re: Sales Order - quantity stays at zero FOR 2.1

Hello Pete,

Yes, you are absolutely right. Both this bug and the one you have posted in the next thread have appeared here after item code table structure change (category added), this is my fault. I will update unstable CVS in a while.

Regarding the mantis there is no FrontAccount 2.1 branch because the new release is currently under development and have not achieved freeze state yet. Currently all bugs regarding the latest features included into future 2.1 release can be reported here on forum, but if you want make some extensive testing of  the unstable code, and you prefer to use the mantis we can of course create new branch in Mantis at any time.  Simply keep in mind that the unstable 2.1 code is subject to change at any time before freeze, so it is not recomended for production use, and also bug reports should be send with some delay after related code CVS commitment, to give us a chance to fix them ourself wink.

Anyway thank you very much for your kind effort. Very appreciated.

Regards
Janusz

3 (edited by p2409 12/22/2008 10:52:38 pm)

Re: Sales Order - quantity stays at zero FOR 2.1

Hi Janusz

I am going to do a bit of 2.1 testing so rather than clog up these user forums with details, maybe it would be a good idea to create a mantis 2.1 branch? Up to you.

I'm not using 2.1 for production, but it looks like it will have some really good extra feature, so I've been keen to test it, but of course I understand it's unstable.

Just out of interest, what do you guys use to test/debug? I use Komodo which is fantastic for line-by-line debugging, but I may slowly make the change to Netbeans 6.5, which supports PHP and allegedly has some other Netbeans features for PHP like better class/code completion and syntax error displays. The advantage of Netbeans of course is it's completely free, and can handle most of your other languages too smile.

Happy Christmas!
Pete

Re: Sales Order - quantity stays at zero FOR 2.1

Sometimes for bugtracking and profilling purposes I use xdebug together with kate , but personally I prefer old good console editors like mcedit. When code has good overall structure, there is no need for more complex tools I think.
I've created separated bugtracker section for unstable code on Mantis. This is really good tool, and cooperation with mantis seems work better. So if you will find something bad in the 2.1 code please report it there.

Thank you once again and Happy Christmas

Janusz

Re: Sales Order - quantity stays at zero FOR 2.1

We have this issue too now which didn't happen to us in the past years. For a number of products, when we input Delivery note, no matter what quantity we input, it will become zero. Then we will have to edit the line again to update the quantity. This is causing a lot of trouble as we will have to input 2 times to make the quantity right.

This position after input on DN always come as zero "null" quantities. What should we do to fix this? Thank you.