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']) . ')';
}
}
}
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;
option.text = text;
element.add(option, 0);
element.selectedIndex = 0;
+ search.value = '';
element.onchange();
} else {
var stock_element = doc.getElementsByName('stock_id');
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
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.");
}
}
}
$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,