From 04617d0eb31852cf3f04408d46ad84fce19d4c15 Mon Sep 17 00:00:00 2001 From: jfefe Date: Wed, 6 Mar 2013 05:33:00 +0100 Subject: [PATCH] Show extrafields for object into invoice ODT document --- .../doc/doc_generic_invoice_odt.modules.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index dc00f4370fa..2370f102625 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -140,6 +140,28 @@ class doc_generic_invoice_odt extends ModelePDFFactures $resarray['object_total_vat_'.$line->tva_tx]+=$line->total_tva; } + // Retrieve extrafields + if(is_array($object->array_options) && count($object->array_options)) + { + 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('facture',true); + $object->fetch_optionals($object->id,$extralabels); + + foreach($extrafields->attribute_label as $key=>$label) + { + if($extrafields->attribute_type[$key] == 'price') + { + $object->array_options['options_'.$key] = price($object->array_options['options_'.$key]).' '.$outputlangs->getCurrencySymbol($conf->currency); + } + else if($extrafields->attribute_type[$key] == 'select') + { + $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; + } + $resarray=array_merge($resarray,array('object_options_'.$key => $object->array_options['options_'.$key])); + } + } return $resarray; }