Fix coding style errors
This commit is contained in:
parent
65e4273fdf
commit
132cdd9ed4
@ -18,6 +18,7 @@
|
|||||||
use Luracast\Restler\RestException;
|
use Luracast\Restler\RestException;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for category object
|
* API class for category object
|
||||||
@ -276,6 +277,7 @@ class CategoryApi extends DolibarrApi
|
|||||||
/**
|
/**
|
||||||
* Get categories for a customer
|
* Get categories for a customer
|
||||||
*
|
*
|
||||||
|
* @param int $cusid Customer id filter
|
||||||
* @param string $sortfield Sort field
|
* @param string $sortfield Sort field
|
||||||
* @param string $sortorder Sort order
|
* @param string $sortorder Sort order
|
||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
@ -285,9 +287,44 @@ class CategoryApi extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @url GET /customer/{cusid}/categories
|
* @url GET /customer/{cusid}/categories
|
||||||
*/
|
*/
|
||||||
function getListCustomerCategories($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $cusid) {
|
function getListCustomerCategories($cusid, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
||||||
return $this->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $cusid);
|
return $this->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $cusid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add category to customer
|
||||||
|
*
|
||||||
|
* @param int $cusid Id of customer
|
||||||
|
* @param int $catid Id of category
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @url GET /customer/{cusid}/addCategory/{catid}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function addCustomerCategory($cusid,$catid) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$customer = new Client($this->db);
|
||||||
|
$customer->fetch($cusid);
|
||||||
|
if( ! $customer ) {
|
||||||
|
throw new RestException(404, 'customer not found');
|
||||||
|
}
|
||||||
|
$result = $this->category->fetch($catid);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'category not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('societe',$customer->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('category',$this->category->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
$this->category->add_type($customer,'customer');
|
||||||
|
return $customer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get supplier categories list
|
* Get supplier categories list
|
||||||
|
|||||||
@ -98,6 +98,7 @@ class CommandeApi extends DolibarrApi
|
|||||||
* Get a list of orders
|
* Get a list of orders
|
||||||
*
|
*
|
||||||
* @param int $mode Use this param to filter list
|
* @param int $mode Use this param to filter list
|
||||||
|
* @param string $societe Societe filter field
|
||||||
* @param string $sortfield Sort field
|
* @param string $sortfield Sort field
|
||||||
* @param string $sortorder Sort order
|
* @param string $sortorder Sort order
|
||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
@ -202,7 +203,7 @@ class CommandeApi extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @url POST order/
|
* @url POST order/
|
||||||
*
|
*
|
||||||
* @return string ID of commande
|
* @return int ID of commande
|
||||||
*/
|
*/
|
||||||
function post($request_data = NULL)
|
function post($request_data = NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -147,6 +147,7 @@ class ThirdpartyApi extends DolibarrApi
|
|||||||
* @param int $mode Set to 1 to show only customers
|
* @param int $mode Set to 1 to show only customers
|
||||||
* Set to 2 to show only prospects
|
* Set to 2 to show only prospects
|
||||||
* Set to 3 to show only those are not customer neither prospect
|
* Set to 3 to show only those are not customer neither prospect
|
||||||
|
* @param Text $email Search by email filter
|
||||||
* @param string $sortfield Sort field
|
* @param string $sortfield Sort field
|
||||||
* @param string $sortorder Sort order
|
* @param string $sortorder Sort order
|
||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
@ -369,7 +370,7 @@ class ThirdpartyApi extends DolibarrApi
|
|||||||
* Delete thirdparty
|
* Delete thirdparty
|
||||||
*
|
*
|
||||||
* @param int $id Thirparty ID
|
* @param int $id Thirparty ID
|
||||||
* @return integer
|
* @return type
|
||||||
*
|
*
|
||||||
* @url DELETE thirdparty/{id}
|
* @url DELETE thirdparty/{id}
|
||||||
* @url DELETE customer/{id}
|
* @url DELETE customer/{id}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user