25require_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();
604 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"ecm_files set filepath = 'knowledgerecord/".$this->db->escape($this->newref).
"'";
605 $sql .=
" WHERE filepath = 'knowledgerecord/".$this->db->escape($this->
ref).
"' and entity = ".$conf->entity;
606 $resql = $this->db->query($sql);
608 $error++; $this->error = $this->db->lasterror();
614 $dirsource = $conf->knowledgemanagement->dir_output.
'/knowledgerecord/'.$oldref;
615 $dirdest = $conf->knowledgemanagement->dir_output.
'/knowledgerecord/'.$newref;
616 if (!$error && file_exists($dirsource)) {
617 dol_syslog(get_class($this).
"::validate() rename dir ".$dirsource.
" into ".$dirdest);
619 if (@rename($dirsource, $dirdest)) {
622 $listoffiles =
dol_dir_list($conf->knowledgemanagement->dir_output.
'/knowledgerecord/'.$newref,
'files', 1,
'^'.preg_quote($oldref,
'/'));
623 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);
638 $this->status = self::STATUS_VALIDATED;
645 $this->db->rollback();
661 if ($this->status <= self::STATUS_DRAFT) {
672 return $this->
setStatusCommon($user, self::STATUS_DRAFT, $notrigger,
'KNOWLEDGERECORD_UNVALIDATE');
682 public function cancel($user, $notrigger = 0)
685 if ($this->status != self::STATUS_VALIDATED) {
696 return $this->
setStatusCommon($user, self::STATUS_CANCELED, $notrigger,
'KNOWLEDGERECORD_CANCEL');
706 public function reopen($user, $notrigger = 0)
709 if ($this->status != self::STATUS_CANCELED) {
720 return $this->
setStatusCommon($user, self::STATUS_VALIDATED, $notrigger,
'KNOWLEDGERECORD_REOPEN');
732 global $conf, $langs;
734 $langs->loadLangs([
'knowledgemanagement',
'languages']);
737 $nofetch = !empty($params[
'nofetch']);
739 $datas[
'picto'] =
img_picto(
'', $this->picto).
' <u class="paddingrightonly">'.$langs->trans(
"KnowledgeRecord").
'</u>';
740 if (isset($this->
statut)) {
741 $datas[
'picto'] .=
' '.$this->getLibStatut(5);
743 $datas[
'label'] =
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
744 $datas[
'question'] =
'<br><b>'.$langs->trans(
'Question').
':</b> '.$this->question;
745 $labellang = ($this->lang ? $langs->trans(
'Language_'.$this->lang) :
'');
746 $datas[
'lang'] =
'<br><b>'.$langs->trans(
'Language').
':</b> ' .
picto_from_langcode($this->lang,
'class="paddingrightonly saturatemedium opacitylow"') . $labellang;
748 if (isModEnabled(
'categorie') && !$nofetch) {
749 require_once DOL_DOCUMENT_ROOT .
'/categories/class/categorie.class.php';
750 $form =
new Form($this->db);
751 $datas[
'categories'] =
'<br>' . $form->showCategories($this->
id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1);
767 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
769 global $conf, $langs, $hookmanager;
771 if (!empty($conf->dol_no_mouse_hover)) {
779 'objecttype' => $this->element.($this->module ?
'@'.$this->module :
''),
783 $classfortooltip =
'classfortooltip';
786 $classfortooltip =
'classforajaxtooltip';
787 $dataparams =
' data-params="'.dol_escape_htmltag(json_encode($params)).
'"';
793 $url =
dol_buildpath(
'/knowledgemanagement/knowledgerecord_card.php', 1).
'?id='.$this->id;
795 if ($option !=
'nolink') {
797 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
798 if ($save_lastsearch_value == -1 && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
799 $add_save_lastsearch_values = 1;
801 if ($add_save_lastsearch_values) {
802 $url .=
'&save_lastsearch_values=1';
807 if (empty($notooltip)) {
808 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
809 $label = $langs->trans(
"ShowKnowledgeRecord");
810 $linkclose .=
' alt="'.dol_escape_htmltag($label, 1).
'"';
812 $linkclose .= ($label ?
' title="'.dol_escape_htmltag($label, 1).
'"' :
' title="tocomplete"');
813 $linkclose .= $dataparams.
' class="'.$classfortooltip.($morecss ?
' '.$morecss :
'').
'"';
815 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
818 if ($option ==
'nolink') {
819 $linkstart =
'<span';
821 $linkstart =
'<a href="'.$url.
'"';
823 $linkstart .= $linkclose.
'>';
824 if ($option ==
'nolink') {
825 $linkend =
'</span>';
830 $result .= $linkstart;
832 if (empty($this->showphoto_on_popup)) {
834 $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);
838 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
840 list($class, $module) = explode(
'@', $this->picto);
843 $filename = $filearray[0][
'name'];
844 if (!empty($filename)) {
845 $pospoint = strpos($filearray[0][
'name'],
'.');
847 $pathtophoto = $class.
'/'.$this->
ref.
'/thumbs/'.substr($filename, 0, $pospoint).
'_mini'.substr($filename, $pospoint);
848 if (empty($conf->global->{strtoupper($module.
'_'.$class).
'_FORMATLISTPHOTOSASUSERS'})) {
849 $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>';
851 $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>';
856 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), (($withpicto != 2) ?
'class="paddingright"' :
''), 0, 0, $notooltip ? 0 : 1);
861 if ($withpicto != 2) {
862 $result .= $this->ref;
868 global $action, $hookmanager;
869 $hookmanager->initHooks(array(
'knowledgerecorddao'));
870 $parameters = array(
'id'=>$this->
id,
'getnomurl' => &$result);
871 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
873 $result = $hookmanager->resPrint;
875 $result .= $hookmanager->resPrint;
889 return $this->LibStatut($this->status, $mode);
903 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
906 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
907 $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Validated');
908 $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Obsolete');
909 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv(
'Draft');
910 $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv(
'Validated');
911 $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv(
'Obsolete');
914 $statusType =
'status'.$status;
915 if ($status == self::STATUS_VALIDATED) $statusType =
'status4';
916 if ($status == self::STATUS_CANCELED) {
917 $statusType =
'status6';
920 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
931 $sql =
'SELECT rowid, date_creation as datec, tms as datem,';
932 $sql .=
' fk_user_creat, fk_user_modif';
933 $sql .=
' FROM '.MAIN_DB_PREFIX.$this->table_element.
' as t';
934 $sql .=
' WHERE t.rowid = '.((int) $id);
935 $result = $this->db->query($sql);
937 if ($this->db->num_rows($result)) {
938 $obj = $this->db->fetch_object($result);
939 $this->
id = $obj->rowid;
941 $this->user_creation_id = $obj->fk_user_creat;
942 $this->user_modification_id = $obj->fk_user_modif;
943 $this->date_creation = $this->db->jdate($obj->datec);
944 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
947 $this->db->free($result);
961 $this->question =
"ABCD";
962 $this->initAsSpecimenCommon();
972 $this->lines = array();
975 $result = $objectline->fetchAll(
'ASC',
'position', 0, 0, array(
'customsql'=>
'fk_knowledgerecord = '.((
int) $this->
id)));
977 if (is_numeric($result)) {
978 $this->error = $objectline->error;
979 $this->errors = $objectline->errors;
982 $this->lines = $result;
994 global $langs, $conf;
995 $langs->load(
"knowledgemanagement");
997 if (empty($conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON)) {
998 $conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON =
'mod_knowledgerecord_standard';
1001 if (!empty($conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON)) {
1004 $file = $conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON.
".php";
1005 $classname = $conf->global->KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_ADDON;
1008 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
1009 foreach ($dirmodels as $reldir) {
1010 $dir =
dol_buildpath($reldir.
"core/modules/knowledgemanagement/");
1013 $mybool |= @include_once $dir.$file;
1016 if ($mybool ===
false) {
1021 if (class_exists($classname)) {
1022 $obj =
new $classname();
1023 $numref = $obj->getNextValue($this);
1025 if ($numref !=
'' && $numref !=
'-1') {
1028 $this->error = $obj->error;
1033 print $langs->trans(
"Error").
" ".$langs->trans(
"ClassNotFound").
' '.$classname;
1037 print $langs->trans(
"ErrorNumberingModuleNotSetup", $this->element);
1053 public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams =
null)
1055 global $conf, $langs;
1058 $includedocgeneration = 0;
1060 $langs->load(
"knowledgemanagement");
1063 $modele =
'standard_knowledgerecord';
1065 if (!empty($this->model_pdf)) {
1066 $modele = $this->model_pdf;
1067 } elseif (!empty($conf->global->KNOWLEDGERECORD_ADDON_PDF)) {
1068 $modele = $conf->global->KNOWLEDGERECORD_ADDON_PDF;
1072 $modelpath =
"core/modules/knowledgemanagement/doc/";
1074 if ($includedocgeneration && !empty($modele)) {
1075 $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
1090 global $conf, $langs;
1106 $this->db->commit();
1123 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1124 return parent::setCategoriesCommon($categories, Categorie::TYPE_KNOWLEDGEMANAGEMENT);
1136 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
1138 $return =
'<div class="box-flex-item box-flex-grow-zero">';
1139 $return .=
'<div class="info-box info-box-sm">';
1140 $return .=
'<span class="info-box-icon bg-infobox-action">';
1142 $return .=
'</span>';
1143 $return .=
'<div class="info-box-content">';
1144 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this,
'getNomUrl') ? $this->getNomUrl(1) : $this->ref).
'</span>';
1145 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1146 if (property_exists($this,
'lang') && !empty($this->lang)) {
1148 $return .=
'<br>'.picto_from_langcode($this->lang,
'class="paddingrightonly saturatemedium opacitylow paddingrightonly"');
1150 if (property_exists($this,
'question')) {
1151 $return .=
'<span class="info-box-label">'.dolGetFirstLineOfText($this->question).
'</span>';
1153 if (method_exists($this,
'getLibStatut')) {
1154 $return .=
'<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).
'</div>';
1156 $return .=
'</div>';
1157 $return .=
'</div>';
1158 $return .=
'</div>';
1164require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobjectline.class.php';
1177 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.
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.
getFieldList($alias='', $excludefields=array())
Function to concat keys of fields.
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.
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.
print $langs trans("Ref").' m m m statut
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)
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.