26 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
38 public $module =
'mymodule';
43 public $element =
'myobject';
48 public $table_element =
'mymodule_myobject';
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,
'visible'=>-2,
'noteditable'=>1,
'notnull'=> 1,
'index'=>1,
'position'=>1,
'comment'=>
'Id',
'css'=>
'left'),
117 'entity' => array(
'type'=>
'integer',
'label'=>
'Entity',
'enabled'=>1,
'visible'=>0,
'notnull'=> 1,
'default'=>1,
'index'=>1,
'position'=>10),
118 'ref' => array(
'type'=>
'varchar(128)',
'label'=>
'Ref',
'enabled'=>1,
'visible'=>1,
'noteditable'=>0,
'default'=>
'',
'notnull'=> 1,
'showoncombobox'=>1,
'index'=>1,
'position'=>20,
'searchall'=>1,
'comment'=>
'Reference of object',
'validate'=>1),
119 'label' => array(
'type'=>
'varchar(255)',
'label'=>
'Label',
'enabled'=>1,
'visible'=>1,
'position'=>30,
'searchall'=>1,
'css'=>
'minwidth300',
'cssview'=>
'wordbreak',
'help'=>
'Help text',
'showoncombobox'=>2,
'validate'=>1,
'alwayseditable'=>1),
120 'amount' => array(
'type'=>
'price',
'label'=>
'Amount',
'enabled'=>1,
'visible'=>1,
'default'=>
'null',
'position'=>40,
'searchall'=>0,
'isameasure'=>1,
'help'=>
'Help text for amount',
'validate'=>1),
121 'qty' => array(
'type'=>
'real',
'label'=>
'Qty',
'enabled'=>1,
'visible'=>1,
'default'=>
'0',
'position'=>45,
'searchall'=>0,
'isameasure'=>1,
'help'=>
'Help text for quantity',
'css'=>
'maxwidth75imp',
'validate'=>1),
122 'fk_soc' => array(
'type'=>
'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)',
'picto'=>
'company',
'label'=>
'ThirdParty',
'visible'=> 1,
'enabled'=>
'$conf->societe->enabled',
'position'=>50,
'notnull'=>-1,
'index'=>1,
'help'=>
'OrganizationEventLinkToThirdParty',
'validate'=>1,
'css'=>
'maxwidth500 widthcentpercentminusxx',
'csslist'=>
'tdoverflowmax150'),
123 'fk_project' => array(
'type'=>
'integer:Project:projet/class/project.class.php:1',
'label'=>
'Project',
'picto'=>
'project',
'enabled'=>
'$conf->project->enabled',
'visible'=>-1,
'position'=>52,
'notnull'=>-1,
'index'=>1,
'validate'=>1,
'css'=>
'maxwidth500 widthcentpercentminusxx',
'csslist'=>
'tdoverflowmax150'),
124 'description' => array(
'type'=>
'text',
'label'=>
'Description',
'enabled'=>1,
'visible'=>3,
'position'=>60,
'validate'=>1),
125 'note_public' => array(
'type'=>
'html',
'label'=>
'NotePublic',
'enabled'=>1,
'visible'=>0,
'position'=>61,
'validate'=>1,
'cssview'=>
'wordbreak'),
126 'note_private' => array(
'type'=>
'html',
'label'=>
'NotePrivate',
'enabled'=>1,
'visible'=>0,
'position'=>62,
'validate'=>1,
'cssview'=>
'wordbreak'),
127 'date_creation' => array(
'type'=>
'datetime',
'label'=>
'DateCreation',
'enabled'=>1,
'visible'=>-2,
'notnull'=> 1,
'position'=>500),
128 'tms' => array(
'type'=>
'timestamp',
'label'=>
'DateModification',
'enabled'=>1,
'visible'=>-2,
'notnull'=> 0,
'position'=>501),
130 'fk_user_creat' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserAuthor',
'picto'=>
'user',
'enabled'=>1,
'visible'=>-2,
'notnull'=> 1,
'position'=>510,
'foreignkey'=>
'user.rowid',
'csslist'=>
'tdoverflowmax150'),
131 'fk_user_modif' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserModif',
'picto'=>
'user',
'enabled'=>1,
'visible'=>-2,
'notnull'=>-1,
'position'=>511,
'csslist'=>
'tdoverflowmax150'),
133 'last_main_doc' => array(
'type'=>
'varchar(255)',
'label'=>
'LastMainDoc',
'enabled'=>1,
'visible'=>0,
'notnull'=>0,
'position'=>600),
134 'import_key' => array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>1,
'visible'=>-2,
'notnull'=>-1,
'index'=>0,
'position'=>1000),
135 'model_pdf' => array(
'type'=>
'varchar(255)',
'label'=>
'Model pdf',
'enabled'=>1,
'visible'=>0,
'notnull'=>-1,
'position'=>1010),
136 'status' => array(
'type'=>
'integer',
'label'=>
'Status',
'enabled'=>1,
'visible'=>1,
'notnull'=> 1,
'default'=>0,
'index'=>1,
'position'=>2000,
'arrayofkeyval'=>array(0=>
'Draft', 1=>
'Validated', 9=>
'Canceled'),
'validate'=>1),
178 public $date_creation;
188 public $fk_user_creat;
193 public $fk_user_modif;
198 public $last_main_doc;
250 global $conf, $langs;
254 if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields[
'rowid']) && !empty($this->fields[
'ref'])) {
255 $this->fields[
'rowid'][
'visible'] = 0;
257 if (!
isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
258 $this->fields[
'entity'][
'enabled'] = 0;
268 foreach ($this->fields as $key => $val) {
269 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
270 unset($this->fields[$key]);
275 if (is_object($langs)) {
276 foreach ($this->fields as $key => $val) {
277 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
278 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
279 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
299 return $resultcreate;
311 global $langs, $extrafields;
316 $object =
new self($this->db);
321 $result = $object->fetchCommon($fromid);
322 if ($result > 0 && !empty($object->table_element_line)) {
323 $object->fetchLines();
332 unset($object->fk_user_creat);
333 unset($object->import_key);
336 if (property_exists($object,
'ref')) {
337 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
339 if (property_exists($object,
'label')) {
340 $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".$object->label : $this->fields[
'label'][
'default'];
342 if (property_exists($object,
'status')) {
343 $object->status = self::STATUS_DRAFT;
345 if (property_exists($object,
'date_creation')) {
346 $object->date_creation =
dol_now();
348 if (property_exists($object,
'date_modification')) {
349 $object->date_modification =
null;
353 if (is_array($object->array_options) && count($object->array_options) > 0) {
354 $extrafields->fetch_name_optionals_label($this->table_element);
355 foreach ($object->array_options as $key => $option) {
356 $shortkey = preg_replace(
'/options_/',
'', $key);
357 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
360 unset($object->array_options[$key]);
366 $object->context[
'createfromclone'] =
'createfromclone';
367 $result = $object->createCommon($user);
370 $this->error = $object->error;
371 $this->errors = $object->errors;
383 if (!empty($object->socid) && property_exists($this,
'fk_soc') && $this->fk_soc == $object->socid) {
390 unset($object->context[
'createfromclone']);
397 $this->
db->rollback();
409 public function fetch($id, $ref =
null)
412 if ($result > 0 && !empty($this->table_element_line)) {
425 $this->lines = array();
443 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
453 $sql .=
" FROM ".$this->db->prefix().$this->table_element.
" as t";
454 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
455 $sql .=
" WHERE t.entity IN (".getEntity($this->element).
")";
457 $sql .=
" WHERE 1 = 1";
461 if (count($filter) > 0) {
462 foreach ($filter as $key => $value) {
463 if ($key ==
't.rowid') {
464 $sqlwhere[] = $key.
" = ".((int) $value);
465 } elseif (in_array($this->fields[$key][
'type'], array(
'date',
'datetime',
'timestamp'))) {
466 $sqlwhere[] = $key.
" = '".$this->
db->idate($value).
"'";
467 } elseif ($key ==
'customsql') {
468 $sqlwhere[] = $value;
469 } elseif (strpos($value,
'%') ===
false) {
470 $sqlwhere[] = $key.
" IN (".$this->
db->sanitize($this->
db->escape($value)).
")";
472 $sqlwhere[] = $key.
" LIKE '%".$this->
db->escape($value).
"%'";
476 if (count($sqlwhere) > 0) {
477 $sql .=
" AND (".implode(
" ".$filtermode.
" ", $sqlwhere).
")";
480 if (!empty($sortfield)) {
481 $sql .= $this->
db->order($sortfield, $sortorder);
483 if (!empty($limit)) {
484 $sql .= $this->
db->plimit($limit, $offset);
491 while ($i < ($limit ? min($limit, $num) : $num)) {
492 $obj = $this->
db->fetch_object(
$resql);
494 $record =
new self($this->db);
495 $record->setVarsFromFetchObj($obj);
497 $records[$record->id] = $record;
505 $this->errors[] =
'Error '.$this->db->lasterror();
506 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
531 public function delete(
User $user, $notrigger =
false)
547 if ($this->status < 0) {
548 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
565 global $conf, $langs;
567 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
572 if ($this->status == self::STATUS_VALIDATED) {
573 dol_syslog(get_class($this).
"::validate action abandonned: already validated", LOG_WARNING);
590 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
595 $this->newref = $num;
599 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
600 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
601 $sql .=
" status = ".self::STATUS_VALIDATED;
602 if (!empty($this->fields[
'date_validation'])) {
603 $sql .=
", date_validation = '".$this->db->idate($now).
"'";
605 if (!empty($this->fields[
'fk_user_valid'])) {
606 $sql .=
", fk_user_valid = ".((int) $user->id);
608 $sql .=
" WHERE rowid = ".((int) $this->
id);
610 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
614 $this->error = $this->
db->lasterror();
618 if (!$error && !$notrigger) {
620 $result = $this->
call_trigger(
'MYOBJECT_VALIDATE', $user);
629 $this->oldref = $this->ref;
632 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
634 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filename = CONCAT('".$this->
db->escape($this->newref).
"', SUBSTR(filename, ".(strlen($this->
ref) + 1).
")), filepath = 'myobject/".$this->
db->escape($this->newref).
"'";
635 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'myobject/".$this->
db->escape($this->
ref).
"' and entity = ".$conf->entity;
638 $error++; $this->error = $this->
db->lasterror();
644 $dirsource = $conf->mymodule->dir_output.
'/myobject/'.$oldref;
645 $dirdest = $conf->mymodule->dir_output.
'/myobject/'.$newref;
646 if (!$error && file_exists($dirsource)) {
647 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
649 if (@rename($dirsource, $dirdest)) {
652 $listoffiles =
dol_dir_list($conf->mymodule->dir_output.
'/myobject/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
653 foreach ($listoffiles as $fileentry) {
654 $dirsource = $fileentry[
'name'];
655 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
656 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
657 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
658 @rename($dirsource, $dirdest);
668 $this->status = self::STATUS_VALIDATED;
675 $this->
db->rollback();
691 if ($this->status <= self::STATUS_DRAFT) {
702 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'MYOBJECT_UNVALIDATE');
712 public function cancel($user, $notrigger = 0)
715 if ($this->status != self::STATUS_VALIDATED) {
726 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'MYOBJECT_CANCEL');
736 public function reopen($user, $notrigger = 0)
739 if ($this->status == self::STATUS_VALIDATED) {
750 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'MYOBJECT_REOPEN');
763 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
765 global $conf, $langs, $hookmanager;
767 if (!empty($conf->dol_no_mouse_hover)) {
773 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"MyObject").
'</u>';
774 if (isset($this->status)) {
775 $label .=
' '.$this->getLibStatut(5);
778 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
780 $url =
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.$this->id;
782 if ($option !=
'nolink') {
784 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
785 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
786 $add_save_lastsearch_values = 1;
788 if ($url && $add_save_lastsearch_values) {
789 $url .=
'&save_lastsearch_values=1';
794 if (empty($notooltip)) {
795 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
796 $label = $langs->trans(
"ShowMyObject");
797 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
799 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
800 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
802 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
805 if ($option ==
'nolink' || empty($url)) {
806 $linkstart =
'<span';
808 $linkstart =
'<a href="'.$url.
'"';
810 $linkstart .= $linkclose.
'>';
811 if ($option ==
'nolink' || empty($url)) {
812 $linkend =
'</span>';
817 $result .= $linkstart;
819 if (empty($this->showphoto_on_popup)) {
821 $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);
825 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
827 list($class, $module) = explode(
'@', $this->picto);
830 $filename = $filearray[0][
'name'];
831 if (!empty($filename)) {
832 $pospoint = strpos($filearray[0][
'name'],
'.');
834 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
835 if (empty($conf->global->{strtoupper($module.
'_'.$class).
'_FORMATLISTPHOTOSASUSERS'})) {
836 $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>';
838 $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>';
843 $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);
848 if ($withpicto != 2) {
849 $result .= $this->ref;
855 global $action, $hookmanager;
856 $hookmanager->initHooks(array($this->element.
'dao'));
857 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
858 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
860 $result = $hookmanager->resPrint;
862 $result .= $hookmanager->resPrint;
906 return $this->LibStatut($this->status, $mode);
917 return $this->LibStatut($this->status, $mode);
931 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
934 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
935 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
936 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
937 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
938 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
939 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
942 $statusType =
'status'.$status;
944 if ($status == self::STATUS_CANCELED) {
945 $statusType =
'status6';
948 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
959 $sql =
"SELECT rowid,";
960 $sql .=
" date_creation as datec, tms as datem,";
961 $sql .=
" fk_user_creat, fk_user_modif";
962 $sql .=
" FROM ".MAIN_DB_PREFIX.$this->table_element.
" as t";
963 $sql .=
" WHERE t.rowid = ".((int) $id);
965 $result = $this->
db->query($sql);
967 if ($this->
db->num_rows($result)) {
968 $obj = $this->
db->fetch_object($result);
970 $this->
id = $obj->rowid;
972 $this->user_creation_id = $obj->fk_user_creat;
973 $this->user_modification_id = $obj->fk_user_modif;
974 if (!empty($obj->fk_user_valid)) {
975 $this->user_validation_id = $obj->fk_user_valid;
977 $this->date_creation = $this->
db->jdate($obj->datec);
978 $this->date_modification = empty($obj->datem) ?
'' : $this->
db->jdate($obj->datem);
979 if (!empty($obj->datev)) {
980 $this->date_validation = empty($obj->datev) ?
'' : $this->
db->jdate($obj->datev);
984 $this->
db->free($result);
1002 $this->initAsSpecimenCommon();
1012 $this->lines = array();
1015 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0, array(
'customsql'=>
'fk_myobject = '.((
int) $this->
id)));
1017 if (is_numeric($result)) {
1018 $this->error = $objectline->error;
1019 $this->errors = $objectline->errors;
1022 $this->lines = $result;
1023 return $this->lines;
1034 global $langs, $conf;
1035 $langs->load(
"mymodule@mymodule");
1037 if (empty($conf->global->MYMODULE_MYOBJECT_ADDON)) {
1038 $conf->global->MYMODULE_MYOBJECT_ADDON =
'mod_myobject_standard';
1041 if (!empty($conf->global->MYMODULE_MYOBJECT_ADDON)) {
1044 $file = $conf->global->MYMODULE_MYOBJECT_ADDON.
".php";
1045 $classname = $conf->global->MYMODULE_MYOBJECT_ADDON;
1048 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
1049 foreach ($dirmodels as $reldir) {
1053 $mybool |= @include_once $dir.$file;
1056 if ($mybool ===
false) {
1061 if (class_exists($classname)) {
1062 $obj =
new $classname();
1063 $numref = $obj->getNextValue($this);
1065 if ($numref !=
'' && $numref !=
'-1') {
1068 $this->error = $obj->error;
1073 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
1077 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1093 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1095 global $conf, $langs;
1098 $includedocgeneration = 0;
1100 $langs->load(
"mymodule@mymodule");
1103 $modele =
'standard_myobject';
1105 if (!empty($this->model_pdf)) {
1106 $modele = $this->model_pdf;
1107 } elseif (!empty($conf->global->MYOBJECT_ADDON_PDF)) {
1108 $modele = $conf->global->MYOBJECT_ADDON_PDF;
1112 $modelpath =
"core/modules/mymodule/doc/";
1114 if ($includedocgeneration && !empty($modele)) {
1115 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1130 global $conf, $langs;
1146 $this->
db->commit();
1153 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobjectline.class.php';
1166 public $isextrafieldmanaged = 0;
Parent class of all other business classes (invoices, contracts, proposals, orders,...
deleteLineCommon(User $user, $idline, $notrigger=false)
Delete a line of object in database.
getFieldList($alias='')
Function to concat keys of fields.
fetchCommon($id, $ref=null, $morewhere='')
Load object in memory from the database.
createCommon(User $user, $notrigger=false)
Create object into database.
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
setStatusCommon($user, $status, $notrigger=0, $triggercode='')
Set to a status.
copy_linked_contact($objFrom, $source='internal')
Copy contact from one element to current.
updateCommon(User $user, $notrigger=false)
Update object into database.
fetchLinesCommon($morewhere='')
Load object in memory from the database.
call_trigger($triggerName, $user)
Call trigger based on this instance.
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
Class to manage Dolibarr database access.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
createFromClone(User $user, $fromid)
Clone an object into another one.
getLibStatut($mode=0)
Return the label of the status.
fetch($id, $ref=null)
Load object in memory from the database.
reopen($user, $notrigger=0)
Set back to validated status.
setDraft($user, $notrigger=0)
Set draft status.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
LibStatut($status, $mode=0)
Return the status.
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter=array(), $filtermode='AND')
Load list of objects in memory from the database.
__construct(DoliDB $db)
Constructor.
cancel($user, $notrigger=0)
Set cancel status.
fetchLines()
Load object lines in memory from the database.
update(User $user, $notrigger=false)
Update object into database.
info($id)
Load the info information in the object.
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
getLabelStatus($mode=0)
Return a thumb for kanban views.
create(User $user, $notrigger=false)
Create object into database.
deleteLine(User $user, $idline, $notrigger=false)
Delete a line of object in database.
validate($user, $notrigger=0)
Validate object.
getLinesArray()
Create an array of lines.
__construct(DoliDB $db)
Constructor.
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
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)
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db
API class for accounts.