<?php
include_once($path_to_root."/includes/ui/ui_input.inc");
+function update_extra_order_details() {
+ if(!isset($_POST['Update']) || $_POST['Update'] != 'Update') return;
+
+begin_transaction();
+ // update in database all field
+ foreach($_POST['detail'] as $detail_id => $values) {
+ $set = array();
+ if($comment = $values['comment']) array_push($set, " comment='$comment' ");
+ if(isset($values['required_date'])) {
+ $required_date = trim($values['required_date']);
+ if($required_date == "") {
+ array_push($set," required_date = NULL");
+ } else {
+ $date = date2sql($required_date);
+ array_push($set," required_date='$date' ");
+ }
+ }
+
+ if(!empty($set)) {
+ $sql = "UPDATE ".TB_PREF."sales_order_details SET ".implode($set,', ')." WHERE id = $detail_id ";
+
+ if(!db_query($sql)) {
+ display_error('Problem while updating order details. Try again');
+ cancel_transaction();
+ return;
+ }
+ }
+
+ }
+
+ display_notification('Order details updated');
+
+}
+
function compute_input_name($row, $field) {
$row_id = $row['id'];
return "detail[$row_id][$field]";
$_SESSION['page_title'] = _($help_context = "Edit lines extra parameters");
+update_extra_order_details();
+
$js = "";
if ($use_popup_windows)
$js .= get_js_open_window(900, 600);