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] =
'Validate articles';
255 $this->rights[$r][4] =
'knowledgerecord_advance';
256 $this->rights[$r][5] =
'validate';
258 $this->rights[$r][0] = $this->numero + $r + 1;
259 $this->rights[$r][1] =
'Delete articles';
260 $this->rights[$r][4] =
'knowledgerecord';
261 $this->rights[$r][5] =
'delete';
266 $this->menu = array();
289 $this->menu[$r++] = array(
291 'fk_menu' =>
'fk_mainmenu=ticket',
294 'titre' =>
'MenuKnowledgeRecord',
295 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth em092"'),
296 'mainmenu' =>
'ticket',
297 'leftmenu' =>
'knowledgemanagement_knowledgerecord',
298 'url' =>
'/knowledgemanagement/knowledgerecord_list.php',
300 'langs' =>
'knowledgemanagement',
303 'enabled' =>
'$conf->knowledgemanagement->enabled',
305 'perms' =>
'$user->rights->knowledgemanagement->knowledgerecord->read',
310 $this->menu[$r++] = array(
312 'fk_menu' =>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
315 'titre' =>
'ListKnowledgeRecord',
316 'mainmenu' =>
'ticket',
317 'leftmenu' =>
'knowledgemanagement_list',
318 'url' =>
'/knowledgemanagement/knowledgerecord_list.php',
320 'langs' =>
'knowledgemanagement',
323 'enabled' =>
'$conf->knowledgemanagement->enabled',
325 'perms' =>
'$user->rights->knowledgemanagement->knowledgerecord->read',
330 $this->menu[$r++] = array(
332 'fk_menu' =>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
335 'titre' =>
'NewKnowledgeRecord',
336 'mainmenu' =>
'ticket',
337 'leftmenu' =>
'knowledgemanagement_new',
338 'url' =>
'/knowledgemanagement/knowledgerecord_card.php?action=create',
340 'langs' =>
'knowledgemanagement',
343 'enabled' =>
'$conf->knowledgemanagement->enabled',
345 'perms' =>
'$user->hasRight("knowledgemanagement", "knowledgerecord", "write")',
350 $this->menu[$r++] = array(
351 'fk_menu' =>
'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord',
353 'titre' =>
'Categories',
354 'mainmenu' =>
'ticket',
355 'url' =>
'/categories/index.php?type=13',
356 'langs' =>
'knowledgemanagement',
358 'enabled' =>
'$conf->knowledgemanagement->enabled',
359 'perms' =>
'$user->rights->knowledgemanagement->knowledgerecord->read',
426 public function init($options =
'')
428 global $conf, $langs;
430 $result = $this->
_load_tables(
'/install/mysql/',
'knowledgemanagement');
445 $this->
remove($options);
450 $moduledir =
'knowledgemanagement';
451 $myTmpObjects = array();
452 $myTmpObjects[
'KnowledgeRecord'] = array(
'includerefgeneration' => 0,
'includedocgeneration' => 0);
454 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
455 if ($myTmpObjectArray[
'includerefgeneration']) {
456 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/knowledgemanagement/template_knowledgerecords.odt';
457 $dirodt = DOL_DATA_ROOT.
'/doctemplates/knowledgemanagement';
458 $dest = $dirodt.
'/template_knowledgerecords.odt';
460 if (file_exists($src) && !file_exists($dest)) {
461 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
463 $result =
dol_copy($src, $dest,
'0', 0);
465 $langs->load(
"errors");
466 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
471 $sql = array_merge($sql, array(
472 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
473 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".strtolower($myTmpObjectKey).
"',".((
int) $conf->entity).
")",
474 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey).
"_odt' AND type = '".strtolower($myTmpObjectKey).
"' AND entity = ".((
int) $conf->entity),
475 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".strtolower($myTmpObjectKey).
"', ".((
int) $conf->entity).
")"
480 return $this->
_init($sql, $options);
491 public function remove($options =
'')
494 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.