31require_once DOL_DOCUMENT_ROOT .
'/core/class/commonobject.class.php';
41 public $module =
'hrm';
46 public $element =
'position';
51 public $table_element =
'hrm_job_user';
56 public $picto =
'user-cog';
59 const STATUS_DRAFT = 0;
60 const STATUS_VALIDATED = 1;
61 const STATUS_CANCELED = 9;
94 public $fields = array(
95 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'position' => 1,
'notnull' => 1,
'visible' => 2,
'index' => 1,
'css' =>
'left',
'comment' =>
"Id"),
97 'date_creation' => array(
'type' =>
'datetime',
'label' =>
'DateCreation',
'enabled' => 1,
'position' => 500,
'notnull' => 1,
'visible' => -2,),
98 'tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModification',
'enabled' => 1,
'position' => 501,
'notnull' => 0,
'visible' => -2,),
99 'fk_contrat' => array(
'type' =>
'integer:Contrat:contrat/class/contrat.class.php',
'label' =>
'fk_contrat',
'enabled' =>
'isModEnabled("contract")',
'position' => 50,
'notnull' => 0,
'visible' => 0,),
100 'fk_user' => array(
'type' =>
'integer:User:user/class/user.class.php:0:(t.statut:=:1)',
'label' =>
'Employee',
'enabled' => 1,
'position' => 55,
'notnull' => 1,
'visible' => 1,
'default' =>
'0',
'picto' =>
'user',
'css' =>
'maxwidth300 widthcentpercentminusxx',
'csslist' =>
'tdoverflowmax150'),
101 'fk_job' => array(
'type' =>
'integer:Job:/hrm/class/job.class.php',
'label' =>
'JobProfile',
'enabled' => 1,
'position' => 56,
'notnull' => 1,
'visible' => 1,
'picto' =>
'jobprofile',
'css' =>
'maxwidth300 widthcentpercentminusxx',
'csslist' =>
'tdoverflowmax150'),
102 'date_start' => array(
'type' =>
'date',
'label' =>
'DateStart',
'enabled' => 1,
'position' => 101,
'notnull' => 1,
'visible' => 1,),
103 'date_end' => array(
'type' =>
'date',
'label' =>
'DateEnd',
'enabled' => 1,
'position' => 102,
'notnull' => 0,
'visible' => 1,),
104 'description' => array(
'type' =>
'text',
'label' =>
'Description',
'enabled' => 1,
'position' => 120,
'notnull' => 0,
'visible' => 3,),
105 'abort_comment' => array(
'type' =>
'varchar(255)',
'label' =>
'AbandonmentComment',
'enabled' =>
'getDolGlobalInt("HRM_JOB_POSITON_ENDING_COMMENT")',
'position' => 502,
'notnull' => 0,
'visible' => 1,),
106 'note_public' => array(
'type' =>
'html',
'label' =>
'NotePublic',
'enabled' => 1,
'position' => 151,
'notnull' => 0,
'visible' => 0,),
107 'note_private' => array(
'type' =>
'html',
'label' =>
'NotePrivate',
'enabled' => 1,
'position' => 152,
'notnull' => 0,
'visible' => 0,),
108 'fk_user_creat' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'UserAuthor',
'enabled' => 1,
'position' => 510,
'notnull' => 1,
'visible' => -2,
'foreignkey' =>
'user.rowid',),
109 'fk_user_modif' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'UserModif',
'enabled' => 1,
'position' => 511,
'notnull' => -1,
'visible' => -2,),
146 public $abort_comment;
154 public $note_private;
158 public $fk_user_creat;
162 public $fk_user_modif;
214 $this->ismultientitymanaged = 0;
215 $this->isextrafieldmanaged = 0;
220 if (!
isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
221 $this->fields[
'entity'][
'enabled'] = 0;
231 foreach ($this->fields as $key => $val) {
232 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
233 unset($this->fields[$key]);
238 if (is_object($langs)) {
239 foreach ($this->fields as $key => $val) {
240 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
241 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
242 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
262 return $resultcreate;
274 global $langs, $extrafields;
284 $result =
$object->fetchCommon($fromid);
285 if ($result > 0 && !empty(
$object->table_element_line)) {
296 unset(
$object->user_ceation_id);
300 if (property_exists(
$object,
'ref')) {
301 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_" .
$object->ref : $this->fields[
'ref'][
'default'];
303 if (property_exists(
$object,
'status')) {
304 $object->status = self::STATUS_DRAFT;
306 if (property_exists(
$object,
'date_creation')) {
309 if (property_exists(
$object,
'date_modification')) {
310 $object->date_modification =
null;
314 if (is_array(
$object->array_options) && count(
$object->array_options) > 0) {
315 $extrafields->fetch_name_optionals_label($this->table_element);
316 foreach (
$object->array_options as $key => $option) {
317 $shortkey = preg_replace(
'/options_/',
'', $key);
318 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
320 unset(
$object->array_options[$key]);
326 $object->context[
'createfromclone'] =
'createfromclone';
327 $result =
$object->createCommon($user);
342 if (property_exists($this,
'fk_soc') && $this->fk_soc ==
$object->socid) {
349 unset(
$object->context[
'createfromclone']);
356 $this->db->rollback();
368 public function fetch($id, $ref =
null)
371 if ($result > 0 && !empty($this->table_element_line)) {
384 $this->lines = array();
403 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
411 $sql .=
' FROM ' . MAIN_DB_PREFIX . $this->table_element .
' as t';
412 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
413 $sql .=
' WHERE t.entity IN (' .
getEntity($this->element) .
')';
415 $sql .=
' WHERE 1 = 1';
422 $this->errors[] = $errormessage;
423 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
427 if (!empty($sortfield)) {
428 $sql .= $this->db->order($sortfield, $sortorder);
430 if (!empty($limit)) {
431 $sql .=
' ' . $this->db->plimit($limit, $offset);
434 $resql = $this->db->query($sql);
436 $num = $this->db->num_rows($resql);
438 while ($i < ($limit ? min($limit, $num) : $num)) {
439 $obj = $this->db->fetch_object($resql);
441 $record =
new self($this->db);
442 $record->setVarsFromFetchObj($obj);
444 $records[$record->id] = $record;
448 $this->db->free($resql);
452 $this->errors[] =
'Error ' . $this->db->lasterror();
453 dol_syslog(__METHOD__ .
' ' . implode(
',', $this->errors), LOG_ERR);
478 public function delete(
User $user, $notrigger = 0)
495 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
512 global $conf, $langs;
514 require_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
519 if ($this->
status == self::STATUS_VALIDATED) {
520 dol_syslog(get_class($this) .
"::validate action abandoned: already validated", LOG_WARNING);
537 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
540 $num = (string) $this->
ref;
542 $this->newref = $num;
546 $sql =
"UPDATE " . MAIN_DB_PREFIX . $this->table_element;
547 $sql .=
" SET ref = '" . $this->db->escape($num) .
"',";
548 $sql .=
" status = " . self::STATUS_VALIDATED;
549 if (!empty($this->fields[
'date_validation'])) {
550 $sql .=
", date_validation = '" . $this->db->idate($now) .
"'";
552 if (!empty($this->fields[
'fk_user_valid'])) {
553 $sql .=
", fk_user_valid = " . ((int) $user->id);
555 $sql .=
" WHERE rowid = " . ((int) $this->
id);
557 dol_syslog(get_class($this) .
"::validate()", LOG_DEBUG);
558 $resql = $this->db->query($sql);
561 $this->error = $this->db->lasterror();
565 if (!$error && !$notrigger) {
567 $result = $this->call_trigger(
'HRM_POSITION_VALIDATE', $user);
576 $this->oldref = $this->ref;
579 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
581 $sql =
'UPDATE ' . MAIN_DB_PREFIX .
"ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) .
"', SUBSTR(filename, " . (strlen($this->
ref) + 1) .
")), filepath = 'position/" . $this->db->escape($this->newref) .
"'";
582 $sql .=
" WHERE filename LIKE '" . $this->db->escape($this->
ref) .
"%' AND filepath = 'position/" . $this->db->escape($this->
ref) .
"' and entity = " . $conf->entity;
583 $resql = $this->db->query($sql);
586 $this->error = $this->db->lasterror();
588 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'position/".$this->db->escape($this->newref).
"'";
589 $sql .=
" WHERE filepath = 'position/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
590 $resql = $this->db->query($sql);
593 $this->error = $this->db->lasterror();
599 $dirsource = $conf->hrm->dir_output .
'/position/' . $oldref;
600 $dirdest = $conf->hrm->dir_output .
'/position/' . $newref;
601 if (!$error && file_exists($dirsource)) {
602 dol_syslog(get_class($this) .
"::validate() rename dir " . $dirsource .
" into " . $dirdest);
604 if (@rename($dirsource, $dirdest)) {
607 $listoffiles =
dol_dir_list($conf->hrm->dir_output .
'/position/' . $newref,
'files', 1,
'^' . preg_quote($oldref,
'/'));
608 foreach ($listoffiles as $fileentry) {
609 $dirsource = $fileentry[
'name'];
610 $dirdest = preg_replace(
'/^' . preg_quote($oldref,
'/') .
'/', $newref, $dirsource);
611 $dirsource = $fileentry[
'path'] .
'/' . $dirsource;
612 $dirdest = $fileentry[
'path'] .
'/' . $dirdest;
613 @rename($dirsource, $dirdest);
623 $this->
status = self::STATUS_VALIDATED;
630 $this->db->rollback();
646 if ($this->
status <= self::STATUS_DRAFT) {
657 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'POSITION_UNVALIDATE');
667 public function cancel($user, $notrigger = 0)
670 if ($this->
status != self::STATUS_VALIDATED) {
681 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'POSITION_CANCEL');
691 public function reopen($user, $notrigger = 0)
694 if ($this->
status != self::STATUS_CANCELED) {
705 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'POSITION_REOPEN');
718 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
720 global $conf, $langs, $hookmanager;
722 if (!empty($conf->dol_no_mouse_hover)) {
728 $label =
img_picto(
'', $this->picto) .
' <u>' . $langs->trans(
"Position") .
'</u>';
729 if (isset($this->
status)) {
733 $label .=
'<b>' . $langs->trans(
'Ref') .
':</b> ' . $this->ref;
735 $url =
dol_buildpath(
'/hrm/position_card.php', 1) .
'?id=' . $this->id;
737 if ($option !=
'nolink') {
739 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
740 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
741 $add_save_lastsearch_values = 1;
743 if ($add_save_lastsearch_values) {
744 $url .=
'&save_lastsearch_values=1';
749 if (empty($notooltip)) {
751 $label = $langs->trans(
"ShowPosition");
755 $linkclose .=
' class="classfortooltip' . ($morecss ?
' ' . $morecss :
'') .
'"';
757 $linkclose = ($morecss ?
' class="' . $morecss .
'"' :
'');
760 if ($option ==
'nolink') {
761 $linkstart =
'<span';
763 $linkstart =
'<a href="' . $url .
'"';
765 $linkstart .= $linkclose .
'>';
766 if ($option ==
'nolink') {
767 $linkend =
'</span>';
772 $result .= $linkstart;
774 if (empty($this->showphoto_on_popup)) {
776 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="' . (($withpicto != 2) ?
'paddingright ' :
'') .
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
780 require_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
782 list($class, $module) = explode(
'@', $this->picto);
785 $filename = $filearray[0][
'name'];
786 if (!empty($filename)) {
787 $pospoint = strpos($filearray[0][
'name'],
'.');
789 $pathtophoto = $class .
'/' . $this->
ref .
'/thumbs/' . substr($filename, 0, $pospoint) .
'_mini' . substr($filename, $pospoint);
790 if (!
getDolGlobalString(strtoupper($module .
'_' . $class) .
'_FORMATLISTPHOTOSASUSERS')) {
791 $result .=
'<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $module .
'" alt="No photo" border="0" src="' . DOL_URL_ROOT .
'/viewimage.php?modulepart=' . $module .
'&entity=' . $conf->entity .
'&file=' . urlencode($pathtophoto) .
'"></div></div>';
793 $result .=
'<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="' . DOL_URL_ROOT .
'/viewimage.php?modulepart=' . $module .
'&entity=' . $conf->entity .
'&file=' . urlencode($pathtophoto) .
'"></div>';
798 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="' . (($withpicto != 2) ?
'paddingright ' :
'') .
'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
803 if ($withpicto != 2) {
804 $result .= $this->ref;
810 global $action, $hookmanager;
811 $hookmanager->initHooks(array(
'positiondao'));
812 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
813 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
815 $result = $hookmanager->resPrint;
817 $result .= $hookmanager->resPrint;
846 if (is_null($status)) {
850 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
853 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
854 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
855 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
856 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
857 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
858 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
861 $statusType =
'status' . $status;
863 if ($status == self::STATUS_CANCELED) {
864 $statusType =
'status6';
867 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
884 public function showInputField($val, $key, $value, $moreparam =
'', $keysuffix =
'', $keyprefix =
'', $morecss = 0, $nonewbutton = 0)
888 if ($key ==
'fk_user') {
889 $vacantId = $keyprefix.$key.
'vacant'.$keysuffix;
891 $out = parent::showInputField(
null, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
892 $out .=
'<label class="nowrap position-fk-user classfortooltip" title="'.dol_escape_js($langs->trans(
'VacantCheckboxHelper')).
'"><input type="checkbox" id="'.$vacantId.
'" name="'.$vacantId.
'"> '.$langs->trans(
"Vacant").
'</label>'; ?>
893 <script
type=
"text/javascript">
894 $(document).ready(
function () {
895 var checkbox = $(
'#<?php print $vacantId; ?>');
896 var searchfkuser = $(
'#<?php print $keyprefix.$key.$keysuffix; ?>');
897 checkbox.click(
function () {
898 if (checkbox.prop(
'checked')) {
899 searchfkuser.val(0).trigger(
'change');
900 searchfkuser.prop(
'disabled', 1);
902 searchfkuser.prop(
'disabled', 0);
909 $out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
928 public function showOutputField($val, $key, $value, $moreparam =
'', $keysuffix =
'', $keyprefix =
'', $morecss =
'')
932 if ($key ==
'fk_user' && $this->fk_user == 0) {
933 return $langs->trans(
"VacantPosition");
935 return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
947 $sql =
'SELECT rowid, date_creation as datec, tms as datem,';
948 $sql .=
' fk_user_creat, fk_user_modif';
949 $sql .=
' FROM ' . MAIN_DB_PREFIX . $this->table_element .
' as t';
950 $sql .=
' WHERE t.rowid = ' . ((int) $id);
951 $result = $this->db->query($sql);
953 if ($this->db->num_rows($result)) {
954 $obj = $this->db->fetch_object($result);
956 $this->
id = $obj->rowid;
958 $this->user_creation_id = $obj->fk_user_creat;
959 $this->user_modification_id = $obj->fk_user_modif;
960 $this->date_creation = $this->db->jdate($obj->datec);
961 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
964 $this->db->free($result);
992 $this->lines = array();
995 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0,
'(fk_position:=:'.((
int) $this->
id).
')');
997 if (is_numeric($result)) {
1001 $this->lines = $result;
1002 return $this->lines;
1013 global $langs, $conf;
1014 $langs->load(
"hrm");
1017 $conf->global->hrm_POSITION_ADDON =
'mod_position_standard';
1027 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
1028 foreach ($dirmodels as $reldir) {
1032 $mybool = ((bool) @include_once $dir.$file) || $mybool;
1040 if (class_exists($classname)) {
1041 $obj =
new $classname();
1042 '@phan-var-force ModeleNumRefEvaluation $obj';
1043 $numref = $obj->getNextValue($this);
1045 if ($numref !=
'' && $numref !=
'-1') {
1048 $this->error = $obj->error;
1053 print $langs->trans(
"Error") .
" " . $langs->trans(
"ClassNotFound") .
' ' . $classname;
1057 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1070 $TPosition = array();
1072 $TPosition = $this->
fetchAll(
'ASC',
't.rowid', 0, 0,
'(fk_user:=:'.((
int) $userid).
')');
1088 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1090 global $conf, $langs;
1093 $includedocgeneration = 0;
1095 $langs->load(
"hrm");
1098 $modele =
'standard_position';
1100 if (!empty($this->model_pdf)) {
1101 $modele = $this->model_pdf;
1107 $modelpath =
"core/modules/hrm/doc/";
1109 if ($includedocgeneration && !empty($modele)) {
1110 $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1125 global $selected, $langs;
1127 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1129 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1130 $return .=
'<div class="info-box info-box-sm">';
1131 $return .=
'<span class="info-box-icon bg-infobox-action">';
1133 $return .=
'</span>';
1134 $return .=
'<div class="info-box-content">';
1135 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->
getNomUrl(1) : $this->ref).
'</span>';
1136 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1137 if (!empty($arraydata[
'user'])) {
1138 $return .=
'<br><span class="info-box-label ">'.$arraydata[
'user'].
'</span>';
1140 if (!empty($arraydata[
'job'])) {
1142 $return .=
'<br><span class="info-box-label ">'.$arraydata[
'job'].
'</span>';
1144 if (property_exists($this,
'date_start') && property_exists($this,
'date_end')) {
1145 $return .=
'<br><div class ="nothing"><span class="info-box-label ">'.dol_print_date($this->db->jdate($this->date_start),
'day').
'</span>';
1146 $return .=
' - <span class="info-box-label ">'.dol_print_date($this->db->jdate($this->date_end),
'day').
'</span></div>';
1148 $return .=
'</div>';
1149 $return .=
'</div>';
1150 $return .=
'</div>';
1156require_once DOL_DOCUMENT_ROOT .
'/core/class/commonobjectline.class.php';
1175 $this->isextrafieldmanaged = 0;
if(! $sortfield) if(! $sortorder) $object
Parent class of all other business classes (invoices, contracts, proposals, orders,...
deleteLineCommon(User $user, $idline, $notrigger=0)
Delete a line of object in database.
commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
Common function for all objects extending CommonObject for generating documents.
setErrorsFromObject($object)
setErrorsFromObject
createCommon(User $user, $notrigger=0)
Create object in the database.
getFieldList($alias='', $excludefields=array())
Function to concat keys of fields.
updateCommon(User $user, $notrigger=0)
Update object into database.
setStatusCommon($user, $status, $notrigger=0, $triggercode='')
Set to a status.
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
copy_linked_contact($objFrom, $source='internal')
Copy contact from one element to current.
fetchLinesCommon($morewhere='', $noextrafields=0)
Load object in memory from the database.
fetchCommon($id, $ref=null, $morewhere='', $noextrafields=0)
Load object in memory from the database.
deleteCommon(User $user, $notrigger=0, $forcechilddeletion=0)
Delete object in database.
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
Class to manage Dolibarr database access.
validate($user, $notrigger=0)
Validate object.
cancel($user, $notrigger=0)
Set cancel status.
info($id)
Load the info information in the object.
update(User $user, $notrigger=0)
Update object into database.
getLibStatut($mode=0)
Return the label of the status.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter='', $filtermode='AND')
Load list of objects in memory from the database.
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionally the picto)
getLinesArray()
Create an array of lines.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
setDraft($user, $notrigger=0)
Set draft status.
getKanbanView($option='', $arraydata=null)
Return clickable link of object (with eventually picto)
deleteLine(User $user, $idline, $notrigger=0)
Delete a line of object in database.
fetch($id, $ref=null)
Load object in memory from the database.
showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $morecss=0, $nonewbutton=0)
Return HTML string to put an input field into a page Code very similar with showInputField of extra f...
create(User $user, $notrigger=0)
Create object into database.
showOutputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $morecss='')
Return HTML string to show a field into a page Code very similar with showOutputField of extra fields...
LibStatut($status, $mode=0)
Return the status.
getForUser($userid)
getForUser
reopen($user, $notrigger=0)
Set back to validated status.
fetchLines()
Load object lines in memory from the database.
createFromClone(User $user, $fromid)
Clone an object into another one.
__construct(DoliDB $db)
Constructor.
__construct(DoliDB $db)
Constructor.
Class to manage Dolibarr users.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_now($mode='gmt')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0)
forgeSQLFromUniversalSearchCriteria
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...