FIX Missing search on barcode, only if defined

This commit is contained in:
Laurent Destailleur 2016-06-01 12:15:54 +02:00
parent 79291b7a77
commit 40005b8f65
3 changed files with 16 additions and 92 deletions

View File

@ -1603,7 +1603,7 @@ class Form
* @param string $selected_input_value Value of preselected input text (for use with ajax)
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
* @param array $ajaxoptions Options for ajax_autocompleter
* @param int $socid Thirdparty Id
* @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @return void
*/
function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0)
@ -1662,7 +1662,7 @@ class Form
* @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $finished Filter on finished field: 2=No filter
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $socid Thirdparty Id
* @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @return array Array of keys for json
*/
function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0)
@ -1673,7 +1673,7 @@ class Form
$outarray=array();
$sql = "SELECT ";
$sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock, p.fk_price_expression";
$sql.= " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock, p.fk_price_expression";
//Price by customer
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
@ -1860,6 +1860,7 @@ class Form
$outref='';
$outlabel='';
$outdesc='';
$outbarcode='';
$outtype='';
$outprice_ht='';
$outprice_ttc='';
@ -1878,6 +1879,8 @@ class Form
$outref=$objp->ref;
$outlabel=$objp->label;
$outdesc=$objp->description;
$outbarcode=$objp->barcode;
$outtype=$objp->fk_product_type;
$outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration,0,dol_strlen($objp->duration)-1):'';
$outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration,-1):'';
@ -1891,12 +1894,16 @@ class Form
else if ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"';
}
$opt.= '>';
$opt.= $objp->ref.' - '.dol_trunc($label,$maxlengtharticle).' - ';
$opt.= $objp->ref;
if ($outbarcode) $opt.=' ('.$outbarcode.')';
$opt.=' - '.dol_trunc($label,$maxlengtharticle).' - ';
$objRef = $objp->ref;
if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$objRef,1);
$outval.=$objRef.' - '.dol_trunc($label,$maxlengtharticle).' - ';
$outval.=$objRef;
if ($outbarcode) $outval.=' ('.$outbarcode.')';
$outval.=' - '.dol_trunc($label,$maxlengtharticle).' - ';
$found=0;
// Multiprice

View File

@ -527,89 +527,6 @@ if ($resql)
print '<br>';
}
/*
* Correct stock
*/
/*
if ($action == "correction")
{
print load_fiche_titre($langs->trans("StockCorrection"));
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="correct_stock">';
print '<table class="border" width="100%">';
// Product
print '<tr>';
print '<td width="20%">'.$langs->trans("Product").'</td>';
print '<td width="20%">';
print $form->select_produits(GETPOST('productid'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''));
print '</td>';
print '<td width="20%">';
print '<select name="mouvement" class="flat">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1">'.$langs->trans("Delete").'</option>';
print '</select></td>';
print '<td width="20%">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input class="flat" name="nbpiece" size="10" value=""></td>';
print '</tr>';
// Label
print '<tr>';
print '<td width="20%">'.$langs->trans("Label").'</td>';
print '<td colspan="4">';
print '<input type="text" name="label" size="40" value="">';
print '</td>';
print '</tr>';
print '</table>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
}
if ($action == "transfert")
{
print load_fiche_titre($langs->trans("Transfer"));
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="transfert_stock">';
print '<table class="border" width="100%">';
print '<tr>';
print '<td width="20%">'.$langs->trans("Product").'</td>';
print '<td width="20%">';
print $form->select_produits(GETPOST('productid'),'product_id');
print '</td>';
print '<td width="20%">'.$langs->trans("WarehouseTarget").'</td><td width="20%">';
print $formproduct->selectWarehouses('','id_entrepot_destination','',1);
print '</td>';
print '<td width="20%">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input name="nbpiece" size="10" value=""></td>';
print '</tr>';
// Label
print '<tr>';
print '<td width="20%">'.$langs->trans("Label").'</td>';
print '<td colspan="5">';
print '<input type="text" name="label" size="40" value="">';
print '</td>';
print '</tr>';
print '</table>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
}
*/
/* ************************************************************************** */
/* */

View File

@ -56,14 +56,14 @@
{
print '<td width="20%" class="fieldrequired" colspan="2">'.$langs->trans("Warehouse").'</td>';
print '<td width="20%">';
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')),'id_entrepot','',1);
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', '', 1);
print '</td>';
}
if ($object->element == 'stock')
{
print '<td width="20%" class="fieldrequired" colspan="2">'.$langs->trans("Product").'</td>';
print '<td width="20%">';
print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''));
print $form->select_produits(GETPOST('product_id'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''));
print '</td>';
}
print '<td width="20%">';