22use Luracast\Restler\RestException;
24require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
25require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
26require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
42 public static $FIELDS = array(
59 $this->useraccount =
new User($this->db);
84 public function index($sortfield =
"t.rowid", $sortorder =
'ASC', $limit = 100, $page = 0, $user_ids =
'0', $category = 0, $sqlfilters =
'', $properties =
'')
86 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'lire') && empty(DolibarrApiAccess::$user->admin)) {
87 throw new RestException(403,
"You are not allowed to read list of users");
95 $sql =
"SELECT t.rowid";
96 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user AS t LEFT JOIN ".MAIN_DB_PREFIX.
"user_extrafields AS ef ON (ef.fk_object = t.rowid)";
98 $sql .=
", ".$this->db->prefix().
"categorie_user as c";
100 $sql .=
' WHERE t.entity IN ('.getEntity(
'user').
')';
102 $sql .=
" AND t.rowid IN (".$this->db->sanitize($user_ids).
")";
107 $sql .=
" AND c.fk_categorie = ".((int) $category);
108 $sql .=
" AND c.fk_user = t.rowid";
116 throw new RestException(400,
'Error when validating parameter sqlfilters -> '.$errormessage);
120 $sql .= $this->db->order($sortfield, $sortorder);
125 $offset = $limit * $page;
127 $sql .= $this->db->plimit($limit + 1, $offset);
130 $result = $this->db->query($sql);
134 $num = $this->db->num_rows($result);
135 $min = min($num, ($limit <= 0 ? $num : $limit));
137 $obj = $this->db->fetch_object($result);
138 $user_static =
new User($this->db);
139 if ($user_static->fetch($obj->rowid)) {
145 throw new RestException(503,
'Error when retrieve User list : '.$this->db->lasterror());
165 public function get(
$id, $includepermissions = 0)
167 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'lire') && empty(DolibarrApiAccess::$user->admin) &&
$id != 0 && DolibarrApiAccess::$user->id !=
$id) {
168 throw new RestException(403,
'Not allowed');
172 $result = $this->useraccount->initAsSpecimen();
174 $result = $this->useraccount->fetch(
$id);
177 throw new RestException(404,
'User not found');
181 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
184 if ($includepermissions) {
185 $this->useraccount->loadRights();
211 throw new RestException(400,
'Bad parameters');
214 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'lire') && empty(DolibarrApiAccess::$user->admin) && DolibarrApiAccess::$user->login != $login) {
215 throw new RestException(403,
'Not allowed');
218 $result = $this->useraccount->fetch(0, $login);
220 throw new RestException(404,
'User not found');
224 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
227 if ($includepermissions) {
228 $this->useraccount->loadRights();
254 throw new RestException(400,
'Bad parameters');
257 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'lire') && empty(DolibarrApiAccess::$user->admin) && DolibarrApiAccess::$user->
email != $email) {
258 throw new RestException(403,
'Not allowed');
261 $result = $this->useraccount->fetch(0,
'',
'', 0, -1, $email);
263 throw new RestException(404,
'User not found');
267 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
270 if ($includepermissions) {
271 $this->useraccount->loadRights();
290 public function getInfo($includepermissions = 0)
292 if (!DolibarrApiAccess::$user->hasRight(
'user',
'self',
'creer') && !DolibarrApiAccess::$user->hasRight(
'user',
'user',
'lire') && empty(DolibarrApiAccess::$user->admin)) {
293 throw new RestException(403,
'Not allowed');
296 $apiUser = DolibarrApiAccess::$user;
298 $result = $this->useraccount->fetch($apiUser->id);
300 throw new RestException(404,
'User not found');
304 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
307 if ($includepermissions) {
308 $this->useraccount->loadRights();
312 $userGroupList = $usergroup->listGroupsForUser($apiUser->id,
false);
313 if (!is_array($userGroupList)) {
314 throw new RestException(404,
'User group not found');
334 public function post($request_data =
null)
337 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer') && empty(DolibarrApiAccess::$user->admin)) {
338 throw new RestException(403,
"User creation not allowed for login ".DolibarrApiAccess::$user->login);
350 foreach ($request_data as $field => $value) {
351 if (in_array($field, array(
'pass_crypted',
'pass_indatabase',
'pass_indatabase_crypted',
'pass_temp',
'api_key'))) {
353 throw new RestException(405,
'The property '.$field.
" can't be set/modified using the APIs");
355 if ($field ===
'caller') {
357 $this->useraccount->context[
'caller'] =
sanitizeVal($request_data[
'caller'],
'aZ09');
368 $this->useraccount->$field = $this->
_checkValForAPI($field, $value, $this->useraccount);
371 if ($this->useraccount->create(DolibarrApiAccess::$user) < 0) {
372 throw new RestException(500,
'Error creating', array_merge(array($this->useraccount->error), $this->useraccount->errors));
374 return $this->useraccount->id;
393 public function put(
$id, $request_data =
null)
396 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer') && empty(DolibarrApiAccess::$user->admin)) {
397 throw new RestException(403,
"User update not allowed");
400 $result = $this->useraccount->fetch(
$id);
402 throw new RestException(404,
'Account not found');
406 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
409 foreach ($request_data as $field => $value) {
410 if (in_array($field, array(
'pass_crypted',
'pass_indatabase',
'pass_indatabase_crypted',
'pass_temp',
'api_key'))) {
412 throw new RestException(405,
'The property '.$field.
" can't be set/modified using the APIs");
414 if ($field ==
'id') {
417 if ($field ==
'pass') {
418 if ($this->useraccount->id != DolibarrApiAccess::$user->id && !DolibarrApiAccess::$user->hasRight(
'user',
'user',
'password')) {
419 throw new RestException(403,
'You are not allowed to modify password of other users');
421 if ($this->useraccount->id == DolibarrApiAccess::$user->id && !DolibarrApiAccess::$user->hasRight(
'user',
'self',
'password')) {
422 throw new RestException(403,
'You are not allowed to modify your own password');
425 if ($field ===
'caller') {
427 $this->useraccount->context[
'caller'] =
sanitizeVal($request_data[
'caller'],
'aZ09');
430 if ($field ==
'array_options' && is_array($value)) {
431 foreach ($value as $index => $val) {
432 $this->useraccount->array_options[$index] = $this->
_checkValForAPI($field, $val, $this->useraccount);
437 if (DolibarrApiAccess::$user->admin) {
438 if ($field ==
'admin' && $value != $this->useraccount->admin && empty($value)) {
439 throw new RestException(403,
'Reseting the admin status of a user is not possible using the API');
442 if ($field ==
'admin' && $value != $this->useraccount->admin) {
443 throw new RestException(403,
'Only an admin user can modify the admin status of another user');
446 if ($field ==
'entity' && $value != $this->useraccount->entity) {
447 throw new RestException(403,
'Changing entity of a user using the APIs is not possible');
452 if ($field ==
'statut' || $field ==
'status') {
453 $result = $this->useraccount->setstatus($value);
455 throw new RestException(500,
'Error when updating status of user: '.$this->useraccount->error);
458 $this->useraccount->$field = $this->
_checkValForAPI($field, $value, $this->useraccount);
464 if ($this->useraccount->update(DolibarrApiAccess::$user) >= 0) {
465 return $this->
get(
$id);
467 throw new RestException(500, $this->useraccount->error);
490 throw new RestException(403,
"Error: login and password reset APIs are disabled. You can get access token from the backoffice to get access permission but permission and password manipulation from APIs are forbidden.");
495 throw new RestException(403,
"Error: password reset APIs are disabled by default. To allow this, the option API_ALLOW_PASSWORD_RESET must be set.");
498 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer') && empty(DolibarrApiAccess::$user->admin)) {
499 throw new RestException(403,
"setPassword on user not allowed for login ".DolibarrApiAccess::$user->login);
502 $result = $this->useraccount->fetch(
$id);
504 throw new RestException(404,
'User not found, no password changed');
508 throw new RestException(403,
'Access on this object not allowed for login '.DolibarrApiAccess::$user->login);
511 $newpassword = $this->useraccount->setPassword($this->useraccount,
'');
512 if (is_int($newpassword) && $newpassword < 0) {
513 throw new RestException(500,
'ErrorFailedToSetNewPassword'.$this->useraccount->error);
516 if ($send_password) {
517 if ($this->useraccount->send_password($this->useraccount, $newpassword) > 0) {
520 throw new RestException(500,
'ErrorFailedSendingNewPassword - '.$this->useraccount->error);
545 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'lire') && empty(DolibarrApiAccess::$user->admin)) {
546 throw new RestException(403);
549 $user =
new User($this->db);
550 $result = $user->fetch(
$id);
552 throw new RestException(404,
'user not found');
556 $groups = $usergroup->listGroupsForUser(
$id,
false);
558 foreach ($groups as $group) {
585 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer') && empty(DolibarrApiAccess::$user->admin)) {
586 throw new RestException(403,
'setGroup on users not allowed for login '.DolibarrApiAccess::$user->login);
589 $result = $this->useraccount->fetch(
$id);
591 throw new RestException(404,
'User not found');
595 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
598 if (isModEnabled(
'multicompany') &&
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && !empty(DolibarrApiAccess::$user->admin) && empty(DolibarrApiAccess::$user->entity)) {
599 $entity = (!empty($entity) ? $entity :
$conf->entity);
603 $entity = (DolibarrApiAccess::$user->entity > 0 ? DolibarrApiAccess::$user->entity :
$conf->entity);
606 $result = $this->useraccount->SetInGroup($group, $entity);
607 if (!($result > 0)) {
608 throw new RestException(500, $this->useraccount->error);
638 public function listGroups($sortfield =
"t.rowid", $sortorder =
'ASC', $limit = 100, $page = 0, $group_ids =
'0', $sqlfilters =
'', $properties =
'')
642 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !DolibarrApiAccess::$user->hasRight(
'user',
'user',
'lire') && empty(DolibarrApiAccess::$user->admin)) ||
643 getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !DolibarrApiAccess::$user->hasRight(
'user',
'group_advance',
'read') && empty(DolibarrApiAccess::$user->admin)) {
644 throw new RestException(403,
"You are not allowed to read groups");
650 $sql =
"SELECT t.rowid";
651 $sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup AS t LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_extrafields AS ef ON (ef.fk_object = t.rowid)";
652 $sql .=
' WHERE t.entity IN ('.getEntity(
'user').
')';
654 $sql .=
" AND t.rowid IN (".$this->db->sanitize($group_ids).
")";
661 throw new RestException(400,
'Error when validating parameter sqlfilters -> '.$errormessage);
665 $sql .= $this->db->order($sortfield, $sortorder);
670 $offset = $limit * $page;
672 $sql .= $this->db->plimit($limit + 1, $offset);
675 $result = $this->db->query($sql);
679 $num = $this->db->num_rows($result);
680 $min = min($num, ($limit <= 0 ? $num : $limit));
682 $obj = $this->db->fetch_object($result);
683 $group_static =
new UserGroup($this->db);
684 if ($group_static->fetch($obj->rowid)) {
690 throw new RestException(503,
'Error when retrieve Group list : '.$this->db->lasterror());
714 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !DolibarrApiAccess::$user->hasRight(
'user',
'user',
'lire') && empty(DolibarrApiAccess::$user->admin)) ||
715 getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !DolibarrApiAccess::$user->hasRight(
'user',
'group_advance',
'read') && empty(DolibarrApiAccess::$user->admin)) {
716 throw new RestException(403,
"You are not allowed to read groups");
719 $group_static =
new UserGroup($this->db);
720 $result = $group_static->fetch($group,
'', (
bool) $load_members);
723 throw new RestException(404,
'Group not found');
742 public function delete(
$id)
744 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'supprimer') && empty(DolibarrApiAccess::$user->admin)) {
745 throw new RestException(403,
'Not allowed');
747 $result = $this->useraccount->fetch(
$id);
749 throw new RestException(404,
'User not found');
753 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
755 $this->useraccount->oldcopy = clone $this->useraccount;
757 if (!$this->useraccount->delete(DolibarrApiAccess::$user)) {
758 throw new RestException(500);
764 'message' =>
'Ticket deleted'
787 throw new RestException(400,
'user ID is mandatory');
789 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'lire') && empty(DolibarrApiAccess::$user->admin)) {
790 throw new RestException(403);
793 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
800 $sql =
"SELECT rowid as id, fk_action as event, fk_user, type, datec, tms";
801 $sql .=
" FROM ".MAIN_DB_PREFIX.
"notify_def";
802 $sql .=
" WHERE fk_user = ".((int)
$id);
804 $result = $this->db->query($sql);
805 if ($this->db->num_rows($result) == 0) {
806 throw new RestException(404,
'Notification not found');
811 $notifications = array();
814 $num = $this->db->num_rows($result);
816 $obj = $this->db->fetch_object($result);
817 $notifications[] = $obj;
821 throw new RestException(404,
'No notifications found');
824 $fields = array(
'id',
'fk_user',
'event',
'datec',
'tms',
'type');
826 $returnNotifications = array();
828 foreach ($notifications as $notification) {
830 foreach ($notification as $key => $value) {
831 if (in_array($key, $fields)) {
835 $returnNotifications[] =
$object;
839 return $returnNotifications;
860 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer')) {
861 throw new RestException(403,
"User has no right to update users");
863 if ($this->useraccount->fetch(
$id) <= 0) {
864 throw new RestException(404,
'Error creating User Notification, User doesn\'t exists');
866 $notification =
new Notify($this->db);
868 $notification->fk_user =
$id;
870 foreach ($request_data as $field => $value) {
871 $notification->$field = $value;
874 $event = $notification->event;
876 throw new RestException(500,
'Error creating User Notification, request_data missing event');
878 $fk_user = $notification->fk_user;
880 $exists_sql =
"SELECT rowid, fk_action as event, fk_user, type, datec, tms as datem";
881 $exists_sql .=
" FROM ".MAIN_DB_PREFIX.
"notify_def";
882 $exists_sql .=
" WHERE fk_action = '".$this->db->escape((
string) $event).
"'";
883 $exists_sql .=
" AND fk_user = '".$this->db->escape((
string) $fk_user).
"'";
885 $exists_result = $this->db->query($exists_sql);
886 if ($this->db->num_rows($exists_result) > 0) {
887 throw new RestException(403,
'Notification already exists');
890 if ($notification->create(DolibarrApiAccess::$user) < 0) {
891 throw new RestException(500,
'Error creating User Notification');
894 if ($notification->update(DolibarrApiAccess::$user) < 0) {
895 throw new RestException(500,
'Error updating values');
921 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer')) {
922 throw new RestException(403,
"User has no right to update users");
924 if ($this->useraccount->fetch(
$id) <= 0) {
925 throw new RestException(404,
'Error creating User Notification, User doesn\'t exists');
927 $notification =
new Notify($this->db);
928 $notification->fk_user =
$id;
930 $sql =
"SELECT t.rowid as id FROM ".MAIN_DB_PREFIX.
"c_action_trigger as t";
931 $sql .=
" WHERE t.code = '".$this->db->escape($code).
"'";
933 $result = $this->db->query($sql);
934 if ($this->db->num_rows($result) == 0) {
935 throw new RestException(404,
'Action Trigger code not found');
938 $notification->event = $this->db->fetch_row($result)[0];
939 foreach ($request_data as $field => $value) {
940 if ($field ===
'event') {
941 throw new RestException(500,
'Error creating User Notification, request_data contains event key');
943 if ($field ===
'fk_action') {
944 throw new RestException(500,
'Error creating User Notification, request_data contains fk_action key');
946 $notification->$field = $value;
949 $event = $notification->event;
950 $fk_user = $notification->fk_user;
952 $exists_sql =
"SELECT rowid, fk_action as event, fk_user, type, datec, tms as datem";
953 $exists_sql .=
" FROM ".MAIN_DB_PREFIX.
"notify_def";
954 $exists_sql .=
" WHERE fk_action = '".$this->db->escape((
string) $event).
"'";
955 $exists_sql .=
" AND fk_user = '".$this->db->escape((
string) $fk_user).
"'";
957 $exists_result = $this->db->query($exists_sql);
958 if ($this->db->num_rows($exists_result) > 0) {
959 throw new RestException(403,
'Notification already exists');
962 if ($notification->create(DolibarrApiAccess::$user) < 0) {
963 throw new RestException(500,
'Error creating User Notification, are request_data well formed?');
966 if ($notification->update(DolibarrApiAccess::$user) < 0) {
967 throw new RestException(500,
'Error updating values');
989 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer')) {
990 throw new RestException(403,
"User has no right to update users");
993 $notification =
new Notify($this->db);
995 $notification->fetch($notification_id);
997 $fk_user = (int) $notification->fk_user;
999 if ($fk_user ==
$id) {
1000 return $notification->delete(DolibarrApiAccess::$user);
1002 throw new RestException(403,
"Not allowed due to bad consistency of input data");
1025 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer')) {
1026 throw new RestException(403,
"User has no right to update users");
1028 if ($this->useraccount->fetch(
$id) <= 0) {
1029 throw new RestException(404,
'Error creating Notification, User doesn\'t exists');
1031 $notification =
new Notify($this->db);
1034 $notification->fetch($notification_id,
$id);
1036 if ($notification->fk_user !=
$id) {
1037 throw new RestException(403,
"Not allowed due to bad consistency of input data");
1040 foreach ($request_data as $field => $value) {
1041 $notification->$field = $value;
1044 if ($notification->update(DolibarrApiAccess::$user) < 0) {
1045 throw new RestException(500,
'Error updating values');
1063 unset(
$object->default_values);
1064 unset(
$object->lastsearch_values);
1065 unset(
$object->lastsearch_values_tmp);
1069 unset(
$object->total_localtax1);
1070 unset(
$object->total_localtax2);
1073 unset(
$object->label_incoterms);
1074 unset(
$object->location_incoterms);
1076 unset(
$object->fk_delivery_address);
1078 unset(
$object->all_permissions_are_loaded);
1079 unset(
$object->shipping_method_id);
1083 unset(
$object->clicktodial_loaded);
1087 unset(
$object->pass_indatabase);
1088 unset(
$object->pass_indatabase_crypted);
1091 unset(
$object->clicktodial_password);
1097 $canreadsalary = ((isModEnabled(
'salaries') && DolibarrApiAccess::$user->hasRight(
'salaries',
'read')) || !isModEnabled(
'salaries'));
1099 if (!$canreadsalary) {
1117 $cleanObjectList = array();
1119 foreach ($objectList as
$object) {
1120 $cleanObject = parent::_cleanObjectDatas(
$object);
1122 unset($cleanObject->default_values);
1123 unset($cleanObject->lastsearch_values);
1124 unset($cleanObject->lastsearch_values_tmp);
1126 unset($cleanObject->total_ht);
1127 unset($cleanObject->total_tva);
1128 unset($cleanObject->total_localtax1);
1129 unset($cleanObject->total_localtax2);
1130 unset($cleanObject->total_ttc);
1132 unset($cleanObject->libelle_incoterms);
1133 unset($cleanObject->location_incoterms);
1135 unset($cleanObject->fk_delivery_address);
1136 unset($cleanObject->fk_incoterms);
1137 unset($cleanObject->all_permissions_are_loaded);
1138 unset($cleanObject->shipping_method_id);
1139 unset($cleanObject->nb_rights);
1140 unset($cleanObject->search_sid);
1141 unset($cleanObject->ldap_sid);
1142 unset($cleanObject->clicktodial_loaded);
1144 unset($cleanObject->datec);
1145 unset($cleanObject->tms);
1146 unset($cleanObject->members);
1147 unset($cleanObject->note);
1148 unset($cleanObject->note_private);
1150 $cleanObjectList[] = $cleanObject;
1153 return $cleanObjectList;
1166 foreach (Users::$FIELDS as $field) {
1167 if (!isset($data[$field])) {
1168 throw new RestException(400,
"$field field missing");
1170 $account[$field] = $data[$field];
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
_filterObjectProperties($object, $properties)
Filter properties that will be returned on object.
static _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
Check access by user to a given resource.
_checkValForAPI($field, $value, $object)
Check and convert a string depending on its type/name.
Class to manage the table of subscription to notifications.
Class to manage user groups.
Class to manage Dolibarr users.
put($id, $request_data=null)
Update a user.
listGroups($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $group_ids='0', $sqlfilters='', $properties='')
List groups.
index($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $user_ids='0', $category=0, $sqlfilters='', $properties='')
List users.
_cleanObjectDatas($object)
Clean sensible object datas.
getInfo($includepermissions=0)
Get more properties of a user.
_cleanUserGroupListDatas($objectList)
Clean sensible user group list datas.
updateUserNotification($id, $notification_id, $request_data=null)
Update a notification for a user.
setGroup($id, $group, $entity=1)
Add a user to a group.
setPassword($id, $send_password=false)
Update a user password.
deleteUserNotification($id, $notification_id)
Delete a notification attached to a user.
infoGroups($group, $load_members=0)
Get properties of a user group.
_validate($data)
Validate fields before create or update object.
getByEmail($email, $includepermissions=0)
Get a user by email.
getGroups($id)
List the groups of a user.
createUserNotificationByCode($id, $code, $request_data=null)
Create a notification for a user using action trigger code.
post($request_data=null)
Create a user.
createUserNotification($id, $request_data=null)
Create a notification for a user.
getByLogin($login, $includepermissions=0)
Get a user by login.
getUserNotification($id)
Get notifications for a user.
__construct()
Constructor.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0)
forgeSQLFromUniversalSearchCriteria
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
sanitizeVal($out='', $check='alphanohtml', $filter=null, $options=null)
Return a sanitized or empty value after checking value against a rule.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...