#9236 Allow to import expedtion lines via API

This commit is contained in:
Sébastien Couragier 2018-08-13 11:59:55 +02:00
parent 6a8ed56c3d
commit e58c03d7b9

View File

@ -192,13 +192,13 @@ class Shipments extends DolibarrApi
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
$this->shipment->$field = $value; $this->shipment->$field = $value;
} }
/*if (isset($request_data["lines"])) { if (isset($request_data["lines"])) {
$lines = array(); $lines = array();
foreach ($request_data["lines"] as $line) { foreach ($request_data["lines"] as $line) {
array_push($lines, (object) $line); array_push($lines, (object) $line);
} }
$this->shipment->lines = $lines; $this->shipment->lines = $lines;
}*/ }
if ($this->shipment->create(DolibarrApiAccess::$user) < 0) { if ($this->shipment->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating shipment", array_merge(array($this->shipment->error), $this->shipment->errors)); throw new RestException(500, "Error creating shipment", array_merge(array($this->shipment->error), $this->shipment->errors));