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);
340 unset(
$object->context[
'createfromclone']);
347 $this->db->rollback();
359 public function fetch($id, $ref =
null)
362 if ($result > 0 && !empty($this->table_element_line)) {
375 $this->lines = array();
394 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
402 $sql .=
' FROM ' . MAIN_DB_PREFIX . $this->table_element .
' as t';
403 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
404 $sql .=
' WHERE t.entity IN (' .
getEntity($this->element) .
')';
406 $sql .=
' WHERE 1 = 1';
413 $this->errors[] = $errormessage;
414 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
418 if (!empty($sortfield)) {
419 $sql .= $this->db->order($sortfield, $sortorder);
421 if (!empty($limit)) {
422 $sql .=
' ' . $this->db->plimit($limit, $offset);
425 $resql = $this->db->query($sql);
427 $num = $this->db->num_rows($resql);
429 while ($i < ($limit ? min($limit, $num) : $num)) {
430 $obj = $this->db->fetch_object($resql);
432 $record =
new self($this->db);
433 $record->setVarsFromFetchObj($obj);
435 $records[$record->id] = $record;
439 $this->db->free($resql);
443 $this->errors[] =
'Error ' . $this->db->lasterror();
444 dol_syslog(__METHOD__ .
' ' . implode(
',', $this->errors), LOG_ERR);
469 public function delete(
User $user, $notrigger = 0)
486 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
503 global
$conf, $langs;
505 require_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
510 if ($this->
status == self::STATUS_VALIDATED) {
511 dol_syslog(get_class($this) .
"::validate action abandoned: already validated", LOG_WARNING);
528 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
531 $num = (string) $this->
ref;
533 $this->newref = $num;
537 $sql =
"UPDATE " . MAIN_DB_PREFIX . $this->table_element;
538 $sql .=
" SET ref = '" . $this->db->escape($num) .
"',";
539 $sql .=
" status = " . self::STATUS_VALIDATED;
540 if (!empty($this->fields[
'date_validation'])) {
541 $sql .=
", date_validation = '" . $this->db->idate($now) .
"'";
543 if (!empty($this->fields[
'fk_user_valid'])) {
544 $sql .=
", fk_user_valid = " . ((int) $user->id);
546 $sql .=
" WHERE rowid = " . ((int) $this->
id);
548 dol_syslog(get_class($this) .
"::validate()", LOG_DEBUG);
549 $resql = $this->db->query($sql);
551 dol_print_error($this->db);
552 $this->error = $this->db->lasterror();
556 if (!$error && !$notrigger) {
558 $result = $this->call_trigger(
'HRM_POSITION_VALIDATE', $user);
567 $this->oldref = $this->ref;
570 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
572 $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) .
"'";
573 $sql .=
" WHERE filename LIKE '" . $this->db->escape($this->
ref) .
"%' AND filepath = 'position/" . $this->db->escape($this->
ref) .
"' and entity = " . ((int)
$conf->entity);
574 $resql = $this->db->query($sql);
577 $this->error = $this->db->lasterror();
579 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'position/".$this->db->escape($this->newref).
"'";
580 $sql .=
" WHERE filepath = 'position/".$this->db->escape($this->
ref).
"' and entity = ".((int)
$conf->entity);
581 $resql = $this->db->query($sql);
584 $this->error = $this->db->lasterror();
590 $dirsource =
$conf->hrm->dir_output .
'/position/' . $oldref;
591 $dirdest =
$conf->hrm->dir_output .
'/position/' . $newref;
592 if (!$error && file_exists($dirsource)) {
593 dol_syslog(get_class($this) .
"::validate() rename dir " . $dirsource .
" into " . $dirdest);
595 if (@rename($dirsource, $dirdest)) {
598 $listoffiles =
dol_dir_list(
$conf->hrm->dir_output .
'/position/' . $newref,
'files', 1,
'^' . preg_quote($oldref,
'/'));
599 foreach ($listoffiles as $fileentry) {
600 $dirsource = $fileentry[
'name'];
601 $dirdest = preg_replace(
'/^' . preg_quote($oldref,
'/') .
'/', $newref, $dirsource);
602 $dirsource = $fileentry[
'path'] .
'/' . $dirsource;
603 $dirdest = $fileentry[
'path'] .
'/' . $dirdest;
604 @rename($dirsource, $dirdest);
614 $this->
status = self::STATUS_VALIDATED;
621 $this->db->rollback();
637 if ($this->
status <= self::STATUS_DRAFT) {
648 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'POSITION_UNVALIDATE');
658 public function cancel($user, $notrigger = 0)
661 if ($this->
status != self::STATUS_VALIDATED) {
672 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'POSITION_CANCEL');
682 public function reopen($user, $notrigger = 0)
685 if ($this->
status != self::STATUS_CANCELED) {
696 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'POSITION_REOPEN');
709 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
711 global
$conf, $langs, $hookmanager;
713 if (!empty(
$conf->dol_no_mouse_hover)) {
719 $label = img_picto(
'', $this->picto) .
' <u>' . $langs->trans(
"Position") .
'</u>';
720 if (isset($this->
status)) {
724 $label .=
'<b>' . $langs->trans(
'Ref') .
':</b> ' . $this->ref;
726 $url =
dol_buildpath(
'/hrm/position_card.php', 1) .
'?id=' . $this->id;
728 if ($option !=
'nolink') {
730 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
731 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
732 $add_save_lastsearch_values = 1;
734 if ($add_save_lastsearch_values) {
735 $url .=
'&save_lastsearch_values=1';
740 if (empty($notooltip)) {
742 $label = $langs->trans(
"ShowPosition");
746 $linkclose .=
' class="classfortooltip' . ($morecss ?
' ' . $morecss :
'') .
'"';
748 $linkclose = ($morecss ?
' class="' . $morecss .
'"' :
'');
751 if ($option ==
'nolink') {
752 $linkstart =
'<span';
754 $linkstart =
'<a href="' . $url .
'"';
756 $linkstart .= $linkclose .
'>';
757 if ($option ==
'nolink') {
758 $linkend =
'</span>';
763 $result .= $linkstart;
765 if (empty($this->showphoto_on_popup)) {
767 $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);
771 require_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
773 list($class, $module) = explode(
'@', $this->picto);
776 $filename = $filearray[0][
'name'];
777 if (!empty($filename)) {
778 $pospoint = strpos($filearray[0][
'name'],
'.');
780 $pathtophoto = $class .
'/' . $this->
ref .
'/thumbs/' .
dol_substr($filename, 0, $pospoint) .
'_mini' .
dol_substr($filename, $pospoint);
781 if (!
getDolGlobalString(strtoupper($module .
'_' . $class) .
'_FORMATLISTPHOTOSASUSERS')) {
782 $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>';
784 $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>';
789 $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);
794 if ($withpicto != 2) {
795 $result .= $this->ref;
801 global $action, $hookmanager;
802 $hookmanager->initHooks(array(
'positiondao'));
803 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
804 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
806 $result = $hookmanager->resPrint;
808 $result .= $hookmanager->resPrint;
837 if (is_null($status)) {
841 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
844 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
845 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
846 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
847 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
848 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
849 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
852 $statusType =
'status' . $status;
854 if ($status == self::STATUS_CANCELED) {
855 $statusType =
'status6';
858 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
875 public function showInputField($val, $key, $value, $moreparam =
'', $keysuffix =
'', $keyprefix =
'', $morecss = 0, $nonewbutton = 0)
879 if ($key ==
'fk_user') {
880 $vacantId = $keyprefix.$key.
'vacant'.$keysuffix;
882 $out = parent::showInputField(
null, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
883 $out .=
'<label class="nowrap position-fk-user classfortooltip" title="'.dolPrintHTMLForAttribute($langs->trans(
'VacantCheckboxHelper')).
'"><input type="checkbox" id="'.$vacantId.
'" name="'.$vacantId.
'"> '.$langs->trans(
"Vacant").
'</label>'; ?>
884 <script
type=
"text/javascript">
885 $(document).ready(
function () {
886 var checkbox = $(
'#<?php print $vacantId; ?>');
887 var searchfkuser = $(
'#<?php print $keyprefix.$key.$keysuffix; ?>');
888 checkbox.click(
function () {
889 if (checkbox.prop(
'checked')) {
890 searchfkuser.val(0).trigger(
'change');
891 searchfkuser.prop(
'disabled', 1);
893 searchfkuser.prop(
'disabled', 0);
900 $out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
919 public function showOutputField($val, $key, $value, $moreparam =
'', $keysuffix =
'', $keyprefix =
'', $morecss =
'')
923 if ($key ==
'fk_user' && $this->fk_user == 0) {
924 return $langs->trans(
"VacantPosition");
926 return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss);
938 $sql =
'SELECT rowid, date_creation as datec, tms as datem,';
939 $sql .=
' fk_user_creat, fk_user_modif';
940 $sql .=
' FROM ' . MAIN_DB_PREFIX . $this->table_element .
' as t';
941 $sql .=
' WHERE t.rowid = ' . ((int) $id);
942 $result = $this->db->query($sql);
944 if ($this->db->num_rows($result)) {
945 $obj = $this->db->fetch_object($result);
947 $this->
id = $obj->rowid;
949 $this->user_creation_id = $obj->fk_user_creat;
950 $this->user_modification_id = $obj->fk_user_modif;
951 $this->date_creation = $this->db->jdate($obj->datec);
952 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
955 $this->db->free($result);
957 dol_print_error($this->db);
983 $this->lines = array();
986 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0,
'(fk_position:=:'.((
int) $this->
id).
')');
988 if (is_numeric($result)) {
992 $this->lines = $result;
1004 global $langs,
$conf;
1005 $langs->load(
"hrm");
1008 $conf->global->hrm_POSITION_ADDON =
'mod_position_standard';
1018 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
1019 foreach ($dirmodels as $reldir) {
1023 $mybool = ((bool) @include_once $dir.$file) || $mybool;
1027 dol_print_error(
null,
"Failed to include file " . $file);
1031 if (class_exists($classname)) {
1032 $obj =
new $classname();
1033 '@phan-var-force ModeleNumRefEvaluation $obj';
1034 $numref = $obj->getNextValue($this);
1036 if ($numref !=
'' && $numref !=
'-1') {
1039 $this->error = $obj->error;
1044 print $langs->trans(
"Error") .
" " . $langs->trans(
"ClassNotFound") .
' ' . $classname;
1048 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1061 $TPosition = array();
1063 $TPosition = $this->
fetchAll(
'ASC',
't.rowid', 0, 0,
'(fk_user:=:'.((
int) $userid).
')');
1079 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1081 global
$conf, $langs;
1084 $includedocgeneration = 0;
1086 $langs->load(
"hrm");
1089 $modele =
'standard_position';
1091 if (!empty($this->model_pdf)) {
1092 $modele = $this->model_pdf;
1098 $modelpath =
"core/modules/hrm/doc/";
1100 if ($includedocgeneration && !empty($modele)) {
1101 $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1116 global $selected, $langs;
1118 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1120 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1121 $return .=
'<div class="info-box info-box-sm">';
1122 $return .=
'<span class="info-box-icon bg-infobox-action">';
1123 $return .= img_picto(
'', $this->picto);
1124 $return .=
'</span>';
1125 $return .=
'<div class="info-box-content">';
1126 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->
getNomUrl(1) : $this->ref).
'</span>';
1127 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1128 if (!empty($arraydata[
'user'])) {
1129 $return .=
'<br><span class="info-box-label ">'.$arraydata[
'user'].
'</span>';
1131 if (!empty($arraydata[
'job'])) {
1133 $return .=
'<br><span class="info-box-label ">'.$arraydata[
'job'].
'</span>';
1135 if (property_exists($this,
'date_start') && property_exists($this,
'date_end')) {
1136 $return .=
'<br><div class ="nothing"><span class="info-box-label ">'.dol_print_date($this->db->jdate($this->date_start),
'day').
'</span>';
1137 $return .=
' - <span class="info-box-label ">'.dol_print_date($this->db->jdate($this->date_end),
'day').
'</span></div>';
1139 $return .=
'</div>';
1140 $return .=
'</div>';
1141 $return .=
'</div>';
1147require_once DOL_DOCUMENT_ROOT .
'/core/class/commonobjectline.class.php';
1166 $this->isextrafieldmanaged = 0;
if(! $sortfield) if(! $sortorder) $object
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0, $forbiddenfields=array())
forgeSQLFromUniversalSearchCriteria
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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)