mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
FIX: we should ensure Commande::$lines array contains OrderLine objects (#34727)
This commit is contained in:
committed by
ldestailleur
parent
659f758d61
commit
4fd04e7dc2
@@ -1068,10 +1068,15 @@ class Commande extends CommonOrder
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
$line = $this->lines[$i];
|
||||
|
||||
// Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array
|
||||
// Test and convert into OrderLine object this->lines[$i]. When coming from REST API, we may still have an array
|
||||
//if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object.
|
||||
if (!is_object($line)) {
|
||||
$line = (object) $line;
|
||||
$lineobj = new OrderLine($this->db);
|
||||
foreach ($line as $key => $val) {
|
||||
$lineobj->$key = $val;
|
||||
}
|
||||
$line = $lineobj;
|
||||
$this->lines[$i] = $line;
|
||||
}
|
||||
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
|
||||
Reference in New Issue
Block a user