shipment not found into reception not found

This commit is contained in:
Quatadah Nasdami 2022-07-04 14:38:51 +02:00
parent 831ff35c4d
commit 17c9f0a25b

View File

@ -71,7 +71,7 @@ class Receptions extends DolibarrApi
$result = $this->reception->fetch($id); $result = $this->reception->fetch($id);
if (!$result) { if (!$result) {
throw new RestException(404, 'Shipment not found'); throw new RestException(404, 'Reception not found');
} }
if (!DolibarrApi::_checkAccessToResource('reception', $this->reception->id)) { if (!DolibarrApi::_checkAccessToResource('reception', $this->reception->id)) {
@ -236,7 +236,7 @@ class Receptions extends DolibarrApi
$result = $this->reception->fetch($id); $result = $this->reception->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Shipment not found'); throw new RestException(404, 'Reception not found');
} }
if( ! DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) { if( ! DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) {
@ -270,7 +270,7 @@ class Receptions extends DolibarrApi
$result = $this->reception->fetch($id); $result = $this->reception->fetch($id);
if ( ! $result ) { if ( ! $result ) {
throw new RestException(404, 'Shipment not found'); throw new RestException(404, 'Reception not found');
} }
if( ! DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) { if( ! DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) {
@ -338,7 +338,7 @@ class Receptions extends DolibarrApi
$result = $this->reception->fetch($id); $result = $this->reception->fetch($id);
if ( ! $result ) { if ( ! $result ) {
throw new RestException(404, 'Shipment not found'); throw new RestException(404, 'Reception not found');
} }
if( ! DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) { if( ! DolibarrApi::_checkAccessToResource('reception',$this->reception->id)) {
@ -405,7 +405,7 @@ class Receptions extends DolibarrApi
$result = $this->reception->fetch($id); $result = $this->reception->fetch($id);
if (!$result) { if (!$result) {
throw new RestException(404, 'Shipment not found'); throw new RestException(404, 'Reception not found');
} }
if (!DolibarrApi::_checkAccessToResource('reception', $this->reception->id)) { if (!DolibarrApi::_checkAccessToResource('reception', $this->reception->id)) {
@ -438,7 +438,7 @@ class Receptions extends DolibarrApi
$result = $this->reception->fetch($id); $result = $this->reception->fetch($id);
if (!$result) { if (!$result) {
throw new RestException(404, 'Shipment not found'); throw new RestException(404, 'Reception not found');
} }
if (!DolibarrApi::_checkAccessToResource('reception', $this->reception->id)) { if (!DolibarrApi::_checkAccessToResource('reception', $this->reception->id)) {
@ -461,7 +461,7 @@ class Receptions extends DolibarrApi
/** /**
* Delete reception * Delete reception
* *
* @param int $id Shipment ID * @param int $id Reception ID
* *
* @return array * @return array
*/ */
@ -472,7 +472,7 @@ class Receptions extends DolibarrApi
} }
$result = $this->reception->fetch($id); $result = $this->reception->fetch($id);
if (!$result) { if (!$result) {
throw new RestException(404, 'Shipment not found'); throw new RestException(404, 'Reception not found');
} }
if (!DolibarrApi::_checkAccessToResource('reception', $this->reception->id)) { if (!DolibarrApi::_checkAccessToResource('reception', $this->reception->id)) {
@ -486,7 +486,7 @@ class Receptions extends DolibarrApi
return array( return array(
'success' => array( 'success' => array(
'code' => 200, 'code' => 200,
'message' => 'Shipment deleted' 'message' => 'Reception deleted'
) )
); );
} }
@ -497,7 +497,7 @@ class Receptions extends DolibarrApi
* This may record stock movements if module stock is enabled and option to * This may record stock movements if module stock is enabled and option to
* decrease stock on reception is on. * decrease stock on reception is on.
* *
* @param int $id Shipment ID * @param int $id Reception ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* *
* @url POST {id}/validate * @url POST {id}/validate
@ -517,7 +517,7 @@ class Receptions extends DolibarrApi
} }
$result = $this->reception->fetch($id); $result = $this->reception->fetch($id);
if (!$result) { if (!$result) {
throw new RestException(404, 'Shipment not found'); throw new RestException(404, 'Reception not found');
} }
if (!DolibarrApi::_checkAccessToResource('reception', $this->reception->id)) { if (!DolibarrApi::_checkAccessToResource('reception', $this->reception->id)) {
@ -529,7 +529,7 @@ class Receptions extends DolibarrApi
throw new RestException(304, 'Error nothing done. May be object is already validated'); throw new RestException(304, 'Error nothing done. May be object is already validated');
} }
if ($result < 0) { if ($result < 0) {
throw new RestException(500, 'Error when validating Shipment: '.$this->reception->error); throw new RestException(500, 'Error when validating Reception: '.$this->reception->error);
} }
// Reload reception // Reload reception
@ -562,11 +562,11 @@ class Receptions extends DolibarrApi
throw new RestException(401); throw new RestException(401);
} }
if(empty($id)) { if(empty($id)) {
throw new RestException(400, 'Shipment ID is mandatory'); throw new RestException(400, 'Reception ID is mandatory');
} }
$result = $this->reception->fetch($id); $result = $this->reception->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Shipment not found'); throw new RestException(404, 'Reception not found');
} }
$result = $this->reception->classifyBilled(DolibarrApiAccess::$user); $result = $this->reception->classifyBilled(DolibarrApiAccess::$user);
@ -640,7 +640,7 @@ class Receptions extends DolibarrApi
$result = $this->reception->fetch($id); $result = $this->reception->fetch($id);
if (!$result) { if (!$result) {
throw new RestException(404, 'Shipment not found'); throw new RestException(404, 'Reception not found');
} }
if (!DolibarrApi::_checkAccessToResource('reception', $this->commande->id)) { if (!DolibarrApi::_checkAccessToResource('reception', $this->commande->id)) {