diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 5da3ad27183..38968ab9cd5 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -604,7 +604,7 @@ if (! empty($conf->banque->enabled)) $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " WHERE clos = 0"; $sql.= " AND courant = 1"; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity IN (".getEntity('bank_account', 1).")"; $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 7db4831c294..17796b6b35f 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -613,7 +613,7 @@ class Account extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON ba.fk_pays = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON ba.state_id = d.rowid'; - $sql.= " WHERE entity = ".$conf->entity; + $sql.= " WHERE entity IN (".getEntity($this->element, 1).")"; if ($id) $sql.= " AND ba.rowid = ".$id; if ($ref) $sql.= " AND ba.ref = '".$this->db->escape($ref)."'"; diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 51b7a4dc818..7d862ff59c4 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -59,7 +59,7 @@ $accounts = array(); $sql = "SELECT rowid, courant, rappro"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; -$sql.= " WHERE entity = ".$conf->entity; +$sql.= " WHERE entity IN (".getEntity('bank_account', 1).")"; if ($statut != 'all') $sql.= " AND clos = 0"; $sql.= $db->order('label', 'ASC'); diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 2fd7a970d92..bcfa32582d4 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -55,7 +55,7 @@ $sql = "SELECT count(b.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " WHERE ba.rowid = b.fk_account"; -$sql.= " AND ba.entity = ".$conf->entity; +$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")"; $sql.= " AND b.fk_type = 'CHQ'"; $sql.= " AND b.fk_bordereau = 0"; $sql.= " AND b.amount > 0"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c913a06be06..cf645055ab2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2326,7 +2326,7 @@ class Form $sql = "SELECT rowid, label, bank"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " WHERE clos = '".$statut."'"; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity IN (".getEntity('bank_account', 1).")"; if ($filtre) $sql.=" AND ".$filtre; $sql.= " ORDER BY label";