BulkUpdater work.
[order_line_extra.git] / item_schedule.php
index ef34297e5dde32b70620f572c4a4914634f34580..608bf90ecbe0ef40537656f535b982b8da469b48 100644 (file)
@@ -19,6 +19,8 @@ include_once($path_to_root . "/reporting/includes/reporting.inc");
 
 //include_once("includes/item_scheduler.inc");
 include_once("hincludes/lib/php/Boot.class.php");
+include_once("includes/db_order_lines.inc");
+include_once("config.php");
 
 $page_security = 'SA_ORDERLINEX_EDIT';
 add_access_extensions();
@@ -38,12 +40,6 @@ start_form();
 start_table(TABLESTYLE_NOBORDER);
 start_row();
 
-echo date('h:i:s <br>',time());
-?>GET<?php
-print_r($_GET);
-?>POST<?php
-print_r($_POST);
-
 if (!isset($_POST['stock_id'])) {
 if (isset($_GET['stock_id']))
 {
@@ -54,7 +50,9 @@ else {
        }
 }
 
-if (list_updated('stock_id') || in_ajax()) $Ajax->activate('item_schedule');
+if (list_updated('stock_id') || in_ajax()) $Ajax->activate('item_schedule') ;
+//else update_queue_quantities() && update_qoh_for_item();
+
 
 //if (!@$_GET['popup'])
 //     start_form();
@@ -71,17 +69,17 @@ if(isset($stock_id)) echo '<input type="hidden" name="last_stock_id" value="'.$s
 
 if(isset($_POST['Update'])) {
        $Ajax->activate('item_schedule');
-               echo 'youpiii';
        // Restore the parameters
-       $params = $_SESSION['schedule_parameters'];
+       $params = new ScheduleParameters($_SESSION['schedule_parameters']);
        $params->setMode('update');
 }
 else {
        $params = in_ajax() && $stock_id == @$_POST['last_stock_id'] ? new ScheduleParameters($_POST) : null;
        // save parameters form update
-       $_SESSION['schedule_parameters'] = $params;
+       $_SESSION['schedule_parameters'] = $_POST;
 }
-$scheduler = new ItemScheduler($stock_id, 'DEF', $params);
+$scheduler = new ItemScheduler($stock_id, OrderXtraConfig::$default_location, $params);
+$scheduler->action();
 
 start_table(TABLESTYLE);
 $th = $scheduler->tableHeader();
@@ -93,8 +91,10 @@ $scheduler->generateTable();
 end_table();
 
 
-submit_center_first('Update', _("Update"), '', 'default', false);
-submit_center_last('Cancel', _("Cancel"), '', 'cancel', false);
+if($scheduler->needsUpdate()) {
+        submit_center_first('Update', _("Update"), '', 'default', false);
+       submit_center_last('Cancel', _("Cancel"), '', 'cancel', false);
+}
 
 
 
@@ -121,6 +121,10 @@ tr.on_time {
 tr.late {
                background: #fc8;
 }
+tr.early {
+               background: #def;
+               color: blue;
+}
 
 tr.soldout {
                background: pink;
@@ -138,7 +142,6 @@ tr.tDnD_whileDrag :nth-child(4), tr.tDnD_whileDrag :nth-child(5) {
 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
 <script src="js/jquery.tablednd.0.8.min.js"></script>
 <script text="text/javascript">
-       console.log('hello')
        /**  add table DnD as behavior **/
        function onDragStart (table, row) {
        console.log(table)