From: Janusz Dobrowolski Date: Thu, 24 Sep 2020 20:20:59 +0000 (+0200) Subject: [0005178] Fixed customer selection via popup after missing inline customer search. X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=44228f3af373146199525f7a865a23453f8009a8 [0005178] Fixed customer selection via popup after missing inline customer search. --- diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 417d6032..5ca6a49d 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -150,7 +150,7 @@ $opts = array( // default options foreach($opts['search'] as $i=> $s) $opts['search'][$i] = $s . " LIKE " .db_escape(($class=='combo3' ? '' : '%').$txt.'%'); - $opts['where'][] = '('. implode($opts['search'], ' OR ') . ')'; + $opts['where'][] = '('. implode(' OR ', $opts['search']) . ')'; } } } diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc index 59fa6888..99a753d5 100644 --- a/includes/ui/ui_view.inc +++ b/includes/ui/ui_view.inc @@ -939,6 +939,7 @@ function get_js_select_combo_item() { function get_js_set_combo_item() { $js = "function setComboItem(doc, client_id, value, text){ var element = doc.getElementById(client_id); + var search = doc.getElementById('_'+client_id+'_edit'); if(typeof(element) != 'undefined' && element != null && element.tagName === 'SELECT') { var options = element.options; options.length = 0; @@ -947,6 +948,7 @@ function get_js_set_combo_item() { option.text = text; element.add(option, 0); element.selectedIndex = 0; + search.value = ''; element.onchange(); } else { var stock_element = doc.getElementsByName('stock_id'); diff --git a/sales/includes/cart_class.inc b/sales/includes/cart_class.inc index e19ea316..f7e05815 100644 --- a/sales/includes/cart_class.inc +++ b/sales/includes/cart_class.inc @@ -71,7 +71,7 @@ class Cart var $dimension_id; var $dimension2_id; var $payment; - var $payment_terms; // cached payment terms + var $payment_terms = array('cash_sale' => false, 'days_before_due' => 0); // cached payment terms var $credit; // prepayment mode: var $prepaid=false; // true for documents issued in prepayment mode diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index d9e20583..c0337bc0 100644 --- a/sales/includes/ui/sales_order_ui.inc +++ b/sales/includes/ui/sales_order_ui.inc @@ -353,7 +353,7 @@ function display_order_header(&$order, $editable, $date_text) else { $row = get_customer_to_order($_POST['customer_id']); - if ($row['dissallow_invoices'] == 1) + if ($row && $row['dissallow_invoices'] == 1) $customer_error = _("The selected customer account is currently on hold. Please contact the credit control personnel to discuss."); } } @@ -515,8 +515,11 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1) } $item_info = get_item_edit_info($_POST['stock_id']); - $units = $item_info["units"]; - $dec = $item_info['decimals']; + $units = ''; $dec = 2; + if ($item_info) { + $units = $item_info["units"]; + $dec = $item_info['decimals']; + } $_POST['qty'] = number_format2(1, $dec); $price = get_kit_price($_POST['stock_id'], $order->customer_currency, $order->sales_type,