2
0
forked from Wavyzz/dolibarr

Clean code

This commit is contained in:
Laurent Destailleur
2020-12-24 02:33:11 +01:00
parent e9129154e4
commit 11a122176d
3 changed files with 11 additions and 12 deletions

View File

@@ -173,7 +173,7 @@ class DolibarrApi
unset($object->name_bis); unset($object->name_bis);
unset($object->newref); unset($object->newref);
if ($object->table_element != 'ticket') { if (!isset($object->table_element) || $object->table_element != 'ticket') {
unset($object->comments); unset($object->comments);
} }

View File

@@ -142,11 +142,11 @@ class Users extends DolibarrApi
* Get properties of an user object * Get properties of an user object
* *
* @param int $id ID of user * @param int $id ID of user
* @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose)
* @return array|mixed data without useless information * @return array|mixed data without useless information
* *
* @throws RestException 401 Insufficient rights * @throws RestException 401 Insufficient rights
* @throws RestException 404 User or group not found * @throws RestException 404 User or group not found
*/ */
public function get($id, $includepermissions = 0) public function get($id, $includepermissions = 0)
{ {
@@ -177,13 +177,13 @@ class Users extends DolibarrApi
* Get properties of an user object by login * Get properties of an user object by login
* *
* @param string $login Login of user * @param string $login Login of user
* @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose)
* @return array|mixed data without useless information * @return array|mixed Data without useless information
* *
* @url GET login/{login} * @url GET login/{login}
* *
* @throws RestException 401 Insufficient rights * @throws RestException 401 Insufficient rights
* @throws RestException 404 User or group not found * @throws RestException 404 User or group not found
*/ */
public function getByLogin($login, $includepermissions = 0) public function getByLogin($login, $includepermissions = 0)
{ {
@@ -211,8 +211,8 @@ class Users extends DolibarrApi
* Get properties of an user object by Email * Get properties of an user object by Email
* *
* @param string $email Email of user * @param string $email Email of user
* @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose)
* @return array|mixed data without useless information * @return array|mixed Data without useless information
* *
* @url GET email/{email} * @url GET email/{email}
* *

View File

@@ -190,7 +190,6 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
*/ */
public function testRestCreateUser() public function testRestCreateUser()
{ {
// attemp to create without mandatory fields : // attemp to create without mandatory fields :
$url = $this->api_url.'/users?api_key='.$this->api_key; $url = $this->api_url.'/users?api_key='.$this->api_key;
$addheaders=array('Content-Type: application/json'); $addheaders=array('Content-Type: application/json');