Fix issue #9434 : no array_options available when calling api :

I replace the deprecated code by the fetch_optionnals() recommanded call.
This commit is contained in:
aplose 2018-10-03 15:15:46 +02:00
parent 6e7fd15e1e
commit 8ee7a48583
2 changed files with 15 additions and 9 deletions

View File

@ -1677,10 +1677,11 @@ class Commande extends CommonOrder
// Retrieve all extrafields for invoice // Retrieve all extrafields for invoice
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db); // $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); // $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels); // $this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
$this->db->free($result); $this->db->free($result);
@ -1882,6 +1883,9 @@ class Commande extends CommonOrder
$line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_tva = $objp->multicurrency_total_tva;
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$line->fetch_optionals();
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;

View File

@ -1353,10 +1353,12 @@ class Facture extends CommonInvoice
// Retrieve all extrafield for invoice // Retrieve all extrafield for invoice
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db); // $extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); // $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels); // $this->fetch_optionals($this->id,$extralabels);
$this->fetch_optionals();
/* /*
* Lines * Lines
@ -1477,7 +1479,7 @@ class Facture extends CommonInvoice
$line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_tva = $objp->multicurrency_total_tva;
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $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; $this->lines[$i] = $line;