diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9007490d421..6677a9f08de 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1677,10 +1677,11 @@ class Commande extends CommonOrder // Retrieve all extrafields for invoice // fetch optionals attributes and labels - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields=new ExtraFields($this->db); - $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); - $this->fetch_optionals($this->id,$extralabels); +// require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +// $extrafields=new ExtraFields($this->db); +// $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); +// $this->fetch_optionals($this->id,$extralabels); + $this->fetch_optionals(); $this->db->free($result); @@ -1882,6 +1883,9 @@ class Commande extends CommonOrder $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $line->fetch_optionals(); + + $this->lines[$i] = $line; $i++; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index bc7a14c0c45..9bf6d4b876c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1353,10 +1353,12 @@ class Facture extends CommonInvoice // Retrieve all extrafield for invoice // fetch optionals attributes and labels - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields=new ExtraFields($this->db); - $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); - $this->fetch_optionals($this->id,$extralabels); +// require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +// $extrafields=new ExtraFields($this->db); +// $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); +// $this->fetch_optionals($this->id,$extralabels); + $this->fetch_optionals(); + /* * Lines @@ -1477,7 +1479,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - // TODO Fetch optional like done in fetch line of facture_rec ? + $line->fetch_optionals(); $this->lines[$i] = $line; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 42a20caa213..22b9eba29cc 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -437,11 +437,12 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target } else { $companytouseforaddress = $targetcompany; - // Contact on a thirdparty that is a different thirdparty than the thirdparty of object - if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) - { - $targetcontact->fetch_thirdparty(); - $companytouseforaddress = $targetcontact->thirdparty; + // Contact on a thirdparty that is a different thirdparty than the thirdparty of object + if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) + { + $targetcontact->fetch_thirdparty(); + $companytouseforaddress = $targetcontact->thirdparty; + } $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress)); }