30include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
49 $this->numero = 57000;
52 $this->rights_class =
'knowledgemanagement';
56 $this->family =
"crm";
59 $this->module_position =
'90';
64 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
69 $this->descriptionlong =
"Manage a Knowledge Management (KM) or Help-Desk base";
72 $this->version =
'dolibarr';
77 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
83 $this->picto =
'knowledgemanagement';
86 $this->module_parts = array(
122 'moduleforexternal' => 0,
127 $this->dirs = array(
"/knowledgemanagement/temp");
130 $this->config_page_url = array(
"knowledgemanagement.php");
134 $this->hidden =
false;
136 $this->depends = array();
137 $this->requiredby = array();
138 $this->conflictwith = array();
141 $this->langfiles = array(
"knowledgemanagement");
144 $this->phpmin = array(7, 0);
145 $this->need_dolibarr_version = array(11, -3);
148 $this->warnings_activation = array();
149 $this->warnings_activation_ext = array();
158 $this->
const = array();
166 if (!isset($conf->knowledgemanagement) || !isset($conf->knowledgemanagement->enabled)) {
167 $conf->knowledgemanagement =
new stdClass();
168 $conf->knowledgemanagement->enabled = 0;
172 $this->tabs = array();
200 $this->dictionaries = array();
204 $this->boxes = array(
206 'file' =>
'box_last_knowledgerecord.php',
207 'enabledbydefaulton' =>
'ticketindex',
210 'file' =>
'box_last_modified_knowledgerecord.php',
211 'enabledbydefaulton' =>
'ticketindex',
217 $this->cronjobs = array(
239 $this->rights = array();
243 $this->rights[$r][0] = $this->numero + $r + 1;
244 $this->rights[$r][1] =
'Read articles';
245 $this->rights[$r][4] =
'knowledgerecord';
246 $this->rights[$r][5] =
'read';
248 $this->rights[$r][0] = $this->numero + $r + 1;
249 $this->rights[$r][1] =
'Create/Update articles';
250 $this->rights[$r][4] =
'knowledgerecord';
251 $this->rights[$r][5] =
'write';
253 $this->rights[$r][0] = $this->numero + $r + 1;
254 $this->rights[$r][1] =
'Delete articles';
255 $this->rights[$r][4] =
'knowledgerecord';
256 $this->rights[$r][5] =
'delete';
261 $this->menu = array();
284 $this->menu[$r++] = array(
286 'fk_menu' =>
'fk_mainmenu=ticket',
289 'titre' =>
'MenuKnowledgeRecord',
290 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth em092"'),
291 'mainmenu' =>
'ticket',
292 'leftmenu' =>
'knowledgemanagement_knowledgerecord',
293 'url' =>
'/knowledgemanagement/knowledgerecord_list.php',
295 'langs' =>
'knowledgemanagement',
298 'enabled' =>
'$conf->knowledgemanagement->enabled',
300 'perms' =>
'$user->rights->knowledgemanagement->knowledgerecord->read',
305 $this->menu[$r++] = array(
307 'fk_menu' =>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
310 'titre' =>
'ListKnowledgeRecord',
311 'mainmenu' =>
'ticket',
312 'leftmenu' =>
'knowledgemanagement_list',
313 'url' =>
'/knowledgemanagement/knowledgerecord_list.php',
315 'langs' =>
'knowledgemanagement',
318 'enabled' =>
'$conf->knowledgemanagement->enabled',
320 'perms' =>
'$user->rights->knowledgemanagement->knowledgerecord->read',
325 $this->menu[$r++] = array(
327 'fk_menu' =>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
330 'titre' =>
'NewKnowledgeRecord',
331 'mainmenu' =>
'ticket',
332 'leftmenu' =>
'knowledgemanagement_new',
333 'url' =>
'/knowledgemanagement/knowledgerecord_card.php?action=create',
335 'langs' =>
'knowledgemanagement',
338 'enabled' =>
'$conf->knowledgemanagement->enabled',
340 'perms' =>
'$user->hasRight("knowledgemanagement", "knowledgerecord", "write")',
345 $this->menu[$r++] = array(
346 'fk_menu' =>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
348 'titre' =>
'Categories',
349 'mainmenu' =>
'ticket',
350 'url' =>
'/categories/index.php?type=13',
351 'langs' =>
'knowledgemanagement',
353 'enabled' =>
'$conf->knowledgemanagement->enabled',
354 'perms' =>
'$user->rights->knowledgemanagement->knowledgerecord->read',
421 public function init($options =
'')
423 global $conf, $langs;
425 $result = $this->
_load_tables(
'/install/mysql/',
'knowledgemanagement');
440 $this->
remove($options);
445 $moduledir =
'knowledgemanagement';
446 $myTmpObjects = array();
447 $myTmpObjects[
'KnowledgeRecord'] = array(
'includerefgeneration' => 0,
'includedocgeneration' => 0);
449 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
450 if ($myTmpObjectKey ==
'KnowledgeRecord') {
453 if ($myTmpObjectArray[
'includerefgeneration']) {
454 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/knowledgemanagement/template_knowledgerecords.odt';
455 $dirodt = DOL_DATA_ROOT.
'/doctemplates/knowledgemanagement';
456 $dest = $dirodt.
'/template_knowledgerecords.odt';
458 if (file_exists($src) && !file_exists($dest)) {
459 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
461 $result =
dol_copy($src, $dest, 0, 0);
463 $langs->load(
"errors");
464 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
469 $sql = array_merge($sql, array(
470 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
471 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".strtolower($myTmpObjectKey).
"',".((
int) $conf->entity).
")",
472 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey).
"_odt' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
473 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".strtolower($myTmpObjectKey).
"', ".((
int) $conf->entity).
")"
478 return $this->
_init($sql, $options);
489 public function remove($options =
'')
492 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=0, $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.