25 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
37 public $module =
'knowledgemanagement';
42 public $element =
'knowledgerecord';
47 public $table_element =
'knowledgemanagement_knowledgerecord';
53 public $ismultientitymanaged = 1;
58 public $isextrafieldmanaged = 1;
63 public $picto =
'knowledgemanagement';
66 const STATUS_DRAFT = 0;
67 const STATUS_VALIDATED = 1;
68 const STATUS_CANCELED = 9;
102 public $fields=array(
103 'rowid' => array(
'type'=>
'integer',
'label'=>
'TechnicalID',
'enabled'=>
'1',
'position'=>1,
'notnull'=>1,
'visible'=>0,
'noteditable'=>
'1',
'index'=>1,
'css'=>
'left',
'comment'=>
"Id"),
104 'ref' => array(
'type'=>
'varchar(128)',
'label'=>
'Ref',
'enabled'=>
'1',
'position'=>10,
'notnull'=>1,
'default'=>
'(PROV)',
'visible'=>5,
'index'=>1,
'searchall'=>1,
'comment'=>
"Reference of object",
"csslist"=>
"nowraponall",
"showoncombobox"=>1),
105 'entity' =>array(
'type'=>
'integer',
'label'=>
'Entity',
'default'=>1,
'enabled'=>1,
'visible'=>0,
'notnull'=>1,
'position'=>20,
'index'=>1),
106 'question' => array(
'type'=>
'text',
'label'=>
'Question',
'enabled'=>
'1',
'position'=>30,
'notnull'=>1,
'visible'=>1,
'searchall'=>1,
'csslist'=>
'tdoverflowmax300',
'copytoclipboard'=>1,
'tdcss'=>
'titlefieldcreate nowraponall'),
107 'lang' => array(
'type'=>
'varchar(6)',
'label'=>
'Language',
'enabled'=>
'1',
'position'=>40,
'notnull'=>0,
'visible'=>1,
'tdcss'=>
'titlefieldcreate nowraponall',
"csslist"=>
"tdoverflowmax100"),
108 'date_creation' => array(
'type'=>
'datetime',
'label'=>
'DateCreation',
'enabled'=>
'1',
'position'=>500,
'notnull'=>1,
'visible'=>-2,),
109 'tms' => array(
'type'=>
'timestamp',
'label'=>
'DateModification',
'enabled'=>
'1',
'position'=>501,
'notnull'=>0,
'visible'=>2,),
110 'last_main_doc' => array(
'type'=>
'varchar(255)',
'label'=>
'LastMainDoc',
'enabled'=>
'1',
'position'=>600,
'notnull'=>0,
'visible'=>0,),
111 'fk_user_creat' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserCreation',
'enabled'=>
'1',
'position'=>510,
'notnull'=>1,
'visible'=>-2,
'foreignkey'=>
'user.rowid',),
112 'fk_user_modif' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserModif',
'enabled'=>
'1',
'position'=>511,
'notnull'=>-1,
'visible'=>-2,),
113 'fk_user_valid' => array(
'type'=>
'integer:User:user/class/user.class.php',
'label'=>
'UserValidation',
'enabled'=>
'1',
'position'=>512,
'notnull'=>0,
'visible'=>-2,),
114 'import_key' => array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>
'1',
'position'=>1000,
'notnull'=>-1,
'visible'=>-2,),
115 'model_pdf' => array(
'type'=>
'varchar(255)',
'label'=>
'Model pdf',
'enabled'=>
'1',
'position'=>1010,
'notnull'=>-1,
'visible'=>0,),
117 'fk_c_ticket_category' => array(
'type'=>
'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos',
'label'=>
'SuggestedForTicketsInGroup',
'enabled'=>
'isModEnabled("ticket")',
'position'=>520,
'notnull'=>0,
'visible'=>-1,
'help'=>
'YouCanLinkArticleToATicketCategory',
'csslist'=>
'minwidth200 tdoverflowmax250'),
118 'answer' => array(
'type'=>
'html',
'label'=>
'Solution',
'enabled'=>
'1',
'position'=>600,
'notnull'=>0,
'visible'=>3,
'searchall'=>1,
'csslist'=>
'tdoverflowmax300',
'copytoclipboard'=>1,
'tdcss'=>
'titlefieldcreate nowraponall'),
119 'status' => array(
'type'=>
'integer',
'label'=>
'Status',
'enabled'=>
'1',
'position'=>1000,
'notnull'=>1,
'visible'=>5,
'default'=>0,
'index'=>1,
'arrayofkeyval'=>array(
'0'=>
'Draft',
'1'=>
'Validated',
'9'=>
'Obsolete'),),
124 public $date_creation;
126 public $last_main_doc;
127 public $fk_user_creat;
128 public $fk_user_modif;
129 public $fk_user_valid;
191 global $conf, $langs;
195 if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields[
'rowid'])) {
196 $this->fields[
'rowid'][
'visible'] = 0;
198 if (!
isModEnabled(
'multicompany') && isset($this->fields[
'entity'])) {
199 $this->fields[
'entity'][
'enabled'] = 0;
209 foreach ($this->fields as $key => $val) {
210 if (isset($val[
'enabled']) && empty($val[
'enabled'])) {
211 unset($this->fields[$key]);
216 if (is_object($langs)) {
217 foreach ($this->fields as $key => $val) {
218 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
219 foreach ($val[
'arrayofkeyval'] as $key2 => $val2) {
220 $this->fields[$key][
'arrayofkeyval'][$key2] = $langs->trans($val2);
248 global $langs, $extrafields;
253 $object =
new self($this->db);
258 $result = $object->fetchCommon($fromid);
259 if ($result > 0 && !empty($object->table_element_line)) {
260 $object->fetchLines();
269 unset($object->fk_user_creat);
270 unset($object->import_key);
273 if (property_exists($object,
'ref')) {
274 $object->ref = empty($this->fields[
'ref'][
'default']) ?
"Copy_Of_".$object->ref : $this->fields[
'ref'][
'default'];
276 if (property_exists($object,
'question')) {
277 $object->question = empty($this->fields[
'question'][
'default']) ? $langs->trans(
"CopyOf").
" ".$object->question : $this->fields[
'question'][
'default'];
279 if (property_exists($object,
'status')) {
280 $object->status = self::STATUS_DRAFT;
282 if (property_exists($object,
'date_creation')) {
283 $object->date_creation =
dol_now();
285 if (property_exists($object,
'date_modification')) {
286 $object->date_modification =
null;
290 if (is_array($object->array_options) && count($object->array_options) > 0) {
291 $extrafields->fetch_name_optionals_label($this->table_element);
292 foreach ($object->array_options as $key => $option) {
293 $shortkey = preg_replace(
'/options_/',
'', $key);
294 if (!empty($extrafields->attributes[$this->table_element][
'unique'][$shortkey])) {
297 unset($object->array_options[$key]);
303 $object->context[
'createfromclone'] =
'createfromclone';
304 $result = $object->createCommon($user);
307 $this->error = $object->error;
308 $this->errors = $object->errors;
320 if (property_exists($this,
'fk_soc') && $this->fk_soc == $object->socid) {
327 unset($object->context[
'createfromclone']);
334 $this->db->rollback();
346 public function fetch($id, $ref =
null)
349 if ($result > 0 && !empty($this->table_element_line)) {
362 $this->lines = array();
380 public function fetchAll($sortorder =
'', $sortfield =
'', $limit = 0, $offset = 0, array $filter = array(), $filtermode =
'AND')
390 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
391 if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
392 $sql .=
' WHERE t.entity IN ('.getEntity($this->element).
')';
394 $sql .=
' WHERE 1 = 1';
398 if (count($filter) > 0) {
399 foreach ($filter as $key => $value) {
400 if ($key ==
't.rowid') {
401 $sqlwhere[] = $key.
" = ".((int) $value);
402 } elseif (in_array($this->fields[$key][
'type'], array(
'date',
'datetime',
'timestamp'))) {
403 $sqlwhere[] = $key.
" = '".$this->db->idate($value).
"'";
404 } elseif ($key ==
'customsql') {
405 $sqlwhere[] = $value;
406 } elseif (strpos($value,
'%') ===
false) {
407 $sqlwhere[] = $key.
' IN ('.$this->db->sanitize($this->db->escape($value)).
')';
409 $sqlwhere[] = $key.
" LIKE '%".$this->db->escape($value).
"%'";
413 if (count($sqlwhere) > 0) {
414 $sql .=
' AND ('.implode(
' '.$this->db->escape($filtermode).
' ', $sqlwhere).
')';
417 if (!empty($sortfield)) {
418 $sql .= $this->db->order($sortfield, $sortorder);
420 if (!empty($limit)) {
421 $sql .= $this->db->plimit($limit, $offset);
424 $resql = $this->db->query(
$sql);
426 $num = $this->db->num_rows($resql);
428 while ($i < ($limit ? min($limit, $num) : $num)) {
429 $obj = $this->db->fetch_object($resql);
431 $record =
new self($this->db);
432 $record->setVarsFromFetchObj($obj);
434 $records[$record->id] = $record;
438 $this->db->free($resql);
442 $this->errors[] =
'Error '.$this->db->lasterror();
443 dol_syslog(__METHOD__.
' '.join(
',', $this->errors), LOG_ERR);
468 public function delete(
User $user, $notrigger =
false)
471 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"categorie_knowledgemanagement WHERE fk_knowledgemanagement = ".((int) $this->
id);
472 dol_syslog(get_class($this).
"::delete", LOG_DEBUG);
473 $resql = $this->db->query(
$sql);
476 $this->error .= $this->db->lasterror();
482 $elements = array(
'categorie_knowledgemanagement');
483 foreach ($elements as $table) {
485 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.$table;
486 $sql .=
" WHERE fk_knowledgemanagement = ".(int) $this->
id;
488 $result = $this->db->query(
$sql);
491 $this->errors[] = $this->db->lasterror();
511 if ($this->status < 0) {
512 $this->error =
'ErrorDeleteLineNotAllowedByObjectStatus';
529 global $conf, $langs;
531 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
536 if ($this->status == self::STATUS_VALIDATED) {
537 dol_syslog(get_class($this).
"::validate action abandonned: already validated", LOG_WARNING);
554 if (!$error && (preg_match(
'/^[\(]?PROV/i', $this->
ref) || empty($this->
ref))) {
559 $this->newref = $num;
563 $sql =
"UPDATE ".MAIN_DB_PREFIX.$this->table_element;
564 $sql .=
" SET ref = '".$this->db->escape($num).
"',";
565 $sql .=
" status = ".self::STATUS_VALIDATED;
566 if (!empty($this->fields[
'date_validation'])) {
567 $sql .=
", date_validation = '".$this->db->idate($now).
"'";
569 if (!empty($this->fields[
'fk_user_valid'])) {
570 $sql .=
", fk_user_valid = ".((int) $user->id);
572 $sql .=
" WHERE rowid = ".((int) $this->
id);
574 dol_syslog(get_class($this).
"::validate()", LOG_DEBUG);
575 $resql = $this->db->query(
$sql);
578 $this->error = $this->db->lasterror();
582 if (!$error && !$notrigger) {
584 $result = $this->
call_trigger(
'KNOWLEDGERECORD_VALIDATE', $user);
593 $this->oldref = $this->ref;
596 if (preg_match(
'/^[\(]?PROV/i', $this->
ref)) {
598 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filename = CONCAT('".$this->db->escape($this->newref).
"', SUBSTR(filename, ".(strlen($this->
ref) + 1).
")), filepath = 'knowledgerecord/".$this->db->escape($this->newref).
"'";
599 $sql .=
" WHERE filename LIKE '".$this->db->escape($this->
ref).
"%' AND filepath = 'knowledgerecord/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
600 $resql = $this->db->query(
$sql);
602 $error++; $this->error = $this->db->lasterror();
608 $dirsource = $conf->knowledgemanagement->dir_output.
'/knowledgerecord/'.$oldref;
609 $dirdest = $conf->knowledgemanagement->dir_output.
'/knowledgerecord/'.$newref;
610 if (!$error && file_exists($dirsource)) {
611 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
613 if (@rename($dirsource, $dirdest)) {
616 $listoffiles =
dol_dir_list($conf->knowledgemanagement->dir_output.
'/knowledgerecord/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
617 foreach ($listoffiles as $fileentry) {
618 $dirsource = $fileentry[
'name'];
619 $dirdest = preg_replace(
'/^'.preg_quote($oldref,
'/').
'/', $newref, $dirsource);
620 $dirsource = $fileentry[
'path'].
'/'.$dirsource;
621 $dirdest = $fileentry[
'path'].
'/'.$dirdest;
622 @rename($dirsource, $dirdest);
632 $this->status = self::STATUS_VALIDATED;
639 $this->db->rollback();
655 if ($this->status <= self::STATUS_DRAFT) {
666 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'KNOWLEDGERECORD_UNVALIDATE');
676 public function cancel($user, $notrigger = 0)
679 if ($this->status != self::STATUS_VALIDATED) {
690 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'KNOWLEDGERECORD_CANCEL');
700 public function reopen($user, $notrigger = 0)
703 if ($this->status != self::STATUS_CANCELED) {
714 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'KNOWLEDGERECORD_REOPEN');
726 global $conf, $langs;
728 $langs->loadLangs([
'knowledgemanagement',
'languages']);
731 $nofetch = !empty($params[
'nofetch']);
733 $datas[
'picto'] =
img_picto(
'', $this->picto).
' <u class="paddingrightonly">'.$langs->trans(
"KnowledgeRecord").
'</u>';
734 if (isset($this->statut)) {
735 $datas[
'picto'] .=
' '.$this->getLibStatut(5);
737 $datas[
'label'] =
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
738 $datas[
'question'] =
'<br><b>'.$langs->trans(
'Question').
':</b> '.$this->question;
739 $labellang = ($this->lang ? $langs->trans(
'Language_'.$this->lang) :
'');
740 $datas[
'lang'] =
'<br><b>'.$langs->trans(
'Language').
':</b> ' .
picto_from_langcode($this->lang,
'class="paddingrightonly saturatemedium opacitylow"') . $labellang;
743 require_once DOL_DOCUMENT_ROOT .
'/categories/class/categorie.class.php';
745 $datas[
'categories'] =
'<br>' .
$form->showCategories($this->
id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1);
761 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
763 global $conf, $langs, $hookmanager;
765 if (!empty($conf->dol_no_mouse_hover)) {
773 'objecttype' => $this->element.($this->module ?
'@'.$this->module :
''),
777 $classfortooltip =
'classfortooltip';
780 $classfortooltip =
'classforajaxtooltip';
781 $dataparams =
' data-params="'.dol_escape_htmltag(json_encode($params)).
'"';
787 $url =
dol_buildpath(
'/knowledgemanagement/knowledgerecord_card.php', 1).
'?id='.$this->id;
789 if ($option !=
'nolink') {
791 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
792 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
793 $add_save_lastsearch_values = 1;
795 if ($add_save_lastsearch_values) {
796 $url .=
'&save_lastsearch_values=1';
801 if (empty($notooltip)) {
802 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
803 $label = $langs->trans(
"ShowKnowledgeRecord");
804 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
806 $linkclose .= ($label ?
' title="'.dol_escape_htmltag($label, 1).
'"' :
' title="tocomplete"');
807 $linkclose .= $dataparams.
' class="'.$classfortooltip.($morecss ?
' '.$morecss :
'').
'"';
809 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
812 if ($option ==
'nolink') {
813 $linkstart =
'<span';
815 $linkstart =
'<a href="'.$url.
'"';
817 $linkstart .= $linkclose.
'>';
818 if ($option ==
'nolink') {
819 $linkend =
'</span>';
824 $result .= $linkstart;
826 if (empty($this->showphoto_on_popup)) {
828 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') : $dataparams.
' class="'.(($withpicto != 2) ?
'paddingright ' :
'').$classfortooltip.
'"'), 0, 0, $notooltip ? 0 : 1);
832 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
834 list($class, $module) = explode(
'@', $this->picto);
837 $filename = $filearray[0][
'name'];
838 if (!empty($filename)) {
839 $pospoint = strpos($filearray[0][
'name'],
'.');
841 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
843 $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>';
845 $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>';
850 $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);
855 if ($withpicto != 2) {
856 $result .= $this->ref;
862 global $action, $hookmanager;
863 $hookmanager->initHooks(array(
'knowledgerecorddao'));
864 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
865 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
867 $result = $hookmanager->resPrint;
869 $result .= $hookmanager->resPrint;
883 return $this->
LibStatut($this->status, $mode);
897 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
900 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
901 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Validated');
902 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Obsolete');
903 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
904 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Validated');
905 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Obsolete');
908 $statusType =
'status'.$status;
909 if ($status == self::STATUS_VALIDATED) $statusType =
'status4';
910 if ($status == self::STATUS_CANCELED) {
911 $statusType =
'status6';
914 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
925 $sql =
'SELECT rowid, date_creation as datec, tms as datem,';
926 $sql .=
' fk_user_creat, fk_user_modif';
927 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
928 $sql .=
' WHERE t.rowid = '.((int) $id);
929 $result = $this->db->query(
$sql);
931 if ($this->db->num_rows($result)) {
932 $obj = $this->db->fetch_object($result);
933 $this->
id = $obj->rowid;
935 $this->user_creation_id = $obj->fk_user_creat;
936 $this->user_modification_id = $obj->fk_user_modif;
937 $this->date_creation = $this->db->jdate($obj->datec);
938 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
941 $this->db->free($result);
955 $this->question =
"ABCD";
966 $this->lines = array();
969 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0, array(
'customsql'=>
'fk_knowledgerecord = '.((
int) $this->
id)));
971 if (is_numeric($result)) {
972 $this->error = $objectline->error;
973 $this->errors = $objectline->errors;
976 $this->lines = $result;
988 global $langs, $conf;
989 $langs->load(
"knowledgemanagement");
991 if (empty($conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON)) {
992 $conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON =
'mod_knowledgerecord_standard';
995 if (!empty($conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON)) {
998 $file = $conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON.
".php";
999 $classname = $conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON;
1002 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
1003 foreach ($dirmodels as $reldir) {
1004 $dir =
dol_buildpath($reldir.
"core/modules/knowledgemanagement/");
1007 $mybool |= @include_once $dir.$file;
1010 if ($mybool ===
false) {
1015 if (class_exists($classname)) {
1016 $obj =
new $classname();
1017 $numref = $obj->getNextValue($this);
1019 if ($numref !=
'' && $numref !=
'-1') {
1022 $this->error = $obj->error;
1027 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
1031 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1047 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1049 global $conf, $langs;
1052 $includedocgeneration = 0;
1054 $langs->load(
"knowledgemanagement");
1057 $modele =
'standard_knowledgerecord';
1059 if (!empty($this->model_pdf)) {
1060 $modele = $this->model_pdf;
1061 } elseif (!empty($conf->global->KNOWLEDGERECORD_ADDON_PDF)) {
1062 $modele = $conf->global->KNOWLEDGERECORD_ADDON_PDF;
1066 $modelpath =
"core/modules/knowledgemanagement/doc/";
1068 if ($includedocgeneration && !empty($modele)) {
1069 $result = $this->
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1084 global $conf, $langs;
1100 $this->db->commit();
1117 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1118 return parent::setCategoriesCommon($categories, Categorie::TYPE_KNOWLEDGEMANAGEMENT);
1130 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1132 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1133 $return .=
'<div class="info-box info-box-sm">';
1134 $return .=
'<span class="info-box-icon bg-infobox-action">';
1136 $return .=
'</span>';
1137 $return .=
'<div class="info-box-content">';
1138 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->
getNomUrl(1) : $this->ref).
'</span>';
1139 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1140 if (property_exists($this,
'lang') && !empty($this->lang)) {
1142 $return .=
'<br>'.picto_from_langcode($this->lang,
'class="paddingrightonly saturatemedium opacitylow paddingrightonly"');
1144 if (property_exists($this,
'question')) {
1145 $return .=
'<span class="info-box-label">'.dolGetFirstLineOfText($this->question).
'</span>';
1147 if (method_exists($this,
'getLibStatut')) {
1148 $return .=
'<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).
'</div>';
1150 $return .=
'</div>';
1151 $return .=
'</div>';
1152 $return .=
'</div>';
1158 require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobjectline.class.php';
1171 public $isextrafieldmanaged = 0;
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.
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.
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.
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.
Class for KnowledgeRecord.
getKanbanView($option='', $arraydata=null)
Return clicable link of object (with eventually picto)
fetch($id, $ref=null)
Load object in memory from the database.
validate($user, $notrigger=0)
Validate object.
getNextNumRef()
Returns the reference to the following non used object depending on the active numbering module.
info($id)
Load the info information in the object.
cancel($user, $notrigger=0)
Set cancel status.
deleteLine(User $user, $idline, $notrigger=false)
Delete a line of object in database.
fetchLines()
Load object lines in memory from the database.
LibStatut($status, $mode=0)
Return the status.
create(User $user, $notrigger=false)
Create object into database.
getTooltipContentArray($params)
getTooltipContentArray
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
createFromClone(User $user, $fromid)
Clone an object into another one.
doScheduledJob()
Action executed by scheduler CAN BE A CRON TASK.
setCategories($categories)
Sets object to supplied categories.
initAsSpecimen()
Initialise object with example values Id must be 0 if object instance is a specimen.
getLinesArray()
Create an array of lines.
__construct(DoliDB $db)
Constructor.
getLibStatut($mode=0)
Return the label of the status.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template module.
reopen($user, $notrigger=0)
Set back to validated status.
setDraft($user, $notrigger=0)
Set draft status.
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.
Class KnowledgeRecordLine.
__construct(DoliDB $db)
Constructor.
Class to manage Dolibarr users.
if(isModEnabled('facture') && $user->hasRight('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') && $user->hasRight('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)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
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.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.