28require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
40 public $module =
'webhook';
45 public $element =
'target';
50 public $table_element =
'webhook_target';
55 public $picto =
'webhook';
58 const STATUS_DRAFT = 0;
59 const STATUS_VALIDATED = 1;
60 const STATUS_AUTOMATIC_TRIGGER = 1;
61 const STATUS_MANUAL_TRIGGER = 2;
62 const STATUS_CANCELED = 9;
64 const TYPE_BLOCKING = 0;
65 const TYPE_NO_BLOCKING = 1;
100 public $fields = array(
101 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'position' => 1,
'notnull' => 1,
'visible' => 0,
'noteditable' => 1,
'index' => 1,
'css' =>
'left',
'comment' =>
"Id"),
102 'ref' => array(
'type' =>
'varchar(128)',
'label' =>
'Ref',
'enabled' => 1,
'position' => 20,
'notnull' => 1,
'visible' => 4,
'noteditable' => 1,
'index' => 1,
'searchall' => 1,
'validate' => 1,
'comment' =>
"Reference of object"),
103 'label' => array(
'type' =>
'varchar(255)',
'label' =>
'Label',
'enabled' => 1,
'position' => 30,
'notnull' => 1,
'visible' => 1,
'searchall' => 1,
'css' =>
'minwidth300',
'cssview' =>
'wordbreak',
'csslist' =>
'tdoverflowmax150',
'showoncombobox' => 2,
'validate' => 1,
'autofocusoncreate' => 1),
104 'type' => array(
'type' =>
'select',
'label' =>
'Type',
'enabled' => 1,
'position' => 40,
'notnull' => 1,
'default' =>
'0',
'visible' => 1,
'index' => 1,
'arrayofkeyval' => array(
'0' =>
'TypeSuccessRequired',
'1' =>
'TypeSuccessOrError'),
'css' =>
'minwidth200',
'help' =>
'WebhookTargetTypeHelp',
'validate' => 1),
105 'trigger_codes' => array(
'type' =>
'text',
'label' =>
'TriggerCodes',
'enabled' => 1,
'position' => 50,
'notnull' => 1,
'visible' => 1,
'help' =>
"TriggerCodeInfo",
'tdcss' =>
'titlefieldmiddle',
'csslist' =>
'tdoverflowmax200',
'css' =>
'minwidth400',
'arrayofkeyval' => array(
'defined_in_constructor' =>
'defined_from_c_action_trigger'),
'multiinput' => 1,),
106 'url' => array(
'type' =>
'url',
'label' =>
'Url',
'enabled' => 1,
'position' => 55,
'notnull' => 1,
'visible' => 1,
'help' =>
'WebHooksSupportExternalUrlOnly'),
107 'description' => array(
'type' =>
'text',
'label' =>
'Description',
'enabled' => 1,
'position' => 60,
'notnull' => 0,
'visible' => 3,
'validate' => 1,),
108 'note_public' => array(
'type' =>
'html',
'label' =>
'NotePublic',
'enabled' => 1,
'position' => 61,
'notnull' => 0,
'visible' => 0,
'cssview' =>
'wordbreak',
'validate' => 1,),
109 'note_private' => array(
'type' =>
'html',
'label' =>
'NotePrivate',
'enabled' => 1,
'position' => 62,
'notnull' => 0,
'visible' => 0,
'cssview' =>
'wordbreak',
'validate' => 1,),
110 'date_creation' => array(
'type' =>
'datetime',
'label' =>
'DateCreation',
'enabled' => 1,
'position' => 500,
'notnull' => 1,
'visible' => -2,),
111 'tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModification',
'enabled' => 1,
'position' => 501,
'notnull' => 0,
'visible' => -2,),
112 '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',),
113 'fk_user_modif' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'UserModif',
'enabled' => 1,
'position' => 511,
'notnull' => -1,
'visible' => -2,),
114 'import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'position' => 1000,
'notnull' => -1,
'visible' => -2,),
115 'status' => array(
'type' =>
'integer',
'label' =>
'Status',
'enabled' => 1,
'position' => 2000,
'notnull' => 1,
'default' =>
'1',
'visible' => 1,
'index' => 1,
'arrayofkeyval' => array(
'1' =>
'AutomaticTrigger',
'2' =>
'ManualTrigger',
'0' =>
'Disabled'),
'validate' => 1,),
144 public $note_private;
148 public $fk_user_creat;
152 public $fk_user_modif;
168 public $trigger_codes;
220 $this->ismultientitymanaged = 0;
221 $this->isextrafieldmanaged = 0;
224 $this->fields[
'rowid'][
'visible'] = 0;
226 if (!
isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
227 $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);
256 $entitytoicon = array(
257 'societe' =>
'company',
259 'commande' =>
'order',
260 'order_supplier' =>
'supplier_order',
261 'proposal_supplier' =>
'supplier_proposal',
262 'invoice_supplier' =>
'supplier_invoice',
263 'facturerec' =>
'bill',
264 'ficheinter' =>
'intervention',
265 'shipping' =>
'shipment',
266 'contrat' =>
'contract',
267 'recruitment' =>
'recruitmentjobposition',
271 if (!empty($this->fields[
"trigger_codes"][
'arrayofkeyval']) && is_array($this->fields[
"trigger_codes"][
'arrayofkeyval']) && !empty($this->fields[
"trigger_codes"][
"multiinput"])) {
272 $sql =
"SELECT c.code, c.label, c.elementtype FROM ".MAIN_DB_PREFIX.
"c_action_trigger as c ORDER BY c.rang ASC";
273 $resql = $this->db->query($sql);
275 $num = $this->db->num_rows($resql);
277 $arraytrigger = array();
279 $obj = $this->db->fetch_object($resql);
280 $elementtype = (!empty($entitytoicon[$obj->elementtype]) ? $entitytoicon[$obj->elementtype] : $obj->elementtype);
281 $arraytrigger[$obj->code] =
img_object(
"", $elementtype).
' '.$obj->label.
' ('.$obj->code.
')';
284 $this->fields[
"trigger_codes"][
'arrayofkeyval'] = $arraytrigger;
286 $this->errors[] =
'Error '.$this->db->lasterror();
287 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
303 $sql =
"SELECT COUNT(wt.rowid) as nbtarget";
304 $sql .=
" FROM ".MAIN_DB_PREFIX.
"webhook_target as wt";
305 $sql .=
" WHERE wt.status = ".((int) $this::STATUS_MANUAL_TRIGGER);
306 $sql .=
" AND wt.trigger_codes LIKE '%".$this->db->escape($triggercode).
"%'";
307 $resql = $this->db->query($sql);
309 $num = $this->db->num_rows($resql);
311 $obj = $this->db->fetch_object($resql);
312 $res = $obj->nbtarget;
315 $this->errors[] =
'Error '.$this->db->lasterror();
316 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
337 if ($resultcreate <= 0) {
338 return $resultcreate;
353 global $langs, $extrafields;
363 $result =
$object->fetchCommon($fromid);
364 if ($result > 0 && !empty(
$object->table_element_line)) {
378 if (property_exists(
$object,
'ref')) {
380 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
382 if (property_exists(
$object,
'label')) {
384 $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".
$object->label : $this->fields[
'label'][
'default'];
386 if (property_exists(
$object,
'status')) {
387 $object->status = self::STATUS_DRAFT;
389 if (property_exists(
$object,
'date_creation')) {
392 if (property_exists(
$object,
'date_modification')) {
393 $object->date_modification =
null;
397 if (is_array(
$object->array_options) && count(
$object->array_options) > 0) {
398 $extrafields->fetch_name_optionals_label($this->table_element);
399 foreach (
$object->array_options as $key => $option) {
400 $shortkey = preg_replace(
'/options_/',
'', $key);
401 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
403 unset(
$object->array_options[$key]);
409 $object->context[
'createfromclone'] =
'createfromclone';
410 $result =
$object->createCommon($user);
416 unset(
$object->context[
'createfromclone']);
423 $this->db->rollback();
435 public function fetch($id, $ref =
null)
438 if (empty($this->
ref)) {
452 $this->lines = array();
471 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
479 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
480 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
481 $sql .=
" WHERE t.entity IN (".getEntity($this->element).
")";
483 $sql .=
" WHERE 1 = 1";
487 $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
489 $this->errors[] = $errormessage;
490 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
494 if (!empty($sortfield)) {
495 $sql .= $this->db->order($sortfield, $sortorder);
497 if (!empty($limit)) {
498 $sql .= $this->db->plimit($limit, $offset);
501 $resql = $this->db->query($sql);
503 $num = $this->db->num_rows($resql);
505 while ($i < ($limit ? min($limit, $num) : $num)) {
506 $obj = $this->db->fetch_object($resql);
508 $record =
new self($this->db);
509 $record->setVarsFromFetchObj($obj);
511 $records[$record->id] = $record;
515 $this->db->free($resql);
519 $this->errors[] =
'Error '.$this->db->lasterror();
520 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
545 public function delete(
User $user, $notrigger = 0)
562 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
581 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
586 if ($this->
status == self::STATUS_AUTOMATIC_TRIGGER) {
587 dol_syslog(get_class($this).
"::validate action abandoned: already validated", LOG_WARNING);
596 if (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref)) {
601 $this->newref = $num;
605 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
606 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
607 $sql .=
" status = ".((int) self::STATUS_AUTOMATIC_TRIGGER);
608 if (!empty($this->fields[
'date_validation'])) {
609 $sql .=
", date_validation = '".$this->db->idate($now).
"'";
611 if (!empty($this->fields[
'fk_user_valid'])) {
612 $sql .=
", fk_user_valid = ".((int) $user->id);
614 $sql .=
" WHERE rowid = ".((int) $this->
id);
616 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
617 $resql = $this->db->query($sql);
620 $this->error = $this->db->lasterror();
624 if (!$error && !$notrigger) {
626 $result = $this->call_trigger(
'TARGET_VALIDATE', $user);
635 $this->oldref = $this->ref;
638 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
640 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filename = CONCAT('".$this->db->escape($this->newref).
"', SUBSTR(filename, ".(strlen($this->
ref) + 1).
")), filepath = 'target/".$this->db->escape($this->newref).
"'";
641 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'target/".$this->db->escape($this->
ref).
"' and entity = ".((int)
$conf->entity);
642 $resql = $this->db->query($sql);
645 $this->error = $this->db->lasterror();
647 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'target/".$this->db->escape($this->newref).
"'";
648 $sql .=
" WHERE filepath = 'target/".$this->db->escape($this->
ref).
"' and entity = ".((int)
$conf->entity);
649 $resql = $this->db->query($sql);
652 $this->error = $this->db->lasterror();
658 $dirsource =
$conf->webhook->dir_output.
'/target/'.$oldref;
659 $dirdest =
$conf->webhook->dir_output.
'/target/'.$newref;
660 if (!$error && file_exists($dirsource)) {
661 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
663 if (@rename($dirsource, $dirdest)) {
666 $listoffiles =
dol_dir_list(
$conf->webhook->dir_output.
'/target/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
667 foreach ($listoffiles as $fileentry) {
668 $dirsource = $fileentry[
'name'];
669 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
670 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
671 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
672 @rename($dirsource, $dirdest);
682 $this->
status = self::STATUS_AUTOMATIC_TRIGGER;
689 $this->db->rollback();
705 if ($this->
status <= self::STATUS_DRAFT) {
709 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'TARGET_UNVALIDATE');
719 public function cancel($user, $notrigger = 0)
722 if ($this->
status != self::STATUS_AUTOMATIC_TRIGGER) {
726 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'TARGET_CANCEL');
736 public function reopen($user, $notrigger = 0)
739 if ($this->
status != self::STATUS_CANCELED) {
743 return $this->
setStatusCommon($user, self::STATUS_AUTOMATIC_TRIGGER, $notrigger,
'TARGET_REOPEN');
756 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
758 global
$conf, $langs, $hookmanager;
760 if (!empty(
$conf->dol_no_mouse_hover)) {
766 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"Target").
'</u>';
767 if (isset($this->
status)) {
768 $label .=
' '.$this->getLibStatut(5);
771 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
773 $baseurl = DOL_URL_ROOT.
'/webhook/target_card.php';
774 $query = [
'id' => $this->id];
775 if ($option !=
'nolink') {
777 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
778 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
779 $add_save_lastsearch_values = 1;
781 if ($add_save_lastsearch_values) {
782 $query += [
'save_lastsearch_values' => 1];
788 if (empty($notooltip)) {
790 $label = $langs->trans(
"ShowTarget");
791 $linkclose .=
' alt="'.dolPrintHTMLForAttribute($label).
'"';
793 $linkclose .=
' title="'.dolPrintHTMLForAttribute($label).
'"';
794 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
796 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
799 if ($option ==
'nolink' || empty($url)) {
800 $linkstart =
'<span';
802 $linkstart =
'<a href="'.$url.
'"';
804 $linkstart .= $linkclose.
'>';
805 if ($option ==
'nolink' || empty($url)) {
806 $linkend =
'</span>';
811 $result .= $linkstart;
813 if (empty($this->showphoto_on_popup)) {
815 $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);
819 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
821 list($class, $module) = explode(
'@', $this->picto);
824 $filename = $filearray[0][
'name'];
825 if (!empty($filename)) {
826 $pospoint = strpos($filearray[0][
'name'],
'.');
828 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
830 $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>';
832 $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>';
837 $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);
842 if ($withpicto != 2) {
843 $result .= $this->ref;
849 global $action, $hookmanager;
850 $hookmanager->initHooks(array(
'targetdao'));
851 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
852 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
854 $result = $hookmanager->resPrint;
856 $result .= $hookmanager->resPrint;
895 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
898 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Disabled');
899 $this->labelStatus[self::STATUS_AUTOMATIC_TRIGGER] = $langs->transnoentitiesnoconv(
'AutomaticTrigger');
900 $this->labelStatus[self::STATUS_MANUAL_TRIGGER] = $langs->transnoentitiesnoconv(
'ManualTrigger');
901 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
902 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Disabled');
903 $this->labelStatusShort[self::STATUS_AUTOMATIC_TRIGGER] = $langs->transnoentitiesnoconv(
'AutomaticTrigger');
904 $this->labelStatusShort[self::STATUS_MANUAL_TRIGGER] = $langs->transnoentitiesnoconv(
'ManualTrigger');
905 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
908 $statusType =
'status'.$status;
909 if ($status == self::STATUS_AUTOMATIC_TRIGGER) {
910 $statusType =
'status4';
912 if ($status == self::STATUS_MANUAL_TRIGGER) {
913 $statusType =
'status3';
915 if ($status == self::STATUS_CANCELED) {
916 $statusType =
'status6';
919 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
930 $sql =
"SELECT rowid, date_creation as datec, tms as datem,";
931 $sql .=
" fk_user_creat, fk_user_modif";
932 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
933 $sql .=
" WHERE t.rowid = ".((int) $id);
935 $result = $this->db->query($sql);
937 if ($this->db->num_rows($result)) {
938 $obj = $this->db->fetch_object($result);
940 $this->
id = $obj->rowid;
942 $this->user_creation_id = $obj->fk_user_creat;
943 $this->user_modification_id = $obj->fk_user_modif;
944 $this->date_creation = $this->db->jdate($obj->datec);
945 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
948 $this->db->free($result);
962 $this->url =
"https://thisisunurl";
963 $this->trigger_codes =
"ThisIsATestCode";
975 global $langs,
$conf;
980 $file = $classname.
".php";
983 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
984 foreach ($dirmodels as $reldir) {
988 $mybool = ((bool) @include_once $dir.$file) || $mybool;
996 if (class_exists($classname)) {
997 $obj =
new $classname();
998 '@phan-var-force CommonNumRefGenerator $obj';
999 $numref = $obj->getNextValue($this);
1001 if ($numref !=
'' && $numref !=
'-1') {
1004 $this->error = $obj->error;
1009 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
1025 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1028 $includedocgeneration = 0;
1031 $modele =
'standard_target';
1033 if (!empty($this->model_pdf)) {
1034 $modele = $this->model_pdf;
1040 $modelpath =
"core/modules/webhook/doc/";
1042 if ($includedocgeneration && !empty($modele)) {
1043 $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1074 $this->db->commit();
if(! $sortfield) if(! $sortorder) $object
Parent class of all other business classes (invoices, contracts, proposals, orders,...
deleteLineCommon(User $user, $idline, $notrigger=0)
Delete a line of object in database.
commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
Common function for all objects extending CommonObject for generating documents.
setErrorsFromObject($object)
setErrorsFromObject
createCommon(User $user, $notrigger=0)
Create object in the database.
getFieldList($alias='', $excludefields=array())
Function to concat keys of fields.
updateCommon(User $user, $notrigger=0)
Update object into database.
setStatusCommon($user, $status, $notrigger=0, $triggercode='')
Set to a status.
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
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.
Class to manage Dolibarr database access.
deleteLine(User $user, $idline, $notrigger=0)
Delete a line of object in database.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
initListOfTriggers()
Init the list of available triggers;.
getLabelStatus($mode=0)
Return the label of the status.
isTriggerCodeManualTarget($triggercode)
Test if a TriggerCode is inside a Target with status to Manual.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionally the picto)
fetchLines()
Load object lines in memory from the database.
info($id)
Load the info information in the object.
fetch($id, $ref=null)
Load object in memory from the database.
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
__construct(DoliDB $db)
Constructor.
getLibStatut($mode=0)
Return the label of the status.
reopen($user, $notrigger=0)
Set back to validated status.
createFromClone(User $user, $fromid)
Clone an object into another one.
LibStatut($status, $mode=0)
Return the status.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
create(User $user, $notrigger=0)
Create object into database.
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module.
cancel($user, $notrigger=0)
Set cancel status.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter='', $filtermode='AND')
Load in emory the list of all objects from the database.
validate($user, $notrigger=0)
Validate object.
setDraft($user, $notrigger=0)
Set draft status.
update(User $user, $notrigger=0)
Update object into database.
Class to manage Dolibarr users.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_now($mode='gmt')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php