mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
Qual: Uniformisation du code. Suppression des ref_url en doublon avec getNomUrl plus souple.
This commit is contained in:
@@ -1080,30 +1080,30 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Retourne la liste des produits fournisseurs en Ajax si ajax activ<69> ou renvoie <20> select_produits_fournisseurs_do
|
||||
\param selected Produit pr<70>s<EFBFBD>lectionn<6E>
|
||||
\param htmlname Nom de la zone select
|
||||
\param filtretype Pour filtre sur type de produit
|
||||
\param limit Limite sur le nombre de lignes retourn<72>es
|
||||
*/
|
||||
function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtretype='',$filtre='')
|
||||
{
|
||||
global $langs,$conf;
|
||||
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
||||
{
|
||||
print $langs->trans("RefOrLabel").' : <input type="text" size="16" name="keysearch'.$htmlname.'" id="keysearch'.$htmlname.'">';
|
||||
print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&socid='.$socid.'&type=2','working');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->select_produits_fournisseurs_do($socid,$selected,$htmlname,$filtretype,$filtre);
|
||||
}
|
||||
}
|
||||
/**
|
||||
\brief Retourne la liste des produits fournisseurs en Ajax si ajax activ<69> ou renvoie <20> select_produits_fournisseurs_do
|
||||
\param selected Produit pr<70>s<EFBFBD>lectionn<6E>
|
||||
\param htmlname Nom de la zone select
|
||||
\param filtretype Pour filtre sur type de produit
|
||||
\param limit Limite sur le nombre de lignes retourn<72>es
|
||||
*/
|
||||
function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtretype='',$filtre='')
|
||||
{
|
||||
global $langs,$conf;
|
||||
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
|
||||
{
|
||||
print $langs->trans("RefOrLabel").' : <input type="text" size="16" name="keysearch'.$htmlname.'" id="keysearch'.$htmlname.'">';
|
||||
print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&socid='.$socid.'&type=2','working');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->select_produits_fournisseurs_do($socid,$selected,$htmlname,$filtretype,$filtre);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Retourne la liste des produits de fournisseurs
|
||||
\param socid Id soci<63>t<EFBFBD> (0 pour aucun filtre)
|
||||
\param socid Id soci<63>t<EFBFBD> (0 pour aucun filtre)
|
||||
\param selected Produit pr<70>s<EFBFBD>lectionn<6E>
|
||||
\param htmlname Nom de la zone select
|
||||
\param filtretype Pour filtre sur type de produit
|
||||
@@ -1136,42 +1136,50 @@ class Form
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
if ($conf->use_ajax)
|
||||
{
|
||||
if (! $num)
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
print '<option value="0">-- '.$langs->trans("NoProductMatching").' --</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'" onchange="publish_selvalue(this);">';
|
||||
print '<option value="0" selected="true">-- '.$langs->trans("MatchingProducts").' --</option>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
if (! $selected) print '<option value="0" selected="true"> </option>';
|
||||
else print '<option value="0"> </option>';
|
||||
}
|
||||
{
|
||||
if (! $num)
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
print '<option value="0">-- '.$langs->trans("NoProductMatching").' --</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'" onchange="publish_selvalue(this);">';
|
||||
print '<option value="0" selected="true">-- '.$langs->trans("MatchingProducts").' --</option>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
if (! $selected) print '<option value="0" selected="true"> </option>';
|
||||
else print '<option value="0"> </option>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
|
||||
$opt = '<option value="'.$objp->rowid.'"';
|
||||
if ($selected == $objp->rowid) $opt.= ' selected="true"';
|
||||
//$opt.= '>'.$objp->ref.' ('.$objp->ref_fourn.') - ';
|
||||
if ($objp->fprice == '') $opt.=' disabled="disabled"';
|
||||
$opt.= '>'.$objp->ref.' - ';
|
||||
$opt.= dolibarr_trunc($objp->label,24).' - ';
|
||||
$opt.= $objp->fprice.$langs->trans("Currency".$conf->monnaie)."/".$objp->quantity.$langs->trans("Units");
|
||||
if ($objp->quantity > 1)
|
||||
$opt.= dolibarr_trunc($objp->label,18).' - ';
|
||||
if ($objp->fprice != '')
|
||||
{
|
||||
$opt.=" - ";
|
||||
$opt.= round($objp->fprice/$objp->quantity,4).$langs->trans("Currency".$conf->monnaie)."/".$langs->trans("Unit");
|
||||
$opt.= $objp->fprice;
|
||||
$opt.= $langs->trans("Currency".$conf->monnaie)."/".$objp->quantity.$langs->trans("Units");
|
||||
if ($objp->quantity > 1)
|
||||
{
|
||||
$opt.=" - ";
|
||||
$opt.= round($objp->fprice/$objp->quantity,4).$langs->trans("Currency".$conf->monnaie)."/".$langs->trans("Unit");
|
||||
}
|
||||
if ($objp->duration) $opt .= " - ".$objp->duration;
|
||||
}
|
||||
else
|
||||
{
|
||||
$opt.= $langs->trans("NoPriceDefinedForThisSupplier");
|
||||
}
|
||||
if ($objp->duration) $opt .= " - ".$objp->duration;
|
||||
$opt .= "</option>\n";
|
||||
|
||||
print $opt;
|
||||
|
||||
Reference in New Issue
Block a user