diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 52b7761adbe..bb9c9117f24 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -1487,7 +1487,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
else
{
print '
';
- print $form->select_company('','socid','s.client = 1',1);
+ print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print ' | ';
}
print ''."\n";
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 96fca70af4c..77294a3c459 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1916,7 +1916,7 @@ if ($action == 'create')
else
{
print '';
- print $form->select_company('','socid','s.client = 1',1);
+ print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print ' | ';
}
print ''."\n";
diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php
index 902dde79f17..de9ce68e6b3 100644
--- a/htdocs/contrat/fiche.php
+++ b/htdocs/contrat/fiche.php
@@ -827,7 +827,7 @@ if ($action == 'create')
else
{
print '';
- print $form->select_company('','socid','s.client = 1',1);
+ print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print ' | ';
}
print ''."\n";
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 941865da45a..4807ec768fa 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -678,7 +678,7 @@ class Form
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
if (! empty($user->societe_id)) $sql.= " AND s.rowid = ".$user->societe_id;
- if ($filter) $sql.= " AND ".$filter;
+ if ($filter) $sql.= " AND (".$filter.")";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " ORDER BY nom ASC";