Fix qodana

This commit is contained in:
Laurent Destailleur
2023-02-20 02:33:44 +01:00
parent 6ab68be4b3
commit 6da47ea49b
6 changed files with 26 additions and 27 deletions

View File

@@ -60,7 +60,6 @@ class Receptions extends DolibarrApi
*
* @param int $id ID of reception
* @return Object Object with cleaned properties
*
* @throws RestException
*/
public function get($id)
@@ -386,14 +385,12 @@ class Receptions extends DolibarrApi
/**
* Delete a line to given reception
*
*
* @param int $id Id of reception to update
* @param int $lineid Id of line to delete
* @return array
*
* @url DELETE {id}/lines/{lineid}
*
* @return int
*
* @throws RestException 401
* @throws RestException 404
*/
@@ -412,23 +409,27 @@ class Receptions extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
// TODO Check the lineid $lineid is a line of ojbect
// TODO Check the lineid $lineid is a line of object
$updateRes = $this->reception->deleteline(DolibarrApiAccess::$user, $lineid);
if ($updateRes > 0) {
return $this->get($id);
} else {
if ($updateRes < 0) {
throw new RestException(405, $this->reception->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Line deleted'
)
);
}
/**
* Update reception general fields (won't touch lines of reception)
*
* @param int $id Id of reception to update
* @param array $request_data Datas
*
* @return int
* @param int $id Id of reception to update
* @param array $request_data Datas
* @return Object Object with cleaned properties
*/
public function put($id, $request_data = null)
{
@@ -462,7 +463,6 @@ class Receptions extends DolibarrApi
* Delete reception
*
* @param int $id Reception ID
*
* @return array
*/
public function delete($id)