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;
115 public $fields=array(
116 'rowid' => array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>
'1',
'position'=>1,
'notnull'=>1,
'visible'=>2,
'noteditable'=>
'1',
'index'=>1,
'css'=>
'left',
'comment'=>
"Id"),
117 'label' => array(
'type'=>
'varchar(255)',
'label'=>
'Label',
'enabled'=>
'1',
'position'=>20,
'notnull'=>0,
'visible'=>1,
'searchall'=>1,
'css'=>
'minwidth300',
'csslist'=>
'tdoverflowmax150',
'cssview'=>
'wordbreak',
'help'=>
"BookcalLabelAvailabilityHelp",
'showoncombobox'=>
'2',
'validate'=>
'1',),
118 'fk_bookcal_calendar' => array(
'type'=>
'integer:Calendar:bookcal/class/calendar.class.php:1',
'label'=>
'Calendar',
'enabled'=>
'1',
'position'=>25,
'notnull'=>1,
'visible'=>1,
'css'=>
'maxwidth500 widthcentpercentminusxx',
'csslist'=>
'tdoverflowmax100'),
119 'description' => array(
'type'=>
'text',
'label'=>
'Description',
'enabled'=>
'1',
'position'=>60,
'notnull'=>0,
'visible'=>3,
'validate'=>
'1',),
120 'note_public' => array(
'type'=>
'html',
'label'=>
'NotePublic',
'enabled'=>
'1',
'position'=>61,
'notnull'=>0,
'visible'=>0,
'cssview'=>
'wordbreak',
'validate'=>
'1',),
121 'note_private' => array(
'type'=>
'html',
'label'=>
'NotePrivate',
'enabled'=>
'1',
'position'=>62,
'notnull'=>0,
'visible'=>0,
'cssview'=>
'wordbreak',
'validate'=>
'1',),
122 'date_creation' => array(
'type'=>
'datetime',
'label'=>
'DateCreation',
'enabled'=>
'1',
'position'=>500,
'notnull'=>1,
'visible'=>-2,),
123 'tms' => array(
'type'=>
'timestamp',
'label'=>
'DateModification',
'enabled'=>
'1',
'position'=>501,
'notnull'=>0,
'visible'=>-2,),
124 'fk_user_creat' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserAuthor',
'picto'=>
'user',
'enabled'=>
'1',
'position'=>510,
'notnull'=>1,
'visible'=>-2,
'css'=>
'maxwidth500 widthcentpercentminusxx',
'csslist'=>
'tdoverflowmax150'),
125 'fk_user_modif' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserModif',
'picto'=>
'user',
'enabled'=>
'1',
'position'=>511,
'notnull'=>-1,
'visible'=>-2,
'css'=>
'maxwidth500 widthcentpercentminusxx',
'csslist'=>
'tdoverflowmax150'),
126 'last_main_doc' => array(
'type'=>
'varchar(255)',
'label'=>
'LastMainDoc',
'enabled'=>
'1',
'position'=>600,
'notnull'=>0,
'visible'=>0,),
127 'import_key' => array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>
'1',
'position'=>1000,
'notnull'=>-1,
'visible'=>-2,),
128 'model_pdf' => array(
'type'=>
'varchar(255)',
'label'=>
'Model pdf',
'enabled'=>
'1',
'position'=>1010,
'notnull'=>-1,
'visible'=>0,),
129 'start' => array(
'type'=>
'date',
'label'=>
'Start Date',
'enabled'=>
'1',
'position'=>40,
'notnull'=>1,
'visible'=>1,
'searchall'=>1,),
130 'end' => array(
'type'=>
'date',
'label'=>
'End Date',
'enabled'=>
'1',
'position'=>45,
'notnull'=>1,
'visible'=>1,
'searchall'=>1,),
131 'duration' => array(
'type'=>
'integer',
'label'=>
'DurationOfRange',
'enabled'=>
'1',
'position'=>47,
'notnull'=>1,
'visible'=>1,
'default'=>
'30',
'css'=>
'width50 right'),
132 'startHour' => array(
'type'=>
'integer',
'label'=>
'Start Hour',
'enabled'=>
'1',
'position'=>46,
'notnull'=>1,
'visible'=>1,),
133 'endHour' => array(
'type'=>
'integer',
'label'=>
'End Hour',
'enabled'=>
'1',
'position'=>46.5,
'notnull'=>1,
'visible'=>1,),
134 'status' => array(
'type'=>
'integer',
'label'=>
'Status',
'enabled'=>
'1',
'position'=>2000,
'notnull'=>1,
'visible'=>1,
'index'=>1,
'arrayofkeyval'=>array(
'0'=>
'Draft',
'1'=>
'Validated',
'9'=>
'Closed'),
'default'=>1,
'validate'=>
'1'),
140 public $note_private;
141 public $date_creation;
143 public $fk_user_creat;
144 public $fk_user_modif;
145 public $last_main_doc;
154 public $fk_bookcal_calendar;
201 global $conf, $langs;
205 if (!
getDolGlobalString(
'MAIN_SHOW_TECHNICAL_ID') && isset($this->fields[
'rowid']) && !empty($this->fields[
'ref'])) {
206 $this->fields[
'rowid'][
'visible'] = 0;
208 if (empty($conf->multicompany->enabled) && isset($this->fields[
'entity'])) {
209 $this->fields[
'entity'][
'enabled'] = 0;
219 foreach ($this->fields as $key => $val) {
220 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
221 unset($this->fields[$key]);
226 if (is_object($langs)) {
227 foreach ($this->fields as $key => $val) {
228 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
229 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
230 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
250 return $resultcreate;
262 global $langs, $extrafields;
267 $object =
new self($this->db);
272 $result = $object->fetchCommon($fromid);
273 if ($result > 0 && !empty($object->table_element_line)) {
274 $object->fetchLines();
283 unset($object->fk_user_creat);
284 unset($object->import_key);
287 if (property_exists($object,
'ref')) {
288 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
290 if (property_exists($object,
'label')) {
291 $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".$object->label : $this->fields[
'label'][
'default'];
293 if (property_exists($object,
'status')) {
294 $object->status = self::STATUS_DRAFT;
296 if (property_exists($object,
'date_creation')) {
297 $object->date_creation =
dol_now();
299 if (property_exists($object,
'date_modification')) {
300 $object->date_modification =
null;
304 if (is_array($object->array_options) && count($object->array_options) > 0) {
305 $extrafields->fetch_name_optionals_label($this->table_element);
306 foreach ($object->array_options as $key => $option) {
307 $shortkey = preg_replace(
'/options_/',
'', $key);
308 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
311 unset($object->array_options[$key]);
317 $object->context[
'createfromclone'] =
'createfromclone';
318 $result = $object->createCommon($user);
321 $this->error = $object->error;
322 $this->errors = $object->errors;
334 if (!empty($object->socid) && property_exists($this,
'fk_soc') && $this->fk_soc == $object->socid) {
341 unset($object->context[
'createfromclone']);
348 $this->db->rollback();
360 public function fetch($id, $ref =
null)
363 if ($result > 0 && !empty($this->table_element_line)) {
376 $this->lines = array();
394 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
404 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
405 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
406 $sql .=
" WHERE t.entity IN (".getEntity($this->element).
")";
408 $sql .=
" WHERE 1 = 1";
412 if (count($filter) > 0) {
413 foreach ($filter as $key => $value) {
414 if ($key ==
't.rowid') {
415 $sqlwhere[] = $key.
" = ".((int) $value);
416 } elseif (array_key_exists($key, $this->fields) && in_array($this->fields[$key][
'type'], array(
'date',
'datetime',
'timestamp'))) {
417 $sqlwhere[] = $key.
" = '".$this->db->idate($value).
"'";
418 } elseif ($key ==
'customsql') {
419 $sqlwhere[] = $value;
420 } elseif (strpos($value,
'%') ===
false) {
421 $sqlwhere[] = $key.
" IN (".$this->db->sanitize($this->db->escape($value)).
")";
423 $sqlwhere[] = $key.
" LIKE '%".$this->db->escape($value).
"%'";
427 if (count($sqlwhere) > 0) {
428 $sql .=
" AND (".implode(
" ".$filtermode.
" ", $sqlwhere).
")";
431 if (!empty($sortfield)) {
432 $sql .= $this->db->order($sortfield, $sortorder);
434 if (!empty($limit)) {
435 $sql .= $this->db->plimit($limit, $offset);
438 $resql = $this->db->query($sql);
440 $num = $this->db->num_rows($resql);
442 while ($i < ($limit ? min($limit, $num) : $num)) {
443 $obj = $this->db->fetch_object($resql);
445 $record =
new self($this->db);
446 $record->setVarsFromFetchObj($obj);
448 $records[$record->id] = $record;
452 $this->db->free($resql);
456 $this->errors[] =
'Error '.$this->db->lasterror();
457 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
482 public function delete(
User $user, $notrigger =
false)
499 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
516 global $conf, $langs;
518 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
523 if ($this->
status == self::STATUS_VALIDATED) {
524 dol_syslog(get_class($this).
"::validate action abandonned: already validated", LOG_WARNING);
541 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
546 $this->newref = $num;
550 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
551 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
552 $sql .=
" status = ".self::STATUS_VALIDATED;
553 if (!empty($this->fields[
'date_validation'])) {
554 $sql .=
", date_validation = '".$this->db->idate($now).
"'";
556 if (!empty($this->fields[
'fk_user_valid'])) {
557 $sql .=
", fk_user_valid = ".((int) $user->id);
559 $sql .=
" WHERE rowid = ".((int) $this->
id);
561 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
562 $resql = $this->db->query($sql);
565 $this->error = $this->db->lasterror();
569 if (!$error && !$notrigger) {
571 $result = $this->
call_trigger(
'AVAILABILITIES_VALIDATE', $user);
580 $this->oldref = $this->ref;
583 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
585 $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).
"'";
586 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'availabilities/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
587 $resql = $this->db->query($sql);
590 $this->error = $this->db->lasterror();
592 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'availabilities/".$this->db->escape($this->newref).
"'";
593 $sql .=
" WHERE filepath = 'availabilities/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
594 $resql = $this->db->query($sql);
597 $this->error = $this->db->lasterror();
603 $dirsource = $conf->bookcal->dir_output.
'/availabilities/'.$oldref;
604 $dirdest = $conf->bookcal->dir_output.
'/availabilities/'.$newref;
605 if (!$error && file_exists($dirsource)) {
606 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
608 if (@rename($dirsource, $dirdest)) {
611 $listoffiles =
dol_dir_list($conf->bookcal->dir_output.
'/availabilities/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
612 foreach ($listoffiles as $fileentry) {
613 $dirsource = $fileentry[
'name'];
614 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
615 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
616 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
617 @rename($dirsource, $dirdest);
627 $this->
status = self::STATUS_VALIDATED;
634 $this->db->rollback();
650 if ($this->
status <= self::STATUS_DRAFT) {
661 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'AVAILABILITIES_UNVALIDATE');
671 public function cancel($user, $notrigger = 0)
674 if ($this->
status != self::STATUS_VALIDATED) {
685 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'AVAILABILITIES_CANCEL');
695 public function reopen($user, $notrigger = 0)
698 if ($this->
status != self::STATUS_CANCELED) {
709 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'AVAILABILITIES_REOPEN');
722 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
724 global $conf, $langs, $hookmanager;
726 if (!empty($conf->dol_no_mouse_hover)) {
732 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"Availabilities").
'</u>';
733 if (isset($this->
status)) {
734 $label .=
' '.$this->getLibStatut(5);
737 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
739 $url =
dol_buildpath(
'/bookcal/availabilities_card.php', 1).
'?id='.$this->id;
741 if ($option !=
'nolink') {
743 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
744 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
745 $add_save_lastsearch_values = 1;
747 if ($url && $add_save_lastsearch_values) {
748 $url .=
'&save_lastsearch_values=1';
753 if (empty($notooltip)) {
755 $label = $langs->trans(
"ShowAvailabilities");
756 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
758 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
759 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
761 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
764 if ($option ==
'nolink' || empty($url)) {
765 $linkstart =
'<span';
767 $linkstart =
'<a href="'.$url.
'"';
769 $linkstart .= $linkclose.
'>';
770 if ($option ==
'nolink' || empty($url)) {
771 $linkend =
'</span>';
776 $result .= $linkstart;
778 if (empty($this->showphoto_on_popup)) {
780 $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);
784 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
786 list($class, $module) = explode(
'@', $this->picto);
789 $filename = $filearray[0][
'name'];
790 if (!empty($filename)) {
791 $pospoint = strpos($filearray[0][
'name'],
'.');
793 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
795 $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>';
797 $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>';
802 $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);
807 if ($withpicto != 2) {
808 $result .= $this->ref;
814 global $action, $hookmanager;
815 $hookmanager->initHooks(array(
'availabilitiesdao'));
816 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
817 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
819 $result = $hookmanager->resPrint;
821 $result .= $hookmanager->resPrint;
836 global $conf, $langs;
838 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
840 $return =
'<div class="box-flex-item box-flex-grow-zero">';
841 $return .=
'<div class="info-box info-box-sm">';
842 $return .=
'<span class="info-box-icon bg-infobox-action">';
844 $return .=
'</span>';
845 $return .=
'<div class="info-box-content">';
846 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->
getNomUrl() : $this->ref).
'</span>';
847 if ($selected >= 0) {
848 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
850 if (property_exists($this,
'label')) {
851 $return .=
' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.
'</div>';
853 if (property_exists($this,
'amount')) {
855 $return .=
'<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).
'</span>';
857 if (method_exists($this,
'getLibStatut')) {
858 $return .=
'<br><div class="info-box-status">'.$this->getLibStatut(3).
'</div>';
900 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
903 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
904 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
905 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
906 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
907 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
908 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
911 $statusType =
'status'.$status;
912 if ($status == self::STATUS_VALIDATED) {
913 $statusType =
'status4';
915 if ($status == self::STATUS_CANCELED) {
916 $statusType =
'status6';
919 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
930 $sql =
"SELECT rowid,";
931 $sql .=
" date_creation as datec, tms as datem,";
932 $sql .=
" fk_user_creat, fk_user_modif";
933 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
934 $sql .=
" WHERE t.rowid = ".((int) $id);
936 $result = $this->db->query($sql);
938 if ($this->db->num_rows($result)) {
939 $obj = $this->db->fetch_object($result);
941 $this->
id = $obj->rowid;
943 $this->user_creation_id = $obj->fk_user_creat;
944 $this->user_modification_id = $obj->fk_user_modif;
945 $this->date_creation = $this->db->jdate($obj->datec);
946 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
949 $this->db->free($result);
977 $this->lines = array();
980 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0, array(
'customsql'=>
'fk_availabilities = '.((
int) $this->
id)));
982 if (is_numeric($result)) {
983 $this->error = $objectline->error;
984 $this->errors = $objectline->errors;
987 $this->lines = $result;
999 global $langs, $conf;
1000 $langs->load(
"agenda");
1003 $conf->global->BOOKCAL_AVAILABILITIES_ADDON =
'mod_availabilities_standard';
1010 $classname = $conf->global->BOOKCAL_AVAILABILITIES_ADDON;
1013 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
1014 foreach ($dirmodels as $reldir) {
1018 $mybool |= @include_once $dir.$file;
1021 if ($mybool ===
false) {
1026 if (class_exists($classname)) {
1027 $obj =
new $classname();
1028 $numref = $obj->getNextValue($this);
1030 if ($numref !=
'' && $numref !=
'-1') {
1033 $this->error = $obj->error;
1038 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
1042 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1058 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1060 global $conf, $langs;
1063 $includedocgeneration = 0;
1065 $langs->load(
"agenda");
1068 $modele =
'standard_availabilities';
1070 if (!empty($this->model_pdf)) {
1071 $modele = $this->model_pdf;
1073 $modele = $conf->global->AVAILABILITIES_ADDON_PDF;
1077 $modelpath =
"core/modules/bookcal/doc/";
1079 if ($includedocgeneration && !empty($modele)) {
1080 $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1095 global $conf, $langs;
1111 $this->db->commit();
1118require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobjectline.class.php';
1131 public $isextrafieldmanaged = 0;
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
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.
getKanbanView($option='', $arraydata=null)
Return a thumb for kanban views.
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,...
commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
Common function for all objects extending CommonObject for generating documents.
deleteLineCommon(User $user, $idline, $notrigger=false)
Delete a line of object in 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.
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.
updateCommon(User $user, $notrigger=false)
Update object into database.
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.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.