diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5efc1cf9db4..7663a05812f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1321,7 +1321,7 @@ class Propal extends CommonObject function fetch($rowid,$ref='') { - $sql = "SELECT p.rowid, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; + $sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; $sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; $sql.= ", p.datec"; $sql.= ", p.date_valid as datev"; @@ -1367,6 +1367,7 @@ class Propal extends CommonObject $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; + $this->entity = $obj->entity; $this->ref = $obj->ref; $this->ref_client = $obj->ref_client; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 65b704693fb..feac3d74106 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1572,7 +1572,7 @@ class Commande extends CommonOrder // Check parameters if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; - $sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut'; + $sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut'; $sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; $sql.= ', c.fk_account'; $sql.= ', c.date_commande'; @@ -1602,12 +1602,14 @@ class Commande extends CommonOrder dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); - if ($result) - { - $obj = $this->db->fetch_object($result); - if ($obj) - { - $this->id = $obj->rowid; + if ($result) + { + $obj = $this->db->fetch_object($result); + if ($obj) + { + $this->id = $obj->rowid; + $this->entity = $obj->entity; + $this->ref = $obj->ref; $this->ref_client = $obj->ref_client; $this->ref_customer = $obj->ref_client; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 589a184030e..a87ebf0c9a9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1239,7 +1239,7 @@ class Facture extends CommonInvoice if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; - $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount'; + $sql = 'SELECT f.rowid,f.entity,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount'; $sql.= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp'; $sql.= ', f.remise_percent, f.remise_absolue, f.remise'; $sql.= ', f.datef as df, f.date_pointoftax'; @@ -1276,6 +1276,8 @@ class Facture extends CommonInvoice $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; + $this->entity = $obj->entity; + $this->ref = $obj->facnumber; $this->ref_client = $obj->ref_client; $this->ref_ext = $obj->ref_ext; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 38d0e42d36a..a42546fdb84 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -218,7 +218,7 @@ class CommandeFournisseur extends CommonOrder // Check parameters if (empty($id) && empty($ref)) return -1; - $sql = "SELECT c.rowid, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_vat,"; + $sql = "SELECT c.rowid, c.entity, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_vat,"; $sql.= " c.localtax1, c.localtax2, "; $sql.= " c.date_creation, c.date_valid, c.date_approve, c.date_approve2,"; $sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,"; @@ -253,6 +253,8 @@ class CommandeFournisseur extends CommonOrder } $this->id = $obj->rowid; + $this->entity = $obj->entity; + $this->ref = $obj->ref; $this->ref_supplier = $obj->ref_supplier; $this->socid = $obj->fk_soc; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index e43404777b6..621a229121c 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1132,7 +1132,7 @@ class SupplierProposal extends CommonObject { global $conf; - $sql = "SELECT p.rowid, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; + $sql = "SELECT p.rowid, p.entity, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; $sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; $sql.= ", p.datec"; $sql.= ", p.date_valid as datev"; @@ -1166,6 +1166,7 @@ class SupplierProposal extends CommonObject $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; + $this->entity = $obj->entity; $this->ref = $obj->ref; $this->remise = $obj->remise;