27require_once DOL_DOCUMENT_ROOT.
"/core/class/commonobject.class.php";
28require_once DOL_DOCUMENT_ROOT.
"/core/lib/functions2.lib.php";
29require_once DOL_DOCUMENT_ROOT.
'/core/class/commonpeople.class.php';
41 public $element =
'dolresource';
46 public $table_element =
'resource';
51 public $picto =
'resource';
71 public $fk_code_type_resource;
86 public $resource_type;
114 public $fulldayevent;
119 public $fk_user_create;
129 public $cache_code_type_resource;
147 $this->cache_code_type_resource = array();
160 $this->date_creation =
dol_now();
163 $new_resource_values = [
175 $this->fk_code_type_resource,
179 foreach ($new_resource_values as $key => $value) {
181 $new_resource_values[$key] = trim($value);
186 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.$this->table_element.
"(";
192 $sql .=
"fk_country,";
194 $sql .=
"description,";
197 $sql .=
"max_users,";
199 $sql .=
"fk_code_type_resource,";
200 $sql .=
"note_public,";
201 $sql .=
"note_private, ";
203 $sql .=
"fk_user_author ";
204 $sql .=
") VALUES (";
206 foreach ($new_resource_values as $value) {
207 $sql .=
" " . ((isset($value) && $value > 0) ?
"'" . $this->db->escape($value) .
"'" :
'NULL') .
",";
209 $sql .=
" '" . $this->db->idate($this->date_creation) .
"',";
210 $sql .=
" " . (!empty($user->id) ? ((int) $user->id) :
"null");
216 dol_syslog(get_class($this) .
"::create", LOG_DEBUG);
218 error_log(
'dol_syslog error: ' . $exception->getMessage());
220 $resql = $this->db->query($sql);
223 $this->errors[] =
"Error ".$this->db->lasterror();
227 $this->
id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
234 if (!$error && !$no_trigger) {
235 $result = $this->
call_trigger(
'RESOURCE_CREATE', $user);
243 foreach ($this->errors as $errmsg) {
245 dol_syslog(get_class($this) .
"::create " . $errmsg, LOG_ERR);
247 error_log(
'dol_syslog error: ' . $exception->getMessage());
249 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
251 $this->db->rollback();
266 public function fetch(
int $id,
string $ref =
'')
270 $sql .=
" t.entity,";
272 $sql .=
" t.address,";
275 $sql .=
" t.fk_country,";
276 $sql .=
" t.fk_state,";
277 $sql .=
" t.description,";
280 $sql .=
" t.max_users,";
282 $sql .=
" t.fk_code_type_resource,";
283 $sql .=
" t.note_public,";
284 $sql .=
" t.note_private,";
285 $sql .=
" t.tms as date_modification,";
286 $sql .=
" t.datec as date_creation,";
287 $sql .=
" ty.label as type_label";
288 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
289 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_type_resource as ty ON ty.code=t.fk_code_type_resource";
291 $sql .=
" WHERE t.rowid = ".($id);
293 $sql .=
" WHERE t.ref = '".$this->db->escape($ref).
"'";
296 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
297 $resql = $this->db->query($sql);
299 if ($this->db->num_rows($resql)) {
300 $obj = $this->db->fetch_object($resql);
302 $this->
id = $obj->rowid;
303 $this->entity = $obj->entity;
304 $this->
ref = $obj->ref;
305 $this->address = $obj->address;
306 $this->zip = $obj->zip;
307 $this->town = $obj->town;
308 $this->country_id = $obj->fk_country;
309 $this->state_id = $obj->fk_state;
311 $this->phone = $obj->phone;
312 $this->email = $obj->email;
313 $this->max_users = $obj->max_users;
314 $this->url = $obj->url;
315 $this->fk_code_type_resource = $obj->fk_code_type_resource;
316 $this->note_public = $obj->note_public;
317 $this->note_private = $obj->note_private;
318 $this->date_creation = $this->db->jdate($obj->date_creation);
319 $this->date_modification = $this->db->jdate($obj->date_modification);
320 $this->type_label = $obj->type_label;
326 $this->db->free($resql);
330 $this->error =
"Error ".$this->db->lasterror();
331 dol_syslog(get_class($this).
"::fetch ".$this->error, LOG_ERR);
344 public function update(
User $user =
null,
int $notrigger = 0)
346 global $conf, $langs;
348 $this->date_modification =
dol_now();
351 if (isset($this->
ref)) {
352 $this->
ref = trim($this->
ref);
354 if (isset($this->address)) {
355 $this->address = trim($this->address);
357 if (isset($this->zip)) {
358 $this->zip = trim($this->zip);
360 if (isset($this->town)) {
361 $this->town = trim($this->town);
363 if (!is_numeric($this->country_id)) {
364 $this->country_id = 0;
366 if (!is_numeric($this->state_id)) {
372 if (isset($this->phone)) {
373 $this->phone = trim($this->phone);
375 if (isset($this->email)) {
376 $this->email = trim($this->email);
378 if (!is_numeric($this->max_users)) {
379 $this->max_users = 0;
381 if (isset($this->url)) {
382 $this->url = trim($this->url);
384 if (isset($this->fk_code_type_resource)) {
385 $this->fk_code_type_resource = trim($this->fk_code_type_resource);
389 if (is_null($this->oldcopy) || (is_object($this->oldcopy) && $this->oldcopy->isEmpty())) {
394 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element.
" SET";
395 $sql .=
" ref=".(isset($this->
ref) ?
"'".$this->db->escape($this->
ref).
"'" :
"null").
",";
396 $sql .=
" address=".(isset($this->address) ?
"'".$this->db->escape($this->address).
"'" :
"null").
",";
397 $sql .=
" zip=".(isset($this->zip) ?
"'".$this->db->escape($this->zip).
"'" :
"null").
",";
398 $sql .=
" town=".(isset($this->town) ?
"'".$this->db->escape($this->town).
"'" :
"null").
",";
399 $sql .=
" fk_country=".($this->country_id > 0 ? (int) $this->country_id :
"null").
",";
400 $sql .=
" fk_state=".($this->state_id > 0 ? (int) $this->state_id :
"null").
",";
401 $sql .=
" description=".(isset($this->
description) ?
"'".$this->db->escape($this->
description).
"'" :
"null").
",";
402 $sql .=
" phone=".(isset($this->phone) ?
"'".$this->db->escape($this->phone).
"'" :
"null").
",";
403 $sql .=
" email=".(isset($this->email) ?
"'".$this->db->escape($this->email).
"'" :
"null").
",";
404 $sql .=
" max_users=".(isset($this->max_users) ? (int) $this->max_users :
"null").
",";
405 $sql .=
" url=".(isset($this->url) ?
"'".$this->db->escape($this->url).
"'" :
"null").
",";
406 $sql .=
" fk_code_type_resource=".(isset($this->fk_code_type_resource) ?
"'".$this->db->escape($this->fk_code_type_resource).
"'" :
"null").
",";
407 $sql .=
" tms=" . (
"'" . $this->db->idate($this->date_modification) .
"',");
408 $sql .=
" fk_user_modif=" . (!empty($user->id) ? ((int) $user->id) :
"null");
409 $sql .=
" WHERE rowid=".((int) $this->
id);
413 dol_syslog(get_class($this).
"::update", LOG_DEBUG);
414 $resql = $this->db->query($sql);
417 $this->errors[] =
"Error ".$this->db->lasterror();
423 $result = $this->
call_trigger(
'RESOURCE_MODIFY', $user);
431 if (!$error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) {
433 if (!empty($conf->resource->dir_output)) {
436 if (file_exists($olddir)) {
437 $res = @rename($olddir, $newdir);
439 $langs->load(
"errors");
440 $this->error = $langs->trans(
'ErrorFailToRenameDir', $olddir, $newdir);
457 foreach ($this->errors as $errmsg) {
458 dol_syslog(get_class($this).
"::update ".$errmsg, LOG_ERR);
459 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
461 $this->db->rollback();
479 $sql .=
" t.resource_id,";
480 $sql .=
" t.resource_type,";
481 $sql .=
" t.element_id,";
482 $sql .=
" t.element_type,";
484 $sql .=
" t.mandatory,";
485 $sql .=
" t.fk_user_create,";
486 $sql .=
" t.tms as date_modification";
487 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_resources as t";
488 $sql .=
" WHERE t.rowid = ".($id);
490 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
491 $resql = $this->db->query($sql);
493 if ($this->db->num_rows($resql)) {
494 $obj = $this->db->fetch_object($resql);
496 $this->
id = $obj->rowid;
497 $this->resource_id = $obj->resource_id;
498 $this->resource_type = $obj->resource_type;
499 $this->element_id = $obj->element_id;
500 $this->element_type = $obj->element_type;
501 $this->busy = $obj->busy;
502 $this->mandatory = $obj->mandatory;
503 $this->fk_user_create = $obj->fk_user_create;
504 $this->date_modification = $obj->date_modification;
509 if ($obj->element_id && $obj->element_type) {
513 $this->db->free($resql);
517 $this->error =
"Error ".$this->db->lasterror();
529 public function delete(
User $user,
int $notrigger = 0)
533 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
541 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
542 $sql .=
" WHERE rowid = ".($rowid);
545 if ($this->db->query($sql)) {
546 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"element_resources";
547 $sql .=
" WHERE element_type='resource' AND resource_id = ".((int) $rowid);
548 dol_syslog(get_class($this).
"::delete", LOG_DEBUG);
549 $resql = $this->db->query($sql);
551 $this->error = $this->db->lasterror();
555 $this->error = $this->db->lasterror();
564 dol_syslog(get_class($this).
"::delete error -3 ".$this->error, LOG_ERR);
570 $result = $this->
call_trigger(
'RESOURCE_DELETE', $user);
580 if (!empty($conf->resource->dir_output)) {
582 if (file_exists($dir)) {
585 $this->errors[] =
'ErrorFailToDeleteDir';
596 $this->db->rollback();
611 public function fetchAll(
string $sortorder,
string $sortfield,
int $limit,
int $offset, $filter =
'')
613 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
618 $sql .=
" t.entity,";
620 $sql .=
" t.address,";
623 $sql .=
" t.fk_country,";
624 $sql .=
" t.fk_state,";
625 $sql .=
" t.description,";
628 $sql .=
" t.max_users,";
630 $sql .=
" t.fk_code_type_resource,";
631 $sql .=
" t.tms as date_modification,";
632 $sql .=
" t.datec as date_creation,";
634 if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element][
'label'])) {
635 foreach ($extrafields->attributes[$this->table_element][
'label'] as $key => $val) {
636 $sql .= ($extrafields->attributes[$this->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
" as options_".$key.
', ' :
'');
639 $sql .=
" ty.label as type_label";
640 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
641 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_type_resource as ty ON ty.code=t.fk_code_type_resource";
642 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$this->table_element.
"_extrafields as ef ON ef.fk_object=t.rowid";
643 $sql .=
" WHERE t.entity IN (".getEntity(
'resource').
")";
646 if (is_array($filter)) {
647 foreach ($filter as $key => $value) {
648 if (strpos($key,
'date')) {
649 $sql .=
" AND ".$this->db->sanitize($key).
" = '".$this->db->idate($value).
"'";
650 } elseif (strpos($key,
'ef.') !==
false) {
651 $sql .=
" AND ".$this->db->sanitize($key).
" = ".((float) $value);
653 $sql .=
" AND ".$this->db->sanitize($key).
" LIKE '%".$this->db->escape($this->db->escapeforlike($value)).
"%'";
664 $this->errors[] = $errormessage;
665 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
669 $sql .= $this->db->order($sortfield, $sortorder);
671 $sql .= $this->db->plimit($limit, $offset);
674 dol_syslog(get_class($this).
"::fetchAll", LOG_DEBUG);
676 $this->lines = array();
677 $resql = $this->db->query($sql);
679 $num = $this->db->num_rows($resql);
681 while ($obj = $this->db->fetch_object($resql)) {
683 $line->id = $obj->rowid;
684 $line->ref = $obj->ref;
685 $line->address = $obj->address;
686 $line->zip = $obj->zip;
687 $line->town = $obj->town;
688 $line->country_id = $obj->fk_country;
689 $line->state_id = $obj->fk_state;
690 $line->description = $obj->description;
691 $this->phone = $obj->phone;
692 $this->email = $obj->email;
693 $this->max_users = $obj->max_users;
694 $this->url = $obj->url;
695 $line->fk_code_type_resource = $obj->fk_code_type_resource;
696 $line->date_modification = $obj->date_modification;
697 $line->date_creation = $obj->date_creation;
698 $line->type_label = $obj->type_label;
702 $line->fetch_optionals();
704 $this->lines[] = $line;
706 $this->db->free($resql);
710 $this->error = $this->db->lasterror();
725 $this->date_modification =
dol_now();
728 if (!is_numeric($this->resource_id)) {
729 $this->resource_id = 0;
731 if (isset($this->resource_type)) {
732 $this->resource_type = trim($this->resource_type);
734 if (!is_numeric($this->element_id)) {
735 $this->element_id = 0;
737 if (isset($this->element_type)) {
738 $this->element_type = trim($this->element_type);
740 if (isset($this->busy)) {
741 $this->busy = (int) $this->busy;
743 if (isset($this->mandatory)) {
744 $this->mandatory = (int) $this->mandatory;
748 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"element_resources SET";
749 $sql .=
" resource_id = ".(isset($this->resource_id) ? (int) $this->resource_id :
"null").
",";
750 $sql .=
" resource_type = ".(isset($this->resource_type) ?
"'".$this->db->escape($this->resource_type).
"'" :
"null").
",";
751 $sql .=
" element_id = ".(isset($this->element_id) ? (int) $this->element_id :
"null").
",";
752 $sql .=
" element_type = ".(isset($this->element_type) ?
"'".$this->db->escape($this->element_type).
"'" :
"null").
",";
753 $sql .=
" busy = ".(isset($this->busy) ? (int) $this->busy :
"null").
",";
754 $sql .=
" mandatory = ".(isset($this->mandatory) ? (int) $this->mandatory :
"null").
",";
755 $sql .=
" tms = ".(dol_strlen($this->date_modification) != 0 ?
"'".$this->db->idate($this->date_modification).
"'" :
'null');
756 $sql .=
" WHERE rowid=".((int) $this->
id);
760 dol_syslog(get_class($this).
"::update", LOG_DEBUG);
761 $resql = $this->db->query($sql);
764 $this->errors[] =
"Error ".$this->db->lasterror();
770 $result = $this->
call_trigger(
'RESOURCE_MODIFY', $user);
780 foreach ($this->errors as $errmsg) {
781 dol_syslog(get_class($this).
"::update ".$errmsg, LOG_ERR);
782 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
784 $this->db->rollback();
804 $sql =
'SELECT rowid, resource_id, resource_type, busy, mandatory';
805 $sql .=
' FROM '.MAIN_DB_PREFIX.
'element_resources';
806 $sql .=
" WHERE element_id=".((int) $element_id).
" AND element_type='".$this->db->escape($element).
"'";
807 if ($resource_type) {
808 $sql .=
" AND resource_type LIKE '%".$this->db->escape($resource_type).
"%'";
810 $sql .=
' ORDER BY resource_type';
812 dol_syslog(get_class($this).
"::getElementResources", LOG_DEBUG);
814 $resources = array();
815 $resql = $this->db->query($sql);
817 $num = $this->db->num_rows($resql);
820 $obj = $this->db->fetch_object($resql);
822 $resources[$i] = array(
823 'rowid' => $obj->rowid,
824 'resource_id' => $obj->resource_id,
825 'resource_type' => $obj->resource_type,
826 'busy' => $obj->busy,
827 'mandatory' => $obj->mandatory
847 foreach ($resources as $resource) {
863 if (is_array($this->cache_code_type_resource) && count($this->cache_code_type_resource)) {
867 $sql =
"SELECT rowid, code, label, active";
868 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_type_resource";
869 $sql .=
" WHERE active > 0";
870 $sql .=
" ORDER BY rowid";
871 dol_syslog(get_class($this).
"::load_cache_code_type_resource", LOG_DEBUG);
872 $resql = $this->db->query($sql);
874 $num = $this->db->num_rows($resql);
877 $obj = $this->db->fetch_object($resql);
879 $label = ($langs->trans(
"ResourceTypeShort".$obj->code) !=
"ResourceTypeShort".$obj->code ? $langs->trans(
"ResourceTypeShort".$obj->code) : ($obj->label !=
'-' ? $obj->label :
''));
880 $this->cache_code_type_resource[$obj->rowid][
'code'] = $obj->code;
881 $this->cache_code_type_resource[$obj->rowid][
'label'] = $label;
882 $this->cache_code_type_resource[$obj->rowid][
'active'] = $obj->active;
902 $langs->load(
'resource');
906 $datas[
'picto'] =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"Resource").
'</u>';
907 $datas[
'ref'] =
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
911 if (isset($this->type_label)) {
912 $datas[
'label'] =
'<br><b>'.$langs->trans(
"ResourceType").
":</b> ".$this->type_label;
929 public function getNomUrl(
int $withpicto = 0,
string $option =
'',
string $get_params =
'',
int $notooltip = 0,
string $morecss =
'',
int $save_lastsearch_value = -1)
931 global $langs, $hookmanager, $action;
936 'objecttype' => $this->element,
938 $classfortooltip =
'classfortooltip';
941 $classfortooltip =
'classforajaxtooltip';
942 $dataparams =
' data-params="'.dol_escape_htmltag(json_encode($params)).
'"';
948 $url = DOL_URL_ROOT.
'/resource/card.php?id='.$this->id;
950 if ($option !=
'nolink') {
952 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
953 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
954 $add_save_lastsearch_values = 1;
956 if ($add_save_lastsearch_values) {
957 $url .=
'&save_lastsearch_values=1';
962 if (empty($notooltip)) {
964 $label = $langs->trans(
"ShowMyObject");
965 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
967 $linkclose .= ($label ?
' title="'.dol_escape_htmltag($label, 1).
'"' :
' title="tocomplete"');
968 $linkclose .= $dataparams.
' class="'.$classfortooltip.($morecss ?
' '.$morecss :
'').
'"';
970 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
973 $linkstart =
'<a href="'.$url.$get_params.
'"';
974 $linkstart .= $linkclose.
'>';
979 $result .= $linkstart;
981 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ?:
'generic'), (($withpicto != 2) ?
'class="paddingright"' :
''), 0, 0, $notooltip ? 0 : 1);
983 if ($withpicto != 2) {
984 $result .= $this->ref;
988 $hookmanager->initHooks(array($this->element .
'dao'));
989 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
990 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
992 $result = $hookmanager->resPrint;
994 $result .= $hookmanager->resPrint;
1030 $this->nb = array();
1032 $sql =
"SELECT count(r.rowid) as nb";
1033 $sql .=
" FROM ".MAIN_DB_PREFIX.
"resource as r";
1034 $sql .=
" WHERE r.entity IN (".getEntity(
'resource').
")";
1036 $resql = $this->db->query($sql);
1038 while ($obj = $this->db->fetch_object($resql)) {
1039 $this->nb[
"dolresource"] = $obj->nb;
1041 $this->db->free($resql);
1045 $this->error = $this->db->error();
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Parent class of all other business classes (invoices, contracts, proposals, orders,...
fetch_optionals($rowid=null, $optionsArray=null)
Function to get extra fields of an object into $this->array_options This method is in most cases call...
deleteExtraFields()
Delete all extra fields values for the current object.
insertExtraFields($trigger='', $userused=null)
Add/Update all extra fields values for the current object.
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage Dolibarr database access.
fetchAll(string $sortorder, string $sortfield, int $limit, int $offset, $filter='')
Load resource objects into $this->lines.
loadStateBoard()
Load indicators this->nb for state board.
getNomUrl(int $withpicto=0, string $option='', string $get_params='', int $notooltip=0, string $morecss='', int $save_lastsearch_value=-1)
Return clickable link of object (with optional picto)
fetch(int $id, string $ref='')
Load object into memory from database.
$objelement
Used by fetchElementResource() to return an object.
fetchElementResources(string $elementType, int $elementId)
Return an int number of resources linked to the element.
updateElementResource(User $user=null, int $notrigger=0)
Update element resource in database.
static getLibStatusLabel(int $status, int $mode=0)
Get status.
loadCacheCodeTypeResource()
Load in cache resource type code (setup in dictionary)
getTooltipContentArray($params)
getTooltipContentArray
fetchElementResource(int $id)
Load data of resource links into memory from database.
update(User $user=null, int $notrigger=0)
Update object in database.
getElementResources(string $element, int $element_id, string $resource_type='')
Return an array with resources linked to the element.
create(User $user, int $no_trigger=0)
Create object in database.
__construct(DoliDB $db)
Constructor.
getLibStatut(int $mode=0)
Get status label.
Class to manage Dolibarr users.
trait CommonPeople
Support class for thirdparties, contacts, members, users or resources.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0)
forgeSQLFromUniversalSearchCriteria
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
fetchObjectByElement($element_id, $element_type, $element_ref='', $useCache=0, $maxCacheByType=10)
Fetch an object from its id and element_type Inclusion of classes is automatic.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.