88 public $module_position =
'50';
105 public $dirs = array();
110 public $boxes = array();
115 public $const = array();
120 public $cronjobs = array();
130 public $rights_class;
135 public $menu = array();
164 public $module_parts = array();
176 public $dbversion =
"-";
220 public $descriptionlong;
233 public $export_label;
237 public $export_permission;
238 public $export_fields_array;
239 public $export_TypeFields_array;
240 public $export_entities_array;
241 public $export_help_array;
242 public $export_special_array;
243 public $export_dependencies_array;
244 public $export_sql_start;
245 public $export_sql_end;
246 public $export_sql_order;
259 public $import_label;
263 public $import_entities_array;
264 public $import_tables_array;
265 public $import_fields_array;
266 public $import_fieldshidden_array;
267 public $import_convertvalue_array;
268 public $import_regex_array;
269 public $import_examplevalues_array;
270 public $import_updatekeys_array;
281 public $always_enabled;
291 public $core_enabled;
307 public $config_page_url;
326 public $conflictwith;
338 public $warnings_activation;
345 public $warnings_activation_ext;
358 public $need_dolibarr_version;
363 public $hidden =
false;
368 public $url_last_version;
397 protected function _init($array_sql, $options =
'')
421 if (!$err && !preg_match(
'/newboxdefonly/', $options)) {
426 if (!$err && !preg_match(
'/noboxes/', $options)) {
451 $num = count($array_sql);
452 for ($i = 0; $i < $num; $i++) {
454 $val = $array_sql[$i];
457 if (is_array($val)) {
459 $ignoreerror = $val[
'ignoreerror'];
462 $sql = str_replace(
'__ENTITY__', $conf->entity, $sql);
464 dol_syslog(get_class($this).
"::_init ignoreerror=".$ignoreerror, LOG_DEBUG);
465 $result = $this->
db->query($sql, $ignoreerror);
468 $this->error = $this->
db->lasterror();
471 dol_syslog(get_class($this).
"::_init Warning ".$this->
db->lasterror(), LOG_WARNING);
482 $this->
db->rollback();
496 protected function _remove($array_sql, $options =
'')
524 if (!$err && !preg_match(
'/(newboxdefonly|noboxes)/', $options)) {
549 $num = count($array_sql);
550 for ($i = 0; $i < $num; $i++) {
552 dol_syslog(get_class($this).
"::_remove", LOG_DEBUG);
553 $result = $this->
db->query($array_sql[$i]);
555 $this->error = $this->
db->error();
566 $this->
db->rollback();
581 $langs->load(
"admin");
583 if ($langs->transnoentitiesnoconv(
"Module".$this->numero.
"Name") != (
"Module".$this->numero.
"Name")) {
585 return $langs->transnoentitiesnoconv(
"Module".$this->numero.
"Name");
588 if (is_array($this->langfiles)) {
589 foreach ($this->langfiles as $val) {
596 if ($langs->trans(
"Module".$this->name.
"Name") != (
"Module".$this->name.
"Name")) {
598 return $langs->transnoentitiesnoconv(
"Module".$this->
name.
"Name");
602 return $langs->transnoentitiesnoconv($this->
name);
615 $langs->load(
"admin");
617 if ($langs->transnoentitiesnoconv(
"Module".$this->numero.
"Desc") != (
"Module".$this->numero.
"Desc")) {
619 return $langs->transnoentitiesnoconv(
"Module".$this->numero.
"Desc");
622 if (is_array($this->langfiles)) {
623 foreach ($this->langfiles as $val) {
630 if ($langs->transnoentitiesnoconv(
"Module".$this->name.
"Desc") != (
"Module".$this->name.
"Desc")) {
632 return $langs->trans(
"Module".$this->
name.
"Desc");
649 $langs->load(
"admin");
651 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
652 include_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
658 $content = file_get_contents($pathoffile);
660 if ((
float) DOL_VERSION >= 6.0) {
661 @include_once DOL_DOCUMENT_ROOT.
'/core/lib/parsemd.lib.php';
673 $content = nl2br($content);
677 if (!empty($this->descriptionlong)) {
678 if (is_array($this->langfiles)) {
679 foreach ($this->langfiles as $val) {
686 $content = $langs->transnoentitiesnoconv($this->descriptionlong);
706 $pathoffile =
dol_buildpath(strtolower($this->
name).
'/README-'.$langs->defaultlang.
'.md', 0);
711 $tmp = explode(
'_', $langs->defaultlang);
712 $pathoffile =
dol_buildpath(strtolower($this->
name).
'/README-'.$tmp[0].
'.md', 0);
724 return ($filefound ? $pathoffile :
'');
736 $langs->load(
"admin");
738 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
739 include_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
745 $pathoffile =
dol_buildpath(strtolower($this->
name).
'/ChangeLog-'.$langs->defaultlang.
'.md', 0);
757 $content = file_get_contents($pathoffile);
759 if ((
float) DOL_VERSION >= 6.0) {
760 @include_once DOL_DOCUMENT_ROOT.
'/core/lib/parsemd.lib.php';
763 $content = nl2br($content);
777 return $this->editor_name;
787 return $this->editor_url;
801 $langs->load(
"admin");
805 $newversion = preg_replace(
'/_deprecated/',
'', $this->version);
806 if ($newversion ==
'experimental') {
807 $ret = ($translated ? $langs->transnoentitiesnoconv(
"VersionExperimental") : $newversion);
808 } elseif ($newversion ==
'development') {
809 $ret = ($translated ? $langs->transnoentitiesnoconv(
"VersionDevelopment") : $newversion);
810 } elseif ($newversion ==
'dolibarr') {
812 } elseif ($newversion) {
815 $ret = ($translated ? $langs->transnoentitiesnoconv(
"VersionUnknown") :
'unknown');
818 if (preg_match(
'/_deprecated/', $this->version)) {
819 $ret .= ($translated ?
' ('.$langs->transnoentitiesnoconv(
"Deprecated").
')' : $this->version);
831 if (in_array($this->version, array(
'dolibarr',
'experimental',
'development'))) {
832 return $this->module_position;
834 if ($this->module_position >= 100000) {
835 return $this->module_position;
837 return $this->module_position + 100000;
851 if ($this->version ==
'dolibarr' || $this->version ==
'dolibarr_deprecated') {
854 if (!empty($this->version) && !in_array($this->version, array(
'experimental',
'development'))) {
857 if (!empty($this->editor_name) || !empty($this->editor_url)) {
860 if ($this->numero >= 100000) {
874 return $this->langfiles;
888 $langstring =
"ExportDataset_".$this->export_code[$r];
889 if ($langs->trans($langstring) == $langstring) {
891 return $langs->trans($this->export_label[$r]);
894 return $langs->trans($langstring);
910 $langstring =
"ImportDataset_".$this->import_code[$r];
912 if ($langs->trans($langstring) == $langstring) {
914 return $langs->transnoentitiesnoconv($this->import_label[$r]);
917 return $langs->transnoentitiesnoconv($langstring);
933 $sql =
"SELECT tms FROM ".MAIN_DB_PREFIX.
"const";
934 $sql .=
" WHERE ".$this->db->decrypt(
'name').
" = '".$this->
db->escape($this->const_name).
"'";
935 $sql .=
" AND entity IN (0, ".$conf->entity.
")";
937 dol_syslog(get_class($this).
"::getLastActiveDate", LOG_DEBUG);
942 $obj = $this->
db->fetch_object(
$resql);
944 return $this->
db->jdate($obj->tms);
963 $sql =
"SELECT tms, note FROM ".MAIN_DB_PREFIX.
"const";
964 $sql .=
" WHERE ".$this->db->decrypt(
'name').
" = '".$this->
db->escape($this->const_name).
"'";
965 $sql .=
" AND entity IN (0, ".$conf->entity.
")";
967 dol_syslog(get_class($this).
"::getLastActiveDate", LOG_DEBUG);
972 $obj = $this->
db->fetch_object(
$resql);
976 $tmp = json_decode($obj->note,
true);
979 'authorid' => $tmp[
'authorid'],
981 'lastactivationdate' => $this->
db->jdate($obj->tms),
982 'lastactivationversion' => (!empty($tmp[
'lastactivationversion']) ? $tmp[
'lastactivationversion'] :
'unknown'),
1000 global $conf, $user;
1005 $entity = ((!empty($this->always_enabled) || !empty($this->core_enabled)) ? 0 : $conf->entity);
1007 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
1008 $sql .=
" WHERE ".$this->db->decrypt(
'name').
" = '".$this->
db->escape($this->const_name).
"'";
1009 $sql .=
" AND entity IN (0, ".$entity.
")";
1011 dol_syslog(get_class($this).
"::_active delete activation constant", LOG_DEBUG);
1017 $note = json_encode(
1019 'authorid' => (is_object($user) ? $user->id : 0),
1020 'ip' => (empty($_SERVER[
'REMOTE_ADDR']) ?
'' : $_SERVER[
'REMOTE_ADDR']),
1021 'lastactivationversion' => $this->version,
1025 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"const (name, value, visible, entity, note) VALUES";
1026 $sql .=
" (".$this->db->encrypt($this->const_name);
1027 $sql .=
", ".$this->db->encrypt(
'1');
1028 $sql .=
", 0, ".((int) $entity);
1029 $sql .=
", '".$this->db->escape($note).
"')";
1031 dol_syslog(get_class($this).
"::_active insert activation constant", LOG_DEBUG);
1055 $entity = ((!empty($this->always_enabled) || !empty($this->core_enabled)) ? 0 : $conf->entity);
1057 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
1058 $sql .=
" WHERE ".$this->db->decrypt(
'name').
" = '".$this->
db->escape($this->const_name).
"'";
1059 $sql .=
" AND entity IN (0, ".$entity.
")";
1061 dol_syslog(get_class($this).
"::_unactive", LOG_DEBUG);
1062 $this->
db->query($sql);
1092 if (empty($reldir)) {
1096 include_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
1099 foreach ($conf->file->dol_document_root as $dirroot) {
1101 $dirsql = $dirroot.$reldir;
1105 $listofsubdir = array(
'',
'tables/',
'data/');
1106 if ($this->
db->type ==
'pgsql') {
1107 $listofsubdir[] =
'../pgsql/functions/';
1110 foreach ($listofsubdir as $subdir) {
1111 $dir = $dirsql.$subdir;
1113 $handle = @opendir($dir);
1114 if (is_resource($handle)) {
1119 while (($file = readdir($handle)) !==
false) {
1123 foreach ($files as $file) {
1124 if ($onlywithsuffix) {
1125 if (!preg_match(
'/\-'.preg_quote($onlywithsuffix,
'/').
'\./i', $file)) {
1132 if (preg_match(
'/\.sql$/i', $file) && !preg_match(
'/\.key\.sql$/i', $file) && substr($file, 0, 4) ==
'llx_') {
1133 $result =
run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0,
'', 1);
1144 while (($file = readdir($handle)) !==
false) {
1148 foreach ($files as $file) {
1149 if ($onlywithsuffix) {
1150 if (!preg_match(
'/\-'.preg_quote($onlywithsuffix,
'/').
'\./i', $file)) {
1157 if (preg_match(
'/\.key\.sql$/i', $file) && substr($file, 0, 4) ==
'llx_') {
1158 $result =
run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0,
'', 1);
1169 while (($file = readdir($handle)) !==
false) {
1173 foreach ($files as $file) {
1174 if ($onlywithsuffix) {
1175 if (!preg_match(
'/\-'.preg_quote($onlywithsuffix,
'/').
'\./i', $file)) {
1182 if (preg_match(
'/\.sql$/i', $file) && !preg_match(
'/\.key\.sql$/i', $file) && substr($file, 0, 9) ==
'functions') {
1183 $result =
run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0,
'', 1);
1194 while (($file = readdir($handle)) !==
false) {
1198 foreach ($files as $file) {
1199 if ($onlywithsuffix) {
1200 if (!preg_match(
'/\-'.preg_quote($onlywithsuffix,
'/').
'\./i', $file)) {
1207 if (preg_match(
'/\.sql$/i', $file) && !preg_match(
'/\.key\.sql$/i', $file) && substr($file, 0, 4) ==
'data') {
1208 $result =
run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0,
'', 1);
1219 while (($file = readdir($handle)) !==
false) {
1223 foreach ($files as $file) {
1224 if ($onlywithsuffix) {
1225 if (!preg_match(
'/\-'.preg_quote($onlywithsuffix,
'/').
'\./i', $file)) {
1232 if (preg_match(
'/\.sql$/i', $file) && !preg_match(
'/\.key\.sql$/i', $file) && substr($file, 0, 6) ==
'update') {
1233 $result =
run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0,
'', 1);
1251 dol_syslog(
"A module ask to load sql files into ".$reldir.
" but this directory was not found.", LOG_WARNING);
1268 include_once DOL_DOCUMENT_ROOT.
'/core/class/infobox.class.php';
1274 if (is_array($this->boxes)) {
1275 dol_syslog(get_class($this).
"::insert_boxes", LOG_DEBUG);
1279 foreach ($this->boxes as $key => $value) {
1280 $file = isset($this->boxes[$key][
'file']) ? $this->boxes[$key][
'file'] :
'';
1281 $note = isset($this->boxes[$key][
'note']) ? $this->boxes[$key][
'note'] :
'';
1282 $enabledbydefaulton = isset($this->boxes[$key][
'enabledbydefaulton']) ? $this->boxes[$key][
'enabledbydefaulton'] :
'Home';
1285 $file = isset($this->boxes[$key][1]) ? $this->boxes[$key][1] :
'';
1288 $note = isset($this->boxes[$key][2]) ? $this->boxes[$key][2] :
'';
1292 $sql =
"SELECT count(*) as nb FROM ".MAIN_DB_PREFIX.
"boxes_def";
1293 $sql .=
" WHERE file = '".$this->db->escape($file).
"'";
1294 $sql .=
" AND entity = ".$conf->entity;
1296 $sql .=
" AND note ='".$this->db->escape($note).
"'";
1299 $result = $this->
db->query($sql);
1301 $obj = $this->
db->fetch_object($result);
1302 if ($obj->nb == 0) {
1306 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"boxes_def (file, entity, note)";
1307 $sql .=
" VALUES ('".$this->db->escape($file).
"', ";
1308 $sql .= $conf->entity.
", ";
1309 $sql .= $note ?
"'".$this->db->escape($note).
"'" :
"null";
1312 dol_syslog(get_class($this).
"::insert_boxes", LOG_DEBUG);
1318 if (!$err && !preg_match(
'/newboxdefonly/', $option)) {
1319 $lastid = $this->
db->last_insert_id(MAIN_DB_PREFIX.
"boxes_def",
"rowid");
1321 foreach ($pos_name as $key2 => $val2) {
1323 if ($enabledbydefaulton && $val2 != $enabledbydefaulton) {
1327 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"boxes (box_id, position, box_order, fk_user, entity)";
1328 $sql .=
" VALUES (".((int) $lastid).
", ".((int) $key2).
", '0', 0, ".((int) $conf->entity).
")";
1330 dol_syslog(get_class($this).
"::insert_boxes onto page ".$key2.
"=".$val2, LOG_DEBUG);
1339 $this->
db->commit();
1341 $this->error = $this->
db->lasterror();
1342 $this->
db->rollback();
1347 $this->error = $this->
db->lasterror();
1370 if (is_array($this->boxes)) {
1371 foreach ($this->boxes as $key => $value) {
1373 if (empty($this->boxes[$key][
'file'])) {
1374 $file = isset($this->boxes[$key][1]) ? $this->boxes[$key][1] :
'';
1376 $file = $this->boxes[$key][
'file'];
1384 if ($file ==
'box_graph_product_distribution.php') {
1386 dol_syslog(
"We discard deleting module ".$file.
" because another module still active requires it.");
1391 if ($this->
db->type ==
'sqlite3') {
1394 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"boxes ";
1395 $sql .=
"WHERE ".MAIN_DB_PREFIX.
"boxes.box_id IN (";
1396 $sql .=
"SELECT ".MAIN_DB_PREFIX.
"boxes_def.rowid ";
1397 $sql .=
"FROM ".MAIN_DB_PREFIX.
"boxes_def ";
1398 $sql .=
"WHERE ".MAIN_DB_PREFIX.
"boxes_def.file = '".$this->
db->escape($file).
"') ";
1399 $sql .=
"AND ".MAIN_DB_PREFIX.
"boxes.entity = ".$conf->entity;
1401 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"boxes";
1402 $sql .=
" USING ".MAIN_DB_PREFIX.
"boxes, ".MAIN_DB_PREFIX.
"boxes_def";
1403 $sql .=
" WHERE ".MAIN_DB_PREFIX.
"boxes.box_id = ".MAIN_DB_PREFIX.
"boxes_def.rowid";
1404 $sql .=
" AND ".MAIN_DB_PREFIX.
"boxes_def.file = '".$this->
db->escape($file).
"'";
1405 $sql .=
" AND ".MAIN_DB_PREFIX.
"boxes.entity = ".$conf->entity;
1408 dol_syslog(get_class($this).
"::delete_boxes", LOG_DEBUG);
1411 $this->error = $this->
db->lasterror();
1415 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"boxes_def";
1416 $sql .=
" WHERE file = '".$this->db->escape($file).
"'";
1417 $sql .=
" AND entity = ".$conf->entity;
1419 dol_syslog(get_class($this).
"::delete_boxes", LOG_DEBUG);
1422 $this->error = $this->
db->lasterror();
1440 include_once DOL_DOCUMENT_ROOT.
'/core/class/infobox.class.php';
1446 if (is_array($this->cronjobs)) {
1447 dol_syslog(get_class($this).
"::insert_cronjobs", LOG_DEBUG);
1449 foreach ($this->cronjobs as $key => $value) {
1450 $entity = isset($this->cronjobs[$key][
'entity']) ? $this->cronjobs[$key][
'entity'] : $conf->entity;
1451 $label = isset($this->cronjobs[$key][
'label']) ? $this->cronjobs[$key][
'label'] :
'';
1452 $jobtype = isset($this->cronjobs[$key][
'jobtype']) ? $this->cronjobs[$key][
'jobtype'] :
'';
1453 $class = isset($this->cronjobs[$key][
'class']) ? $this->cronjobs[$key][
'class'] :
'';
1454 $objectname = isset($this->cronjobs[$key][
'objectname']) ? $this->cronjobs[$key][
'objectname'] :
'';
1455 $method = isset($this->cronjobs[$key][
'method']) ? $this->cronjobs[$key][
'method'] :
'';
1456 $command = isset($this->cronjobs[$key][
'command']) ? $this->cronjobs[$key][
'command'] :
'';
1457 $parameters = isset($this->cronjobs[$key][
'parameters']) ? $this->cronjobs[$key][
'parameters'] :
'';
1458 $comment = isset($this->cronjobs[$key][
'comment']) ? $this->cronjobs[$key][
'comment'] :
'';
1459 $frequency = isset($this->cronjobs[$key][
'frequency']) ? $this->cronjobs[$key][
'frequency'] :
'';
1460 $unitfrequency = isset($this->cronjobs[$key][
'unitfrequency']) ? $this->cronjobs[$key][
'unitfrequency'] :
'';
1461 $priority = isset($this->cronjobs[$key][
'priority']) ? $this->cronjobs[$key][
'priority'] :
'';
1462 $datestart = isset($this->cronjobs[$key][
'datestart']) ? $this->cronjobs[$key][
'datestart'] :
'';
1463 $dateend = isset($this->cronjobs[$key][
'dateend']) ? $this->cronjobs[$key][
'dateend'] :
'';
1464 $status = isset($this->cronjobs[$key][
'status']) ? $this->cronjobs[$key][
'status'] :
'';
1465 $test = isset($this->cronjobs[$key][
'test']) ? $this->cronjobs[$key][
'test'] :
'';
1468 $sql =
"SELECT count(*) as nb FROM ".MAIN_DB_PREFIX.
"cronjob";
1470 $sql .=
" WHERE label = '".$this->db->escape($label).
"'";
1486 $sql .=
" AND entity = ".((int) $entity);
1490 $result = $this->
db->query($sql);
1492 $obj = $this->
db->fetch_object($result);
1493 if ($obj->nb == 0) {
1497 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"cronjob (module_name, datec, datestart, dateend, label, jobtype, classesname, objectname, methodename, command, params, note,";
1498 if (is_int($frequency)) {
1499 $sql .=
' frequency,';
1501 if (is_int($unitfrequency)) {
1502 $sql .=
' unitfrequency,';
1504 if (is_int($priority)) {
1505 $sql .=
' priority,';
1507 if (is_int($status)) {
1510 $sql .=
" entity, test)";
1511 $sql .=
" VALUES (";
1512 $sql .=
"'".$this->db->escape(empty($this->rights_class) ?strtolower($this->
name) : $this->rights_class).
"', ";
1513 $sql .=
"'".$this->db->idate($now).
"', ";
1514 $sql .= ($datestart ?
"'".$this->db->idate($datestart).
"'" :
"'".$this->db->idate($now).
"'").
", ";
1515 $sql .= ($dateend ?
"'".$this->db->idate($dateend).
"'" :
"NULL").
", ";
1516 $sql .=
"'".$this->db->escape($label).
"', ";
1517 $sql .=
"'".$this->db->escape($jobtype).
"', ";
1518 $sql .= ($class ?
"'".$this->db->escape($class).
"'" :
"null").
",";
1519 $sql .= ($objectname ?
"'".$this->db->escape($objectname).
"'" :
"null").
",";
1520 $sql .= ($method ?
"'".$this->db->escape($method).
"'" :
"null").
",";
1521 $sql .= ($command ?
"'".$this->db->escape($command).
"'" :
"null").
",";
1522 $sql .= ($parameters ?
"'".$this->db->escape($parameters).
"'" :
"null").
",";
1523 $sql .= ($comment ?
"'".$this->db->escape($comment).
"'" :
"null").
",";
1524 if (is_int($frequency)) {
1525 $sql .=
"'".$this->db->escape($frequency).
"', ";
1527 if (is_int($unitfrequency)) {
1528 $sql .=
"'".$this->db->escape($unitfrequency).
"', ";
1530 if (is_int($priority)) {
1531 $sql .=
"'".$this->db->escape($priority).
"', ";
1533 if (is_int($status)) {
1534 $sql .= ((int) $status).
", ";
1536 $sql .= $entity.
",";
1537 $sql .=
"'".$this->db->escape($test).
"'";
1547 $this->
db->commit();
1549 $this->error = $this->
db->lasterror();
1550 $this->
db->rollback();
1555 $this->error = $this->
db->lasterror();
1578 if (is_array($this->cronjobs)) {
1579 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"cronjob";
1580 $sql .=
" WHERE module_name = '".$this->db->escape(empty($this->rights_class) ?strtolower($this->
name) : $this->rights_class).
"'";
1581 $sql .=
" AND entity = ".$conf->entity;
1582 $sql .=
" AND test = '1'";
1585 dol_syslog(get_class($this).
"::delete_cronjobs", LOG_DEBUG);
1588 $this->error = $this->
db->lasterror();
1609 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
1610 $sql .=
" WHERE ".$this->db->decrypt(
'name').
" like '".$this->
db->escape($this->const_name).
"_TABS_%'";
1611 $sql .=
" AND entity = ".$conf->entity;
1613 dol_syslog(get_class($this).
"::delete_tabs", LOG_DEBUG);
1614 if (!$this->
db->query($sql)) {
1615 $this->error = $this->
db->lasterror();
1635 if (!empty($this->tabs)) {
1636 dol_syslog(get_class($this).
"::insert_tabs", LOG_DEBUG);
1639 foreach ($this->tabs as $key => $value) {
1640 if (is_array($value) && count($value) == 0) {
1644 $entity = $conf->entity;
1647 if (is_array($value)) {
1648 $newvalue = $value[
'data'];
1649 if (isset($value[
'entity'])) {
1650 $entity = $value[
'entity'];
1655 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"const (";
1660 $sql .=
", visible";
1663 $sql .=
" VALUES (";
1664 $sql .= $this->
db->encrypt($this->const_name.
"_TABS_".$i);
1665 $sql .=
", 'chaine'";
1666 $sql .=
", ".$this->db->encrypt($newvalue);
1669 $sql .=
", ".((int) $entity);
1675 if ($this->
db->lasterrno() !=
'DB_ERROR_RECORD_ALREADY_EXISTS') {
1676 $this->error = $this->
db->lasterror();
1677 $this->errors[] = $this->
db->lasterror();
1702 if (empty($this->
const)) {
1706 dol_syslog(get_class($this).
"::insert_const", LOG_DEBUG);
1708 foreach ($this->
const as $key => $value) {
1709 $name = $this->
const[$key][0];
1710 $type = $this->
const[$key][1];
1711 $val = $this->
const[$key][2];
1712 $note = isset($this->
const[$key][3]) ? $this->
const[$key][3] :
'';
1713 $visible = isset($this->
const[$key][4]) ? $this->
const[$key][4] : 0;
1714 $entity = (!empty($this->
const[$key][5]) && $this->
const[$key][5] !=
'current') ? 0 : $conf->entity;
1717 if (empty($visible)) {
1720 if (empty($val) && $val !=
'0') {
1724 $sql =
"SELECT count(*)";
1725 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const";
1726 $sql .=
" WHERE ".$this->db->decrypt(
'name').
" = '".$this->
db->escape($name).
"'";
1727 $sql .=
" AND entity = ".((int) $entity);
1729 $result = $this->
db->query($sql);
1731 $row = $this->
db->fetch_row($result);
1734 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"const (name,type,value,note,visible,entity)";
1735 $sql .=
" VALUES (";
1736 $sql .= $this->
db->encrypt($name);
1737 $sql .=
",'".$this->db->escape($type).
"'";
1738 $sql .=
",".(($val !=
'') ? $this->
db->encrypt($val) :
"''");
1739 $sql .=
",".($note ?
"'".$this->db->escape($note).
"'" :
"null");
1740 $sql .=
",'".$this->db->escape($visible).
"'";
1741 $sql .=
",".$entity;
1744 if (!$this->
db->query($sql)) {
1748 dol_syslog(get_class($this).
"::insert_const constant '".$name.
"' already exists", LOG_WARNING);
1771 if (empty($this->
const)) {
1775 foreach ($this->
const as $key => $value) {
1776 $name = $this->
const[$key][0];
1777 $deleteonunactive = (!empty($this->
const[$key][6])) ? 1 : 0;
1779 if ($deleteonunactive) {
1780 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
1781 $sql .=
" WHERE ".$this->db->decrypt(
'name').
" = '".$this->
db->escape($name).
"'";
1782 $sql .=
" AND entity in (0, ".$conf->entity.
")";
1783 dol_syslog(get_class($this).
"::delete_const", LOG_DEBUG);
1784 if (!$this->
db->query($sql)) {
1785 $this->error = $this->
db->lasterror();
1806 global $conf, $user;
1809 $entity = (!empty($force_entity) ? $force_entity : $conf->entity);
1811 dol_syslog(get_class($this).
"::insert_permissions", LOG_DEBUG);
1814 $sql_del =
"SELECT ".$this->db->decrypt(
'value').
" as value";
1815 $sql_del .=
" FROM ".MAIN_DB_PREFIX.
"const";
1816 $sql_del .=
" WHERE ".$this->db->decrypt(
'name').
" = '".$this->
db->escape($this->const_name).
"'";
1817 $sql_del .=
" AND entity IN (0,".$entity.
")";
1819 $resql = $this->
db->query($sql_del);
1822 $obj = $this->
db->fetch_object(
$resql);
1824 if ($obj !==
null && !empty($obj->value) && !empty($this->rights)) {
1825 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
1828 foreach ($this->rights as $key => $value) {
1829 $r_id = $this->rights[$key][0];
1830 $r_desc = $this->rights[$key][1];
1831 $r_type = isset($this->rights[$key][2]) ? $this->rights[$key][2] :
'';
1832 $r_def = empty($this->rights[$key][3]) ? 0 : $this->rights[$key][3];
1833 $r_perms = $this->rights[$key][4];
1834 $r_subperms = isset($this->rights[$key][5]) ? $this->rights[$key][5] :
'';
1835 $r_modul = empty($this->rights_class) ? strtolower($this->
name) : $this->rights_class;
1837 if (empty($r_type)) {
1842 $sql =
"SELECT count(*) as nb FROM ".MAIN_DB_PREFIX.
"rights_def";
1843 $sql .=
" WHERE id = ".((int) $r_id).
" AND entity = ".((int) $entity);
1845 $resqlselect = $this->
db->query($sql);
1847 $objcount = $this->
db->fetch_object($resqlselect);
1848 if ($objcount && $objcount->nb == 0) {
1851 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"rights_def";
1852 $sql .=
" (id, entity, libelle, module, type, bydefault, perms, subperms)";
1854 $sql .=
"(".$r_id.
",".$entity.
",'".$this->
db->escape($r_desc).
"','".$this->
db->escape($r_modul).
"','".$this->
db->escape($r_type).
"',".$r_def.
",'".$this->
db->escape($r_perms).
"','".$this->
db->escape($r_subperms).
"')";
1856 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"rights_def";
1857 $sql .=
" (id, entity, libelle, module, type, bydefault, perms)";
1859 $sql .=
"(".$r_id.
",".$entity.
",'".$this->
db->escape($r_desc).
"','".$this->
db->escape($r_modul).
"','".$this->
db->escape($r_type).
"',".$r_def.
",'".$this->
db->escape($r_perms).
"')";
1862 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"rights_def ";
1863 $sql .=
" (id, entity, libelle, module, type, bydefault)";
1865 $sql .=
"(".$r_id.
",".$entity.
",'".$this->
db->escape($r_desc).
"','".$this->
db->escape($r_modul).
"','".$this->
db->escape($r_type).
"',".$r_def.
")";
1868 $resqlinsert = $this->
db->query($sql, 1);
1870 if (!$resqlinsert) {
1871 if ($this->
db->errno() !=
"DB_ERROR_RECORD_ALREADY_EXISTS") {
1872 $this->error = $this->
db->lasterror();
1876 dol_syslog(get_class($this).
"::insert_permissions record already exists", LOG_INFO);
1880 $this->
db->free($resqlinsert);
1883 $this->
db->free($resqlselect);
1887 if ($reinitadminperms) {
1888 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"user WHERE admin = 1";
1889 dol_syslog(get_class($this).
"::insert_permissions Search all admin users", LOG_DEBUG);
1891 $resqlseladmin = $this->
db->query($sql, 1);
1893 if ($resqlseladmin) {
1894 $num = $this->
db->num_rows($resqlseladmin);
1897 $obj2 = $this->
db->fetch_object($resqlseladmin);
1898 dol_syslog(get_class($this).
"::insert_permissions Add permission id ".$r_id.
" to user id=".$obj2->rowid);
1900 $tmpuser =
new User($this->
db);
1901 $result = $tmpuser->fetch($obj2->rowid);
1903 $tmpuser->addrights($r_id,
'',
'', 0, 1);
1905 dol_syslog(get_class($this).
"::insert_permissions Failed to add the permission to user because fetch return an error", LOG_ERR);
1915 if ($reinitadminperms && !empty($user->admin)) {
1917 $user->clearrights();
1923 $this->error = $this->
db->lasterror();
1944 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"rights_def";
1945 $sql .=
" WHERE module = '".$this->db->escape(empty($this->rights_class) ?strtolower($this->
name) : $this->rights_class).
"'";
1946 $sql .=
" AND entity = ".$conf->entity;
1947 dol_syslog(get_class($this).
"::delete_permissions", LOG_DEBUG);
1948 if (!$this->
db->query($sql)) {
1949 $this->error = $this->
db->lasterror();
1968 if (!is_array($this->menu) || empty($this->menu)) {
1972 include_once DOL_DOCUMENT_ROOT.
'/core/class/menubase.class.php';
1974 dol_syslog(get_class($this).
"::insert_menus", LOG_DEBUG);
1980 foreach ($this->menu as $key => $value) {
1982 $menu->menu_handler =
'all';
1985 $menu->module = (empty($this->rights_class) ? strtolower($this->
name) : $this->rights_class);
1987 if (!$this->menu[$key][
'fk_menu']) {
1991 $fk_parent = $this->menu[$key][
'fk_menu'];
1993 if (preg_match(
'/^r=/', $fk_parent)) {
1994 $fk_parent = str_replace(
'r=',
'', $fk_parent);
1995 if (isset($this->menu[$fk_parent][
'rowid'])) {
1996 $menu->fk_menu = $this->menu[$fk_parent][
'rowid'];
1999 } elseif (preg_match(
'/^fk_mainmenu=([a-zA-Z0-9_]+),fk_leftmenu=([a-zA-Z0-9_]+)$/', $fk_parent, $reg)) {
2000 $menu->fk_menu = -1;
2001 $menu->fk_mainmenu = $reg[1];
2002 $menu->fk_leftmenu = $reg[2];
2004 } elseif (preg_match(
'/^fk_mainmenu=([a-zA-Z0-9_]+)$/', $fk_parent, $reg)) {
2005 $menu->fk_menu = -1;
2006 $menu->fk_mainmenu = $reg[1];
2007 $menu->fk_leftmenu =
'';
2010 if (!$foundparent) {
2011 $this->error =
"ErrorBadDefinitionOfMenuArrayInModuleDescriptor";
2012 dol_syslog(get_class($this).
"::insert_menus ".$this->error.
" ".$this->menu[$key][
'fk_menu'], LOG_ERR);
2016 $menu->type = $this->menu[$key][
'type'];
2017 $menu->mainmenu = isset($this->menu[$key][
'mainmenu']) ? $this->menu[$key][
'mainmenu'] : (isset($menu->fk_mainmenu) ? $menu->fk_mainmenu :
'');
2018 $menu->leftmenu = isset($this->menu[$key][
'leftmenu']) ? $this->menu[$key][
'leftmenu'] :
'';
2019 $menu->title = $this->menu[$key][
'titre'];
2020 $menu->prefix = isset($this->menu[$key][
'prefix']) ? $this->menu[$key][
'prefix'] :
'';
2021 $menu->url = $this->menu[$key][
'url'];
2022 $menu->langs = isset($this->menu[$key][
'langs']) ? $this->menu[$key][
'langs'] :
'';
2023 $menu->position = $this->menu[$key][
'position'];
2024 $menu->perms = $this->menu[$key][
'perms'];
2025 $menu->target = isset($this->menu[$key][
'target']) ? $this->menu[$key][
'target'] :
'';
2026 $menu->user = $this->menu[$key][
'user'];
2027 $menu->enabled = isset($this->menu[$key][
'enabled']) ? $this->menu[$key][
'enabled'] : 0;
2028 $menu->position = $this->menu[$key][
'position'];
2031 $result = $menu->create($user);
2033 $this->menu[$key][
'rowid'] = $result;
2035 $this->error = $menu->error;
2036 dol_syslog(get_class($this).
'::insert_menus result='.$result.
" ".$this->error, LOG_ERR);
2044 $this->
db->commit();
2046 dol_syslog(get_class($this).
"::insert_menus ".$this->error, LOG_ERR);
2047 $this->
db->rollback();
2068 $module = empty($this->rights_class) ?strtolower($this->
name) : $this->rights_class;
2070 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"menu";
2071 $sql .=
" WHERE module = '".$this->db->escape($module).
"'";
2072 $sql .=
" AND entity = ".$conf->entity;
2074 dol_syslog(get_class($this).
"::delete_menus", LOG_DEBUG);
2077 $this->error = $this->
db->lasterror();
2093 global $langs, $conf;
2097 if (isset($this->dirs) && is_array($this->dirs)) {
2098 foreach ($this->dirs as $key => $value) {
2101 if (!is_array($value)) {
2104 $constname = $this->const_name.
"_DIR_";
2105 $dir = $this->dirs[$key][1];
2106 $addtodatabase = empty($this->dirs[$key][2]) ?
'' : $this->dirs[$key][2];
2107 $subname = empty($this->dirs[$key][3]) ?
'' : strtoupper($this->dirs[$key][3]);
2108 $forcename = empty($this->dirs[$key][4]) ?
'' : strtoupper($this->dirs[$key][4]);
2110 if (!empty($forcename)) {
2111 $constname =
'MAIN_MODULE_'.$forcename.
"_DIR_";
2113 if (!empty($subname)) {
2114 $constname = $constname.$subname.
"_";
2117 $name = $constname.strtoupper($this->dirs[$key][0]);
2121 if (empty($conf->global->MAIN_MODULE_MULTICOMPANY) || $conf->entity == 1) {
2122 $fulldir = DOL_DATA_ROOT.$dir;
2124 $fulldir = DOL_DATA_ROOT.
"/".$conf->entity.$dir;
2127 if (!empty($fulldir) && !file_exists($fulldir)) {
2128 if (
dol_mkdir($fulldir, DOL_DATA_ROOT) < 0) {
2129 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $fulldir);
2130 dol_syslog(get_class($this).
"::_init ".$this->error, LOG_ERR);
2136 if (!empty($addtodatabase)) {
2165 $sql =
"SELECT count(*)";
2166 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const";
2167 $sql .=
" WHERE ".$this->db->decrypt(
'name').
" = '".$this->
db->escape($name).
"'";
2168 $sql .=
" AND entity = ".$conf->entity;
2170 dol_syslog(get_class($this).
"::insert_dirs", LOG_DEBUG);
2171 $result = $this->
db->query($sql);
2173 $row = $this->
db->fetch_row($result);
2176 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"const (name, type, value, note, visible, entity)";
2177 $sql .=
" VALUES (".$this->db->encrypt($name).
", 'chaine', ".$this->
db->encrypt($dir).
", '".$this->
db->escape(
"Directory for module ".$this->
name).
"', '0', ".((int) $conf->entity).
")";
2179 dol_syslog(get_class($this).
"::insert_dirs", LOG_DEBUG);
2180 $this->
db->query($sql);
2183 $this->error = $this->
db->lasterror();
2204 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
2205 $sql .=
" WHERE ".$this->db->decrypt(
'name').
" LIKE '".$this->
db->escape($this->const_name).
"_DIR_%'";
2206 $sql .=
" AND entity = ".$conf->entity;
2208 dol_syslog(get_class($this).
"::delete_dirs", LOG_DEBUG);
2209 if (!$this->
db->query($sql)) {
2210 $this->error = $this->
db->lasterror();
2230 if (is_array($this->module_parts) && !empty($this->module_parts)) {
2231 foreach ($this->module_parts as $key => $value) {
2232 if (is_array($value) && count($value) == 0) {
2236 $entity = $conf->entity;
2240 if (is_array($value)) {
2243 if (isset($value[
'data']) && is_array($value[
'data'])) {
2244 $newvalue = json_encode($value[
'data']);
2245 if (isset($value[
'entity'])) {
2246 $entity = $value[
'entity'];
2248 } elseif (isset($value[
'data']) && !is_array($value[
'data'])) {
2249 $newvalue = $value[
'data'];
2250 if (isset($value[
'entity'])) {
2251 $entity = $value[
'entity'];
2254 $newvalue = json_encode($value);
2258 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"const (";
2263 $sql .=
", visible";
2266 $sql .=
" VALUES (";
2267 $sql .=
" ".$this->db->encrypt($this->const_name.
"_".strtoupper($key));
2268 $sql .=
", 'chaine'";
2269 $sql .=
", ".$this->db->encrypt($newvalue);
2272 $sql .=
", ".((int) $entity);
2275 dol_syslog(get_class($this).
"::insert_module_parts for key=".$this->const_name.
"_".strtoupper($key), LOG_DEBUG);
2277 $resql = $this->
db->query($sql, 1);
2279 if ($this->
db->lasterrno() !=
'DB_ERROR_RECORD_ALREADY_EXISTS') {
2281 $this->error = $this->
db->lasterror();
2283 dol_syslog(get_class($this).
"::insert_module_parts for ".$this->const_name.
"_".strtoupper($key).
" Record already exists.", LOG_WARNING);
2303 $entity = $conf->entity;
2305 if (is_array($this->module_parts) && !empty($this->module_parts)) {
2306 dol_syslog(get_class($this).
"::delete_module_parts", LOG_DEBUG);
2308 foreach ($this->module_parts as $key => $value) {
2310 if (is_array($value) && isset($value[
'entity'])) {
2311 $entity = $value[
'entity'];
2314 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
2315 $sql .=
" WHERE ".$this->db->decrypt(
'name').
" LIKE '".$this->
db->escape($this->const_name).
"_".strtoupper($key).
"'";
2316 $sql .=
" AND entity = ".((int) $entity);
2318 if (!$this->
db->query($sql)) {
2319 $this->error = $this->
db->lasterror();
2336 public function init($options =
'')
2338 return $this->
_init(array(), $options);
2349 public function remove($options =
'')
2351 return $this->
_remove(array(), $options);
2364 global $conf, $langs;
2369 $imginfo =
"info_black";
2372 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($this)));
2376 if (preg_match(
'/development/i', $version)) {
2377 $versiontrans .=
'warning';
2379 if (preg_match(
'/experimental/i', $version)) {
2380 $versiontrans .=
'warning';
2382 if (preg_match(
'/deprecated/i', $version)) {
2383 $versiontrans .=
'warning';
2387 <div class="box-flex-item info-box-module'
2388 .(empty($conf->global->$const_name) ?
' --disabled' :
'')
2390 .($this->needUpdate ?
' --need-update' :
'')
2392 <div class="info-box info-box-sm info-box-module">
2393 <div class="info-box-icon'.(empty($conf->global->$const_name) ?
'' :
' info-box-icon-module-enabled'.($versiontrans ?
' info-box-icon-module-warning' :
'')).
'">';
2398 if (!empty($this->picto)) {
2399 if (preg_match(
'/^\//i', $this->picto)) {
2400 print
img_picto($alttext, $this->picto,
'class="inline-block valignmiddle"', 1);
2402 print
img_object($alttext, $this->picto,
'class="inline-block valignmiddle"');
2405 print
img_object($alttext,
'generic',
'class="inline-block valignmiddle"');
2408 if ($this->
isCoreOrExternalModule() ==
'external' || preg_match(
'/development|experimental|deprecated/i', $version)) {
2409 $versionTitle = $langs->trans(
"Version").
' '.$this->
getVersion(1);
2410 if ($this->needUpdate) {
2411 $versionTitle.=
'<br>'.$langs->trans(
'ModuleUpdateAvailable').
' : '.
$this->lastVersion;
2414 print
'<span class="info-box-icon-version'.($versiontrans ?
' '.$versiontrans :
'').
' classfortooltip" title="'.
dol_escape_js($versionTitle).
'" >';
2420 <div class="info-box-content info-box-text-module'.(empty($conf->global->$const_name) ?
'' :
' info-box-module-enabled'.($versiontrans ?
' info-box-content-warning' :
'')).
'">
2421 <span class="info-box-title">'.$this->
getName().
'</span>
2424 print
'<div class="valignmiddle inline-block info-box-more">';
2426 print
'<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.
'/admin/modulehelp.php?id='.$this->numero.
'\',\
'text/html\',\''.dol_escape_js($langs->trans(
"Module")).
'\')
">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule
").' - ' : '').$langs->trans("ClickToShowDescription
"), $imginfo).'</a>';
2429 print '<div class="valignmiddle
inline-block info-box-actions
">';
2430 print '<div class="valignmiddle
inline-block info-box-setup
">';
2431 print $codetoconfig;
2433 print '<div class="valignmiddle
inline-block marginleftonly marginrightonly
">';
2434 print $codeenabledisable;
2439 </div><!-- /.info-box-content -->
2440 </div><!-- /.info-box -->
2451 public function checkForUpdate()
2453 require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
2454 if (!empty($this->url_last_version)) {
2455 $lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only
2456 if (isset($lastVersion['content']) && strlen($lastVersion['content']) < 30) {
2457 // Security warning : be careful with remote data content, the module editor could be hacked (or evil) so limit to a-z A-Z 0-9 _ . -
2458 $this->lastVersion = preg_replace("/[^a-zA-Z0-9_\.\-]+/
", "", $lastVersion['content']);
2459 if (version_compare($this->lastVersion, $this->version) > 0) {
2460 $this->needUpdate = true;
2463 $this->needUpdate = false;
run_sql($sqlfile, $silent=1, $entity='', $usesavepoint=1, $handler='', $okerror='default', $linelengthlimit=32768, $nocommentremoval=0, $offsetforchartofaccount=0, $colspan=0, $onlysqltoimportwebsite=0)
Launch a sql file.
delete_permissions()
Removes access rights.
getImportDatasetLabel($r)
Gives translated label of an import dataset.
_init($array_sql, $options='')
Enables a module.
getLastActivationDate()
Gives the last date of activation.
delete_cronjobs()
Removes boxes.
getKanbanView($codeenabledisable='', $codetoconfig='')
Return Kanban view of a module.
getModulePosition()
Gives the module position.
insert_const()
Adds constants.
__construct($db)
Constructor.
delete_boxes()
Removes boxes.
isCoreOrExternalModule()
Tells if module is core or external.
getDescLongReadmeFound()
Return path of file if a README file was found.
insert_permissions($reinitadminperms=0, $force_entity=null, $notrigger=0)
Adds access rights.
delete_menus()
Removes menu entries.
delete_const()
Removes constants tagged 'deleteonunactive'.
_active()
Insert constants for module activation.
_remove($array_sql, $options='')
Disable function.
getDescLong()
Gives the long description of a module.
insert_boxes($option='')
Adds boxes.
getPublisher()
Gives the publisher name.
getChangeLog()
Gives the changelog.
insert_cronjobs()
Adds cronjobs.
create_dirs()
Creates directories.
delete_module_parts()
Removes generic parts.
getVersion($translated=1)
Gives module version (translated if param $translated is on) For 'experimental' modules,...
_unactive()
Module deactivation.
getDesc()
Gives the translated module description if translation exists in admin.lang or the default module des...
$needUpdate
true indicate this module need update
delete_tabs()
Removes tabs.
getExportDatasetLabel($r)
Gives translated label of an export dataset.
getName()
Gives the translated module name if translation exists in admin.lang or into language files of module...
_load_tables($reldir, $onlywithsuffix='')
Create tables and keys required by module:
$lastVersion
Module last version.
insert_dirs($name, $dir)
Adds directories definitions.
getLangFilesArray()
Gives module related language files list.
insert_menus()
Adds menu entries.
insert_module_parts()
Adds generic parts.
getPublisherUrl()
Gives the publisher url.
getLastActivationInfo()
Gives the last author of activation.
delete_dirs()
Removes directories.
init($options='')
Function called when module is enabled.
static getListOfPagesForBoxes()
Name of positions (See below)
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_is_file($pathoffile)
Return if path is a file.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
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_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
dolMd2Html($content, $parser='parsedown', $replaceimagepath=null)
Function to parse MD content into HTML.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.