27require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
39 public $module =
'timespent';
44 public $element =
'timespent';
49 public $table_element =
'element_time';
55 public $ismultientitymanaged = 0;
60 public $isextrafieldmanaged = 0;
65 public $picto =
'fa-file';
68 const STATUS_DRAFT = 0;
69 const STATUS_VALIDATED = 1;
70 const STATUS_CANCELED = 9;
116 public $fields=array(
117 'rowid' => array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>
'1',
'position'=>1,
'notnull'=>1,
'visible'=>0,
'noteditable'=>
'1',
'index'=>1,
'css'=>
'left',
'comment'=>
"Id"),
118 'tms' => array(
'type'=>
'timestamp',
'label'=>
'DateModification',
'enabled'=>
'1',
'position'=>17,
'notnull'=>0,
'visible'=>-2,),
119 'import_key' => array(
'type'=>
'varchar(14)',
'label'=>
'import_key',
'enabled'=>
'1',
'position'=>15,
'notnull'=>0,
'visible'=>-1,),
120 'fk_element' => array(
'type'=>
'integer',
'label'=>
'fk_element',
'enabled'=>
'1',
'position'=>2,
'notnull'=>1,
'visible'=>-1,),
121 'elementtype' => array(
'type'=>
'varchar(32)',
'label'=>
'elementtype',
'enabled'=>
'1',
'position'=>3,
'notnull'=>1,
'visible'=>-1,),
122 'element_date' => array(
'type'=>
'date',
'label'=>
'element_date',
'enabled'=>
'1',
'position'=>4,
'notnull'=>0,
'visible'=>-1,),
123 'element_datehour' => array(
'type'=>
'datetime',
'label'=>
'element_datehour',
'enabled'=>
'1',
'position'=>5,
'notnull'=>0,
'visible'=>-1,),
124 'element_date_withhour' => array(
'type'=>
'integer',
'label'=>
'element_date_withhour',
'enabled'=>
'1',
'position'=>6,
'notnull'=>0,
'visible'=>-1,),
125 'element_duration' => array(
'type'=>
'double',
'label'=>
'element_duration',
'enabled'=>
'1',
'position'=>7,
'notnull'=>0,
'visible'=>-1,),
126 'fk_product' => array(
'type'=>
'integer',
'label'=>
'fk_product',
'enabled'=>
'1',
'position'=>8,
'notnull'=>0,
'visible'=>-1,),
127 'fk_user' => array(
'type'=>
'integer',
'label'=>
'fk_user',
'enabled'=>
'1',
'position'=>9,
'notnull'=>0,
'visible'=>-1,),
128 'thm' => array(
'type'=>
'double(24,8)',
'label'=>
'thm',
'enabled'=>
'1',
'position'=>10,
'notnull'=>0,
'visible'=>-1,),
129 'invoice_id' => array(
'type'=>
'integer',
'label'=>
'invoice_id',
'enabled'=>
'1',
'position'=>11,
'notnull'=>0,
'visible'=>-1,
'default'=>
'NULL',),
130 'invoice_line_id' => array(
'type'=>
'integer',
'label'=>
'invoice_line_id',
'enabled'=>
'1',
'position'=>12,
'notnull'=>0,
'visible'=>-1,
'default'=>
'NULL',),
131 'intervention_id' => array(
'type'=>
'integer',
'label'=>
'intervention_id',
'enabled'=>
'1',
'position'=>13,
'notnull'=>0,
'visible'=>-1,
'default'=>
'NULL',),
132 'intervention_line_id' => array(
'type'=>
'integer',
'label'=>
'intervention_line_id',
'enabled'=>
'1',
'position'=>14,
'notnull'=>0,
'visible'=>-1,
'default'=>
'NULL',),
133 'datec' => array(
'type'=>
'datetime',
'label'=>
'datec',
'enabled'=>
'1',
'position'=>16,
'notnull'=>0,
'visible'=>-1,),
134 'note' => array(
'type'=>
'text',
'label'=>
'note',
'enabled'=>
'1',
'position'=>18,
'notnull'=>0,
'visible'=>-1,),
141 public $element_date;
142 public $element_datehour;
143 public $element_date_withhour;
144 public $element_duration;
149 public $invoice_line_id;
150 public $intervention_id;
151 public $intervention_line_id;
200 global $conf, $langs;
204 if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields[
'rowid']) && !empty($this->fields[
'ref'])) {
205 $this->fields[
'rowid'][
'visible'] = 0;
207 if (!isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
208 $this->fields[
'entity'][
'enabled'] = 0;
218 foreach ($this->fields as $key => $val) {
219 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
220 unset($this->fields[$key]);
225 if (is_object($langs)) {
226 foreach ($this->fields as $key => $val) {
227 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
228 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
229 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
249 return $resultcreate;
261 global $langs, $extrafields;
266 $object =
new self($this->db);
271 $result = $object->fetchCommon($fromid);
272 if ($result > 0 && !empty($object->table_element_line)) {
273 $object->fetchLines();
282 unset($object->fk_user_creat);
283 unset($object->import_key);
286 if (property_exists($object,
'ref')) {
287 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
289 if (property_exists($object,
'label')) {
290 $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".$object->label : $this->fields[
'label'][
'default'];
292 if (property_exists($object,
'status')) {
293 $object->status = self::STATUS_DRAFT;
295 if (property_exists($object,
'date_creation')) {
296 $object->date_creation =
dol_now();
298 if (property_exists($object,
'date_modification')) {
299 $object->date_modification =
null;
303 if (is_array($object->array_options) && count($object->array_options) > 0) {
304 $extrafields->fetch_name_optionals_label($this->table_element);
305 foreach ($object->array_options as $key => $option) {
306 $shortkey = preg_replace(
'/options_/',
'', $key);
307 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
310 unset($object->array_options[$key]);
316 $object->context[
'createfromclone'] =
'createfromclone';
317 $result = $object->createCommon($user);
320 $this->error = $object->error;
321 $this->errors = $object->errors;
333 if (!empty($object->socid) && property_exists($this,
'fk_soc') && $this->fk_soc == $object->socid) {
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();
393 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
403 $sql .=
" FROM ".$this->db->prefix().$this->table_element.
" as t";
404 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
405 $sql .=
" WHERE t.entity IN (".getEntity($this->element).
")";
407 $sql .=
" WHERE 1 = 1";
411 if (count($filter) > 0) {
412 foreach ($filter as $key => $value) {
413 if ($key ==
't.rowid') {
414 $sqlwhere[] = $key.
" = ".((int) $value);
415 } elseif (in_array($this->fields[$key][
'type'], array(
'date',
'datetime',
'timestamp'))) {
416 $sqlwhere[] = $key.
" = '".$this->db->idate($value).
"'";
417 } elseif ($key ==
'customsql') {
418 $sqlwhere[] = $value;
419 } elseif (strpos($value,
'%') ===
false) {
420 $sqlwhere[] = $key.
" IN (".$this->db->sanitize($this->db->escape($value)).
")";
422 $sqlwhere[] = $key.
" LIKE '%".$this->db->escape($value).
"%'";
426 if (count($sqlwhere) > 0) {
427 $sql .=
" AND (".implode(
" ".$filtermode.
" ", $sqlwhere).
")";
430 if (!empty($sortfield)) {
431 $sql .= $this->db->order($sortfield, $sortorder);
433 if (!empty($limit)) {
434 $sql .= $this->db->plimit($limit, $offset);
437 $resql = $this->db->query($sql);
439 $num = $this->db->num_rows($resql);
441 while ($i < ($limit ? min($limit, $num) : $num)) {
442 $obj = $this->db->fetch_object($resql);
444 $record =
new self($this->db);
445 $record->setVarsFromFetchObj($obj);
447 $records[$record->id] = $record;
451 $this->db->free($resql);
455 $this->errors[] =
'Error '.$this->db->lasterror();
456 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
481 public function delete(
User $user, $notrigger =
false)
497 if ($this->status < 0) {
498 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
515 global $conf, $langs;
517 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
522 if ($this->status == self::STATUS_VALIDATED) {
523 dol_syslog(get_class($this).
"::validate action abandonned: already validated", LOG_WARNING);
540 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
545 $this->newref = $num;
549 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
550 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
551 $sql .=
" status = ".self::STATUS_VALIDATED;
552 if (!empty($this->fields[
'date_validation'])) {
553 $sql .=
", date_validation = '".$this->db->idate($now).
"'";
555 if (!empty($this->fields[
'fk_user_valid'])) {
556 $sql .=
", fk_user_valid = ".((int) $user->id);
558 $sql .=
" WHERE rowid = ".((int) $this->
id);
560 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
561 $resql = $this->db->query($sql);
564 $this->error = $this->db->lasterror();
568 if (!$error && !$notrigger) {
570 $result = $this->
call_trigger(
'timespent_VALIDATE', $user);
579 $this->oldref = $this->ref;
582 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
584 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filename = CONCAT('".$this->db->escape($this->newref).
"', SUBSTR(filename, ".(strlen($this->
ref) + 1).
")), filepath = 'timespent/".$this->db->escape($this->newref).
"'";
585 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'timespent/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
586 $resql = $this->db->query($sql);
588 $error++; $this->error = $this->db->lasterror();
590 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'timespent/".$this->db->escape($this->newref).
"'";
591 $sql .=
" WHERE filepath = 'timespent/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
592 $resql = $this->db->query($sql);
594 $error++; $this->error = $this->db->lasterror();
600 $dirsource = $conf->timespent->dir_output.
'/timespent/'.$oldref;
601 $dirdest = $conf->timespent->dir_output.
'/timespent/'.$newref;
602 if (!$error && file_exists($dirsource)) {
603 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
605 if (@rename($dirsource, $dirdest)) {
608 $listoffiles =
dol_dir_list($conf->timespent->dir_output.
'/timespent/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
609 foreach ($listoffiles as $fileentry) {
610 $dirsource = $fileentry[
'name'];
611 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
612 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
613 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
614 @rename($dirsource, $dirdest);
624 $this->status = self::STATUS_VALIDATED;
631 $this->db->rollback();
647 if ($this->status <= self::STATUS_DRAFT) {
658 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'timespent_UNVALIDATE');
668 public function cancel($user, $notrigger = 0)
671 if ($this->status != self::STATUS_VALIDATED) {
682 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'timespent_CANCEL');
692 public function reopen($user, $notrigger = 0)
695 if ($this->status == self::STATUS_VALIDATED) {
706 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'timespent_REOPEN');
717 global $conf, $langs, $user;
721 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
722 return [
'optimize' => $langs->trans(
"ShowTimeSpent")];
724 $datas[
'picto'] =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"TimeSpent").
'</u>';
725 if (isset($this->status)) {
726 $datas[
'picto'] .=
' '.$this->getLibStatut(5);
728 $datas[
'ref'] .=
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
743 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
745 global $conf, $langs, $hookmanager;
747 if (!empty($conf->dol_no_mouse_hover)) {
754 'objecttype' => $this->element,
757 $classfortooltip =
'classfortooltip';
760 $classfortooltip =
'classforajaxtooltip';
761 $dataparams =
' data-params="'.dol_escape_htmltag(json_encode($params)).
'"';
767 $url =
dol_buildpath(
'/timespent/timespent_card.php', 1).
'?id='.$this->id;
769 if ($option !=
'nolink') {
771 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
772 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
773 $add_save_lastsearch_values = 1;
775 if ($url && $add_save_lastsearch_values) {
776 $url .=
'&save_lastsearch_values=1';
781 if (empty($notooltip)) {
782 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
783 $label = $langs->trans(
"ShowTimeSpent");
784 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
786 $linkclose .= ($label ?
' title="'.dol_escape_htmltag($label, 1).
'"' :
' title="tocomplete"');
787 $linkclose .= $dataparams.
' class="'.$classfortooltip.($morecss ?
' '.$morecss :
'').
'"';
789 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
792 if ($option ==
'nolink' || empty($url)) {
793 $linkstart =
'<span';
795 $linkstart =
'<a href="'.$url.
'"';
797 $linkstart .= $linkclose.
'>';
798 if ($option ==
'nolink' || empty($url)) {
799 $linkend =
'</span>';
804 $result .= $linkstart;
806 if (empty($this->showphoto_on_popup)) {
808 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') : $dataparams.
' class="'.(($withpicto != 2) ?
'paddingright ' :
'').$classfortooltip.
'"'), 0, 0, $notooltip ? 0 : 1);
812 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
814 list($class, $module) = explode(
'@', $this->picto);
817 $filename = $filearray[0][
'name'];
818 if (!empty($filename)) {
819 $pospoint = strpos($filearray[0][
'name'],
'.');
821 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
822 if (empty($conf->global->{strtoupper($module.
'_'.$class).
'_FORMATLISTPHOTOSASUSERS'})) {
823 $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>';
825 $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>';
830 $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);
835 if ($withpicto != 2) {
836 $result .= $this->ref;
842 global $action, $hookmanager;
843 $hookmanager->initHooks(array($this->element.
'dao'));
844 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
845 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
847 $result = $hookmanager->resPrint;
849 $result .= $hookmanager->resPrint;
864 global $conf, $langs;
868 $return =
'<div class="box-flex-item box-flex-grow-zero">';
869 $return .=
'<div class="info-box info-box-sm">';
870 $return .=
'<span class="info-box-icon bg-infobox-action">';
872 $return .=
'</span>';
873 $return .=
'<div class="info-box-content">';
874 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->getNomUrl() : $this->ref).
'</span>';
877 if (property_exists($this,
'label')) {
878 $return .=
' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.
'</div>';
880 if (property_exists($this,
'amount')) {
882 $return .=
'<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).
'</span>';
884 if (method_exists($this,
'getLibStatut')) {
885 $return .=
'<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).
'</div>';
902 return $this->LibStatut($this->status, $mode);
913 return $this->LibStatut($this->status, $mode);
927 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
930 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
931 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
932 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
933 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
934 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
935 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
938 $statusType =
'status'.$status;
940 if ($status == self::STATUS_CANCELED) {
941 $statusType =
'status6';
944 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
955 $sql =
"SELECT rowid,";
956 $sql .=
" date_creation as datec, tms as datem,";
957 $sql .=
" fk_user_creat, fk_user_modif";
958 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
959 $sql .=
" WHERE t.rowid = ".((int) $id);
961 $result = $this->db->query($sql);
963 if ($this->db->num_rows($result)) {
964 $obj = $this->db->fetch_object($result);
966 $this->
id = $obj->rowid;
968 $this->user_creation_id = $obj->fk_user_creat;
969 $this->user_modification_id = $obj->fk_user_modif;
970 if (!empty($obj->fk_user_valid)) {
971 $this->user_validation_id = $obj->fk_user_valid;
973 $this->date_creation = $this->db->jdate($obj->datec);
974 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
975 if (!empty($obj->datev)) {
976 $this->date_validation = empty($obj->datev) ?
'' : $this->db->jdate($obj->datev);
980 $this->db->free($result);
998 $this->initAsSpecimenCommon();
1008 $this->lines = array();
1010 $objectline =
new TimeSpentLine($this->db);
1011 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0, array(
'customsql'=>
'fk_timespent = '.((
int) $this->
id)));
1013 if (is_numeric($result)) {
1014 $this->error = $objectline->error;
1015 $this->errors = $objectline->errors;
1018 $this->lines = $result;
1019 return $this->lines;
1030 global $langs, $conf;
1031 $langs->load(
"timespent@timespent");
1033 if (empty($conf->global->TIMESPENT_timespent_ADDON)) {
1034 $conf->global->TIMESPENT_timespent_ADDON =
'mod_timespent_standard';
1037 if (!empty($conf->global->TIMESPENT_timespent_ADDON)) {
1040 $file = $conf->global->TIMESPENT_timespent_ADDON.
".php";
1041 $classname = $conf->global->TIMESPENT_timespent_ADDON;
1044 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
1045 foreach ($dirmodels as $reldir) {
1049 $mybool |= @include_once $dir.$file;
1052 if ($mybool ===
false) {
1057 if (class_exists($classname)) {
1058 $obj =
new $classname();
1059 $numref = $obj->getNextValue($this);
1061 if ($numref !=
'' && $numref !=
'-1') {
1064 $this->error = $obj->error;
1069 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
1073 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1089 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1091 global $conf, $langs;
1094 $includedocgeneration = 0;
1096 $langs->load(
"timespent@timespent");
1099 $modele =
'standard_timespent';
1101 if (!empty($this->model_pdf)) {
1102 $modele = $this->model_pdf;
1103 } elseif (!empty($conf->global->timespent_ADDON_PDF)) {
1104 $modele = $conf->global->timespent_ADDON_PDF;
1108 $modelpath =
"core/modules/timespent/doc/";
1110 if ($includedocgeneration && !empty($modele)) {
1111 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1142 $this->db->commit();
Parent class of all other business classes (invoices, contracts, proposals, orders,...
deleteLineCommon(User $user, $idline, $notrigger=false)
Delete a line of object in database.
fetchCommon($id, $ref=null, $morewhere='')
Load object in memory from the database.
createCommon(User $user, $notrigger=false)
Create object into database.
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
getFieldList($alias='', $excludefields=array())
Function to concat keys of fields.
setStatusCommon($user, $status, $notrigger=0, $triggercode='')
Set to a status.
copy_linked_contact($objFrom, $source='internal')
Copy contact from one element to current.
updateCommon(User $user, $notrigger=false)
Update object into database.
fetchLinesCommon($morewhere='')
Load object in memory from the database.
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage Dolibarr database access.
validate($user, $notrigger=0)
Validate object.
fetchLines()
Load object lines in memory from the database.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
fetch($id, $ref=null)
Load object in memory from the database.
setDraft($user, $notrigger=0)
Set draft status.
getTooltipContentArray($params)
getTooltipContentArray
cancel($user, $notrigger=0)
Set cancel status.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
deleteLine(User $user, $idline, $notrigger=false)
Delete a line of object in database.
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter=array(), $filtermode='AND')
Load list of objects in memory from the database.
getLabelStatus($mode=0)
Return the label of the status.
__construct(DoliDB $db)
Constructor.
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.
reopen($user, $notrigger=0)
Set back to validated status.
createFromClone(User $user, $fromid)
Clone an object into another one.
info($id)
Load the info information in the object.
LibStatut($status, $mode=0)
Return the status.
update(User $user, $notrigger=false)
Update object into database.
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module.
create(User $user, $notrigger=false)
Create object into database.
getKanbanView($option='', $arraydata=null)
Return a thumb for kanban views.
getLinesArray()
Create an array of lines.
Class to manage Dolibarr users.
dol_dir_list($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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.