diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9be91fd80e5..04f42cb4ea3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1339,6 +1339,16 @@ class Commande extends CommonOrder $this->lines = array(); if ($this->statut == 0) $this->brouillon = 1; + + // Retreive all extrafield for invoice + // fetch optionals attributes and labels + if(!class_exists('Extrafields')) + 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); + if (count($extralabels)>0) { + $this->fetch_optionals($this->id,$extralabels); + } $this->db->free();