31require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
41 public $module =
'hrm';
46 public $element =
'skill';
51 public $table_element =
'hrm_skill';
57 public $table_element_line =
'skilldet';
62 public $picto =
'shapes';
65 const STATUS_DRAFT = 0;
66 const STATUS_VALIDATED = 1;
67 const STATUS_CANCELED = 9;
68 const DEFAULT_MAX_RANK_PER_SKILL = 3;
100 public $fields = array(
101 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'position' => 1,
'notnull' => 1,
'visible' => 0,
'noteditable' => 1,
'index' => 1,
'css' =>
'left',
'comment' =>
"Id"),
102 'label' => array(
'type' =>
'varchar(255)',
'label' =>
'Label',
'enabled' => 1,
'position' => 30,
'notnull' => 1,
'visible' => 1,
'searchall' => 1,
'css' =>
'minwidth300',
'cssview' =>
'wordbreak',
'showoncombobox' => 2,),
103 'description' => array(
'type' =>
'text',
'label' =>
'Description',
'enabled' => 1,
'position' => 60,
'notnull' => 0,
'visible' => 3,),
104 'date_creation' => array(
'type' =>
'datetime',
'label' =>
'DateCreation',
'enabled' => 1,
'position' => 500,
'notnull' => 1,
'visible' => -2,),
105 'tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModification',
'enabled' => 1,
'position' => 501,
'notnull' => 0,
'visible' => -2,),
106 'fk_user_creat' => array(
'type' =>
'integer:User:user/class/user.class.php:0',
'label' =>
'UserAuthor',
'enabled' => 1,
'position' => 510,
'notnull' => 1,
'visible' => -2,
'foreignkey' =>
'user.rowid',),
107 'fk_user_modif' => array(
'type' =>
'integer:User:user/class/user.class.php:0',
'label' =>
'UserModif',
'enabled' => 1,
'position' => 511,
'notnull' => -1,
'visible' => -2,),
108 'required_level' => array(
'type' =>
'integer',
'label' =>
'requiredLevel',
'enabled' => 1,
'position' => 50,
'notnull' => 1,
'visible' => 0,),
109 'date_validite' => array(
'type' =>
'integer',
'label' =>
'date_validite',
'enabled' => 1,
'position' => 52,
'notnull' => 1,
'visible' => 0,),
110 'temps_theorique' => array(
'type' =>
'double(24,8)',
'label' =>
'temps_theorique',
'enabled' => 1,
'position' => 54,
'notnull' => 1,
'visible' => 0,),
111 'skill_type' => array(
'type' =>
'integer',
'label' =>
'SkillType',
'enabled' => 1,
'position' => 55,
'notnull' => 1,
'visible' => 1,
'index' => 1,
'css' =>
'minwidth200',
'arrayofkeyval' => array(
'0' =>
'TypeKnowHow',
'1' =>
'TypeHowToBe',
'9' =>
'TypeKnowledge'),
'default' =>
'0'),
112 'note_public' => array(
'type' =>
'html',
'label' =>
'NotePublic',
'enabled' => 1,
'position' => 70,
'notnull' => 0,
'visible' => 0,),
113 'note_private' => array(
'type' =>
'html',
'label' =>
'NotePrivate',
'enabled' => 1,
'position' => 71,
'notnull' => 0,
'visible' => 0,),
130 public $fk_user_creat;
134 public $fk_user_modif;
138 public $required_level;
142 public $date_validite;
146 public $temps_theorique;
164 public $fk_element =
'fk_skill';
174 protected $childtables = array(
175 'hrm_skillrank' => [
'name' =>
'SkillRank'],
176 'hrm_evaluationdet' => [
'name' =>
'EvaluationDet'],
184 protected $childtablesoncascade = array(
'hrm_skilldet');
200 global
$conf, $langs;
204 $this->ismultientitymanaged = 0;
205 $this->isextrafieldmanaged = 1;
208 $this->fields[
'rowid'][
'visible'] = 0;
210 if (!isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
211 $this->fields[
'entity'][
'enabled'] = 0;
221 foreach ($this->fields as $key => $val) {
222 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
223 unset($this->fields[$key]);
228 if (is_object($langs)) {
229 foreach ($this->fields as $key => $val) {
230 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
231 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
232 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
253 if ($resultcreate > 0) {
258 return $resultcreate;
269 global
$conf, $user, $langs;
271 $MaxNumberSkill =
getDolGlobalInt(
'HRM_MAXRANK', self::DEFAULT_MAX_RANK_PER_SKILL);
272 $defaultSkillDesc =
getDolGlobalString(
'HRM_DEFAULT_SKILL_DESCRIPTION', $langs->trans(
"NoDescription"));
276 require_once __DIR__ .
'/skilldet.class.php';
281 $skilldet =
new Skilldet($this->db);
282 $skilldet->description = $langs->trans(
'SkillNotRequired');
283 $skilldet->rankorder = 0;
284 $skilldet->fk_skill = $this->id;
286 $result = $skilldet->create($user);
292 while ($i <= $MaxNumberSkill) {
293 $skilldet =
new Skilldet($this->db);
294 $skilldet->description = $defaultSkillDesc .
" " . $i;
295 $skilldet->rankorder = $i;
296 $skilldet->fk_skill = $this->id;
298 $result = $skilldet->create($user);
311 $this->db->rollback();
325 global $langs, $extrafields;
335 $result =
$object->fetchCommon($fromid);
336 if ($result > 0 && !empty(
$object->table_element_line)) {
350 if (property_exists(
$object,
'ref')) {
351 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
353 if (property_exists(
$object,
'label')) {
355 $object->label = empty($this->fields[
'label'][
'default']) ? $langs->trans(
"CopyOf").
" ".
$object->label : $this->fields[
'label'][
'default'];
357 if (property_exists(
$object,
'status')) {
358 $object->status = self::STATUS_DRAFT;
360 if (property_exists(
$object,
'date_creation')) {
363 if (property_exists(
$object,
'date_modification')) {
364 $object->date_modification =
null;
368 if (is_array(
$object->array_options) && count(
$object->array_options) > 0) {
369 $extrafields->fetch_name_optionals_label($this->table_element);
370 foreach (
$object->array_options as $key => $option) {
371 $shortkey = preg_replace(
'/options_/',
'', $key);
372 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
374 unset(
$object->array_options[$key]);
380 $object->context[
'createfromclone'] =
'createfromclone';
381 $result =
$object->createCommon($user);
396 if (property_exists($this,
'fk_soc') && $this->fk_soc ==
$object->socid) {
403 unset(
$object->context[
'createfromclone']);
410 $this->db->rollback();
422 public function fetch($id, $ref =
null)
425 if ($result > 0 && !empty($this->table_element_line)) {
438 $this->lines = array();
439 require_once __DIR__ .
'/skilldet.class.php';
440 $skilldet =
new Skilldet($this->db);
441 $this->lines = $skilldet->fetchAll(
'ASC',
'', 0, 0,
'(fk_skill:=:'.$this->
id.
')');
443 if (is_array($this->lines)) {
444 return (count($this->lines) > 0) ? $this->lines : array();
445 } elseif ($this->lines < 0) {
465 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, $filter =
'', $filtermode =
'AND')
473 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
474 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
475 $sql .=
' WHERE t.entity IN ('.getEntity($this->element).
')';
477 $sql .=
' WHERE 1 = 1';
484 $this->errors[] = $errormessage;
485 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
489 if (!empty($sortfield)) {
490 $sql .= $this->db->order($sortfield, $sortorder);
492 if (!empty($limit)) {
493 $sql .=
' '.$this->db->plimit($limit, $offset);
496 $resql = $this->db->query($sql);
498 $num = $this->db->num_rows($resql);
500 while ($i < ($limit ? min($limit, $num) : $num)) {
501 $obj = $this->db->fetch_object($resql);
503 $record =
new self($this->db);
504 $record->setVarsFromFetchObj($obj);
506 $records[$record->id] = $record;
510 $this->db->free($resql);
514 $this->errors[] =
'Error '.$this->db->lasterror();
515 dol_syslog(__METHOD__.
' '.implode(
',', $this->errors), LOG_ERR);
540 public function delete(
User $user, $notrigger = 0)
556 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
575 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
580 if ($this->
status == self::STATUS_VALIDATED) {
581 dol_syslog(get_class($this).
"::validate action abandoned: already validated", LOG_WARNING);
598 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
603 $this->newref = $num;
607 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
608 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
609 $sql .=
" status = ".self::STATUS_VALIDATED;
610 if (!empty($this->fields[
'date_validation'])) {
611 $sql .=
", date_validation = '".$this->db->idate($now).
"'";
613 if (!empty($this->fields[
'fk_user_valid'])) {
614 $sql .=
", fk_user_valid = ".((int) $user->id);
616 $sql .=
" WHERE rowid = ".((int) $this->
id);
618 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
619 $resql = $this->db->query($sql);
622 $this->error = $this->db->lasterror();
626 if (!$error && !$notrigger) {
628 $result = $this->
call_trigger(
'HRM_SKILL_VALIDATE', $user);
637 $this->oldref = $this->ref;
640 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
642 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filename = CONCAT('".$this->db->escape($this->newref).
"', SUBSTR(filename, ".(strlen($this->
ref) + 1).
")), filepath = 'skill/".$this->db->escape($this->newref).
"'";
643 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'skill/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
644 $resql = $this->db->query($sql);
647 $this->error = $this->db->lasterror();
649 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'skill/".$this->db->escape($this->newref).
"'";
650 $sql .=
" WHERE filepath = 'skill/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
651 $resql = $this->db->query($sql);
654 $this->error = $this->db->lasterror();
660 $dirsource =
$conf->hrm->dir_output.
'/skill/'.$oldref;
661 $dirdest =
$conf->hrm->dir_output.
'/skill/'.$newref;
662 if (!$error && file_exists($dirsource)) {
663 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
665 if (@rename($dirsource, $dirdest)) {
668 $listoffiles =
dol_dir_list(
$conf->hrm->dir_output.
'/skill/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
669 foreach ($listoffiles as $fileentry) {
670 $dirsource = $fileentry[
'name'];
671 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
672 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
673 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
674 @rename($dirsource, $dirdest);
684 $this->
status = self::STATUS_VALIDATED;
691 $this->db->rollback();
707 if ($this->
status <= self::STATUS_DRAFT) {
718 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'SKILL_UNVALIDATE');
728 public function cancel($user, $notrigger = 0)
731 if ($this->
status != self::STATUS_VALIDATED) {
742 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'SKILL_CANCEL');
752 public function reopen($user, $notrigger = 0)
755 if ($this->
status != self::STATUS_CANCELED) {
766 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'SKILL_REOPEN');
789 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
791 global
$conf, $langs, $hookmanager;
793 if (!empty(
$conf->dol_no_mouse_hover)) {
799 $label =
img_picto(
'', $this->picto).
' <u>'.$langs->trans(
"Skill").
'</u>';
800 if (isset($this->
status)) {
801 $label .=
' '.$this->getLibStatut(5);
804 $label .=
'<b>'.$langs->trans(
'Label').
':</b> '.$this->label;
807 $url =
dol_buildpath(
'/hrm/skill_card.php', 1).
'?id='.$this->id;
809 if ($option !=
'nolink') {
811 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
812 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
813 $add_save_lastsearch_values = 1;
815 if ($add_save_lastsearch_values) {
816 $url .=
'&save_lastsearch_values=1';
821 if (empty($notooltip)) {
823 $label = $langs->trans(
"ShowSkill");
824 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
826 $linkclose .=
' title="'.dol_escape_htmltag($label, 1).
'"';
827 $linkclose .=
' class="classfortooltip'.($morecss ?
' '.$morecss :
'').
'"';
829 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
832 if ($option ==
'nolink') {
833 $linkstart =
'<span';
835 $linkstart =
'<a href="'.$url.
'"';
837 $linkstart .= $linkclose.
'>';
838 if ($option ==
'nolink') {
839 $linkend =
'</span>';
844 $result .= $linkstart;
846 if (empty($this->showphoto_on_popup)) {
848 $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);
852 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
854 list($class, $module) = explode(
'@', $this->picto);
857 $filename = $filearray[0][
'name'];
858 if (!empty($filename)) {
859 $pospoint = strpos($filearray[0][
'name'],
'.');
861 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
863 $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>';
865 $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>';
870 $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);
875 if ($withpicto != 2) {
876 $result .= $this->label;
882 global $action, $hookmanager;
883 $hookmanager->initHooks(array(
'skilldao'));
884 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
885 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
887 $result = $hookmanager->resPrint;
889 $result .= $hookmanager->resPrint;
916 if (empty($status)) {
921 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
924 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
925 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
926 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
927 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
928 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Enabled');
929 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Disabled');
932 $statusType =
'status'.$status;
934 if ($status == self::STATUS_CANCELED) {
935 $statusType =
'status6';
938 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
949 $sql =
'SELECT rowid, date_creation as datec, tms as datem,';
950 $sql .=
' fk_user_creat, fk_user_modif';
951 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
952 $sql .=
' WHERE t.rowid = '.((int) $id);
953 $result = $this->db->query($sql);
955 if ($this->db->num_rows($result)) {
956 $obj = $this->db->fetch_object($result);
958 $this->
id = $obj->rowid;
960 $this->user_creation_id = $obj->fk_user_creat;
961 $this->user_modification_id = $obj->fk_user_modif;
962 $this->date_creation = $this->db->jdate($obj->datec);
963 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
966 $this->db->free($result);
994 $this->lines = array();
996 $objectline =
new Skilldet($this->db);
997 $result = $objectline->fetchAll(
'ASC',
'rankorder', 0, 0,
'(fk_skill:=:'.((
int) $this->
id).
')');
999 if (is_numeric($result)) {
1003 $this->lines = $result;
1004 return $this->lines;
1015 global $langs,
$conf;
1016 $langs->load(
"hrm");
1019 $conf->global->hrm_SKILL_ADDON =
'mod_skill_standard';
1029 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
1030 foreach ($dirmodels as $reldir) {
1034 $mybool = ((bool) @include_once $dir.$file) || $mybool;
1042 if (class_exists($classname)) {
1043 $obj =
new $classname();
1044 '@phan-var-force ModeleNumRefEvaluation $obj';
1045 $numref = $obj->getNextValue($this);
1047 if ($numref !=
'' && $numref !=
'-1') {
1050 $this->error = $obj->error;
1055 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
1059 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1075 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1077 global
$conf, $langs;
1080 $includedocgeneration = 0;
1082 $langs->load(
"hrm");
1085 $modele =
'standard_skill';
1087 if (!empty($this->model_pdf)) {
1088 $modele = $this->model_pdf;
1094 $modelpath =
"core/modules/hrm/doc/";
1096 if ($includedocgeneration && !empty($modele)) {
1097 $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1112 case 0: $result = $langs->trans(
"TypeKnowHow");
1114 case 1: $result = $langs->trans(
"TypeHowToBe");
1116 case 9: $result = $langs->trans(
"TypeKnowledge");
1131 global $selected, $langs;
1133 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1135 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1136 $return .=
'<div class="info-box info-box-sm">';
1137 $return .=
'<span class="info-box-icon bg-infobox-action">';
1139 $return .=
'</span>';
1140 $return .=
'<div class="info-box-content">';
1141 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->
getNomUrl() : $this->ref).
'</span>';
1142 if ($selected >= 0) {
1143 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1145 if (property_exists($this,
'skill_type')) {
1146 $return .=
'<br><span class="opacitymedium">'.$langs->trans(
"Type").
'</span>';
1147 $return .=
' : <span class="info-box-label ">'.$this->fields[
'skill_type'][
'arrayofkeyval'][$this->skill_type].
'</span>';
1149 if (property_exists($this,
'description')) {
1150 $return .=
'<br><span class="info-box-label opacitymedium">'.$langs->trans(
"Description").
'</span> : ';
1151 $return .=
'<br><span class="info-box-label ">'.(strlen($this->
description) > 30 ?
dol_substr($this->
description, 0, 25).
'...' : $this->description).
'</span>';
1153 $return .=
'</div>';
1154 $return .=
'</div>';
1155 $return .=
'</div>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Parent class of all other business classes (invoices, contracts, proposals, orders,...
deleteLineCommon(User $user, $idline, $notrigger=0)
Delete a line of object in database.
commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
Common function for all objects extending CommonObject for generating documents.
setErrorsFromObject($object)
setErrorsFromObject
createCommon(User $user, $notrigger=0)
Create object in the database.
getFieldList($alias='', $excludefields=array())
Function to concat keys of fields.
updateCommon(User $user, $notrigger=0)
Update object into database.
setStatusCommon($user, $status, $notrigger=0, $triggercode='')
Set to a status.
initAsSpecimenCommon()
Initialise object with example values Id must be 0 if object instance is a specimen.
copy_linked_contact($objFrom, $source='internal')
Copy contact from one element to current.
fetchCommon($id, $ref=null, $morewhere='', $noextrafields=0)
Load object in memory from the database.
deleteCommon(User $user, $notrigger=0, $forcechilddeletion=0)
Delete object in database.
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage Dolibarr database access.
LibStatut($status, $mode=0)
Return the status.
createSkills($i=1)
createSkills
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter='', $filtermode='AND')
Load list of objects in memory from the database.
info($id)
Load the info information in the object.
__construct(DoliDB $db)
Constructor.
getLinesArray()
Create an array of lines.
static typeCodeToLabel($code)
create(User $user, $notrigger=0)
Create object into database.
cancel($user, $notrigger=0)
Set cancel status.
getLibStatut($mode=0)
Return the label of the status.
update(User $user, $notrigger=0)
Update object into database.
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module.
createFromClone(User $user, $fromid)
Clone an object into another one.
setDraft($user, $notrigger=0)
Set draft status.
reopen($user, $notrigger=0)
Set back to validated status.
deleteLine(User $user, $idline, $notrigger=0)
Delete a line of object in database.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
fetch($id, $ref=null)
Load object in memory from the database.
getKanbanView($option='', $arraydata=null)
Return clickable link of object (with eventually picto)
fetchLines()
Load object lines in memory from the database.
validate($user, $notrigger=0)
Validate object.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionally the picto)
Class to manage Dolibarr users.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
forgeSQLFromUniversalSearchCriteria($filter, &$errorstr='', $noand=0, $nopar=0, $noerror=0)
forgeSQLFromUniversalSearchCriteria
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...