Update api_shipments.class.php

This commit is contained in:
Laurent Destailleur 2021-08-03 15:07:16 +02:00 committed by GitHub
parent d1f9762ca9
commit 115b0e6831
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -530,14 +530,9 @@ class Shipments extends DolibarrApi
if ($result < 0) {
throw new RestException(500, 'Error when validating Shipment: '.$this->shipment->error);
}
// Reload shipment
$result = $this->shipment->fetch($id);
if (!$result) {
throw new RestException(404, 'Shipment not found');
}
if (!DolibarrApi::_checkAccessToResource('expedition', $this->shipment->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->shipment->fetchObjectLinked();
return $this->_cleanObjectDatas($this->shipment);
@ -659,14 +654,8 @@ class Shipments extends DolibarrApi
throw new RestException(500, 'Error when closing Order: '.$this->commande->error);
}
// Reload shipment
$result = $this->shipment->fetch($id);
if (!$result) {
throw new RestException(404, 'Shipment not found');
}
if (!DolibarrApi::_checkAccessToResource('expedition', $this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->shipment->fetchObjectLinked();