29 include_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(
214 $this->cronjobs = array(
236 $this->rights = array();
240 $this->rights[$r][0] = $this->numero + $r + 1;
241 $this->rights[$r][1] =
'Read articles';
242 $this->rights[$r][4] =
'knowledgerecord';
243 $this->rights[$r][5] =
'read';
245 $this->rights[$r][0] = $this->numero + $r + 1;
246 $this->rights[$r][1] =
'Create/Update articles';
247 $this->rights[$r][4] =
'knowledgerecord';
248 $this->rights[$r][5] =
'write';
250 $this->rights[$r][0] = $this->numero + $r + 1;
251 $this->rights[$r][1] =
'Delete articles';
252 $this->rights[$r][4] =
'knowledgerecord';
253 $this->rights[$r][5] =
'delete';
258 $this->menu = array();
281 $this->menu[$r++]=array(
283 'fk_menu'=>
'fk_mainmenu=ticket',
286 'titre'=>
'MenuKnowledgeRecord',
287 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth em092"'),
288 'mainmenu'=>
'ticket',
289 'leftmenu'=>
'knowledgemanagement_knowledgerecord',
290 'url'=>
'/knowledgemanagement/knowledgerecord_list.php',
292 'langs'=>
'knowledgemanagement',
295 'enabled'=>
'$conf->knowledgemanagement->enabled',
297 'perms'=>
'$user->rights->knowledgemanagement->knowledgerecord->read',
302 $this->menu[$r++]=array(
304 'fk_menu'=>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
307 'titre'=>
'ListKnowledgeRecord',
308 'mainmenu'=>
'ticket',
309 'leftmenu'=>
'knowledgemanagement_list',
310 'url'=>
'/knowledgemanagement/knowledgerecord_list.php',
312 'langs'=>
'knowledgemanagement',
315 'enabled'=>
'$conf->knowledgemanagement->enabled',
317 'perms'=>
'$user->rights->knowledgemanagement->knowledgerecord->read',
322 $this->menu[$r++]=array(
324 'fk_menu'=>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
327 'titre'=>
'NewKnowledgeRecord',
328 'mainmenu'=>
'ticket',
329 'leftmenu'=>
'knowledgemanagement_new',
330 'url'=>
'/knowledgemanagement/knowledgerecord_card.php?action=create',
332 'langs'=>
'knowledgemanagement',
335 'enabled'=>
'$conf->knowledgemanagement->enabled',
337 'perms'=>
'$user->rights->knowledgemanagement->knowledgerecord->write',
342 $this->menu[$r++] = array(
343 'fk_menu' =>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
345 'titre' =>
'Categories',
346 'mainmenu' =>
'ticket',
347 'url' =>
'/categories/index.php?type=13',
348 'langs' =>
'knowledgemanagement',
350 'enabled' =>
'$conf->knowledgemanagement->enabled',
351 'perms' =>
'$user->rights->knowledgemanagement->knowledgerecord->read',
418 public function init($options =
'')
420 global $conf, $langs;
422 $result = $this->
_load_tables(
'/install/mysql/',
'knowledgemanagement');
437 $this->
remove($options);
442 $moduledir =
'knowledgemanagement';
443 $myTmpObjects = array();
444 $myTmpObjects[
'KnowledgeRecord'] = array(
'includerefgeneration'=>0,
'includedocgeneration'=>0);
446 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
447 if ($myTmpObjectKey ==
'KnowledgeRecord') {
450 if ($myTmpObjectArray[
'includerefgeneration']) {
451 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/knowledgemanagement/template_knowledgerecords.odt';
452 $dirodt = DOL_DATA_ROOT.
'/doctemplates/knowledgemanagement';
453 $dest = $dirodt.
'/template_knowledgerecords.odt';
455 if (file_exists($src) && !file_exists($dest)) {
456 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
458 $result =
dol_copy($src, $dest, 0, 0);
460 $langs->load(
"errors");
461 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
466 $sql = array_merge($sql, array(
467 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
468 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".strtolower($myTmpObjectKey).
"',".((
int) $conf->entity).
")",
469 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey).
"_odt' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
470 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".strtolower($myTmpObjectKey).
"', ".((
int) $conf->entity).
")"
475 return $this->
_init($sql, $options);
486 public function remove($options =
'')
489 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(".$version.") pid 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)
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.
$conf db
API class for accounts.