';
// On récupère les id des contacts déjà sélectionnés
//$contactAlreadySelected = $propal->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
- $html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
+ $nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
+ if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '
';
// On récupère les id des contacts déjà sélectionnés
// $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
- $html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
+ $nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
+ if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '
';
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index 279a1f3e67c..d11475fa55d 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
- * $Source$
*/
/**
@@ -254,12 +253,15 @@ if ($id > 0)
print '
';
// On récupère les id des contacts déjà sélectionnés
//$contactAlreadySelected = $facture->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
- $html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
+ $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
+ if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '
';
// On récupère les id des contacts déjà sélectionnés
//$contactAlreadySelected = $contrat->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
- $html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
+ $nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
+ if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '
';
print '';
print "";
diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php
index 90a4c82e20d..232d8abdb1d 100644
--- a/htdocs/fichinter/contact.php
+++ b/htdocs/fichinter/contact.php
@@ -1,5 +1,6 @@
+/* Copyright (C) 2005-2007 Regis Houssin
+ * Copyright (C) 2007 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -259,12 +260,15 @@ if ($id > 0)
print '
';
// On récupère les id des contacts déjà sélectionnés
//$contactAlreadySelected = $fichinter->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type
- $html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
+ $nbofcontacts=$html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid',0,$contactAlreadySelected);
+ if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '
';
print '';
print "";
diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php
index 5f4c526678c..9abe36c70bb 100644
--- a/htdocs/fourn/contact.php
+++ b/htdocs/fourn/contact.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2005 Laurent Destailleur
+ * Copyright (C) 2004-2007 Laurent Destailleur
* Copyright (C) 2005-2006 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -18,8 +18,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
- * $Source$
- *
*/
/**
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index eed674266a0..a5b1eb80588 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -792,65 +792,65 @@ class Form
* \param htmlname Nom champ formulaire ('none' pour champ non editable)
* \param show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* \param exclude Liste des id contacts à exclure
- * \return int <0 si ko, >=0 si ok
+ * \return int <0 if KO, Nb of contact in list if OK
*/
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='')
- {
- // Permettre l'exclusion de contacts
- if (is_array($exclude))
- {
- $excludeContacts = implode("','",$exclude);
- }
-
- // On recherche les societes
- $sql = "SELECT s.rowid, s.name, s.firstname FROM";
- $sql.= " ".MAIN_DB_PREFIX ."socpeople as s";
- $sql.= " WHERE fk_soc=".$socid;
- if (is_array($exclude) && $excludeContacts) $sql.= " AND s.rowid NOT IN ('".$excludeContacts."')";
- $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 $num;
+ }
+ else
+ {
+ dolibarr_print_error($this->db);
+ return -1;
+ }
+ }
/**
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 97e56401145..72de4006594 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -125,6 +125,7 @@ Supplier=Supplier
CompanyList=Companies' list
AddContact=Add contact
Contact=Contact
+NoContactDefined=No contact defined for this third party
DefaultContact=Default contact
AddCompany=Add company
AddThirdParty=Add third party
diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang
index 2c5948ef86c..9b659c60e9a 100644
--- a/htdocs/langs/fr_FR/companies.lang
+++ b/htdocs/langs/fr_FR/companies.lang
@@ -125,6 +125,7 @@ Supplier=Fournisseur
CompanyList=Liste des sociétés
AddContact=Créer contact
Contact=Contact
+NoContactDefined=Aucun contact défini pour ce tiers
DefaultContact=Contact par défaut
AddCompany=Créer société
AddThirdParty=Créer tiers