29include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
48 $this->numero = 57000;
51 $this->rights_class =
'knowledgemanagement';
55 $this->family =
"crm";
58 $this->module_position =
'90';
63 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
68 $this->descriptionlong =
"Manage a Knowledge Management (KM) or Help-Desk base";
71 $this->version =
'dolibarr';
76 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
82 $this->picto =
'knowledgemanagement';
85 $this->module_parts = array(
121 'moduleforexternal' => 0,
126 $this->dirs = array(
"/knowledgemanagement/temp");
129 $this->config_page_url = array(
"knowledgemanagement.php");
133 $this->hidden =
false;
135 $this->depends = array();
136 $this->requiredby = array();
137 $this->conflictwith = array();
140 $this->langfiles = array(
"knowledgemanagement");
143 $this->phpmin = array(7, 0);
144 $this->need_dolibarr_version = array(11, -3);
147 $this->warnings_activation = array();
148 $this->warnings_activation_ext = array();
157 $this->
const = array();
165 if (!isset($conf->knowledgemanagement) || !isset($conf->knowledgemanagement->enabled)) {
166 $conf->knowledgemanagement =
new stdClass();
167 $conf->knowledgemanagement->enabled = 0;
171 $this->tabs = array();
199 $this->dictionaries = array();
203 $this->boxes = array(
205 'file' =>
'box_last_knowledgerecord.php',
206 'enabledbydefaulton' =>
'ticketindex',
209 'file' =>
'box_last_modified_knowledgerecord.php',
210 'enabledbydefaulton' =>
'ticketindex',
216 $this->cronjobs = array(
238 $this->rights = array();
242 $this->rights[$r][0] = $this->numero + $r + 1;
243 $this->rights[$r][1] =
'Read articles';
244 $this->rights[$r][4] =
'knowledgerecord';
245 $this->rights[$r][5] =
'read';
247 $this->rights[$r][0] = $this->numero + $r + 1;
248 $this->rights[$r][1] =
'Create/Update articles';
249 $this->rights[$r][4] =
'knowledgerecord';
250 $this->rights[$r][5] =
'write';
252 $this->rights[$r][0] = $this->numero + $r + 1;
253 $this->rights[$r][1] =
'Delete articles';
254 $this->rights[$r][4] =
'knowledgerecord';
255 $this->rights[$r][5] =
'delete';
260 $this->menu = array();
283 $this->menu[$r++]=array(
285 'fk_menu'=>
'fk_mainmenu=ticket',
288 'titre'=>
'MenuKnowledgeRecord',
289 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth em092"'),
290 'mainmenu'=>
'ticket',
291 'leftmenu'=>
'knowledgemanagement_knowledgerecord',
292 'url'=>
'/knowledgemanagement/knowledgerecord_list.php',
294 'langs'=>
'knowledgemanagement',
297 'enabled'=>
'$conf->knowledgemanagement->enabled',
299 'perms'=>
'$user->rights->knowledgemanagement->knowledgerecord->read',
304 $this->menu[$r++]=array(
306 'fk_menu'=>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
309 'titre'=>
'ListKnowledgeRecord',
310 'mainmenu'=>
'ticket',
311 'leftmenu'=>
'knowledgemanagement_list',
312 'url'=>
'/knowledgemanagement/knowledgerecord_list.php',
314 'langs'=>
'knowledgemanagement',
317 'enabled'=>
'$conf->knowledgemanagement->enabled',
319 'perms'=>
'$user->rights->knowledgemanagement->knowledgerecord->read',
324 $this->menu[$r++]=array(
326 'fk_menu'=>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
329 'titre'=>
'NewKnowledgeRecord',
330 'mainmenu'=>
'ticket',
331 'leftmenu'=>
'knowledgemanagement_new',
332 'url'=>
'/knowledgemanagement/knowledgerecord_card.php?action=create',
334 'langs'=>
'knowledgemanagement',
337 'enabled'=>
'$conf->knowledgemanagement->enabled',
339 'perms'=>
'$user->hasRight("knowledgemanagement", "knowledgerecord", "write")',
344 $this->menu[$r++] = array(
345 'fk_menu' =>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
347 'titre' =>
'Categories',
348 'mainmenu' =>
'ticket',
349 'url' =>
'/categories/index.php?type=13',
350 'langs' =>
'knowledgemanagement',
352 'enabled' =>
'$conf->knowledgemanagement->enabled',
353 'perms' =>
'$user->rights->knowledgemanagement->knowledgerecord->read',
420 public function init($options =
'')
422 global $conf, $langs;
424 $result = $this->
_load_tables(
'/install/mysql/',
'knowledgemanagement');
439 $this->
remove($options);
444 $moduledir =
'knowledgemanagement';
445 $myTmpObjects = array();
446 $myTmpObjects[
'KnowledgeRecord'] = array(
'includerefgeneration'=>0,
'includedocgeneration'=>0);
448 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
449 if ($myTmpObjectKey ==
'KnowledgeRecord') {
452 if ($myTmpObjectArray[
'includerefgeneration']) {
453 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/knowledgemanagement/template_knowledgerecords.odt';
454 $dirodt = DOL_DATA_ROOT.
'/doctemplates/knowledgemanagement';
455 $dest = $dirodt.
'/template_knowledgerecords.odt';
457 if (file_exists($src) && !file_exists($dest)) {
458 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
460 $result =
dol_copy($src, $dest, 0, 0);
462 $langs->load(
"errors");
463 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
468 $sql = array_merge($sql, array(
469 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
470 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".strtolower($myTmpObjectKey).
"',".((
int) $conf->entity).
")",
471 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey).
"_odt' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
472 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".strtolower($myTmpObjectKey).
"', ".((
int) $conf->entity).
")"
477 return $this->
_init($sql, $options);
488 public function remove($options =
'')
491 return $this->
_remove($sql, $options);
_init($array_sql, $options='')
Enables a module.
_remove($array_sql, $options='')
Disable function.
_load_tables($reldir, $onlywithsuffix='')
Create tables and keys required by module:
Description and activation class for module KnowledgeManagement.
__construct($db)
Constructor.
init($options='')
Function called when module is enabled.
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_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvirus=0, $indexdatabase=0)
Copy a file to another file.
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_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
$conf db name
Only used if Module[ID]Name translation string is not found.