BulkUpdater work.
[order_line_extra.git] / order_lines_view.php
index 1eb0c0c2ec732da0a03d38a8cbeaf238d5e396af..077e3767793f54ef3761888fc94485b2b083b271 100644 (file)
@@ -18,6 +18,7 @@ include_once($path_to_root . "/reporting/includes/reporting.inc");
 
 include_once("includes/order_lines.inc");
 include_once("includes/splitter.inc");
+include_once("includes/bulk_updater.inc");
 
 $page_security = 'SA_ORDERLINEX_EDIT';
 add_access_extensions();
@@ -28,6 +29,7 @@ $_SESSION['page_title'] = _($help_context = "Edit lines extra parameters");
 filter_data($_POST);
 update_extra_order_details();
 split_order_details();
+bulk_update_order_details();
 
 
 $js = "";
@@ -126,17 +128,36 @@ $table->width = "80%";
 display_db_pager($table);
 
 function display_split_area() {
-start_table(TABLESTYLE_NOBORDER);
 qty_cells('Before', 'start_offset', -5);
-date_cells('Start', 'start_date');
-date_cells('End', 'end_date');
+date_cells('Start', 'start_date', null, null, 0, 0, 1001);
+date_cells('End', 'end_date', null, null, 0, 0, 1001);
 qty_cells('After', 'end_offset', 2);
 qty_cells('Max', 'max_quantity', 6);
 submit_cells('Split', 'Split');
-end_table();
 
 }
+
+function display_bulk_area()  {
+date_cells('Priority', 'bulk[priority_date]', null, null, 0, 0, 1001);
+qty_cells(null, 'bulk[priority_time]', '12:00:00');
+date_cells('Hold', 'bulk[hold_until_date]', null, null, 0, 0, 1001);
+date_cells('Required', 'bulk[required_date]', null, null, 0, 0, 1001);
+date_cells('Expiry', 'bulk[expiry_date]', null, null, 0, 0, 1001);
+text_cells('Comment', 'bulk[comment]');
+submit_cells('Bulk', 'Bulk');
+}
+
+
+if($customer_id !== null) {
+start_table(TABLESTYLE);
+start_table(TABLESTYLE_NOBORDER);
 display_split_area();
+end_table();
+start_table(TABLESTYLE_NOBORDER);
+display_bulk_area();
+end_table();
+end_table();
+}
 
 
 br(1);
@@ -175,8 +196,30 @@ var inserts = {
        '#checkAll': function (e) {
                e.onchange = function()  {
                        $('.check_detail').prop('checked', e.checked)
+                       $('.check_detail').trigger('change');
                }
        }
+       ,'tr': function(e) {
+                       // find if there is a check detail box on link all input to it
+                       var tr = $(e);
+                       var check = tr.find('.check_detail');
+                       if(check.length != 1) return;
+                       check = check[0];
+                       var jcheck = $(check);
+                       var inputs = tr.find('input');
+                       inputs.each(function(index, input) {
+                               if(input === check) return;
+                               $(input).prop('disabled', true)
+                       })
+
+                       check.onchange = function() {
+                               inputs.each(function(index, input) {
+                                       var on = jcheck.prop('checked')
+                                       if(input == check) return;
+                                       $(input).prop('disabled', !on);
+                               })
+                       };
+               }
        }
 Behaviour.register(inserts);
 </script>