Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
5382bf1dd4
@ -173,7 +173,7 @@ class DolibarrApi
|
||||
unset($object->name_bis);
|
||||
unset($object->newref);
|
||||
|
||||
if ($object->table_element != 'ticket') {
|
||||
if (!isset($object->table_element) || $object->table_element != 'ticket') {
|
||||
unset($object->comments);
|
||||
}
|
||||
|
||||
|
||||
@ -48,8 +48,8 @@ class Login
|
||||
* @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
|
||||
* @return array Response status and user token
|
||||
*
|
||||
* @throws RestException 403
|
||||
* @throws RestException 500
|
||||
* @throws RestException 403 Access denied
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
* @url GET /
|
||||
* @url POST /
|
||||
|
||||
@ -466,14 +466,18 @@ if ($result)
|
||||
|
||||
// Project
|
||||
if ($arrayfields['project']['checked']) {
|
||||
$proj->fetch($obj->fk_project);
|
||||
print '<td class="nowraponall">'.$proj->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">';
|
||||
if ($obj->fk_project > 0) {
|
||||
$proj->fetch($obj->fk_project);
|
||||
print $proj->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Bank account
|
||||
if ($arrayfields['bank']['checked']) {
|
||||
print '<td>';
|
||||
print '<td class="nowraponall">';
|
||||
if ($obj->bid > 0)
|
||||
{
|
||||
$accountstatic->id = $obj->bid;
|
||||
|
||||
@ -614,14 +614,14 @@ while ($i < min($num, $limit))
|
||||
$socstatic->logo = $obj->logo;
|
||||
$socstatic->country_id = $obj->country_id;
|
||||
$socstatic->country_code = '';
|
||||
$socstatic->country_label = '';*/
|
||||
$socstatic->country = '';*/
|
||||
if ($obj->country_id > 0) {
|
||||
if (!isset($cacheCountryIDCode[$obj->country_id]['code'])) {
|
||||
$tmparray = getCountry($obj->country_id, 'all');
|
||||
$cacheCountryIDCode[$obj->country_id] = array('code'=> empty($tmparray['code']) ? '' : $tmparray['code'], 'label' => empty($tmparray['label']) ? '' : $tmparray['label']);
|
||||
}
|
||||
$socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code'];
|
||||
$socstatic->country_label = $cacheCountryIDCode[$obj->country_id]['label'];
|
||||
$socstatic->country = $cacheCountryIDCode[$obj->country_id]['label'];
|
||||
}
|
||||
|
||||
|
||||
@ -695,7 +695,7 @@ while ($i < min($num, $limit))
|
||||
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print $socstatic->country_label;
|
||||
print $socstatic->country;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -61,9 +61,9 @@ class box_funnel_of_prospection extends ModeleBoxes
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->enabled = ($conf->global->MAIN_FEATURES_LEVEL >= 1); // Not enabled by default, still need some work
|
||||
$this->enabled = ($conf->global->MAIN_FEATURES_LEVEL >= 1 ? 1 : 0); // Not enabled by default, still need some work
|
||||
|
||||
$this->hidden = !($user->rights->projet->lire);
|
||||
$this->hidden = empty($user->rights->projet->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -56,7 +56,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
|
||||
/**
|
||||
* @var boolean Condition to have widget visible (in most cases, permissions)
|
||||
*/
|
||||
public $hidden = 0;
|
||||
public $hidden = false;
|
||||
|
||||
/**
|
||||
* @var int Box definition database ID
|
||||
|
||||
@ -112,6 +112,7 @@ class Notify
|
||||
|
||||
$listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0);
|
||||
|
||||
$texte = '';
|
||||
$nb = -1;
|
||||
if (is_array($listofnotiftodo)) {
|
||||
$nb = count($listofnotiftodo);
|
||||
@ -170,6 +171,8 @@ class Notify
|
||||
if (is_object($object)) {
|
||||
$valueforthreshold = $object->total_ht;
|
||||
}
|
||||
|
||||
$sqlnotifcode = '';
|
||||
if ($notifcode) {
|
||||
if (is_numeric($notifcode)) {
|
||||
$sqlnotifcode = " AND n.fk_action = ".$notifcode; // Old usage
|
||||
|
||||
@ -168,7 +168,7 @@ class Utils
|
||||
$this->output = $langs->trans("PurgeNDirectoriesDeleted", $countdeleted);
|
||||
if ($count > $countdeleted) $this->output .= '<br>'.$langs->trans("PurgeNDirectoriesFailed", ($count - $countdeleted));
|
||||
} else {
|
||||
$this->output = $langs->trans("PurgeNothingToDelete").($choice == 'tempfilesold' ? ' (older than 24h)' : '');
|
||||
$this->output = $langs->trans("PurgeNothingToDelete").(in_array('tempfilesold', $choicesarray) ? ' (older than 24h for temp files)' : '');
|
||||
}
|
||||
|
||||
// Recreate temp dir that are not automatically recreated by core code for performance purpose, we need them
|
||||
|
||||
@ -4461,7 +4461,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
|
||||
|
||||
$savlimit = $limit;
|
||||
$savtotalnboflines = $totalnboflines;
|
||||
$totalnboflines = abs($totalnboflines);
|
||||
$totalnboflines = abs((int) $totalnboflines);
|
||||
|
||||
if ($picto == 'setup') $picto = 'title_setup.png';
|
||||
if (($conf->browser->name == 'ie') && $picto == 'generic') $picto = 'title.gif';
|
||||
|
||||
@ -142,11 +142,11 @@ class Users extends DolibarrApi
|
||||
* Get properties of an user object
|
||||
*
|
||||
* @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)
|
||||
* @return array|mixed data without useless information
|
||||
* @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
|
||||
*
|
||||
* @throws RestException 401 Insufficient rights
|
||||
* @throws RestException 404 User or group not found
|
||||
* @throws RestException 401 Insufficient rights
|
||||
* @throws RestException 404 User or group not found
|
||||
*/
|
||||
public function get($id, $includepermissions = 0)
|
||||
{
|
||||
@ -177,13 +177,13 @@ class Users extends DolibarrApi
|
||||
* Get properties of an user object by login
|
||||
*
|
||||
* @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)
|
||||
* @return array|mixed data without useless information
|
||||
* @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
|
||||
*
|
||||
* @url GET login/{login}
|
||||
*
|
||||
* @throws RestException 401 Insufficient rights
|
||||
* @throws RestException 404 User or group not found
|
||||
* @throws RestException 401 Insufficient rights
|
||||
* @throws RestException 404 User or group not found
|
||||
*/
|
||||
public function getByLogin($login, $includepermissions = 0)
|
||||
{
|
||||
@ -211,8 +211,8 @@ class Users extends DolibarrApi
|
||||
* Get properties of an user object by Email
|
||||
*
|
||||
* @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)
|
||||
* @return array|mixed data without useless information
|
||||
* @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
|
||||
*
|
||||
* @url GET email/{email}
|
||||
*
|
||||
@ -314,11 +314,13 @@ class Users extends DolibarrApi
|
||||
/**
|
||||
* Update account
|
||||
*
|
||||
* @param int $id Id of account to update
|
||||
* @param array $request_data Datas
|
||||
* @return array
|
||||
* @param int $id Id of account to update
|
||||
* @param array $request_data Datas
|
||||
* @return array|mixed Record after update
|
||||
*
|
||||
* @throws RestException
|
||||
* @throws RestException 401 Not allowed
|
||||
* @throws RestException 404 Not found
|
||||
* @throws RestException 500 System error
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
|
||||
@ -122,7 +122,7 @@ $extrafield_array = null;
|
||||
if (is_array($extrafields) && count($extrafields) > 0) {
|
||||
$extrafield_array = array();
|
||||
}
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -315,7 +315,7 @@ function getActionComm($authentication, $id)
|
||||
//Get extrafield values
|
||||
$actioncomm->fetch_optionals();
|
||||
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -454,7 +454,7 @@ function createActionComm($authentication, $actioncomm)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -551,7 +551,7 @@ function updateActionComm($authentication, $actioncomm)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
|
||||
@ -127,7 +127,7 @@ $extrafield_array = null;
|
||||
if (is_array($extrafields) && count($extrafields) > 0) {
|
||||
$extrafield_array = array();
|
||||
}
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -319,7 +319,7 @@ function getContact($authentication, $id, $ref_ext)
|
||||
//Get extrafield values
|
||||
$contact->fetch_optionals();
|
||||
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -424,7 +424,7 @@ function createContact($authentication, $contact)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -671,7 +671,7 @@ function updateContact($authentication, $contact)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
|
||||
@ -120,7 +120,7 @@ $extrafield_line_array = null;
|
||||
if (is_array($extrafields) && count($extrafields) > 0) {
|
||||
$extrafield_line_array = array();
|
||||
}
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -224,7 +224,7 @@ $extrafield_array = null;
|
||||
if (is_array($extrafields) && count($extrafields) > 0) {
|
||||
$extrafield_array = array();
|
||||
}
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -705,7 +705,7 @@ function createOrder($authentication, $order)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -743,7 +743,7 @@ function createOrder($authentication, $order)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -948,7 +948,7 @@ function updateOrder($authentication, $order)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
|
||||
@ -142,7 +142,7 @@ $extrafield_array = null;
|
||||
if (is_array($extrafields) && count($extrafields) > 0) {
|
||||
$extrafield_array = array();
|
||||
}
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -436,7 +436,7 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = ''
|
||||
//Get extrafield values
|
||||
$product->fetch_optionals();
|
||||
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -563,7 +563,7 @@ function createProductOrService($authentication, $product)
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -719,7 +719,7 @@ function updateProductOrService($authentication, $product)
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -1090,7 +1090,7 @@ function getProductsForCategory($authentication, $id, $lang = '')
|
||||
//Get extrafield values
|
||||
$tmpproduct->fetch_optionals();
|
||||
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
|
||||
@ -169,7 +169,7 @@ $extrafield_array = null;
|
||||
if (is_array($extrafields) && count($extrafields) > 0) {
|
||||
$extrafield_array = array();
|
||||
}
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -277,7 +277,7 @@ function createProject($authentication, $project)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -386,7 +386,7 @@ function getProject($authentication, $id = '', $ref = '')
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
|
||||
//Get extrafield values
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
$project->fetch_optionals();
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
|
||||
@ -130,7 +130,7 @@ $extrafield_array = null;
|
||||
if (is_array($extrafields) && count($extrafields) > 0) {
|
||||
$extrafield_array = array();
|
||||
}
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -365,7 +365,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
|
||||
//Get extrafield values
|
||||
$thirdparty->fetch_optionals();
|
||||
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -481,7 +481,7 @@ function createThirdParty($authentication, $thirdparty)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -615,7 +615,7 @@ function updateThirdParty($authentication, $thirdparty)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -723,7 +723,7 @@ function getListOfThirdParties($authentication, $filterthirdparty)
|
||||
$extrafieldsOptions = array();
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
|
||||
@ -193,7 +193,7 @@ $extrafield_array = null;
|
||||
if (is_array($extrafields) && count($extrafields) > 0) {
|
||||
$extrafield_array = array();
|
||||
}
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
@ -599,7 +599,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label($elementtype, true);
|
||||
if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label)
|
||||
{
|
||||
|
||||
@ -164,22 +164,22 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
|
||||
|
||||
print __METHOD__." Request GET url=".$url."\n";
|
||||
$result=getURLContent($url, 'GET', '', 1, array(), array('http', 'https'), 2);
|
||||
//print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n";
|
||||
//print __METHOD__." result for get on unexisting user: ".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(404, $object['error']['code']);
|
||||
$this->assertNotNull($object, "Parsing of json result must not be null");
|
||||
$this->assertEquals(404, $object['error']['code'], 'Error code is not 404');
|
||||
|
||||
$url = $this->api_url.'/users/1?api_key='.$this->api_key;
|
||||
|
||||
print __METHOD__." Request GET url=".$url."\n";
|
||||
$result=getURLContent($url, 'GET', '', 1, array(), array('http', 'https'), 2);
|
||||
//print __METHOD__." Result for existing user user: ".var_export($result, true)."\n";
|
||||
print __METHOD__." result for get on an existing user: ".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertNotNull($object, "Parsing of json result must not be null");
|
||||
$this->assertEquals(1, $object['statut']);
|
||||
}
|
||||
|
||||
@ -190,7 +190,6 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testRestCreateUser()
|
||||
{
|
||||
|
||||
// attemp to create without mandatory fields :
|
||||
$url = $this->api_url.'/users?api_key='.$this->api_key;
|
||||
$addheaders=array('Content-Type: application/json');
|
||||
@ -222,7 +221,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
|
||||
$body = json_encode($bodyobj);
|
||||
print __METHOD__." Request POST url=".$url."\n";
|
||||
$result=getURLContent($url, 'POST', $body, 1, $addheaders, array('http', 'https'), 2);
|
||||
print __METHOD__." Result code for creating user ".var_export($result, true)."\n";
|
||||
print __METHOD__." rclsesult code for creating user ".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$resid=json_decode($result['content'], true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user