From 7331e43db8e12ac4ee3ae0f2602c39053a1eb696 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 19 Jun 2019 10:19:33 +0200 Subject: [PATCH 1/2] FIX : we need to fetch fourn invoice with ref in current entity --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 3a27690e7ac..d7ded8546f1 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -504,7 +504,7 @@ class FactureFournisseur extends CommonInvoice */ public function fetch($id='',$ref='') { - global $langs; + global $langs, $conf; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -555,7 +555,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid'; if ($id) $sql.= " WHERE t.rowid=".$id; - if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; + if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."' AND t.entity = ".$conf->entity; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); From 3ad13adf31d6925760587c685f79bd6e694e90fd Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 19 Jun 2019 10:43:42 +0200 Subject: [PATCH 2/2] FIX : better syntax --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index d7ded8546f1..4f9cd93021f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -504,7 +504,7 @@ class FactureFournisseur extends CommonInvoice */ public function fetch($id='',$ref='') { - global $langs, $conf; + global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -555,7 +555,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid'; if ($id) $sql.= " WHERE t.rowid=".$id; - if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."' AND t.entity = ".$conf->entity; + if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."' AND t.entity IN (".getEntity('supplier_invoice').")"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql);