26require_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    'url' => array(
'type'=>
'varchar(255)', 
'label'=>
'Url', 
'enabled'=>
'1', 
'position'=>50, 
'notnull'=>1, 
'visible'=>1,),
 
  109    'trigger_codes' => array(
'type'=>
'text', 
'label'=>
'TriggerCodes', 
'enabled'=>
'1', 
'position'=>55, 
'notnull'=>1, 
'visible'=>1, 
'help'=>
"TriggerCodeInfo",),
 
  110    'description' => array(
'type'=>
'text', 
'label'=>
'Description', 
'enabled'=>
'1', 
'position'=>60, 
'notnull'=>0, 
'visible'=>3, 
'validate'=>
'1',),
 
  111    'note_public' => array(
'type'=>
'html', 
'label'=>
'NotePublic', 
'enabled'=>
'1', 
'position'=>61, 
'notnull'=>0, 
'visible'=>0, 
'cssview'=>
'wordbreak', 
'validate'=>
'1',),
 
  112    'note_private' => array(
'type'=>
'html', 
'label'=>
'NotePrivate', 
'enabled'=>
'1', 
'position'=>62, 
'notnull'=>0, 
'visible'=>0, 
'cssview'=>
'wordbreak', 
'validate'=>
'1',),
 
  113    'date_creation' => array(
'type'=>
'datetime', 
'label'=>
'DateCreation', 
'enabled'=>
'1', 
'position'=>500, 
'notnull'=>1, 
'visible'=>-2,),
 
  114    'tms' => array(
'type'=>
'timestamp', 
'label'=>
'DateModification', 
'enabled'=>
'1', 
'position'=>501, 
'notnull'=>0, 
'visible'=>-2,),
 
  115    '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',),
 
  116    'fk_user_modif' => array(
'type'=>
'integer:User:user/class/user.class.php', 
'label'=>
'UserModif', 
'enabled'=>
'1', 
'position'=>511, 
'notnull'=>-1, 
'visible'=>-2,),
 
  117    'import_key' => array(
'type'=>
'varchar(14)', 
'label'=>
'ImportId', 
'enabled'=>
'1', 
'position'=>1000, 
'notnull'=>-1, 
'visible'=>-2,),
 
  118    'status' => array(
'type'=>
'integer', 
'label'=>
'Status', 
'enabled'=>
'1', 
'position'=>2000, 
'notnull'=>1, 
'default'=>1, 
'visible'=>1, 
'index'=>1, 
'arrayofkeyval'=>array(
'0'=>
'Disabled', 
'1'=>
'Enabled'), 
'validate'=>
'1',),
 
  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;
 
  185      $this->fields[
'rowid'][
'visible'] = 0;
 
  187    if (!isModEnabled(
'multicompany') && 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;
 
 
  244    global $langs, $extrafields;
 
  249    $object = 
new self($this->db);
 
  254    $result = $object->fetchCommon($fromid);
 
  255    if ($result > 0 && !empty($object->table_element_line)) {
 
  256      $object->fetchLines();
 
  265    unset($object->fk_user_creat);
 
  266    unset($object->import_key);
 
  269    if (property_exists($object, 
'ref')) {
 
  270      $object->ref = empty($this->fields[
'ref'][
'default']) ? 
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
 
  272    if (property_exists($object, 
'label')) {
 
  273      $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".$object->label : $this->fields[
'label'][
'default'];
 
  275    if (property_exists($object, 
'status')) {
 
  276      $object->status = self::STATUS_DRAFT;
 
  278    if (property_exists($object, 
'date_creation')) {
 
  279      $object->date_creation = 
dol_now();
 
  281    if (property_exists($object, 
'date_modification')) {
 
  282      $object->date_modification = 
null;
 
  286    if (is_array($object->array_options) && count($object->array_options) > 0) {
 
  287      $extrafields->fetch_name_optionals_label($this->table_element);
 
  288      foreach ($object->array_options as $key => $option) {
 
  289        $shortkey = preg_replace(
'/options_/', 
'', $key);
 
  290        if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
 
  292          unset($object->array_options[$key]);
 
  298    $object->context[
'createfromclone'] = 
'createfromclone';
 
  299    $result = $object->createCommon($user);
 
  321    unset($object->context[
'createfromclone']);
 
  328      $this->db->rollback();
 
 
  340  public function fetch($id, $ref = 
null)
 
  343    if (empty($this->
ref)) {
 
  344      $this->
ref = $this->id;
 
 
  357    $this->lines = array();
 
 
  375  public function fetchAll($sortorder = 
'', $sortfield = 
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 
'AND')
 
  385    $sql .= 
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
 
  386    if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
 
  387      $sql .= 
" WHERE t.entity IN (".getEntity($this->element).
")";
 
  389      $sql .= 
" WHERE 1 = 1";
 
  393    if (count($filter) > 0) {
 
  394      foreach ($filter as $key => $value) {
 
  395        if ($key == 
't.rowid') {
 
  396          $sqlwhere[] = $key.
" = ".((int) $value);
 
  397        } elseif (array_key_exists($key, $this->fields) && in_array($this->fields[$key][
'type'], array(
'date', 
'datetime', 
'timestamp'))) {
 
  398          $sqlwhere[] = $key.
" = '".$this->db->idate($value).
"'";
 
  399        } elseif ($key == 
'customsql') {
 
  400          $sqlwhere[] = $value;
 
  401        } elseif (strpos($value, 
'%') === 
false) {
 
  402          $sqlwhere[] = $key.
" IN (".$this->db->sanitize($this->db->escape($value)).
")";
 
  404          $sqlwhere[] = $key.
" LIKE '%".$this->db->escape($value).
"%'";
 
  408    if (count($sqlwhere) > 0) {
 
  409      $sql .= 
" AND (".implode(
" ".$filtermode.
" ", $sqlwhere).
")";
 
  412    if (!empty($sortfield)) {
 
  413      $sql .= $this->db->order($sortfield, $sortorder);
 
  415    if (!empty($limit)) {
 
  416      $sql .= $this->db->plimit($limit, $offset);
 
  419    $resql = $this->db->query($sql);
 
  421      $num = $this->db->num_rows($resql);
 
  423      while ($i < ($limit ? min($limit, $num) : $num)) {
 
  424        $obj = $this->db->fetch_object($resql);
 
  426        $record = 
new self($this->db);
 
  427        $record->setVarsFromFetchObj($obj);
 
  429        $records[$record->id] = $record;
 
  433      $this->db->free($resql);
 
  437      $this->errors[] = 
'Error '.$this->db->lasterror();
 
  438      dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
 
 
  463  public function delete(
User $user, $notrigger = 
false)
 
 
  480      $this->error = 
'ErrorDeleteLineNotAllowedByObjectStatus';
 
 
  497    global $conf, $langs;
 
  499    require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
  504    if ($this->
status == self::STATUS_VALIDATED) {
 
  505      dol_syslog(get_class($this).
"::validate action abandonned: already validated", LOG_WARNING);
 
  522    if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) { 
 
  527    $this->newref = $num;
 
  531      $sql = 
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
 
  532      $sql .= 
" SET ref = '".$this->db->escape($num).
"',";
 
  533      $sql .= 
" status = ".self::STATUS_VALIDATED;
 
  534      if (!empty($this->fields[
'date_validation'])) {
 
  535        $sql .= 
", date_validation = '".$this->db->idate($now).
"'";
 
  537      if (!empty($this->fields[
'fk_user_valid'])) {
 
  538        $sql .= 
", fk_user_valid = ".((int) $user->id);
 
  540      $sql .= 
" WHERE rowid = ".((int) $this->
id);
 
  542      dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
 
  543      $resql = $this->db->query($sql);
 
  546        $this->error = $this->db->lasterror();
 
  550      if (!$error && !$notrigger) {
 
  552        $result = $this->
call_trigger(
'TARGET_VALIDATE', $user);
 
  561      $this->oldref = $this->ref;
 
  564      if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
 
  566        $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).
"'";
 
  567        $sql .= 
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'target/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
 
  568        $resql = $this->db->query($sql);
 
  571          $this->error = $this->db->lasterror();
 
  573        $sql = 
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'target/".$this->db->escape($this->newref).
"'";
 
  574        $sql .= 
" WHERE filepath = 'target/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
 
  575        $resql = $this->db->query($sql);
 
  578          $this->error = $this->db->lasterror();
 
  584        $dirsource = $conf->webhook->dir_output.
'/target/'.$oldref;
 
  585        $dirdest = $conf->webhook->dir_output.
'/target/'.$newref;
 
  586        if (!$error && file_exists($dirsource)) {
 
  587          dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
 
  589          if (@rename($dirsource, $dirdest)) {
 
  592            $listoffiles = 
dol_dir_list($conf->webhook->dir_output.
'/target/'.$newref, 
'files', 1, 
'^'.preg_quote($oldref, 
'/'));
 
  593            foreach ($listoffiles as $fileentry) {
 
  594              $dirsource = $fileentry[
'name'];
 
  595              $dirdest = preg_replace(
'/^'.preg_quote($oldref, 
'/').
'/', $newref, $dirsource);
 
  596              $dirsource = $fileentry[
'path'].
'/'.$dirsource;
 
  597              $dirdest = $fileentry[
'path'].
'/'.$dirdest;
 
  598              @rename($dirsource, $dirdest);
 
  608      $this->
status = self::STATUS_VALIDATED;
 
  615      $this->db->rollback();
 
 
  631    if ($this->
status <= self::STATUS_DRAFT) {
 
  642    return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 
'TARGET_UNVALIDATE');
 
 
  652  public function cancel($user, $notrigger = 0)
 
  655    if ($this->
status != self::STATUS_VALIDATED) {
 
  666    return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 
'TARGET_CANCEL');
 
 
  676  public function reopen($user, $notrigger = 0)
 
  679    if ($this->
status != self::STATUS_CANCELED) {
 
  690    return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 
'TARGET_REOPEN');
 
 
  703  public function getNomUrl($withpicto = 0, $option = 
'', $notooltip = 0, $morecss = 
'', $save_lastsearch_value = -1)
 
  705    global $conf, $langs, $hookmanager;
 
  707    if (!empty($conf->dol_no_mouse_hover)) {
 
  713    $label = 
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"Target").
'</u>';
 
  714    if (isset($this->
status)) {
 
  715      $label .= 
' '.$this->getLibStatut(5);
 
  718    $label .= 
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
 
  720    $url = 
dol_buildpath(
'/webhook/target_card.php', 1).
'?id='.$this->id;
 
  722    if ($option != 
'nolink') {
 
  724      $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
 
  725      if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
 
  726        $add_save_lastsearch_values = 1;
 
  728      if ($url && $add_save_lastsearch_values) {
 
  729        $url .= 
'&save_lastsearch_values=1';
 
  734    if (empty($notooltip)) {
 
  736        $label = $langs->trans(
"ShowTarget");
 
  737        $linkclose .= 
' alt="'.dol_escape_htmltag($label, 1).
'"';
 
  739      $linkclose .= 
' title="'.dol_escape_htmltag($label, 1).
'"';
 
  740      $linkclose .= 
' class="classfortooltip'.($morecss ? 
' '.$morecss : 
'').
'"';
 
  742      $linkclose = ($morecss ? 
' class="'.$morecss.
'"' : 
'');
 
  745    if ($option == 
'nolink' || empty($url)) {
 
  746      $linkstart = 
'<span';
 
  748      $linkstart = 
'<a href="'.$url.
'"';
 
  750    $linkstart .= $linkclose.
'>';
 
  751    if ($option == 
'nolink' || empty($url)) {
 
  752      $linkend = 
'</span>';
 
  757    $result .= $linkstart;
 
  759    if (empty($this->showphoto_on_popup)) {
 
  761        $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);
 
  765        require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
  767        list($class, $module) = explode(
'@', $this->picto);
 
  770        $filename = $filearray[0][
'name'];
 
  771        if (!empty($filename)) {
 
  772          $pospoint = strpos($filearray[0][
'name'], 
'.');
 
  774          $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
 
  776            $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>';
 
  778            $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>';
 
  783          $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);
 
  788    if ($withpicto != 2) {
 
  789      $result .= $this->ref;
 
  795    global $action, $hookmanager;
 
  796    $hookmanager->initHooks(array(
'targetdao'));
 
  797    $parameters = array(
'id'=>$this->
id, 
'getnomurl' => &$result);
 
  798    $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action); 
 
  800      $result = $hookmanager->resPrint;
 
  802      $result .= $hookmanager->resPrint;
 
 
  841    if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
 
  844      $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
 
  845      $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
 
  846      $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
 
  847      $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
 
  848      $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
 
  849      $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
 
  852    $statusType = 
'status'.$status;
 
  854    if ($status == self::STATUS_CANCELED) {
 
  855      $statusType = 
'status6';
 
  858    return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], 
'', $statusType, $mode);
 
 
  869    $sql = 
"SELECT rowid, date_creation as datec, tms as datem,";
 
  870    $sql .= 
" fk_user_creat, fk_user_modif";
 
  871    $sql .= 
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
 
  872    $sql .= 
" WHERE t.rowid = ".((int) $id);
 
  874    $result = $this->db->query($sql);
 
  876      if ($this->db->num_rows($result)) {
 
  877        $obj = $this->db->fetch_object($result);
 
  879        $this->
id = $obj->rowid;
 
  881        $this->user_creation_id = $obj->fk_user_creat;
 
  882        $this->user_modification_id = $obj->fk_user_modif;
 
  883        $this->date_creation     = $this->db->jdate($obj->datec);
 
  884        $this->date_modification = empty($obj->datem) ? 
'' : $this->db->jdate($obj->datem);
 
  887      $this->db->free($result);
 
 
  901    $this->url = 
"https://thisisunurl";
 
  902    $this->trigger_codes = 
"ThisIsATestCode";
 
 
  913    $this->lines = array();
 
  916    $result = $objectline->fetchAll(
'ASC', 
'position', 0, 0, array(
'customsql'=>
'fk_target = '.((
int) $this->
id)));
 
  918    if (is_numeric($result)) {
 
  919      $this->error = $objectline->error;
 
  920      $this->errors = $objectline->errors;
 
  923      $this->lines = $result;
 
 
  935    global $langs, $conf;
 
  940    $file = $classname.
".php";
 
  943    $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
 
  944    foreach ($dirmodels as $reldir) {
 
  948      $mybool |= @include_once $dir.$file;
 
  951    if ($mybool === 
false) {
 
  956    if (class_exists($classname)) {
 
  957      $obj = 
new $classname();
 
  958      $numref = $obj->getNextValue($this);
 
  960      if ($numref != 
'' && $numref != 
'-1') {
 
  963        $this->error = $obj->error;
 
  968      print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
 
 
  984  public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = 
null)
 
  986    global $conf, $langs;
 
  989    $includedocgeneration = 0;
 
  992      $modele = 
'standard_target';
 
  994      if (!empty($this->model_pdf)) {
 
  995        $modele = $this->model_pdf;
 
  997        $modele = $conf->global->TARGET_ADDON_PDF;
 
 1001    $modelpath = 
"core/modules/webhook/doc/";
 
 1003    if ($includedocgeneration && !empty($modele)) {
 
 1004      $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
 
 
 1019    global $conf, $langs;
 
 1035    $this->db->commit();
 
 
 
 1042require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobjectline.class.php';
 
 1055  public $isextrafieldmanaged = 0;
 
 
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
 
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.
 
setErrorsFromObject($object)
setErrorsFromObject
 
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.
 
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.
 
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter=array(), $filtermode='AND')
Load list of objects in memory from the database.
 
update(User $user, $notrigger=false)
Update object into database.
 
deleteLine(User $user, $idline, $notrigger=false)
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.
 
getLinesArray()
Create an array of lines.
 
getLabelStatus($mode=0)
Return the label of the status.
 
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly 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.
 
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module.
 
cancel($user, $notrigger=0)
Set cancel status.
 
create(User $user, $notrigger=false)
Create object into database.
 
validate($user, $notrigger=0)
Validate object.
 
setDraft($user, $notrigger=0)
Set draft status.
 
__construct(DoliDB $db)
Constructor.
 
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.