26require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
38 public $module =
'bookcal';
43 public $element =
'availabilities';
48 public $table_element =
'bookcal_availabilities';
54 public $ismultientitymanaged = 0;
59 public $isextrafieldmanaged = 1;
64 public $picto =
'fa-file';
67 const STATUS_DRAFT = 0;
68 const STATUS_VALIDATED = 1;
69 const STATUS_CANCELED = 9;
104 public $fields=array(
105 'rowid' => array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>
'1',
'position'=>1,
'notnull'=>1,
'visible'=>0,
'noteditable'=>
'1',
'index'=>1,
'css'=>
'left',
'comment'=>
"Id"),
106 'ref' => array(
'type'=>
'varchar(128)',
'label'=>
'Ref',
'enabled'=>
'1',
'position'=>20,
'notnull'=>1,
'visible'=>1,
'index'=>1,
'searchall'=>1,
'showoncombobox'=>
'1',
'validate'=>
'1',
'comment'=>
"Reference of object"),
107 'label' => array(
'type'=>
'varchar(255)',
'label'=>
'Label',
'enabled'=>
'1',
'position'=>30,
'notnull'=>0,
'visible'=>1,
'searchall'=>1,
'css'=>
'minwidth300',
'cssview'=>
'wordbreak',
'help'=>
"Help text",
'showoncombobox'=>
'2',
'validate'=>
'1',),
108 'description' => array(
'type'=>
'text',
'label'=>
'Description',
'enabled'=>
'1',
'position'=>60,
'notnull'=>0,
'visible'=>3,
'validate'=>
'1',),
109 'note_public' => array(
'type'=>
'html',
'label'=>
'NotePublic',
'enabled'=>
'1',
'position'=>61,
'notnull'=>0,
'visible'=>0,
'cssview'=>
'wordbreak',
'validate'=>
'1',),
110 'note_private' => array(
'type'=>
'html',
'label'=>
'NotePrivate',
'enabled'=>
'1',
'position'=>62,
'notnull'=>0,
'visible'=>0,
'cssview'=>
'wordbreak',
'validate'=>
'1',),
111 'date_creation' => array(
'type'=>
'datetime',
'label'=>
'DateCreation',
'enabled'=>
'1',
'position'=>500,
'notnull'=>1,
'visible'=>-2,),
112 'tms' => array(
'type'=>
'timestamp',
'label'=>
'DateModification',
'enabled'=>
'1',
'position'=>501,
'notnull'=>0,
'visible'=>-2,),
113 'fk_user_creat' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserAuthor',
'picto'=>
'user',
'enabled'=>
'1',
'position'=>510,
'notnull'=>1,
'visible'=>-2,
'foreignkey'=>
'user.rowid',),
114 'fk_user_modif' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserModif',
'picto'=>
'user',
'enabled'=>
'1',
'position'=>511,
'notnull'=>-1,
'visible'=>-2,),
115 'last_main_doc' => array(
'type'=>
'varchar(255)',
'label'=>
'LastMainDoc',
'enabled'=>
'1',
'position'=>600,
'notnull'=>0,
'visible'=>0,),
116 'import_key' => array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>
'1',
'position'=>1000,
'notnull'=>-1,
'visible'=>-2,),
117 'model_pdf' => array(
'type'=>
'varchar(255)',
'label'=>
'Model pdf',
'enabled'=>
'1',
'position'=>1010,
'notnull'=>-1,
'visible'=>0,),
118 'status' => array(
'type'=>
'integer',
'label'=>
'Status',
'enabled'=>
'1',
'position'=>2000,
'notnull'=>1,
'visible'=>1,
'index'=>1,
'arrayofkeyval'=>array(
'0'=>
'Draft',
'1'=>
'Validated',
'9'=>
'Canceled'),
'validate'=>
'1',),
119 'start' => array(
'type'=>
'date',
'label'=>
'Start Date',
'enabled'=>
'1',
'position'=>40,
'notnull'=>1,
'visible'=>1,
'searchall'=>1),
120 'end' => array(
'type'=>
'date',
'label'=>
'End Date',
'enabled'=>
'1',
'position'=>45,
'notnull'=>1,
'visible'=>1,
'searchall'=>1),
121 'type' => array(
'type'=>
'integer',
'label'=>
'Type',
'enabled'=>
'1',
'position'=>49,
'notnull'=>1,
'visible'=>1,
'index'=>1,
'arrayofkeyval'=>array(
'0'=>
'Customer',
'1'=>
'Supplier',
'2'=>
'Else'),),
122 'duration' => array(
'type'=>
'integer',
'label'=>
'Duration',
'enabled'=>
'1',
'position'=>47,
'notnull'=>1,
'visible'=>1,
'default'=>
'30'),
123 'startHour' => array(
'type'=>
'integer',
'label'=>
'Start Hour',
'enabled'=>
'1',
'position'=>46,
'notnull'=>1,
'visible'=>-1,),
124 'endHour' => array(
'type'=>
'integer',
'label'=>
'End Hour',
'enabled'=>
'1',
'position'=>46.5,
'notnull'=>1,
'visible'=>-1,),
131 public $note_private;
132 public $date_creation;
134 public $fk_user_creat;
135 public $fk_user_modif;
136 public $last_main_doc;
192 global $conf, $langs;
196 if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields[
'rowid']) && !empty($this->fields[
'ref'])) {
197 $this->fields[
'rowid'][
'visible'] = 0;
199 if (empty($conf->multicompany->enabled) && isset($this->fields[
'entity'])) {
200 $this->fields[
'entity'][
'enabled'] = 0;
210 foreach ($this->fields as $key => $val) {
211 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
212 unset($this->fields[$key]);
217 if (is_object($langs)) {
218 foreach ($this->fields as $key => $val) {
219 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
220 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
221 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
241 return $resultcreate;
253 global $langs, $extrafields;
258 $object =
new self($this->db);
263 $result = $object->fetchCommon($fromid);
264 if ($result > 0 && !empty($object->table_element_line)) {
265 $object->fetchLines();
274 unset($object->fk_user_creat);
275 unset($object->import_key);
278 if (property_exists($object,
'ref')) {
279 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
281 if (property_exists($object,
'label')) {
282 $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".$object->label : $this->fields[
'label'][
'default'];
284 if (property_exists($object,
'status')) {
285 $object->status = self::STATUS_DRAFT;
287 if (property_exists($object,
'date_creation')) {
288 $object->date_creation =
dol_now();
290 if (property_exists($object,
'date_modification')) {
291 $object->date_modification =
null;
295 if (is_array($object->array_options) && count($object->array_options) > 0) {
296 $extrafields->fetch_name_optionals_label($this->table_element);
297 foreach ($object->array_options as $key => $option) {
298 $shortkey = preg_replace(
'/options_/',
'', $key);
299 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
302 unset($object->array_options[$key]);
308 $object->context[
'createfromclone'] =
'createfromclone';
309 $result = $object->createCommon($user);
312 $this->error = $object->error;
313 $this->errors = $object->errors;
325 if (!empty($object->socid) && property_exists($this,
'fk_soc') && $this->fk_soc == $object->socid) {
332 unset($object->context[
'createfromclone']);
339 $this->db->rollback();
351 public function fetch($id, $ref =
null)
354 if ($result > 0 && !empty($this->table_element_line)) {
367 $this->lines = array();
385 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
395 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
396 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
397 $sql .=
" WHERE t.entity IN (".getEntity($this->element).
")";
399 $sql .=
" WHERE 1 = 1";
403 if (count($filter) > 0) {
404 foreach ($filter as $key => $value) {
405 if ($key ==
't.rowid') {
406 $sqlwhere[] = $key.
" = ".((int) $value);
407 } elseif (in_array($this->fields[$key][
'type'], array(
'date',
'datetime',
'timestamp'))) {
408 $sqlwhere[] = $key.
" = '".$this->db->idate($value).
"'";
409 } elseif ($key ==
'customsql') {
410 $sqlwhere[] = $value;
411 } elseif (strpos($value,
'%') ===
false) {
412 $sqlwhere[] = $key.
" IN (".$this->db->sanitize($this->db->escape($value)).
")";
414 $sqlwhere[] = $key.
" LIKE '%".$this->db->escape($value).
"%'";
418 if (count($sqlwhere) > 0) {
419 $sql .=
" AND (".implode(
" ".$filtermode.
" ", $sqlwhere).
")";
422 if (!empty($sortfield)) {
423 $sql .= $this->db->order($sortfield, $sortorder);
425 if (!empty($limit)) {
426 $sql .= $this->db->plimit($limit, $offset);
429 $resql = $this->db->query($sql);
431 $num = $this->db->num_rows($resql);
433 while ($i < ($limit ? min($limit, $num) : $num)) {
434 $obj = $this->db->fetch_object($resql);
436 $record =
new self($this->db);
437 $record->setVarsFromFetchObj($obj);
439 $records[$record->id] = $record;
443 $this->db->free($resql);
447 $this->errors[] =
'Error '.$this->db->lasterror();
448 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
473 public function delete(
User $user, $notrigger =
false)
489 if ($this->status < 0) {
490 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
507 global $conf, $langs;
509 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
514 if ($this->status == self::STATUS_VALIDATED) {
515 dol_syslog(get_class($this).
"::validate action abandonned: already validated", LOG_WARNING);
532 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
537 $this->newref = $num;
541 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
542 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
543 $sql .=
" status = ".self::STATUS_VALIDATED;
544 if (!empty($this->fields[
'date_validation'])) {
545 $sql .=
", date_validation = '".$this->db->idate($now).
"'";
547 if (!empty($this->fields[
'fk_user_valid'])) {
548 $sql .=
", fk_user_valid = ".((int) $user->id);
550 $sql .=
" WHERE rowid = ".((int) $this->
id);
552 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
553 $resql = $this->db->query($sql);
556 $this->error = $this->db->lasterror();
560 if (!$error && !$notrigger) {
562 $result = $this->
call_trigger(
'AVAILABILITIES_VALIDATE', $user);
571 $this->oldref = $this->ref;
574 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
576 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filename = CONCAT('".$this->db->escape($this->newref).
"', SUBSTR(filename, ".(strlen($this->
ref) + 1).
")), filepath = 'availabilities/".$this->db->escape($this->newref).
"'";
577 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'availabilities/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
578 $resql = $this->db->query($sql);
580 $error++; $this->error = $this->db->lasterror();
582 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'availabilities/".$this->db->escape($this->newref).
"'";
583 $sql .=
" WHERE filepath = 'availabilities/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
584 $resql = $this->db->query($sql);
586 $error++; $this->error = $this->db->lasterror();
592 $dirsource = $conf->bookcal->dir_output.
'/availabilities/'.$oldref;
593 $dirdest = $conf->bookcal->dir_output.
'/availabilities/'.$newref;
594 if (!$error && file_exists($dirsource)) {
595 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
597 if (@rename($dirsource, $dirdest)) {
600 $listoffiles =
dol_dir_list($conf->bookcal->dir_output.
'/availabilities/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
601 foreach ($listoffiles as $fileentry) {
602 $dirsource = $fileentry[
'name'];
603 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
604 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
605 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
606 @rename($dirsource, $dirdest);
616 $this->status = self::STATUS_VALIDATED;
623 $this->db->rollback();
639 if ($this->status <= self::STATUS_DRAFT) {
650 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'AVAILABILITIES_UNVALIDATE');
660 public function cancel($user, $notrigger = 0)
663 if ($this->status != self::STATUS_VALIDATED) {
674 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'AVAILABILITIES_CANCEL');
684 public function reopen($user, $notrigger = 0)
687 if ($this->status != self::STATUS_CANCELED) {
698 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'AVAILABILITIES_REOPEN');
711 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
713 global $conf, $langs, $hookmanager;
715 if (!empty($conf->dol_no_mouse_hover)) {
721 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"Availabilities").
'</u>';
722 if (isset($this->status)) {
723 $label .=
' '.$this->getLibStatut(5);
726 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
728 $url =
dol_buildpath(
'/bookcal/availabilities_card.php', 1).
'?id='.$this->id;
730 if ($option !=
'nolink') {
732 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
733 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
734 $add_save_lastsearch_values = 1;
736 if ($url && $add_save_lastsearch_values) {
737 $url .=
'&save_lastsearch_values=1';
742 if (empty($notooltip)) {
743 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
744 $label = $langs->trans(
"ShowAvailabilities");
745 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
747 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
748 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
750 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
753 if ($option ==
'nolink' || empty($url)) {
754 $linkstart =
'<span';
756 $linkstart =
'<a href="'.$url.
'"';
758 $linkstart .= $linkclose.
'>';
759 if ($option ==
'nolink' || empty($url)) {
760 $linkend =
'</span>';
765 $result .= $linkstart;
767 if (empty($this->showphoto_on_popup)) {
769 $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);
773 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
775 list($class, $module) = explode(
'@', $this->picto);
778 $filename = $filearray[0][
'name'];
779 if (!empty($filename)) {
780 $pospoint = strpos($filearray[0][
'name'],
'.');
782 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
783 if (empty($conf->global->{strtoupper($module.
'_'.$class).
'_FORMATLISTPHOTOSASUSERS'})) {
784 $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>';
786 $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>';
791 $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);
796 if ($withpicto != 2) {
797 $result .= $this->ref;
803 global $action, $hookmanager;
804 $hookmanager->initHooks(array(
'availabilitiesdao'));
805 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
806 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
808 $result = $hookmanager->resPrint;
810 $result .= $hookmanager->resPrint;
824 return $this->LibStatut($this->status, $mode);
835 return $this->LibStatut($this->status, $mode);
849 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
852 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
853 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
854 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
855 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
856 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
857 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
860 $statusType =
'status'.$status;
862 if ($status == self::STATUS_CANCELED) {
863 $statusType =
'status6';
866 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
877 $sql =
"SELECT rowid,";
878 $sql .=
" date_creation as datec, tms as datem,";
879 $sql .=
" fk_user_creat, fk_user_modif";
880 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
881 $sql .=
" WHERE t.rowid = ".((int) $id);
883 $result = $this->db->query($sql);
885 if ($this->db->num_rows($result)) {
886 $obj = $this->db->fetch_object($result);
888 $this->
id = $obj->rowid;
890 $this->user_creation_id = $obj->fk_user_creat;
891 $this->user_modification_id = $obj->fk_user_modif;
892 if (!empty($obj->fk_user_valid)) {
893 $this->user_validation_id = $obj->fk_user_valid;
895 $this->date_creation = $this->db->jdate($obj->datec);
896 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
897 if (!empty($obj->datev)) {
898 $this->date_validation = empty($obj->datev) ?
'' : $this->db->jdate($obj->datev);
902 $this->db->free($result);
920 $this->initAsSpecimenCommon();
930 $this->lines = array();
933 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0, array(
'customsql'=>
'fk_availabilities = '.((
int) $this->
id)));
935 if (is_numeric($result)) {
936 $this->error = $objectline->error;
937 $this->errors = $objectline->errors;
940 $this->lines = $result;
952 global $langs, $conf;
953 $langs->load(
"agenda");
955 if (empty($conf->global->BOOKCAL_AVAILABILITIES_ADDON)) {
956 $conf->global->BOOKCAL_AVAILABILITIES_ADDON =
'mod_availabilities_standard';
959 if (!empty($conf->global->BOOKCAL_AVAILABILITIES_ADDON)) {
962 $file = $conf->global->BOOKCAL_AVAILABILITIES_ADDON.
".php";
963 $classname = $conf->global->BOOKCAL_AVAILABILITIES_ADDON;
966 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
967 foreach ($dirmodels as $reldir) {
971 $mybool |= @include_once $dir.$file;
974 if ($mybool ===
false) {
979 if (class_exists($classname)) {
980 $obj =
new $classname();
981 $numref = $obj->getNextValue($this);
983 if ($numref !=
'' && $numref !=
'-1') {
986 $this->error = $obj->error;
991 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
995 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1011 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1013 global $conf, $langs;
1016 $includedocgeneration = 0;
1018 $langs->load(
"agenda");
1021 $modele =
'standard_availabilities';
1023 if (!empty($this->model_pdf)) {
1024 $modele = $this->model_pdf;
1025 } elseif (!empty($conf->global->AVAILABILITIES_ADDON_PDF)) {
1026 $modele = $conf->global->AVAILABILITIES_ADDON_PDF;
1030 $modelpath =
"core/modules/bookcal/doc/";
1032 if ($includedocgeneration && !empty($modele)) {
1033 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1048 global $conf, $langs;
1064 $this->db->commit();
1071require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobjectline.class.php';
1084 public $isextrafieldmanaged = 0;
Class for Availabilities.
getLabelStatus($mode=0)
Return the label of the status.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter=array(), $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.
fetch($id, $ref=null)
Load object in memory from the database.
fetchLines()
Load object lines in memory from the database.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
deleteLine(User $user, $idline, $notrigger=false)
Delete a line of object in database.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
create(User $user, $notrigger=false)
Create object into database.
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
update(User $user, $notrigger=false)
Update object into database.
getLibStatut($mode=0)
Return the label of the status.
__construct(DoliDB $db)
Constructor.
LibStatut($status, $mode=0)
Return the status.
createFromClone(User $user, $fromid)
Clone an object into another one.
info($id)
Load the info information in the object.
setDraft($user, $notrigger=0)
Set draft status.
validate($user, $notrigger=0)
Validate object.
getLinesArray()
Create an array of lines.
cancel($user, $notrigger=0)
Set cancel status.
reopen($user, $notrigger=0)
Set back to validated status.
Class AvailabilitiesLine.
__construct(DoliDB $db)
Constructor.
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.
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
Class to manage Dolibarr database access.
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.
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.