[0005178] Fixed customer selection via popup after missing inline customer search.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 24 Sep 2020 20:20:59 +0000 (22:20 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 24 Sep 2020 20:20:59 +0000 (22:20 +0200)
includes/ui/ui_lists.inc
includes/ui/ui_view.inc
sales/includes/cart_class.inc
sales/includes/ui/sales_order_ui.inc

index 417d6032f4185190797cd0e08423b1b2d42692cc..5ca6a49d4c84da915ff56dcc4c3e8b85b173fcd8 100644 (file)
@@ -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']) . ')';
                                }
                }
        }
index 59fa6888b0f256c6ff63f2cc8dd59d588c643f49..99a753d5ef5623cf808f21eaf904373b9c7d1b9f 100644 (file)
@@ -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');
index e19ea3160f0c68ea34b02dcdb65f73b5eb39df4a..f7e05815c285efc2185f7a336e75d07c05ff97c5 100644 (file)
@@ -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
index d9e20583a3f655437c0015b8c035361de907943c..c0337bc0059683522b980d3040d18f54aea2fb99 100644 (file)
@@ -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,