Fix priority queue using hold until date instead of expiry one.
authorMaxime Bourget <bmx007@gmail.com>
Tue, 11 Jun 2013 16:36:10 +0000 (17:36 +0100)
committerMaxime Bourget <bmx007@gmail.com>
Tue, 11 Jun 2013 16:36:10 +0000 (17:36 +0100)
hooks.php
includes/db_order_lines.inc

index 40a3fd9346b1ad1c56f5e5dc12d2917e44e5deb1..0ef098f16a14d1881cda143c8f2f190221b1a652 100644 (file)
--- a/hooks.php
+++ b/hooks.php
@@ -60,9 +60,9 @@ class hooks_order_line_extra extends hooks {
         );
 
                                return $this->update_databases($company, $updates, $check_only)
+                                                               && update_order_detail_defaults(true)
                                                                && update_queue_quantities()
                                                                && update_qoh_for_item()
-                                                               && update_order_detail_defaults(true)
                                                                ;
     }
 
index 94ed65f1512ef3f362972c452aab62154dfd0806..944a3f2f09ae0fe6d0a3ad762a0c7f19814a3ccf 100644 (file)
@@ -52,7 +52,7 @@ function insert_item_into_queue($stock_id) {
                                                                NATURAL JOIN ".TB_PREF."sales_orders
                                                                WHERE stk_code = \"$stock_id\"
                                                                AND quantity > qty_sent
-                                                               ORDER BY IF(hold_until_date < NOW(), 1, 0),  IF(priority IS NULL, CONCAT(ord_date, ' 23:59:59'), priority)
+                                                               ORDER BY IF(expiry_date < NOW(), 1, 0),  IF(priority IS NULL, CONCAT(ord_date, ' 23:59:59'), priority), hold_until_date, id
                                                                ) AS d
        ";