Skip to content
Snippets Groups Projects
Commit 132cdd9e authored by nka11's avatar nka11
Browse files

Fix coding style errors

parent 65e4273f
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@
use Luracast\Restler\RestException;
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
......@@ -276,6 +277,7 @@ class CategoryApi extends DolibarrApi
/**
* Get categories for a customer
*
* @param int $cusid Customer id filter
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
......@@ -285,9 +287,44 @@ class CategoryApi extends DolibarrApi
*
* @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);
}
/**
* 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
......
......@@ -98,6 +98,7 @@ class CommandeApi extends DolibarrApi
* Get a list of orders
*
* @param int $mode Use this param to filter list
* @param string $societe Societe filter field
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
......@@ -202,7 +203,7 @@ class CommandeApi extends DolibarrApi
*
* @url POST order/
*
* @return string ID of commande
* @return int ID of commande
*/
function post($request_data = NULL)
{
......
......@@ -147,6 +147,7 @@ class ThirdpartyApi extends DolibarrApi
* @param int $mode Set to 1 to show only customers
* Set to 2 to show only prospects
* 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 $sortorder Sort order
* @param int $limit Limit for list
......@@ -369,7 +370,7 @@ class ThirdpartyApi extends DolibarrApi
* Delete thirdparty
*
* @param int $id Thirparty ID
* @return integer
* @return type
*
* @url DELETE thirdparty/{id}
* @url DELETE customer/{id}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment