diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index fdc3ddb1a05..1120b78d038 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1287,7 +1287,7 @@ class Form * @param int $socid Id ot third party or 0 for all * @param string $selected Id contact pre-selectionne * @param string $htmlname Name of HTML field ('none' for a not editable field) - * @param int $showempty 0=no empty value, 1=add an empty value + * @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list * @param integer $showfunction Add function into label @@ -1311,10 +1311,10 @@ class Form * Return HTML code of the SELECT of list of all contacts (for a third party or all). * This also set the number of contacts found into $this->num * - * @param int $socid Id ot third party or 0 for all + * @param int $socid Id ot third party or 0 for all or -1 for empty list * @param array|int $selected Array of ID of pre-selected contact id * @param string $htmlname Name of HTML field ('none' for a not editable field) - * @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit) + * @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list * @param integer $showfunction Add function into label @@ -1342,7 +1342,7 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX ."socpeople as sp"; if ($showsoc > 0) $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX ."societe as s ON s.rowid=sp.fk_soc"; $sql.= " WHERE sp.entity IN (".getEntity('socpeople').")"; - if ($socid > 0) $sql.= " AND sp.fk_soc=".$socid; + if ($socid > 0 || $socid == -1) $sql.= " AND sp.fk_soc=".$socid; if (! empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND sp.statut <> 0"; $sql.= " ORDER BY sp.lastname ASC"; @@ -1359,7 +1359,7 @@ class Form } if ($htmlname != 'none' || $options_only) $out.= '