27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
39 if (isset($versionarray[0])) {
40 $string = $versionarray[0];
42 if (isset($versionarray[1])) {
43 $string .=
'.'.$versionarray[1];
45 if (isset($versionarray[2])) {
46 $string .=
'.'.$versionarray[2];
70 $count1 = count($versionarray1);
71 $count2 = count($versionarray2);
72 $maxcount = max($count1, $count2);
73 while ($level < $maxcount) {
74 $operande1 = isset($versionarray1[$level]) ? $versionarray1[$level] : 0;
75 $operande2 = isset($versionarray2[$level]) ? $versionarray2[$level] : 0;
76 if (preg_match(
'/alpha|dev/i', $operande1)) {
79 if (preg_match(
'/alpha|dev/i', $operande2)) {
82 if (preg_match(
'/beta$/i', $operande1)) {
85 if (preg_match(
'/beta$/i', $operande2)) {
88 if (preg_match(
'/beta([0-9])+/i', $operande1)) {
91 if (preg_match(
'/beta([0-9])+/i', $operande2)) {
94 if (preg_match(
'/rc$/i', $operande1)) {
97 if (preg_match(
'/rc$/i', $operande2)) {
100 if (preg_match(
'/rc([0-9])+/i', $operande1)) {
103 if (preg_match(
'/rc([0-9])+/i', $operande2)) {
108 if ($operande1 < $operande2) {
109 $ret = -$level;
break;
111 if ($operande1 > $operande2) {
112 $ret = $level;
break;
127 return explode(
'.', PHP_VERSION);
137 return explode(
'.', DOL_VERSION);
161 function run_sql($sqlfile, $silent = 1, $entity =
'', $usesavepoint = 1, $handler =
'', $okerror =
'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0)
163 global $db, $conf, $langs, $user;
165 dol_syslog(
"Admin.lib::run_sql run sql file ".$sqlfile.
" silent=".$silent.
" entity=".$entity.
" usesavepoint=".$usesavepoint.
" handler=".$handler.
" okerror=".$okerror, LOG_DEBUG);
167 if (!is_numeric($linelengthlimit)) {
168 dol_syslog(
"Admin.lib::run_sql param linelengthlimit is not a numeric", LOG_ERR);
179 $versionarray = $db->getVersionArray();
181 $fp = fopen($sqlfile,
"r");
185 if ($linelengthlimit > 0) {
186 $buf = fgets($fp, $linelengthlimit);
193 if (preg_match(
'/^--\sV(MYSQL|PGSQL)([^\s]*)/i', $buf, $reg)) {
197 if (!empty($reg[1])) {
198 if (!preg_match(
'/'.preg_quote($reg[1]).
'/i', $db->type)) {
205 if (!empty($reg[2])) {
206 if (is_numeric($reg[2])) {
207 $versionrequest = explode(
'.', $reg[2]);
210 if (!count($versionrequest) || !count($versionarray) ||
versioncompare($versionrequest, $versionarray) > 0) {
215 $dbcollation = strtoupper(preg_replace(
'/_/',
'', $conf->db->dolibarr_main_db_collation));
218 if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != $dbcollation)) {
228 $buf = preg_replace(
'/^--\sV(MYSQL|PGSQL)([^\s]*)/i',
'', $buf);
234 if ($nocommentremoval || !preg_match(
'/^\s*--/', $buf)) {
235 if (empty($nocommentremoval)) {
236 $buf = preg_replace(
'/([,;ERLT\)])\s*--.*$/i',
'\1', $buf);
238 $buffer .= trim($buf);
243 if (preg_match(
'/;/', $buffer)) {
246 $arraysql[$i] = $buffer;
254 $arraysql[$i] = $buffer;
258 dol_syslog(
"Admin.lib::run_sql failed to open file ".$sqlfile, LOG_ERR);
262 $listofmaxrowid = array();
263 foreach ($arraysql as $i => $sql) {
267 while (preg_match(
'/__\+MAX_([A-Za-z0-9_]+)__/i', $newsql, $reg)) {
269 if (!isset($listofmaxrowid[$table])) {
271 $sqlgetrowid =
'SELECT MAX(rowid) as max from '.preg_replace(
'/^llx_/', MAIN_DB_PREFIX, $table);
272 $resql = $db->query($sqlgetrowid);
274 $obj = $db->fetch_object(
$resql);
275 $listofmaxrowid[$table] = $obj->max;
276 if (empty($listofmaxrowid[$table])) {
277 $listofmaxrowid[$table] = 0;
281 print '<tr><td class="tdtop" colspan="2">';
284 print '<div class="error">'.$langs->trans(
"Failed to get max rowid for ".$table).
"</div></td>";
294 $from =
'__+MAX_'.$table.
'__';
295 $to =
'+'.$listofmaxrowid[$table];
296 $newsql = str_replace($from, $to, $newsql);
297 dol_syslog(
'Admin.lib::run_sql New Request '.($i + 1).
' (replacing '.$from.
' to '.$to.
')', LOG_DEBUG);
299 $arraysql[$i] = $newsql;
302 if ($offsetforchartofaccount > 0) {
308 $newsql = preg_replace(
'/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'?[^\',]*\'?\s*),\s*\'?([^\',]*)\'?/ims',
'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.
', \2, \3 + '.$offsetforchartofaccount, $newsql);
309 $newsql = preg_replace(
'/([,\s])0 \+ '.$offsetforchartofaccount.
'/ims',
'\1 0', $newsql);
311 $arraysql[$i] = $newsql;
317 $listofinsertedrowid = array();
318 foreach ($arraysql as $i => $sql) {
321 if (MAIN_DB_PREFIX !=
'llx_') {
322 $sql = preg_replace(
'/llx_/i', MAIN_DB_PREFIX, $sql);
325 if (!empty($handler)) {
326 $sql = preg_replace(
'/__HANDLER__/i',
"'".$db->escape($handler).
"'", $sql);
329 $newsql = preg_replace(
'/__ENTITY__/i', (!empty($entity) ? $entity : $conf->entity), $sql);
333 print '<tr class="trforrunsql"><td class="tdtop opacitymedium">'.$langs->trans(
"Request").
' '.($i + 1).
" sql='".
dol_htmlentities($newsql, ENT_NOQUOTES).
"'</td></tr>\n";
335 dol_syslog(
'Admin.lib::run_sql Request '.($i + 1), LOG_DEBUG);
339 if (preg_match_all(
'/__ENCRYPT\(\'([^\']+)\'\)__/i', $newsql, $reg)) {
340 $num = count($reg[0]);
342 for ($j = 0; $j < $num; $j++) {
344 $to = $db->encrypt($reg[1][$j], 1);
345 $newsql = str_replace($from, $to, $newsql);
351 if (preg_match_all(
'/__DECRYPT\(\'([A-Za-z0-9_]+)\'\)__/i', $newsql, $reg)) {
352 $num = count($reg[0]);
354 for ($j = 0; $j < $num; $j++) {
356 $to = $db->decrypt($reg[1][$j]);
357 $newsql = str_replace($from, $to, $newsql);
363 while (preg_match(
'/__([0-9]+)__/', $newsql, $reg)) {
365 if (empty($listofinsertedrowid[$cursor])) {
367 print '<tr><td class="tdtop" colspan="2">';
370 print '<div class="error">'.$langs->trans(
"FileIsNotCorrect").
"</div></td>";
378 $from =
'__'.$cursor.
'__';
379 $to = $listofinsertedrowid[$cursor];
380 $newsql = str_replace($from, $to, $newsql);
385 dol_syslog(
'Admin.lib::run_sql New Request '.($i + 1), LOG_DEBUG);
388 $result = $db->query($newsql, $usesavepoint);
391 print '<!-- Result = OK -->'.
"\n";
394 if (preg_replace(
'/insert into ([^\s]+)/i', $newsql, $reg)) {
398 $table = preg_replace(
'/([^a-zA-Z_]+)/i',
'', $reg[1]);
399 $insertedrowid = $db->last_insert_id($table);
400 $listofinsertedrowid[$cursorinsert] = $insertedrowid;
401 dol_syslog(
'Admin.lib::run_sql Insert nb '.$cursorinsert.
', done in table '.$table.
', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG);
405 $errno = $db->errno();
407 print '<!-- Result = '.$errno.
' -->'.
"\n";
412 'DB_ERROR_TABLE_ALREADY_EXISTS',
413 'DB_ERROR_COLUMN_ALREADY_EXISTS',
414 'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
415 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS',
416 'DB_ERROR_RECORD_ALREADY_EXISTS',
417 'DB_ERROR_NOSUCHTABLE',
418 'DB_ERROR_NOSUCHFIELD',
419 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP',
420 'DB_ERROR_NO_INDEX_TO_DROP',
421 'DB_ERROR_CANNOT_CREATE',
422 'DB_ERROR_CANT_DROP_PRIMARY_KEY',
423 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
426 if ($okerror ==
'none') {
431 if (!in_array($errno, $okerrors)) {
433 print '<tr><td class="tdtop" colspan="2">';
436 print '<div class="error">'.$langs->trans(
"Error").
" ".$db->errno().
": ".$newsql.
"<br>".$db->error().
"</div></td>";
441 dol_syslog(
'Admin.lib::run_sql Request '.($i + 1).
" Error ".$db->errno().
" ".$newsql.
"<br>".$db->error(), LOG_ERR);
453 print '<tr><td>'.$langs->trans(
"ProcessMigrateScript").
'</td>';
454 print '<td class="right">';
456 print '<span class="ok">'.$langs->trans(
"OK").
'</span>';
458 print '<span class="error">'.$langs->trans(
"Error").
'</span>';
461 print '<script type="text/javascript" language="javascript">
462 jQuery(document).ready(function() {
463 function init_trrunsql()
465 console.log("toggle .trforrunsql");
466 jQuery(".trforrunsql").toggle();
469 jQuery(".trforrunsqlshowhide").click(function() {
474 print ' - <a class="trforrunsqlshowhide" href="#">'.$langs->trans(
"ShowHideDetails").
'</a>';
476 print '</td></tr>'.
"\n";
504 dol_print_error(
'',
'Error call dolibar_del_const with parameter name empty');
508 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
509 $sql .=
" WHERE (".$db->decrypt(
'name').
" = '".$db->escape($name).
"'";
510 if (is_numeric($name)) {
511 $sql .=
" OR rowid = '".$db->escape($name).
"'";
515 $sql .=
" AND entity = ".$entity;
518 dol_syslog(
"admin.lib::dolibarr_del_const", LOG_DEBUG);
519 $resql = $db->query($sql);
521 $conf->global->$name =
'';
544 $sql =
"SELECT ".$db->decrypt(
'value').
" as value";
545 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const";
546 $sql .=
" WHERE name = ".$db->encrypt($name, 1);
547 $sql .=
" AND entity = ".$entity;
549 dol_syslog(
"admin.lib::dolibarr_get_const", LOG_DEBUG);
550 $resql = $db->query($sql);
552 $obj = $db->fetch_object(
$resql);
554 $value = $obj->value;
575 function dolibarr_set_const($db, $name, $value, $type =
'chaine', $visible = 0, $note =
'', $entity = 1)
584 dol_print_error($db,
"Error: Call to function dolibarr_set_const with wrong parameters", LOG_ERR);
592 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"const";
593 $sql .=
" WHERE name = ".$db->encrypt($name, 1);
595 $sql .=
" AND entity = ".$entity;
598 dol_syslog(
"admin.lib::dolibarr_set_const", LOG_DEBUG);
599 $resql = $db->query($sql);
601 if (strcmp($value,
'')) {
602 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"const(name,value,type,visible,note,entity)";
604 $sql .= $db->encrypt($name, 1);
605 $sql .=
", ".$db->encrypt($value, 1);
606 $sql .=
",'".$db->escape($type).
"',".$visible.
",'".$db->escape($note).
"',".$entity.
")";
610 dol_syslog(
"admin.lib::dolibarr_set_const", LOG_DEBUG);
611 $resql = $db->query($sql);
616 $conf->global->$name = $value;
619 $error = $db->lasterror();
635 global $langs, $conf, $user;
638 $mode = empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ?
'commonkanban' :
'common';
639 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=".$mode;
640 $head[$h][1] = $langs->trans(
"AvailableModules");
641 $head[$h][2] =
'modules';
644 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=marketplace";
645 $head[$h][1] = $langs->trans(
"ModulesMarketPlaces");
646 $head[$h][2] =
'marketplace';
649 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=deploy";
650 $head[$h][1] = $langs->trans(
"AddExtensionThemeModuleOrOther");
651 $head[$h][2] =
'deploy';
654 $head[$h][0] = DOL_URL_ROOT.
"/admin/modules.php?mode=develop";
655 $head[$h][1] = $langs->trans(
"ModulesDevelopYourModule");
656 $head[$h][2] =
'develop';
670 global $db, $langs, $conf, $user;
674 $head[$h][0] = DOL_URL_ROOT.
"/admin/security_other.php";
675 $head[$h][1] = $langs->trans(
"Miscellaneous");
676 $head[$h][2] =
'misc';
679 $head[$h][0] = DOL_URL_ROOT.
"/admin/security.php";
680 $head[$h][1] = $langs->trans(
"Passwords");
681 $head[$h][2] =
'passwords';
684 $head[$h][0] = DOL_URL_ROOT.
"/admin/security_file.php";
685 $head[$h][1] = $langs->trans(
"Files").
' ('.$langs->trans(
"Upload").
')';
686 $head[$h][2] =
'file';
696 $head[$h][0] = DOL_URL_ROOT.
"/admin/proxy.php";
697 $head[$h][1] = $langs->trans(
"ExternalAccess");
698 $head[$h][2] =
'proxy';
701 $head[$h][0] = DOL_URL_ROOT.
"/admin/events.php";
702 $head[$h][1] = $langs->trans(
"Audit");
703 $head[$h][2] =
'audit';
709 $sql =
"SELECT COUNT(r.id) as nb";
710 $sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
711 $sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
712 $sql .=
" AND entity = ".$conf->entity;
713 $sql .=
" AND bydefault = 1";
714 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
715 $sql .=
" AND r.perms NOT LIKE '%_advance'";
717 $resql = $db->query($sql);
719 $obj = $db->fetch_object(
$resql);
727 $head[$h][0] = DOL_URL_ROOT.
"/admin/perms.php";
728 $head[$h][1] = $langs->trans(
"DefaultRights");
730 $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ?
'<span class="badge marginleftonlyshort">'.$nbPerms.
'</span>' :
'');
732 $head[$h][2] =
'default';
745 global $langs, $conf, $user;
750 $object->id = $object->numero;
752 $head[$h][0] = DOL_URL_ROOT.
"/admin/modulehelp.php?id=".$object->id.
'&mode=desc';
753 $head[$h][1] = $langs->trans(
"Description");
754 $head[$h][2] =
'desc';
757 $head[$h][0] = DOL_URL_ROOT.
"/admin/modulehelp.php?id=".$object->id.
'&mode=feature';
758 $head[$h][1] = $langs->trans(
"TechnicalServicesProvided");
759 $head[$h][2] =
'feature';
762 if ($object->isCoreOrExternalModule() ==
'external') {
763 $head[$h][0] = DOL_URL_ROOT.
"/admin/modulehelp.php?id=".$object->id.
'&mode=changelog';
764 $head[$h][1] = $langs->trans(
"ChangeLog");
765 $head[$h][2] =
'changelog';
783 global $langs, $conf, $user;
787 $head[$h][0] = DOL_URL_ROOT.
"/admin/translation.php?mode=searchkey";
788 $head[$h][1] = $langs->trans(
"TranslationKeySearch");
789 $head[$h][2] =
'searchkey';
792 $head[$h][0] = DOL_URL_ROOT.
"/admin/translation.php?mode=overwrite";
793 $head[$h][1] = $langs->trans(
"TranslationOverwriteKey").
'<span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
794 $head[$h][2] =
'overwrite';
813 global $langs, $conf, $user;
817 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=createform";
818 $head[$h][1] = $langs->trans(
"DefaultCreateForm");
819 $head[$h][2] =
'createform';
822 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=filters";
823 $head[$h][1] = $langs->trans(
"DefaultSearchFilters");
824 $head[$h][2] =
'filters';
827 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=sortorder";
828 $head[$h][1] = $langs->trans(
"DefaultSortOrder");
829 $head[$h][2] =
'sortorder';
832 if (!empty($conf->use_javascript_ajax)) {
833 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=focus";
834 $head[$h][1] = $langs->trans(
"DefaultFocus");
835 $head[$h][2] =
'focus';
838 $head[$h][0] = DOL_URL_ROOT.
"/admin/defaultvalues.php?mode=mandatory";
839 $head[$h][1] = $langs->trans(
"DefaultMandatory");
840 $head[$h][2] =
'mandatory';
867 $arrayofSessions = array();
870 $iniPath = ini_get(
"session.save_path");
872 $sessPath = $iniPath;
875 dol_syslog(
'admin.lib:listOfSessions sessPath='.$sessPath);
879 while (($file = @readdir($dh)) !==
false) {
880 if (preg_match(
'/^sess_/i', $file) && $file !=
"." && $file !=
"..") {
881 $fullpath = $sessPath.$file;
882 if (!@is_dir($fullpath) && is_readable($fullpath)) {
883 $sessValues = file_get_contents($fullpath);
889 if (preg_match(
'/dol_login/i', $sessValues) &&
890 (preg_match(
'/dol_entity\|i:'.$conf->entity.
';/i', $sessValues) || preg_match(
'/dol_entity\|s:([0-9]+):"'.$conf->entity.
'"/i', $sessValues)) &&
891 preg_match(
'/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.
')"/i', $sessValues)) {
892 $tmp = explode(
'_', $file);
895 $loginfound = preg_match(
'/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i', $sessValues, $regs);
897 $arrayofSessions[$idsess][
"login"] = $regs[1];
899 $arrayofSessions[$idsess][
"age"] = time() - filectime($fullpath);
900 $arrayofSessions[$idsess][
"creation"] = filectime($fullpath);
901 $arrayofSessions[$idsess][
"modification"] = filemtime($fullpath);
902 $arrayofSessions[$idsess][
"raw"] = $sessValues;
910 return $arrayofSessions;
923 $sessPath = ini_get(
"session.save_path").
"/";
924 dol_syslog(
'admin.lib:purgeSessions mysessionid='.$mysessionid.
' sessPath='.$sessPath);
930 while (($file = @readdir($dh)) !==
false) {
931 if ($file !=
"." && $file !=
"..") {
932 $fullpath = $sessPath.$file;
933 if (!@is_dir($fullpath)) {
934 $sessValues = file_get_contents($fullpath);
936 if (preg_match(
'/dol_login/i', $sessValues) &&
937 preg_match(
'/dol_entity\|s:([0-9]+):"('.$conf->entity.
')"/i', $sessValues) &&
938 preg_match(
'/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.
')"/i', $sessValues)) {
939 $tmp = explode(
'_', $file);
942 if ($idsess != $mysessionid) {
943 $res = @unlink($fullpath);
973 global $db, $langs, $conf, $mysoc;
979 $ret[
'errors'][] =
'ErrorBadParameter';
983 $ret = array(
'nbmodules'=>0,
'errors'=>array(),
'nbperms'=>0);
985 $modFile = $modName.
".class.php";
992 foreach ($modulesdir as $dir) {
993 if (file_exists($dir.$modFile)) {
994 $found = @include_once $dir.$modFile;
1001 $objMod =
new $modName($db);
1005 $vermin = isset($objMod->phpmin) ? $objMod->phpmin : 0;
1007 $ret[
'errors'][] = $langs->trans(
"ErrorModuleRequirePHPVersion",
versiontostring($vermin));
1013 $vermin = isset($objMod->need_dolibarr_version) ? $objMod->need_dolibarr_version : 0;
1016 $ret[
'errors'][] = $langs->trans(
"ErrorModuleRequireDolibarrVersion",
versiontostring($vermin));
1021 if (!empty($objMod->need_javascript_ajax) && empty($conf->use_javascript_ajax)) {
1022 $ret[
'errors'][] = $langs->trans(
"ErrorModuleRequireJavascript");
1026 $const_name = $objMod->const_name;
1027 if (!empty($conf->global->$const_name)) {
1031 $result = $objMod->init();
1034 $ret[
'errors'][] = $objMod->error;
1037 if (isset($objMod->depends) && is_array($objMod->depends) && !empty($objMod->depends)) {
1040 foreach ($objMod->depends as $key => $modulestring) {
1042 if ((!is_numeric($key)) && !preg_match(
'/^always/', $key) && $mysoc->country_code && !preg_match(
'/^'.$mysoc->country_code.
'/', $key)) {
1043 dol_syslog(
"We are not concerned by dependency with key=".$key.
" because our country is ".$mysoc->country_code);
1047 foreach ($modulesdir as $dir) {
1048 if (file_exists($dir.$modulestring.
".class.php")) {
1050 if (empty($resarray[
'errors'])) {
1053 foreach ($resarray[
'errors'] as $errorMessage) {
1062 $ret[
'nbmodules'] += $resarray[
'nbmodules'];
1063 $ret[
'nbperms'] += $resarray[
'nbperms'];
1065 $ret[
'errors'][] = $langs->trans(
'activateModuleDependNotSatisfied', $objMod->name, $modulestring);
1070 if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && !empty($objMod->conflictwith)) {
1072 $num = count($objMod->conflictwith);
1073 for ($i = 0; $i < $num; $i++) {
1074 foreach ($modulesdir as $dir) {
1075 if (file_exists($dir.$objMod->conflictwith[$i].
".class.php")) {
1084 if (!count($ret[
'errors'])) {
1085 $ret[
'nbmodules']++;
1086 $ret[
'nbperms'] += count($objMod->rights);
1102 global $db, $modules, $conf;
1105 if (empty($value)) {
1106 return 'ErrorBadParameter';
1111 $modFile = $modName.
".class.php";
1118 foreach ($modulesdir as $dir) {
1119 if (file_exists($dir.$modFile)) {
1120 $found = @include_once $dir.$modFile;
1128 $objMod =
new $modName($db);
1129 $result = $objMod->remove();
1131 $ret = $objMod->error;
1137 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
1139 $genericMod->name = preg_replace(
'/^mod/i',
'', $modName);
1140 $genericMod->rights_class = strtolower(preg_replace(
'/^mod/i',
'', $modName));
1141 $genericMod->const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', $modName));
1142 dol_syslog(
"modules::unActivateModule Failed to find module file, we use generic function with name ".$modName);
1143 $genericMod->remove(
'');
1147 if (!$ret && $requiredby && is_object($objMod) && is_array($objMod->requiredby)) {
1148 $countrb = count($objMod->requiredby);
1149 for ($i = 0; $i < $countrb; $i++) {
1177 function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tabsql, &$tabsqlsort, &$tabfield, &$tabfieldvalue, &$tabfieldinsert, &$tabrowid, &$tabcond, &$tabhelp, &$tabfieldcheck)
1179 global $db, $modules, $conf, $langs;
1181 dol_syslog(
"complete_dictionary_with_modules Search external modules to complete the list of dictionnary tables", LOG_DEBUG, 1);
1188 foreach ($modulesdir as $dir) {
1191 dol_syslog(
"Scan directory ".$dir.
" for modules");
1193 if (is_resource($handle)) {
1194 while (($file = readdir($handle)) !==
false) {
1196 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
1197 $modName = substr($file, 0,
dol_strlen($file) - 10);
1200 include_once $dir.$file;
1201 $objMod =
new $modName($db);
1203 if ($objMod->numero > 0) {
1204 $j = $objMod->numero;
1209 $modulequalified = 1;
1212 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
1213 if ($objMod->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) {
1214 $modulequalified = 0;
1216 if ($objMod->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) {
1217 $modulequalified = 0;
1220 if (empty($conf->global->$const_name)) {
1221 $modulequalified = 0;
1224 if ($modulequalified) {
1226 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
1227 foreach ($objMod->langfiles as $langfile) {
1228 $langs->load($langfile);
1233 if (empty($objMod->dictionaries) && !empty($objMod->dictionnaries)) {
1234 $objMod->dictionaries = $objMod->dictionnaries;
1237 if (!empty($objMod->dictionaries)) {
1239 $nbtabname = $nbtablib = $nbtabsql = $nbtabsqlsort = $nbtabfield = $nbtabfieldvalue = $nbtabfieldinsert = $nbtabrowid = $nbtabcond = $nbtabfieldcheck = $nbtabhelp = 0;
1240 foreach ($objMod->dictionaries[
'tabname'] as $val) {
1241 $nbtabname++; $taborder[] = max($taborder) + 1; $tabname[] = $val;
1243 foreach ($objMod->dictionaries[
'tablib'] as $val) {
1244 $nbtablib++; $tablib[] = $val;
1246 foreach ($objMod->dictionaries[
'tabsql'] as $val) {
1247 $nbtabsql++; $tabsql[] = $val;
1249 foreach ($objMod->dictionaries[
'tabsqlsort'] as $val) {
1250 $nbtabsqlsort++; $tabsqlsort[] = $val;
1252 foreach ($objMod->dictionaries[
'tabfield'] as $val) {
1253 $nbtabfield++; $tabfield[] = $val;
1255 foreach ($objMod->dictionaries[
'tabfieldvalue'] as $val) {
1256 $nbtabfieldvalue++; $tabfieldvalue[] = $val;
1258 foreach ($objMod->dictionaries[
'tabfieldinsert'] as $val) {
1259 $nbtabfieldinsert++; $tabfieldinsert[] = $val;
1261 foreach ($objMod->dictionaries[
'tabrowid'] as $val) {
1262 $nbtabrowid++; $tabrowid[] = $val;
1264 foreach ($objMod->dictionaries[
'tabcond'] as $val) {
1265 $nbtabcond++; $tabcond[] = $val;
1267 if (!empty($objMod->dictionaries[
'tabhelp'])) {
1268 foreach ($objMod->dictionaries[
'tabhelp'] as $val) {
1269 $nbtabhelp++; $tabhelp[] = $val;
1272 if (!empty($objMod->dictionaries[
'tabfieldcheck'])) {
1273 foreach ($objMod->dictionaries[
'tabfieldcheck'] as $val) {
1274 $nbtabfieldcheck++; $tabfieldcheck[] = $val;
1278 if ($nbtabname != $nbtablib || $nbtablib != $nbtabsql || $nbtabsql != $nbtabsqlsort) {
1279 print 'Error in descriptor of module '.$const_name.
'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
1289 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
1296 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
1313 global $db, $conf, $langs;
1317 foreach ($modulesdir as $dir) {
1319 dol_syslog(
"Scan directory ".$dir.
" for modules");
1321 if (is_resource($handle)) {
1322 while (($file = readdir($handle)) !==
false) {
1323 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
1324 $modName = substr($file, 0,
dol_strlen($file) - 10);
1327 include_once $dir.$file;
1328 $objMod =
new $modName($db);
1330 $modulequalified = 1;
1333 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
1335 if ($objMod->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
1336 $modulequalified = 0;
1338 if ($objMod->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
1339 $modulequalified = 0;
1341 if (!empty($conf->global->$const_name)) {
1342 $modulequalified = 0;
1345 if ($modulequalified) {
1347 if (isset($objMod->automatic_activation) && is_array($objMod->automatic_activation) && isset($objMod->automatic_activation[$country_code])) {
1350 setEventMessages($objMod->automatic_activation[$country_code], null,
'warnings');
1353 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
1360 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
1375 global $db, $modules, $conf, $langs;
1378 $filename = array();
1387 dol_syslog(
"complete_elementList_with_modules Search external modules to complete the list of contact element", LOG_DEBUG, 1);
1391 foreach ($modulesdir as $dir) {
1394 dol_syslog(
"Scan directory ".$dir.
" for modules");
1396 if (is_resource($handle)) {
1397 while (($file = readdir($handle)) !==
false) {
1399 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
1400 $modName = substr($file, 0,
dol_strlen($file) - 10);
1403 include_once $dir.$file;
1404 $objMod =
new $modName($db);
1406 if ($objMod->numero > 0) {
1407 $j = $objMod->numero;
1412 $modulequalified = 1;
1415 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
1416 if ($objMod->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) {
1417 $modulequalified = 0;
1419 if ($objMod->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) {
1420 $modulequalified = 0;
1423 if (empty($conf->global->$const_name)) {
1424 $modulequalified = 0;
1427 if ($modulequalified) {
1429 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
1430 foreach ($objMod->langfiles as $langfile) {
1431 $langs->load($langfile);
1435 $modules[$i] = $objMod;
1436 $filename[$i] = $modName;
1437 $orders[$i] = $objMod->family.
"_".$j;
1441 if (!empty($objMod->module_parts[
'contactelement'])) {
1442 if (is_array($objMod->module_parts[
'contactelement'])) {
1443 foreach ($objMod->module_parts[
'contactelement'] as $elem => $title) {
1444 $elementList[$elem] = $langs->trans($title);
1447 $elementList[$objMod->name] = $langs->trans($objMod->name);
1454 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
1461 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
1481 global $db, $langs, $conf, $user;
1482 global $_Avery_Labels;
1484 $form =
new Form($db);
1486 if (empty($strictw3c)) {
1487 dol_syslog(
"Warning: Function form_constantes is calle with parameter strictw3c = 0, this is deprecated. Value must be 2 now.", LOG_DEBUG);
1489 if (!empty($strictw3c) && $strictw3c == 1) {
1490 print "\n".
'<form action="'.
$_SERVER[
"PHP_SELF"].
'" method="POST">';
1491 print '<input type="hidden" name="token" value="'.newToken().
'">';
1492 print '<input type="hidden" name="action" value="updateall">';
1495 print '<table class="noborder centpercent">';
1496 print '<tr class="liste_titre">';
1497 print '<td class="titlefield">'.$langs->trans(
"Description").
'</td>';
1499 $text = $langs->trans(
"Value");
1500 print $form->textwithpicto($text, $helptext, 1,
'help',
'', 0, 2,
'idhelptext');
1502 if (empty($strictw3c)) {
1503 print '<td class="center" width="80">'.$langs->trans(
"Action").
'</td>';
1508 foreach ($tableau as $key => $const) {
1511 if (is_numeric($key)) {
1514 if (is_array($const)) {
1515 $type = $const[
'type'];
1516 $label = $const[
'label'];
1526 $sql .=
", ".$db->decrypt(
'name').
" as name";
1527 $sql .=
", ".$db->decrypt(
'value').
" as value";
1530 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const";
1531 $sql .=
" WHERE ".$db->decrypt(
'name').
" = '".$db->escape($const).
"'";
1532 $sql .=
" AND entity IN (0, ".$conf->entity.
")";
1533 $sql .=
" ORDER BY name ASC, entity DESC";
1534 $result = $db->query($sql);
1538 $obj = $db->fetch_object($result);
1541 $obj = (object) array(
'rowid'=>
'',
'name'=>$const,
'value'=>
'',
'type'=>$type,
'note'=>
'');
1544 if (empty($strictw3c)) {
1545 print "\n".
'<form action="'.
$_SERVER[
"PHP_SELF"].
'" method="POST">';
1546 print '<input type="hidden" name="token" value="'.newToken().
'">';
1549 print '<tr class="oddeven">';
1553 if (empty($strictw3c)) {
1554 print '<input type="hidden" name="action" value="update">';
1556 print '<input type="hidden" name="rowid'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.$obj->rowid.
'">';
1557 print '<input type="hidden" name="constname'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.$const.
'">';
1558 print '<input type="hidden" name="constnote_'.$obj->name.
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
1559 print '<input type="hidden" name="consttype_'.$obj->name.
'" value="'.($obj->type ? $obj->type :
'string').
'">';
1561 print ($label ? $label : $langs->trans(
'Desc'.$const));
1563 if ($const ==
'ADHERENT_MAILMAN_URL') {
1564 print '. '.$langs->trans(
"Example").
': <a href="#" id="exampleclick1">'.
img_down().
'</a><br>';
1566 print '<div id="example1" class="hidden">';
1567 print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/add?subscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&subscribe_or_invite=0&send_welcome_msg_to_this_batch=0&notification_to_list_owner=0';
1570 if ($const ==
'ADHERENT_MAILMAN_UNSUB_URL') {
1571 print '. '.$langs->trans(
"Example").
': <a href="#" id="exampleclick2">'.
img_down().
'</a><br>';
1572 print '<div id="example2" class="hidden">';
1573 print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?unsubscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&send_unsub_ack_to_this_batch=0&send_unsub_notifications_to_list_owner=0';
1577 if ($const ==
'ADHERENT_MAILMAN_LISTS') {
1578 print '. '.$langs->trans(
"Example").
': <a href="#" id="exampleclick3">'.
img_down().
'</a><br>';
1579 print '<div id="example3" class="hidden">';
1580 print 'mymailmanlist<br>';
1581 print 'mymailmanlist1,mymailmanlist2<br>';
1582 print 'TYPE:Type1:mymailmanlist1,TYPE:Type2:mymailmanlist2<br>';
1583 if ($conf->categorie->enabled) {
1584 print 'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2<br>';
1593 if ($const ==
'ADHERENT_CARD_TYPE' || $const ==
'ADHERENT_ETIQUETTE_TYPE') {
1596 require_once DOL_DOCUMENT_ROOT.
'/core/lib/format_cards.lib.php';
1597 $arrayoflabels = array();
1598 foreach (array_keys($_Avery_Labels) as $codecards) {
1599 $arrayoflabels[$codecards] = $_Avery_Labels[$codecards][
'name'];
1601 print $form->selectarray(
'constvalue'.(empty($strictw3c) ?
'' :
'[]'), $arrayoflabels, ($obj->value ? $obj->value :
'CARD'), 1, 0, 0);
1602 print '<input type="hidden" name="consttype" value="yesno">';
1603 print '<input type="hidden" name="constnote'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
1607 print '<input type="hidden" name="consttype'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.($obj->type ? $obj->type :
'string').
'">';
1608 print '<input type="hidden" name="constnote'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
1609 if ($obj->type ==
'textarea' || in_array($const, array(
'ADHERENT_CARD_TEXT',
'ADHERENT_CARD_TEXT_RIGHT',
'ADHERENT_ETIQUETTE_TEXT'))) {
1610 print '<textarea class="flat" name="constvalue'.(empty($strictw3c) ?
'' :
'[]').
'" cols="50" rows="5" wrap="soft">'.
"\n";
1612 print "</textarea>\n";
1613 } elseif ($obj->type ==
'html') {
1614 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1615 $doleditor =
new DolEditor(
'constvalue_'.$const.(empty($strictw3c) ?
'' :
'[]'), $obj->value,
'', 160,
'dolibarr_notes',
'',
false,
false, $conf->fckeditor->enabled, ROWS_5,
'90%');
1616 $doleditor->Create();
1617 } elseif ($obj->type ==
'yesno') {
1618 print $form->selectyesno(
'constvalue'.(empty($strictw3c) ?
'' :
'[]'), $obj->value, 1);
1619 } elseif (preg_match(
'/emailtemplate/', $obj->type)) {
1620 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1623 $tmp = explode(
':', $obj->type);
1625 $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, -1);
1627 $arrayofmessagename = array();
1628 if (is_array($formmail->lines_model)) {
1629 foreach ($formmail->lines_model as $modelmail) {
1632 if (!empty($arrayofmessagename[$modelmail->label])) {
1633 $moreonlabel =
' <span class="opacitymedium">('.$langs->trans(
"SeveralLangugeVariatFound").
')</span>';
1636 $arrayofmessagename[$modelmail->label.
':'.$tmp[1]] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->label)).$moreonlabel;
1641 print $form->selectarray(
'constvalue_'.$obj->name, $arrayofmessagename, $obj->value.
':'.$tmp[1],
'None', 0, 0,
'', 0, 0, 0,
'',
'', 1);
1644 print '<input type="text" class="flat" size="48" name="constvalue'.(empty($strictw3c) ?
'' :
'[]').
'" value="'.
dol_escape_htmltag($obj->value).
'">';
1649 if (empty($strictw3c)) {
1650 print '<td class="center">';
1651 print '<input type="submit" class="button" value="'.$langs->trans(
"Update").
'" name="Button">';
1656 if (empty($strictw3c)) {
1663 if (!empty($strictw3c) && $strictw3c == 1) {
1664 print '<div align="center"><input type="submit" class="button" value="'.$langs->trans(
"Update").
'" name="update"></div>';
1678 global $conf, $langs;
1680 $text = $langs->trans(
"OnlyFollowingModulesAreOpenedToExternalUsers");
1681 $listofmodules = explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
1683 if (!empty($modules)) {
1684 foreach ($modules as $module) {
1685 $moduleconst = $module->const_name;
1686 $modulename = strtolower($module->name);
1690 if (!in_array($modulename, $listofmodules)) {
1701 $text .= $langs->trans(
'Module'.$module->numero.
'Name');
1723 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity, libelle, description)";
1724 $sql .=
" VALUES ('".$db->escape($name).
"','".$db->escape($type).
"',".$conf->entity.
", ";
1725 $sql .= ($label ?
"'".$db->escape($label).
"'" :
'null').
", ";
1726 $sql .= (!empty($description) ?
"'".$db->escape($description).
"'" :
"null");
1729 dol_syslog(
"admin.lib::addDocumentModel", LOG_DEBUG);
1730 $resql = $db->query($sql);
1754 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"document_model";
1755 $sql .=
" WHERE nom = '".$db->escape($name).
"'";
1756 $sql .=
" AND type = '".$db->escape($type).
"'";
1757 $sql .=
" AND entity = ".$conf->entity;
1759 dol_syslog(
"admin.lib::delDocumentModel", LOG_DEBUG);
1760 $resql = $db->query($sql);
1781 $phpinfostring = ob_get_contents();
1784 $info_arr = array();
1785 $info_lines = explode(
"\n", strip_tags($phpinfostring,
"<tr><td><h2>"));
1787 foreach ($info_lines as $line) {
1790 preg_match(
"~<h2>(.*)</h2>~", $line, $title) ? $cat = $title[1] : null;
1792 if (preg_match(
"~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) {
1793 $info_arr[trim($cat)][trim($val[1])] = $val[2];
1794 } elseif (preg_match(
"~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val)) {
1795 $info_arr[trim($cat)][trim($val[1])] = array(
"local" => $val[2],
"master" => $val[3]);
1808 global $langs, $conf;
1813 $head[$h][0] = DOL_URL_ROOT.
"/admin/company.php";
1814 $head[$h][1] = $langs->trans(
"Company");
1815 $head[$h][2] =
'company';
1818 $head[$h][0] = DOL_URL_ROOT.
"/admin/openinghours.php";
1819 $head[$h][1] = $langs->trans(
"OpeningHours");
1820 $head[$h][2] =
'openinghours';
1823 $head[$h][0] = DOL_URL_ROOT.
"/admin/accountant.php";
1824 $head[$h][1] = $langs->trans(
"Accountant");
1825 $head[$h][2] =
'accountant';
1828 $head[$h][0] = DOL_URL_ROOT.
"/admin/company_socialnetworks.php";
1829 $head[$h][1] = $langs->trans(
"SocialNetworksInformation");
1830 $head[$h][2] =
'socialnetworks';
1847 global $langs, $conf, $user;
1852 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
1853 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails.php";
1854 $head[$h][1] = $langs->trans(
"OutGoingEmailSetup");
1855 $head[$h][2] =
'common';
1858 if ($conf->mailing->enabled) {
1859 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_emailing.php";
1860 $head[$h][1] = $langs->trans(
"OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv(
"EMailing"));
1861 $head[$h][2] =
'common_emailing';
1865 if ($conf->ticket->enabled) {
1866 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_ticket.php";
1867 $head[$h][1] = $langs->trans(
"OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv(
"Ticket"));
1868 $head[$h][2] =
'common_ticket';
1873 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
1874 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_senderprofile_list.php";
1875 $head[$h][1] = $langs->trans(
"EmailSenderProfiles");
1876 $head[$h][2] =
'senderprofiles';
1880 $head[$h][0] = DOL_URL_ROOT.
"/admin/mails_templates.php";
1881 $head[$h][1] = $langs->trans(
"EMailTemplates");
1882 $head[$h][2] =
'templates';
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
delDocumentModel($name, $type)
Delete document model used by doc generator.
dolibarr_get_const($db, $name, $entity=1)
Recupere une constante depuis la base de donnees.
unActivateModule($value, $requiredby=1)
Disable a module.
complete_elementList_with_modules(&$elementList)
Search external modules to complete the list of contact element.
listOfSessions()
Return list of session.
dolGetModulesDirs($subdir= '')
Return list of modules directories.
purgeSessions($mysessionid)
Purge existing sessions.
email_admin_prepare_head()
Return array head with list of tabs to view object informations.
dolibarr_set_const($db, $name, $value, $type= 'chaine', $visible=0, $note= '', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
modulehelp_prepare_head($object)
Prepare array with list of tabs.
addDocumentModel($name, $type, $label= '', $description= '')
Add document model used by doc generator.
versiondolibarrarray()
Return version Dolibarr.
dol_htmlentities($string, $flags=null, $encoding= 'UTF-8', $double_encode=false)
Replace htmlentities functions.
showModulesExludedForExternal($modules)
Show array with constants to edit.
versiontostring($versionarray)
Renvoi une version en chaine depuis une version en tableau.
translation_prepare_head()
Prepare array with list of tabs.
company_admin_prepare_head()
Return array head with list of tabs to view object informations.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
img_down($titlealt= 'default', $selected=0, $moreclass= '')
Show down arrow logo.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tabsql, &$tabsqlsort, &$tabfield, &$tabfieldvalue, &$tabfieldinsert, &$tabrowid, &$tabcond, &$tabhelp, &$tabfieldcheck)
Add external modules to list of dictionaries.
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
form_constantes($tableau, $strictw3c=0, $helptext= '')
Show array with constants to edit.
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
security_prepare_head()
Prepare array with list of tabs.
run_sql($sqlfile, $silent=1, $entity= '', $usesavepoint=1, $handler= '', $okerror= 'default', $linelengthlimit=32768, $nocommentremoval=0, $offsetforchartofaccount=0)
Launch a sql file.
phpinfo_array()
Return the php_info into an array.
activateModulesRequiredByCountry($country_code)
Activate external modules mandatory when country is country_code.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
defaultvalues_prepare_head()
Prepare array with list of tabs.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
activateModule($value, $withdeps=1)
Enable a module.
Class to manage a WYSIWYG editor.
modules_prepare_head()
Prepare array with list of tabs.
versionphparray()
Return version PHP.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...