Merge pull request #12912 from laudeco/hotfix/stock_movement_date_as_integer
FIX - API - DLC/DLUO date for stock movement
This commit is contained in:
commit
8a55b4d82e
@ -186,10 +186,15 @@ class StockMovements extends DolibarrApi
|
||||
}
|
||||
|
||||
// Type increase or decrease
|
||||
if ($qty >= 0) $type = 3;
|
||||
else $type = 2;
|
||||
$type = 2;
|
||||
if ($qty >= 0){
|
||||
$type = 3;
|
||||
}
|
||||
|
||||
if($this->stockmovement->_create(DolibarrApiAccess::$user, $product_id, $warehouse_id, $qty, $type, $price, $movementlabel, $movementcode, '', $dlc, $dluo, $lot) <= 0) {
|
||||
$eatBy = empty($dluo) ? '' : (new DateTime($dluo))->getTimestamp();
|
||||
$sellBy = empty($dlc) ? '' : (new DateTime($dlc))->getTimestamp();;
|
||||
|
||||
if($this->stockmovement->_create(DolibarrApiAccess::$user, $product_id, $warehouse_id, $qty, $type, $price, $movementlabel, $movementcode, '', $eatBy, $sellBy, $lot) <= 0) {
|
||||
throw new RestException(503, 'Error when create stock movement : '.$this->stockmovement->error);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user