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 =
'myobject@mymodule';
67 const STATUS_DRAFT = 0;
68 const STATUS_VALIDATED = 1;
69 const STATUS_CANCELED = 9;
102 public $fields = array(
103 'rowid' => array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>1,
'visible'=>-2,
'noteditable'=>1,
'notnull'=> 1,
'index'=>1,
'position'=>1,
'comment'=>
'Id',
'css'=>
'left'),
104 'ref' => array(
'type'=>
'varchar(128)',
'label'=>
'Ref',
'enabled'=>1,
'visible'=>1,
'noteditable'=>0,
'default'=>
'',
'notnull'=> 1,
'showoncombobox'=>1,
'index'=>1,
'position'=>10,
'searchall'=>1,
'comment'=>
'Reference of object'),
105 'entity' => array(
'type'=>
'integer',
'label'=>
'Entity',
'enabled'=>1,
'visible'=>0,
'notnull'=> 1,
'default'=>1,
'index'=>1,
'position'=>20),
106 'label' => array(
'type'=>
'varchar(255)',
'label'=>
'Label',
'enabled'=>1,
'visible'=>1,
'position'=>30,
'searchall'=>1,
'css'=>
'minwidth300',
'cssview'=>
'wordbreak',
'help'=>
'Help text',
'showoncombobox'=>1),
107 'amount' => array(
'type'=>
'price',
'label'=>
'Amount',
'enabled'=>1,
'visible'=>1,
'default'=>
'null',
'position'=>40,
'searchall'=>0,
'isameasure'=>1,
'help'=>
'Help text for amount'),
108 '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'),
109 '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'=>1,
'position'=>50,
'notnull'=>-1,
'index'=>1,
'help'=>
'LinkToThirparty'),
110 'fk_project' => array(
'type'=>
'integer:Project:projet/class/project.class.php:1',
'label'=>
'Project',
'picto'=>
'project',
'enabled'=>1,
'visible'=>-1,
'position'=>52,
'notnull'=>-1,
'index'=>1),
111 'description' => array(
'type'=>
'text',
'label'=>
'Description',
'enabled'=>1,
'visible'=>3,
'position'=>60),
112 'note_public' => array(
'type'=>
'html',
'label'=>
'NotePublic',
'enabled'=>1,
'visible'=>0,
'position'=>61),
113 'note_private' => array(
'type'=>
'html',
'label'=>
'NotePrivate',
'enabled'=>1,
'visible'=>0,
'position'=>62),
114 'date_creation' => array(
'type'=>
'datetime',
'label'=>
'DateCreation',
'enabled'=>1,
'visible'=>-2,
'notnull'=> 1,
'position'=>500),
115 'tms' => array(
'type'=>
'timestamp',
'label'=>
'DateModification',
'enabled'=>1,
'visible'=>-2,
'notnull'=> 0,
'position'=>501),
117 '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'),
118 'fk_user_modif' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserModif',
'picto'=>
'user',
'enabled'=>1,
'visible'=>-2,
'notnull'=>-1,
'position'=>511),
120 'last_main_doc' => array(
'type'=>
'varchar(255)',
'label'=>
'LastMainDoc',
'enabled'=>1,
'visible'=>0,
'notnull'=>0,
'position'=>600),
121 'import_key' => array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>1,
'visible'=>-2,
'notnull'=>-1,
'index'=>0,
'position'=>1000),
122 'model_pdf' => array(
'type'=>
'varchar(255)',
'label'=>
'Model pdf',
'enabled'=>1,
'visible'=>0,
'notnull'=>-1,
'position'=>1010),
123 'status' => array(
'type'=>
'smallint',
'label'=>
'Status',
'enabled'=>1,
'visible'=>1,
'notnull'=> 1,
'default'=>0,
'index'=>1,
'position'=>1000,
'arrayofkeyval'=>array(0=>
'Draft', 1=>
'Validated', 9=>
'Canceled')),
159 public $date_creation;
169 public $fk_user_creat;
174 public $fk_user_modif;
179 public $last_main_doc;
231 global $conf, $langs;
235 if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->
fields[
'rowid'])) $this->
fields[
'rowid'][
'visible'] = 0;
236 if (empty($conf->multicompany->enabled) && isset($this->
fields[
'entity'])) $this->
fields[
'entity'][
'enabled'] = 0;
245 foreach ($this->
fields as $key => $val)
247 if (isset($val[
'enabled']) && empty($val[
'enabled']))
249 unset($this->
fields[$key]);
254 if (is_object($langs))
256 foreach ($this->
fields as $key => $val)
258 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval']))
260 foreach ($val[
'arrayofkeyval'] as $key2 => $val2)
262 $this->
fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
290 global $langs, $extrafields;
295 $object =
new self($this->db);
300 $result = $object->fetchCommon($fromid);
301 if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
309 unset($object->fk_user_creat);
310 unset($object->import_key);
313 if (property_exists($object,
'ref')) $object->ref = empty($this->
fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->
fields[
'ref'][
'default'];
314 if (property_exists($object,
'label')) $object->label = empty($this->
fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".$object->label : $this->
fields[
'label'][
'default'];
315 if (property_exists($object,
'status')) { $object->status = self::STATUS_DRAFT; }
316 if (property_exists($object,
'date_creation')) { $object->date_creation =
dol_now(); }
317 if (property_exists($object,
'date_modification')) { $object->date_modification = null; }
320 if (is_array($object->array_options) && count($object->array_options) > 0)
322 $extrafields->fetch_name_optionals_label($this->table_element);
323 foreach ($object->array_options as $key => $option)
325 $shortkey = preg_replace(
'/options_/',
'', $key);
326 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey]))
329 unset($object->array_options[$key]);
335 $object->context[
'createfromclone'] =
'createfromclone';
336 $result = $object->createCommon($user);
339 $this->error = $object->error;
340 $this->errors = $object->errors;
355 if (property_exists($this,
'socid') && $this->socid == $object->socid)
362 unset($object->context[
'createfromclone']);
369 $this->
db->rollback();
381 public function fetch($id, $ref = null)
384 if ($result > 0 && !empty($this->table_element_line)) $this->
fetchLines();
395 $this->lines = array();
413 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
423 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
424 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .=
' WHERE t.entity IN ('.getEntity($this->table_element).
')';
425 else $sql .=
' WHERE 1 = 1';
428 if (count($filter) > 0) {
429 foreach ($filter as $key => $value) {
430 if ($key ==
't.rowid') {
431 $sqlwhere[] = $key.
'='.$value;
432 } elseif (in_array($this->
fields[$key][
'type'], array(
'date',
'datetime',
'timestamp'))) {
433 $sqlwhere[] = $key.
' = \''.$this->
db->idate($value).
'\'';
434 } elseif ($key ==
'customsql') {
435 $sqlwhere[] = $value;
436 } elseif (strpos($value,
'%') ===
false) {
437 $sqlwhere[] = $key.
' IN ('.$this->
db->sanitize($this->
db->escape($value)).
')';
439 $sqlwhere[] = $key.
' LIKE \'%'.$this->
db->escape($value).
'%\'';
443 if (count($sqlwhere) > 0) {
444 $sql .=
' AND ('.implode(
' '.$filtermode.
' ', $sqlwhere).
')';
447 if (!empty($sortfield)) {
448 $sql .= $this->
db->order($sortfield, $sortorder);
450 if (!empty($limit)) {
451 $sql .=
' '.$this->db->plimit($limit, $offset);
458 while ($i < ($limit ? min($limit, $num) : $num))
460 $obj = $this->
db->fetch_object(
$resql);
462 $record =
new self($this->db);
463 $record->setVarsFromFetchObj($obj);
465 $records[$record->id] = $record;
473 $this->errors[] =
'Error '.$this->db->lasterror();
474 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
499 public function delete(
User $user, $notrigger =
false)
515 if ($this->status < 0)
517 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
534 global $conf, $langs;
536 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
541 if ($this->status == self::STATUS_VALIDATED)
543 dol_syslog(get_class($this).
"::validate action abandonned: already validated", LOG_WARNING);
560 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->ref) || empty($this->ref)))
566 $this->newref = $num;
570 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
571 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
572 $sql .=
" status = ".self::STATUS_VALIDATED;
573 if (!empty($this->
fields[
'date_validation'])) $sql .=
", date_validation = '".$this->db->idate($now).
"'";
574 if (!empty($this->
fields[
'fk_user_valid'])) $sql .=
", fk_user_valid = ".$user->id;
575 $sql .=
" WHERE rowid = ".$this->id;
577 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
582 $this->error = $this->
db->lasterror();
586 if (!$error && !$notrigger)
589 $result = $this->
call_trigger(
'MYOBJECT_VALIDATE', $user);
590 if ($result < 0) $error++;
597 $this->oldref = $this->ref;
600 if (preg_match(
'/^[\(]?PROV/i', $this->ref))
603 $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).
"'";
604 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->ref).
"%' AND filepath = 'myobject/".$this->
db->escape($this->ref).
"' and entity = ".$conf->entity;
606 if (!
$resql) { $error++; $this->error = $this->
db->lasterror(); }
611 $dirsource = $conf->mymodule->dir_output.
'/myobject/'.$oldref;
612 $dirdest = $conf->mymodule->dir_output.
'/myobject/'.$newref;
613 if (!$error && file_exists($dirsource))
615 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
617 if (@rename($dirsource, $dirdest))
621 $listoffiles =
dol_dir_list($conf->mymodule->dir_output.
'/myobject/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
622 foreach ($listoffiles as $fileentry)
624 $dirsource = $fileentry[
'name'];
625 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
626 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
627 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
628 @rename($dirsource, $dirdest);
639 $this->status = self::STATUS_VALIDATED;
647 $this->
db->rollback();
663 if ($this->status <= self::STATUS_DRAFT)
675 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'MYOBJECT_UNVALIDATE');
685 public function cancel($user, $notrigger = 0)
688 if ($this->status != self::STATUS_VALIDATED)
700 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'MYOBJECT_CANCEL');
710 public function reopen($user, $notrigger = 0)
713 if ($this->status != self::STATUS_CANCELED)
725 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'MYOBJECT_REOPEN');
738 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
740 global $conf, $langs, $hookmanager;
742 if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1;
746 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"MyObject").
'</u>';
747 if (isset($this->status)) {
748 $label .=
' '.$this->getLibStatut(5);
751 $label .=
'<b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
753 $url =
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.$this->id;
755 if ($option !=
'nolink')
758 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
759 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/',
$_SERVER[
"PHP_SELF"])) $add_save_lastsearch_values = 1;
760 if ($add_save_lastsearch_values) $url .=
'&save_lastsearch_values=1';
764 if (empty($notooltip))
766 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
768 $label = $langs->trans(
"ShowMyObject");
769 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
771 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
772 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
773 }
else $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
775 $linkstart =
'<a href="'.$url.
'"';
776 $linkstart .= $linkclose.
'>';
779 $result .= $linkstart;
781 if (empty($this->showphoto_on_popup)) {
782 if ($withpicto) $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);
785 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
787 list($class, $module) = explode(
'@', $this->picto);
788 $upload_dir = $conf->$module->multidir_output[$conf->entity].
"/$class/".
dol_sanitizeFileName($this->ref);
790 $filename = $filearray[0][
'name'];
791 if (!empty($filename)) {
792 $pospoint = strpos($filearray[0][
'name'],
'.');
794 $pathtophoto = $class.
'/'.$this->ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
795 if (empty($conf->global->{strtoupper($module.
'_'.$class).
'_FORMATLISTPHOTOSASUSERS'})) {
796 $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>';
798 $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>';
803 $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);
808 if ($withpicto != 2) $result .= $this->ref;
813 global $action, $hookmanager;
814 $hookmanager->initHooks(array(
'myobjectdao'));
815 $parameters = array(
'id'=>$this->
id,
'getnomurl'=>$result);
816 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
817 if ($reshook > 0) $result = $hookmanager->resPrint;
818 else $result .= $hookmanager->resPrint;
831 return $this->LibStatut($this->status, $mode);
845 if (empty($this->labelStatus) || empty($this->labelStatusShort))
849 $this->labelStatus[self::STATUS_DRAFT] = $langs->trans(
'Draft');
850 $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans(
'Enabled');
851 $this->labelStatus[self::STATUS_CANCELED] = $langs->trans(
'Disabled');
852 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans(
'Draft');
853 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans(
'Enabled');
854 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans(
'Disabled');
857 $statusType =
'status'.$status;
859 if ($status == self::STATUS_CANCELED) $statusType =
'status6';
861 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
872 $sql =
'SELECT rowid, date_creation as datec, tms as datem,';
873 $sql .=
' fk_user_creat, fk_user_modif';
874 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
875 $sql .=
' WHERE t.rowid = '.$id;
876 $result = $this->
db->query($sql);
879 if ($this->
db->num_rows($result))
881 $obj = $this->
db->fetch_object($result);
882 $this->
id = $obj->rowid;
883 if ($obj->fk_user_author)
885 $cuser =
new User($this->
db);
886 $cuser->fetch($obj->fk_user_author);
887 $this->user_creation = $cuser;
890 if ($obj->fk_user_valid)
892 $vuser =
new User($this->
db);
893 $vuser->fetch($obj->fk_user_valid);
894 $this->user_validation = $vuser;
897 if ($obj->fk_user_cloture)
899 $cluser =
new User($this->
db);
900 $cluser->fetch($obj->fk_user_cloture);
901 $this->user_cloture = $cluser;
904 $this->date_creation = $this->
db->jdate($obj->datec);
905 $this->date_modification = $this->
db->jdate($obj->datem);
906 $this->date_validation = $this->
db->jdate($obj->datev);
909 $this->
db->free($result);
923 $this->initAsSpecimenCommon();
933 $this->lines = array();
936 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0, array(
'customsql'=>
'fk_myobject = '.$this->
id));
938 if (is_numeric($result))
940 $this->error = $this->error;
941 $this->errors = $this->errors;
944 $this->lines = $result;
956 global $langs, $conf;
957 $langs->load(
"mymodule@mymodule");
959 if (empty($conf->global->MYMODULE_MYOBJECT_ADDON)) {
960 $conf->global->MYMODULE_MYOBJECT_ADDON =
'mod_myobject_standard';
963 if (!empty($conf->global->MYMODULE_MYOBJECT_ADDON))
967 $file = $conf->global->MYMODULE_MYOBJECT_ADDON.
".php";
968 $classname = $conf->global->MYMODULE_MYOBJECT_ADDON;
971 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
972 foreach ($dirmodels as $reldir)
977 $mybool |= @include_once $dir.$file;
980 if ($mybool ===
false)
986 if (class_exists($classname)) {
987 $obj =
new $classname();
988 $numref = $obj->getNextValue($this);
990 if ($numref !=
'' && $numref !=
'-1')
994 $this->error = $obj->error;
999 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
1003 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1019 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
1021 global $conf, $langs;
1024 $includedocgeneration = 0;
1026 $langs->load(
"mymodule@mymodule");
1029 $modele =
'standard_myobject';
1031 if (!empty($this->model_pdf)) {
1032 $modele = $this->model_pdf;
1033 } elseif (!empty($conf->global->MYOBJECT_ADDON_PDF)) {
1034 $modele = $conf->global->MYOBJECT_ADDON_PDF;
1038 $modelpath =
"core/modules/mymodule/doc/";
1040 if ($includedocgeneration && !empty($modele)) {
1041 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1056 global $conf, $langs;
1072 $this->
db->commit();
1079 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobjectline.class.php';
1092 public $isextrafieldmanaged = 0;
cancel($user, $notrigger=0)
Set cancel status.
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
getLibStatut($mode=0)
Return the label of the status.
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module...
getNomUrl($withpicto=0, $option= '', $notooltip=0, $morecss= '', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
fetchLinesCommon($morewhere= '')
Load object in memory from the database.
setDraft($user, $notrigger=0)
Set draft status.
foreach($object->fields as $key=> $val) if(is_array($extrafields->attributes[$object->table_element]['label'])&&count($extrafields->attributes[$object->table_element]['label']) > 0) $object fields
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
Class to manage Dolibarr database access.
__construct(DoliDB $db)
Constructor.
fetch($id, $ref=null)
Load object in memory from the database.
createCommon(User $user, $notrigger=false)
Create object into database.
reopen($user, $notrigger=0)
Set back to validated status.
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
info($id)
Load the info information in the object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
$conf db
API class for accounts.
Parent class for class inheritance lines of business objects This class is useless for the moment so ...
update(User $user, $notrigger=false)
Update object into database.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
fetchLines()
Load object lines in memory from the database.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
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.
validate($user, $notrigger=0)
Validate object.
print $_SERVER["PHP_SELF"]
Edit parameters.
__construct(DoliDB $db)
Constructor.
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.
print
Draft customers invoices.
call_trigger($triggerName, $user)
Call trigger based on this instance.
fetchAll($sortorder= '', $sortfield= '', $limit=0, $offset=0, array $filter=array(), $filtermode= 'AND')
Load list of objects in memory from the database.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
setStatusCommon($user, $status, $notrigger=0, $triggercode= '')
Set to a status.
getFieldList()
Function to concat keys of fields.
dolGetStatus($statusLabel= '', $statusLabelShort= '', $html= '', $statusType= 'status0', $displayMode=0, $url= '', $params=array())
Output the badge of a status.
createFromClone(User $user, $fromid)
Clone an object into another one.
LibStatut($status, $mode=0)
Return the status.
Parent class of all other business classes (invoices, contracts, proposals, orders, ...)
create(User $user, $notrigger=false)
Create object into database.
fetchCommon($id, $ref=null, $morewhere= '')
Load object in memory from the database.
deleteLine(User $user, $idline, $notrigger=false)
Delete a line of object in database.
getLinesArray()
Create an array of lines.