diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 277ee0c5ccd..8227bfbc0e7 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -516,7 +516,7 @@ class ExtraFields /** * Load array this->attribute_label * - * @param string $elementtype Type of element + * @param string $elementtype Type of element ('adherent', 'commande', societe', 'facture', 'propal', 'product', ...) * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED * @return array Array of attributes for all extra fields */ @@ -941,18 +941,18 @@ class ExtraFields } $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; //$sql.= ' AND entity = '.$conf->entity; - + dol_syslog(get_class($this).':showOutputField:$type=sellist sql='.$sql); $resql = $this->db->query($sql); if ($resql) { $value=''; // value was used, so now we reste it to use it to build final output - + $obj = $this->db->fetch_object($resql); // Several field into label (eq table:code|libelle:rowid) $fields_label = explode('|',$InfoFieldList[1]); - + if(is_array($fields_label)) { foreach ($fields_label as $field_toshow) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 1195722e29e..e3ca8814a70 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -140,6 +140,16 @@ class doc_generic_order_odt extends ModelePDFCommandes $resarray['object_total_vat_'.$line->tva_tx]+=$line->total_tva; } + // Retrieve extrafields + if(is_array($object->array_options) && count($object->array_options)) + { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label('commande',true); + $object->fetch_optionals($object->id,$extralabels); + + $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key='object',$outputlangs); + } return $resarray; }