mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-16 22:41:30 +01:00
Standardize code
This commit is contained in:
@@ -370,8 +370,10 @@ class Proposals extends DolibarrApi
|
|||||||
* @url DELETE {id}/lines/{lineid}
|
* @url DELETE {id}/lines/{lineid}
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
function delLine($id, $lineid) {
|
function deleteLine($id, $lineid) {
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
@@ -384,9 +386,10 @@ class Proposals extends DolibarrApi
|
|||||||
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
$updateRes = $this->propal->deleteline($lineid);
|
$updateRes = $this->propal->deleteline($lineid);
|
||||||
if ($updateRes == 1) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ class CommandeApi extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function delLine($id, $lineid) {
|
function deleteLine($id, $lineid) {
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,14 +353,16 @@ class Orders extends DolibarrApi
|
|||||||
* Delete a line to given order
|
* Delete a line to given order
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param int $id Id of commande to update
|
* @param int $id Id of order to update
|
||||||
* @param int $lineid Id of line to delete
|
* @param int $lineid Id of line to delete
|
||||||
*
|
*
|
||||||
* @url DELETE {id}/lines/{lineid}
|
* @url DELETE {id}/lines/{lineid}
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
function delLine($id, $lineid) {
|
function deleteLine($id, $lineid) {
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
@@ -373,6 +375,7 @@ class Orders extends DolibarrApi
|
|||||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
$updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
|
$updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
|
|||||||
@@ -312,13 +312,13 @@ class Invoices extends DolibarrApi
|
|||||||
* @param int $id Id of invoice
|
* @param int $id Id of invoice
|
||||||
* @param int $lineid Id of the line to delete
|
* @param int $lineid Id of the line to delete
|
||||||
*
|
*
|
||||||
* @url DELETE {id}/deleteline/{lineid}
|
* @url DELETE {id}/lines/{lineid}
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @throws 304
|
|
||||||
* @throws 400
|
* @throws 400
|
||||||
* @throws 401
|
* @throws 401
|
||||||
* @throws 404
|
* @throws 404
|
||||||
|
* @throws 405
|
||||||
*/
|
*/
|
||||||
function deleteLine($id, $lineid) {
|
function deleteLine($id, $lineid) {
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ class Invoices extends DolibarrApi
|
|||||||
|
|
||||||
$result = $this->invoice->deleteline($lineid);
|
$result = $this->invoice->deleteline($lineid);
|
||||||
if( $result < 0) {
|
if( $result < 0) {
|
||||||
throw new RestException(304);
|
throw new RestException(405, $this->invoice->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ class ExpenseReports extends DolibarrApi
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
function delLine($id, $lineid) {
|
function deleteLine($id, $lineid) {
|
||||||
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
|
if(! DolibarrApiAccess::$user->rights->expensereport->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user