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');
726 if ($load_members > 0 && is_array($group_static->members) && count($group_static->members) > 0) {
727 foreach ($group_static->members as &$member) {
748 public function delete(
$id)
750 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'supprimer') && empty(DolibarrApiAccess::$user->admin)) {
751 throw new RestException(403,
'Not allowed');
753 $result = $this->useraccount->fetch(
$id);
755 throw new RestException(404,
'User not found');
759 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
761 $this->useraccount->oldcopy = clone $this->useraccount;
763 if (!$this->useraccount->delete(DolibarrApiAccess::$user)) {
764 throw new RestException(500);
770 'message' =>
'Ticket deleted'
793 throw new RestException(400,
'user ID is mandatory');
795 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'lire') && empty(DolibarrApiAccess::$user->admin)) {
796 throw new RestException(403);
799 throw new RestException(403,
'Access not allowed for login '.DolibarrApiAccess::$user->login);
806 $sql =
"SELECT rowid as id, fk_action as event, fk_user, type, datec, tms";
807 $sql .=
" FROM ".MAIN_DB_PREFIX.
"notify_def";
808 $sql .=
" WHERE fk_user = ".((int)
$id);
810 $result = $this->db->query($sql);
811 if ($this->db->num_rows($result) == 0) {
812 throw new RestException(404,
'Notification not found');
817 $notifications = array();
820 $num = $this->db->num_rows($result);
822 $obj = $this->db->fetch_object($result);
823 $notifications[] = $obj;
827 throw new RestException(404,
'No notifications found');
830 $fields = array(
'id',
'fk_user',
'event',
'datec',
'tms',
'type');
832 $returnNotifications = array();
834 foreach ($notifications as $notification) {
836 foreach ($notification as $key => $value) {
837 if (in_array($key, $fields)) {
841 $returnNotifications[] =
$object;
845 return $returnNotifications;
866 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer')) {
867 throw new RestException(403,
"User has no right to update users");
869 if ($this->useraccount->fetch(
$id) <= 0) {
870 throw new RestException(404,
'Error creating User Notification, User doesn\'t exists');
872 $notification =
new Notify($this->db);
874 $notification->fk_user =
$id;
876 foreach ($request_data as $field => $value) {
877 $notification->$field = $value;
880 $event = $notification->event;
882 throw new RestException(500,
'Error creating User Notification, request_data missing event');
884 $fk_user = $notification->fk_user;
886 $exists_sql =
"SELECT rowid, fk_action as event, fk_user, type, datec, tms as datem";
887 $exists_sql .=
" FROM ".MAIN_DB_PREFIX.
"notify_def";
888 $exists_sql .=
" WHERE fk_action = '".$this->db->escape((
string) $event).
"'";
889 $exists_sql .=
" AND fk_user = '".$this->db->escape((
string) $fk_user).
"'";
891 $exists_result = $this->db->query($exists_sql);
892 if ($this->db->num_rows($exists_result) > 0) {
893 throw new RestException(403,
'Notification already exists');
896 if ($notification->create(DolibarrApiAccess::$user) < 0) {
897 throw new RestException(500,
'Error creating User Notification');
900 if ($notification->update(DolibarrApiAccess::$user) < 0) {
901 throw new RestException(500,
'Error updating values');
927 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer')) {
928 throw new RestException(403,
"User has no right to update users");
930 if ($this->useraccount->fetch(
$id) <= 0) {
931 throw new RestException(404,
'Error creating User Notification, User doesn\'t exists');
933 $notification =
new Notify($this->db);
934 $notification->fk_user =
$id;
936 $sql =
"SELECT t.rowid as id FROM ".MAIN_DB_PREFIX.
"c_action_trigger as t";
937 $sql .=
" WHERE t.code = '".$this->db->escape($code).
"'";
939 $result = $this->db->query($sql);
940 if ($this->db->num_rows($result) == 0) {
941 throw new RestException(404,
'Action Trigger code not found');
944 $notification->event = $this->db->fetch_row($result)[0];
945 foreach ($request_data as $field => $value) {
946 if ($field ===
'event') {
947 throw new RestException(500,
'Error creating User Notification, request_data contains event key');
949 if ($field ===
'fk_action') {
950 throw new RestException(500,
'Error creating User Notification, request_data contains fk_action key');
952 $notification->$field = $value;
955 $event = $notification->event;
956 $fk_user = $notification->fk_user;
958 $exists_sql =
"SELECT rowid, fk_action as event, fk_user, type, datec, tms as datem";
959 $exists_sql .=
" FROM ".MAIN_DB_PREFIX.
"notify_def";
960 $exists_sql .=
" WHERE fk_action = '".$this->db->escape((
string) $event).
"'";
961 $exists_sql .=
" AND fk_user = '".$this->db->escape((
string) $fk_user).
"'";
963 $exists_result = $this->db->query($exists_sql);
964 if ($this->db->num_rows($exists_result) > 0) {
965 throw new RestException(403,
'Notification already exists');
968 if ($notification->create(DolibarrApiAccess::$user) < 0) {
969 throw new RestException(500,
'Error creating User Notification, are request_data well formed?');
972 if ($notification->update(DolibarrApiAccess::$user) < 0) {
973 throw new RestException(500,
'Error updating values');
995 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer')) {
996 throw new RestException(403,
"User has no right to update users");
999 $notification =
new Notify($this->db);
1001 $notification->fetch($notification_id);
1003 $fk_user = (int) $notification->fk_user;
1005 if ($fk_user ==
$id) {
1006 return $notification->delete(DolibarrApiAccess::$user);
1008 throw new RestException(403,
"Not allowed due to bad consistency of input data");
1031 if (!DolibarrApiAccess::$user->hasRight(
'user',
'user',
'creer')) {
1032 throw new RestException(403,
"User has no right to update users");
1034 if ($this->useraccount->fetch(
$id) <= 0) {
1035 throw new RestException(404,
'Error creating Notification, User doesn\'t exists');
1037 $notification =
new Notify($this->db);
1040 $notification->fetch($notification_id,
$id);
1042 if ($notification->fk_user !=
$id) {
1043 throw new RestException(403,
"Not allowed due to bad consistency of input data");
1046 foreach ($request_data as $field => $value) {
1047 $notification->$field = $value;
1050 if ($notification->update(DolibarrApiAccess::$user) < 0) {
1051 throw new RestException(500,
'Error updating values');
1069 unset(
$object->default_values);
1070 unset(
$object->lastsearch_values);
1071 unset(
$object->lastsearch_values_tmp);
1075 unset(
$object->total_localtax1);
1076 unset(
$object->total_localtax2);
1079 unset(
$object->label_incoterms);
1080 unset(
$object->location_incoterms);
1082 unset(
$object->fk_delivery_address);
1084 unset(
$object->all_permissions_are_loaded);
1085 unset(
$object->shipping_method_id);
1089 unset(
$object->clicktodial_loaded);
1093 unset(
$object->pass_indatabase);
1094 unset(
$object->pass_indatabase_crypted);
1097 unset(
$object->clicktodial_password);
1103 $canreadsalary = ((isModEnabled(
'salaries') && DolibarrApiAccess::$user->hasRight(
'salaries',
'read')) || !isModEnabled(
'salaries'));
1105 if (!$canreadsalary) {
1123 $cleanObjectList = array();
1125 foreach ($objectList as
$object) {
1126 $cleanObject = parent::_cleanObjectDatas(
$object);
1128 unset($cleanObject->default_values);
1129 unset($cleanObject->lastsearch_values);
1130 unset($cleanObject->lastsearch_values_tmp);
1132 unset($cleanObject->total_ht);
1133 unset($cleanObject->total_tva);
1134 unset($cleanObject->total_localtax1);
1135 unset($cleanObject->total_localtax2);
1136 unset($cleanObject->total_ttc);
1138 unset($cleanObject->libelle_incoterms);
1139 unset($cleanObject->location_incoterms);
1141 unset($cleanObject->fk_delivery_address);
1142 unset($cleanObject->fk_incoterms);
1143 unset($cleanObject->all_permissions_are_loaded);
1144 unset($cleanObject->shipping_method_id);
1145 unset($cleanObject->nb_rights);
1146 unset($cleanObject->search_sid);
1147 unset($cleanObject->ldap_sid);
1148 unset($cleanObject->clicktodial_loaded);
1150 unset($cleanObject->datec);
1151 unset($cleanObject->tms);
1152 unset($cleanObject->members);
1153 unset($cleanObject->note);
1154 unset($cleanObject->note_private);
1156 $cleanObjectList[] = $cleanObject;
1159 return $cleanObjectList;
1172 foreach (Users::$FIELDS as $field) {
1173 if (!isset($data[$field])) {
1174 throw new RestException(400,
"$field field missing");
1176 $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...