Fix: Substition of extra field was ko for order.

This commit is contained in:
Laurent Destailleur 2014-02-08 01:01:31 +01:00
parent fb789b8197
commit b714347b6b
2 changed files with 14 additions and 4 deletions

View File

@ -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)

View File

@ -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;
}