NEW: ref in product customer price: look for products with customer ref

This commit is contained in:
Marc de Lima Lucio
2020-10-28 11:04:15 +01:00
parent 541dab5737
commit ca2ed2ef74
2 changed files with 9 additions and 4 deletions

View File

@@ -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