NEW stock API GET movement (#36193)

* Added stock movement GET method

* Updated PHPDoc

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
William Mead 2025-11-09 20:16:28 +01:00 committed by GitHub
parent 9c73d4aa35
commit 6165c865bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,31 +61,33 @@ class StockMovements extends DolibarrApi
*
* Return an array with stock movement information
*
* @since 5.0.0 Initial implementation
* @since 23.0.0 Initial implementation
*
* @param int $id ID of movement
* @return Object Object with cleaned properties
* @param int $id ID of stock movement
* @return Object Stock movement object with cleaned properties
*
* @throws RestException
* @url GET {id}
*
* @throws RestException 400 Bad Request
* @throws RestException 403 Not allowed
* @throws RestException 404 Not found
* @throws RestException 500 Internal Server Error
*/
/*
public function get($id)
{
if (!DolibarrApiAccess::$user->hasRight('stock', 'lire')) {
if (!DolibarrApiAccess::$user->hasRight('stock', 'mouvement', 'lire')) {
throw new RestException(403);
}
if ($id == 0) {
throw new RestException(400, 'No stock movement with id 0 can exist');
}
$result = $this->stockmovement->fetch($id);
if (!$result ) {
throw new RestException(404, 'warehouse not found');
}
if (!DolibarrApi::_checkAccessToResource('warehouse',$this->stockmovement->id)) {
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
throw new RestException(404, 'stock movement not found');
}
return $this->_cleanObjectDatas($this->stockmovement);
}*/
}
/**
* Get a list of stock movements