26 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
38 public $module =
'webhook';
43 public $element =
'target';
48 public $table_element =
'webhook_target';
54 public $ismultientitymanaged = 0;
59 public $isextrafieldmanaged = 0;
64 public $picto =
'webhook';
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'=>4,
'noteditable'=>
'1',
'index'=>1,
'searchall'=>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',
'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',
'enabled'=>
'1',
'position'=>511,
'notnull'=>-1,
'visible'=>-2,),
115 'import_key' => array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>
'1',
'position'=>1000,
'notnull'=>-1,
'visible'=>-2,),
116 'status' => array(
'type'=>
'integer',
'label'=>
'Status',
'enabled'=>
'1',
'position'=>2000,
'notnull'=>1,
'visible'=>3,
'index'=>1,
'arrayofkeyval'=>array(
'0'=>
'Brouillon',
'1'=>
'Validé',
'9'=>
'Annulé'),
'validate'=>
'1',),
117 'url' => array(
'type'=>
'varchar(255)',
'label'=>
'Url',
'enabled'=>
'1',
'position'=>50,
'notnull'=>1,
'visible'=>1,),
118 'trigger_codes' => array(
'type'=>
'text',
'label'=>
'TriggerCodes',
'enabled'=>
'1',
'position'=>50,
'notnull'=>1,
'visible'=>1,
'help'=>
"TriggerCodeInfo",),
125 public $note_private;
126 public $date_creation;
128 public $fk_user_creat;
129 public $fk_user_modif;
133 public $trigger_codes;
180 global $conf, $langs;
184 if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields[
'rowid'])) {
185 $this->fields[
'rowid'][
'visible'] = 0;
187 if (empty($conf->multicompany->enabled) && isset($this->fields[
'entity'])) {
188 $this->fields[
'entity'][
'enabled'] = 0;
198 foreach ($this->fields as $key => $val) {
199 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
200 unset($this->fields[$key]);
205 if (is_object($langs)) {
206 foreach ($this->fields as $key => $val) {
207 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
208 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
209 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
226 $this->
ref = $this->id;
228 if ($resultcreate <= 0) {
229 return $resultcreate;
231 $resultvalidate = $this->
validate($user, $notrigger);
233 return $resultvalidate;
245 global $langs, $extrafields;
250 $object =
new self($this->db);
255 $result = $object->fetchCommon($fromid);
256 if ($result > 0 && !empty($object->table_element_line)) {
257 $object->fetchLines();
266 unset($object->fk_user_creat);
267 unset($object->import_key);
270 if (property_exists($object,
'ref')) {
271 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
273 if (property_exists($object,
'label')) {
274 $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".$object->label : $this->fields[
'label'][
'default'];
276 if (property_exists($object,
'status')) {
277 $object->status = self::STATUS_DRAFT;
279 if (property_exists($object,
'date_creation')) {
280 $object->date_creation =
dol_now();
282 if (property_exists($object,
'date_modification')) {
283 $object->date_modification = null;
287 if (is_array($object->array_options) && count($object->array_options) > 0) {
288 $extrafields->fetch_name_optionals_label($this->table_element);
289 foreach ($object->array_options as $key => $option) {
290 $shortkey = preg_replace(
'/options_/',
'', $key);
291 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
293 unset($object->array_options[$key]);
299 $object->context[
'createfromclone'] =
'createfromclone';
300 $result = $object->createCommon($user);
303 $this->error = $object->error;
304 $this->errors = $object->errors;
316 if (!empty($object->socid) && property_exists($this,
'fk_soc') && $this->fk_soc == $object->socid) {
323 unset($object->context[
'createfromclone']);
330 $this->
db->rollback();
342 public function fetch($id, $ref = null)
345 if ($result > 0 && !empty($this->table_element_line)) {
358 $this->lines = array();
376 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
386 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
387 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
388 $sql .=
" WHERE t.entity IN (".getEntity($this->table_element).
")";
390 $sql .=
" WHERE 1 = 1";
394 if (count($filter) > 0) {
395 foreach ($filter as $key => $value) {
396 if ($key ==
't.rowid') {
397 $sqlwhere[] = $key.
" = ".((int) $value);
398 } elseif (in_array($this->fields[$key][
'type'], array(
'date',
'datetime',
'timestamp'))) {
399 $sqlwhere[] = $key.
" = '".$this->
db->idate($value).
"'";
400 } elseif ($key ==
'customsql') {
401 $sqlwhere[] = $value;
402 } elseif (strpos($value,
'%') ===
false) {
403 $sqlwhere[] = $key.
" IN (".$this->
db->sanitize($this->
db->escape($value)).
")";
405 $sqlwhere[] = $key.
" LIKE '%".$this->
db->escape($value).
"%'";
409 if (count($sqlwhere) > 0) {
410 $sql .=
" AND (".implode(
" ".$filtermode.
" ", $sqlwhere).
")";
413 if (!empty($sortfield)) {
414 $sql .= $this->
db->order($sortfield, $sortorder);
416 if (!empty($limit)) {
417 $sql .= $this->
db->plimit($limit, $offset);
424 while ($i < ($limit ? min($limit, $num) : $num)) {
425 $obj = $this->
db->fetch_object(
$resql);
427 $record =
new self($this->db);
428 $record->setVarsFromFetchObj($obj);
430 $records[$record->id] = $record;
438 $this->errors[] =
'Error '.$this->db->lasterror();
439 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
464 public function delete(
User $user, $notrigger =
false)
480 if ($this->status < 0) {
481 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
498 global $conf, $langs;
500 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
505 if ($this->status == self::STATUS_VALIDATED) {
506 dol_syslog(get_class($this).
"::validate action abandonned: already validated", LOG_WARNING);
523 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
528 $this->newref = $num;
532 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
533 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
534 $sql .=
" status = ".self::STATUS_VALIDATED;
535 if (!empty($this->fields[
'date_validation'])) {
536 $sql .=
", date_validation = '".$this->db->idate($now).
"'";
538 if (!empty($this->fields[
'fk_user_valid'])) {
539 $sql .=
", fk_user_valid = ".((int) $user->id);
541 $sql .=
" WHERE rowid = ".((int) $this->
id);
543 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
547 $this->error = $this->
db->lasterror();
551 if (!$error && !$notrigger) {
553 $result = $this->
call_trigger(
'TARGET_VALIDATE', $user);
562 $this->oldref = $this->ref;
565 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
567 $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).
"'";
568 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'target/".$this->
db->escape($this->
ref).
"' and entity = ".$conf->entity;
571 $error++; $this->error = $this->
db->lasterror();
577 $dirsource = $conf->webhook->dir_output.
'/target/'.$oldref;
578 $dirdest = $conf->webhook->dir_output.
'/target/'.$newref;
579 if (!$error && file_exists($dirsource)) {
580 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
582 if (@rename($dirsource, $dirdest)) {
585 $listoffiles =
dol_dir_list($conf->webhook->dir_output.
'/target/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
586 foreach ($listoffiles as $fileentry) {
587 $dirsource = $fileentry[
'name'];
588 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
589 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
590 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
591 @rename($dirsource, $dirdest);
601 $this->status = self::STATUS_VALIDATED;
608 $this->
db->rollback();
624 if ($this->status <= self::STATUS_DRAFT) {
635 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'TARGET_UNVALIDATE');
645 public function cancel($user, $notrigger = 0)
648 if ($this->status != self::STATUS_VALIDATED) {
659 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'TARGET_CANCEL');
669 public function reopen($user, $notrigger = 0)
672 if ($this->status != self::STATUS_CANCELED) {
683 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'TARGET_REOPEN');
696 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
698 global $conf, $langs, $hookmanager;
700 if (!empty($conf->dol_no_mouse_hover)) {
706 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"Target").
'</u>';
707 if (isset($this->status)) {
708 $label .=
' '.$this->getLibStatut(5);
711 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
713 $url =
dol_buildpath(
'/webhook/target_card.php', 1).
'?id='.$this->id;
715 if ($option !=
'nolink') {
717 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
718 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
719 $add_save_lastsearch_values = 1;
721 if ($url && $add_save_lastsearch_values) {
722 $url .=
'&save_lastsearch_values=1';
727 if (empty($notooltip)) {
728 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
729 $label = $langs->trans(
"ShowTarget");
730 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
732 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
733 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
735 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
738 if ($option ==
'nolink' || empty($url)) {
739 $linkstart =
'<span';
741 $linkstart =
'<a href="'.$url.
'"';
743 $linkstart .= $linkclose.
'>';
744 if ($option ==
'nolink' || empty($url)) {
745 $linkend =
'</span>';
750 $result .= $linkstart;
752 if (empty($this->showphoto_on_popup)) {
754 $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);
758 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
760 list($class, $module) = explode(
'@', $this->picto);
763 $filename = $filearray[0][
'name'];
764 if (!empty($filename)) {
765 $pospoint = strpos($filearray[0][
'name'],
'.');
767 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
768 if (empty($conf->global->{strtoupper($module.
'_'.$class).
'_FORMATLISTPHOTOSASUSERS'})) {
769 $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>';
771 $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>';
776 $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);
781 if ($withpicto != 2) {
782 $result .= $this->ref;
788 global $action, $hookmanager;
789 $hookmanager->initHooks(array(
'targetdao'));
790 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
791 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
793 $result = $hookmanager->resPrint;
795 $result .= $hookmanager->resPrint;
809 return $this->LibStatut($this->status, $mode);
820 return $this->LibStatut($this->status, $mode);
834 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
837 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
838 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
839 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
840 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
841 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
842 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
845 $statusType =
'status'.$status;
847 if ($status == self::STATUS_CANCELED) {
848 $statusType =
'status6';
851 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
862 $sql =
"SELECT rowid, date_creation as datec, tms as datem,";
863 $sql .=
" fk_user_creat, fk_user_modif";
864 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
865 $sql .=
" WHERE t.rowid = ".((int) $id);
867 $result = $this->
db->query($sql);
869 if ($this->
db->num_rows($result)) {
870 $obj = $this->
db->fetch_object($result);
871 $this->
id = $obj->rowid;
874 $this->user_creation_id = $obj->fk_user_creat;
875 $this->user_modification_id = $obj->fk_user_modif;
876 $this->date_creation = $this->
db->jdate($obj->datec);
877 $this->date_modification = empty($obj->datem) ?
'' : $this->
db->jdate($obj->datem);
880 $this->
db->free($result);
898 $this->initAsSpecimenCommon();
908 $this->lines = array();
911 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0, array(
'customsql'=>
'fk_target = '.((
int) $this->
id)));
913 if (is_numeric($result)) {
914 $this->error = $this->error;
915 $this->errors = $this->errors;
918 $this->lines = $result;
930 global $langs, $conf;
931 $langs->load(
"webhook@webhook");
933 if (empty($conf->global->WEBHOOK_TARGET_ADDON)) {
934 $conf->global->WEBHOOK_TARGET_ADDON =
'mod_target_standard';
937 if (!empty($conf->global->WEBHOOK_TARGET_ADDON)) {
940 $file = $conf->global->WEBHOOK_TARGET_ADDON.
".php";
941 $classname = $conf->global->WEBHOOK_TARGET_ADDON;
944 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
945 foreach ($dirmodels as $reldir) {
949 $mybool |= @include_once $dir.$file;
952 if ($mybool ===
false) {
957 if (class_exists($classname)) {
958 $obj =
new $classname();
959 $numref = $obj->getNextValue($this);
961 if ($numref !=
'' && $numref !=
'-1') {
964 $this->error = $obj->error;
969 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
973 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
989 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
991 global $conf, $langs;
994 $includedocgeneration = 0;
996 $langs->load(
"webhook@webhook");
999 $modele =
'standard_target';
1001 if (!empty($this->model_pdf)) {
1002 $modele = $this->model_pdf;
1003 } elseif (!empty($conf->global->TARGET_ADDON_PDF)) {
1004 $modele = $conf->global->TARGET_ADDON_PDF;
1008 $modelpath =
"core/modules/webhook/doc/";
1010 if ($includedocgeneration && !empty($modele)) {
1011 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1026 global $conf, $langs;
1042 $this->
db->commit();
1049 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobjectline.class.php';
1062 public $isextrafieldmanaged = 0;
reopen($user, $notrigger=0)
Set back to validated status.
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
cancel($user, $notrigger=0)
Set cancel status.
fetchLines()
Load object lines in memory from the database.
fetch($id, $ref=null)
Load object in memory from the database.
fetchLinesCommon($morewhere= '')
Load object in memory from the database.
$conf db
API class for accounts.
dol_now($mode= 'auto')
Return date for now.
update(User $user, $notrigger=false)
Update object into database.
Class to manage Dolibarr users.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
Class to manage Dolibarr database access.
getLabelStatus($mode=0)
Return the label of the status.
createCommon(User $user, $notrigger=false)
Create object into database.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
setDraft($user, $notrigger=0)
Set draft status.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
createFromClone(User $user, $fromid)
Clone an object into another one.
__construct(DoliDB $db)
Constructor.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
getFieldList($alias= '')
Function to concat keys of fields.
getLinesArray()
Create an array of lines.
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
validate($user, $notrigger=0)
Validate object.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
updateCommon(User $user, $notrigger=false)
Update object into database.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
getNomUrl($withpicto=0, $option= '', $notooltip=0, $morecss= '', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
__construct(DoliDB $db)
Constructor.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
getLibStatut($mode=0)
Return the label of the status.
deleteLine(User $user, $idline, $notrigger=false)
Delete a line of object in database.
deleteLineCommon(User $user, $idline, $notrigger=false)
Delete a line of object in database.
copy_linked_contact($objFrom, $source= 'internal')
Copy contact from one element to current.
create(User $user, $notrigger=false)
Create object into database.
call_trigger($triggerName, $user)
Call trigger based on this instance.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
info($id)
Load the info information in the object.
setStatusCommon($user, $status, $notrigger=0, $triggercode= '')
Set to a status.
dolGetStatus($statusLabel= '', $statusLabelShort= '', $html= '', $statusType= 'status0', $displayMode=0, $url= '', $params=array())
Output the badge of a status.
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module...
fetchAll($sortorder= '', $sortfield= '', $limit=0, $offset=0, array $filter=array(), $filtermode= 'AND')
Load list of objects in memory from the database.
LibStatut($status, $mode=0)
Return the status.
Parent class of all other business classes (invoices, contracts, proposals, orders, ...)
fetchCommon($id, $ref=null, $morewhere= '')
Load object in memory from the database.