NEW: ref in product customer price: look for products with customer ref
This commit is contained in:
parent
541dab5737
commit
ca2ed2ef74
@ -2137,8 +2137,8 @@ class Form
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid))
|
||||
{
|
||||
$sql .= ', pcp.rowid as idprodcustprice, pcp.price as custprice, pcp.price_ttc as custprice_ttc,';
|
||||
$sql .= ' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx';
|
||||
$selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx";
|
||||
$sql .= ' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx, pcp.ref_customer as custref';
|
||||
$selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx, custref";
|
||||
}
|
||||
// Units
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
@ -2235,6 +2235,7 @@ class Form
|
||||
if ($i > 0) $sql .= " AND ";
|
||||
$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && ! empty($socid)) $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
|
||||
if (!empty($conf->global->PRODUCT_AJAX_SEARCH_ON_DESCRIPTION))
|
||||
{
|
||||
$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
|
||||
@ -2422,6 +2423,7 @@ class Form
|
||||
|
||||
$outkey = $objp->rowid;
|
||||
$outref = $objp->ref;
|
||||
$outrefcust = empty($objp->custref) ? '' : $objp->custref;
|
||||
$outlabel = $objp->label;
|
||||
$outdesc = $objp->description;
|
||||
$outbarcode = $objp->barcode;
|
||||
@ -2487,11 +2489,13 @@ class Form
|
||||
}
|
||||
$opt .= '>';
|
||||
$opt .= $objp->ref;
|
||||
if (! empty($objp->custref)) $opt.= ' (' . $objp->custref . ')';
|
||||
if ($outbarcode) $opt .= ' ('.$outbarcode.')';
|
||||
$opt .= ' - '.dol_trunc($label, $maxlengtharticle);
|
||||
if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) $opt .= ' ('.getCountry($outorigin, 1).')';
|
||||
|
||||
$objRef = $objp->ref;
|
||||
if (! empty($objp->custref)) $objRef .= ' (' . $objp->custref . ')';
|
||||
if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
|
||||
$outval .= $objRef;
|
||||
if ($outbarcode) $outval .= ' ('.$outbarcode.')';
|
||||
@ -2655,7 +2659,7 @@ class Form
|
||||
}
|
||||
|
||||
$opt .= "</option>\n";
|
||||
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'pbq'=>$outpbq);
|
||||
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'pbq'=>$outpbq, 'ref_customer'=>$outrefcust);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
@ -134,7 +134,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
||||
}
|
||||
return { label: label, value: item.value, id: item.key, disabled: item.disabled,
|
||||
update: update, textarea: textarea,
|
||||
pbq: item.pbq, type: item.type, qty: item.qty, discount: item.discount, pricebasetype: item.pricebasetype, price_ht: item.price_ht, price_ttc: item.price_ttc }
|
||||
pbq: item.pbq, type: item.type, qty: item.qty, discount: item.discount, pricebasetype: item.pricebasetype, price_ht: item.price_ht, price_ttc: item.price_ttc, ref_customer: item.ref_customer }
|
||||
}));
|
||||
}
|
||||
else console.error("Error: Ajax url '.$url.($urloption ? '?'.$urloption : '').' has returned an empty page. Should be an empty json array.");
|
||||
@ -152,6 +152,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
||||
$("#'.$htmlname.'").attr("data-pbqbase", ui.item.pricebasetype);
|
||||
$("#'.$htmlname.'").attr("data-pbqqty", ui.item.qty);
|
||||
$("#'.$htmlname.'").attr("data-pbqpercent", ui.item.discount);
|
||||
$("#'.$htmlname.'").attr("data-ref-customer", ui.item.ref_customer);
|
||||
|
||||
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
|
||||
// Disable an element
|
||||
|
||||
Loading…
Reference in New Issue
Block a user