Qual: Factorisation par une fonction des pages affichant la liste des produits/services
This commit is contained in:
parent
658c51b0bd
commit
6d87928e7c
@ -302,43 +302,47 @@ class Form
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne la liste déroulante des sociétés
|
* \brief Retourne la liste déroulante des sociétés
|
||||||
* \param
|
* \param selected societe présélectionnée
|
||||||
|
* \param htmlname nom champ formulaire
|
||||||
|
* \param filter criteres optionnels de filtre
|
||||||
*/
|
*/
|
||||||
function select_societes($selected='',$htmlname='soc_id')
|
function select_societes($selected='',$htmlname='soc_id',$filter)
|
||||||
{
|
{
|
||||||
// On recherche les societes
|
// On recherche les societes
|
||||||
$sql = "SELECT s.idp, s.nom FROM ";
|
$sql = "SELECT s.idp, s.nom FROM";
|
||||||
$sql .= MAIN_DB_PREFIX ."societe as s ";
|
$sql.= " ".MAIN_DB_PREFIX ."societe as s";
|
||||||
$sql .= "ORDER BY nom ASC";
|
if ($filter) $sql.= " WHERE $filter";
|
||||||
|
$sql.= " ORDER BY nom ASC";
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
$resql=$this->db->query($sql);
|
||||||
print '<select class="flat" name="'.$htmlname.'">';
|
if ($resql)
|
||||||
$num = $this->db->num_rows();
|
{
|
||||||
$i = 0;
|
print '<select class="flat" name="'.$htmlname.'">';
|
||||||
if ($num)
|
$num = $this->db->num_rows($resql);
|
||||||
{
|
$i = 0;
|
||||||
while ($i < $num)
|
if ($num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object();
|
while ($i < $num)
|
||||||
if ($selected > 0 && $selected == $obj->idp)
|
{
|
||||||
{
|
$obj = $this->db->fetch_object($resql);
|
||||||
print '<option value="'.$obj->idp.'" selected>'.$obj->nom.'</option>';
|
if ($selected > 0 && $selected == $obj->idp)
|
||||||
}
|
{
|
||||||
else
|
print '<option value="'.$obj->idp.'" selected>'.$obj->nom.'</option>';
|
||||||
{
|
}
|
||||||
print '<option value="'.$obj->idp.'">'.$obj->nom.'</option>';
|
else
|
||||||
}
|
{
|
||||||
$i++;
|
print '<option value="'.$obj->idp.'">'.$obj->nom.'</option>';
|
||||||
}
|
}
|
||||||
}
|
$i++;
|
||||||
print '</select>';
|
}
|
||||||
}
|
}
|
||||||
else {
|
print '</select>';
|
||||||
dolibarr_print_error($this->db);
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -410,7 +414,7 @@ class Form
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
$opt = "<option value=\"$objp->rowid\">[$objp->ref] $objp->label : $objp->price ".MAIN_MONNAIE;
|
$opt = "<option value=\"$objp->rowid\">[$objp->ref] $objp->label - $objp->price ".MAIN_MONNAIE;
|
||||||
if ($objp->duration) $opt .= " - ".$objp->duration;
|
if ($objp->duration) $opt .= " - ".$objp->duration;
|
||||||
$opt .= "</option>\n";
|
$opt .= "</option>\n";
|
||||||
print $opt;
|
print $opt;
|
||||||
@ -673,14 +677,14 @@ class Form
|
|||||||
print '<form method="post" action="'.$page.'">';
|
print '<form method="post" action="'.$page.'">';
|
||||||
print '<input type="hidden" name="action" value="'.$action.'">';
|
print '<input type="hidden" name="action" value="'.$action.'">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr><td colspan="3">'.$title.'</td></tr>';
|
// Ligne titre
|
||||||
|
print '<tr><td class="validtitle" colspan="3">'.$title.'</td></tr>';
|
||||||
|
// Ligne message
|
||||||
print '<tr><td class="valid">'.$question.'</td><td class="valid">';
|
print '<tr><td class="valid">'.$question.'</td><td class="valid">';
|
||||||
|
|
||||||
$this->selectyesno("confirm","no");
|
$this->selectyesno("confirm","no");
|
||||||
|
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Confirm").'"</td></tr>';
|
print '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Confirm").'"</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user