From f45062c3929737b1d984ba874d06c1f97aa19b1b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Feb 2006 22:04:32 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Gestion=20conditions=20r=E9glement=20et?= =?UTF-8?q?=20mode=20r=E9glement=20sur=20propal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/html.form.class.php | 136 ++++++++++++++++++++++++++----------- 1 file changed, 96 insertions(+), 40 deletions(-) diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 51b7b92ea4e..71d86818180 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -426,47 +426,61 @@ class Form /** - * \brief Retourne la liste déroulante des contacts d'une société donnée - * \param socid Id de la société - * \param selected Id contact pré-sélectionn - * \param htmlname Nom champ formulaire + * \brief Retourne la liste déroulante des contacts d'une société donnée + * \param socid Id de la société + * \param selected Id contact pré-sélectionn + * \param htmlname Nom champ formulaire ('none' pour champ non editable) + * \return int <0 si ko, >=0 si ok */ function select_contacts($socid,$selected='',$htmlname='contactid') { - // On recherche les societes - $sql = "SELECT s.idp, s.name, s.firstname FROM "; - $sql .= MAIN_DB_PREFIX ."socpeople as s"; - $sql .= " WHERE fk_soc=".$socid; - $sql .= " ORDER BY s.name ASC"; - - if ($this->db->query($sql)) - { - print ''; - } - else - { - dolibarr_print_error($this->db); - } + // On recherche les societes + $sql = "SELECT s.idp, s.name, s.firstname FROM "; + $sql .= MAIN_DB_PREFIX ."socpeople as s"; + $sql .= " WHERE fk_soc=".$socid; + $sql .= " ORDER BY s.name ASC"; + + $resql=$this->db->query($sql); + if ($resql) + { + $num=$this->db->num_rows(); + if ($num==0) return 0; + + if ($htmlname != 'none') print ''; + return 1; + } + else + { + dolibarr_print_error($this->db); + return -1; + } } @@ -591,7 +605,7 @@ class Form { $objp = $this->db->fetch_object($result); $opt = '