Fix install hook returning error
[order_line_extra.git] / haxe / ItemScheduler.hx
index d01c9602be47f960acb9378d5bd4330bcad1bae5..ab4e9ac83f78fd623696335ff6021d176cdb0b04 100644 (file)
@@ -118,7 +118,7 @@ class ItemScheduler {
                for(order in orders()) {
                        var quantity : Int = Std.parseInt(order.quantity);
 
-                       while(0 > left && locationIter.hasNext()) {
+                       while(0 >= left && locationIter.hasNext()) {
                                location = locationIter.next();
                                var quantityForLocation : Int = location.quantityOnHand(stock_id, null);
                                if(quantityForLocation == null || quantityForLocation == 0) continue;
@@ -131,7 +131,7 @@ class ItemScheduler {
 
                }
                // display the left locations
-                       while(0 > left && locationIter.hasNext()) {
+                       while(0 >= left && locationIter.hasNext()) {
                                location = locationIter.next();
                                var quantityForLocation : Int = location.quantityOnHand(stock_id, null);
                                if(quantityForLocation == null || quantityForLocation == 0) continue;
@@ -232,7 +232,7 @@ return cast(locations(), Array<Dynamic>);
 
 private function loadOrders() {
        var tb : String =  untyped __php__('TB_PREF');
-       var sql : String = "SELECT *  , d.priority AS pp
+       var sql : String = "SELECT *  , d.quantity as qty,   d.priority AS pp
                FROM "+tb+"denorm_order_details_queue  d
                JOIN "+tb+"sales_order_details od ON (od.id = d.id)
                JOIN "+tb+"sales_orders so ON (so.order_no = d.order_id)
@@ -252,6 +252,7 @@ function orders():Array<Order>  {
                var a:Dynamic = php.Lib.objectOfAssociativeArray(row);
                var order:Order = a;
                order.priority = Date.fromString(a.pp);
+               order.quantity = a.qty;
                orderList.push(order);
        };