/** * Constructor * * @param DoliDB $db Database handler * @param Conf $conf Handler de conf * @param Translate $langs Handler de langue * @param User $user Handler du user connecte */ function __construct($db, $conf, $langs, $user) { $this->id = "Perso"; $this->length = $langs->trans("SetupPerso"); $this->db = $db; $this->conf = $conf; $this->langs = $langs; $this->user = $user; if (empty($conf->global->USER_PASSWORD_PATTERN)) { // default value (8carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation. dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1', 'chaine', 0, '', $conf->entity); } $this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $this->Min = strtolower($this->Maj); $this->Nb = "0123456789"; $this->Spe = "!@#\$%&*()_-+={}[]\\|:;'/"; $this->Ambi = array("1", "I", "l", "|", "O", "0"); $tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN); $this->length2 = $tabConf[0]; $this->NbMaj = $tabConf[1]; $this->NbNum = $tabConf[2]; $this->NbSpe = $tabConf[3]; $this->NbRepeat = $tabConf[4]; $this->WithoutAmbi = $tabConf[5]; if ($this->WithoutAmbi) { $this->Maj = str_replace($this->Ambi, "", $this->Maj); $this->Min = str_replace($this->Ambi, "", $this->Min); $this->Nb = str_replace($this->Ambi, "", $this->Nb); $this->Spe = str_replace($this->Ambi, "", $this->Spe); } $this->All = str_shuffle($this->Maj . $this->Min . $this->Nb . $this->Spe); //$this->All = $this->Maj. $this->Min. $this->Nb. $this->Spe; //$this->All = $this->Spe; }
static function setVersion(&$DoliDb, $moduleName) { if (class_exists($moduleName)) { dol_include_once('/core/lib/admin.lib.php'); $mod = new $moduleName($DoliDb); if (!empty($mod->version)) { $version = $mod->version; dolibarr_set_const($DoliDb, 'ATM_MODULE_VERSION_' . strtoupper($moduleName), $version); } } }
if (!$sortorder) { $sortorder = "DESC"; } if (!$sortfield) { $sortfield = "dateevent"; } /* * Actions */ // Purge sessions if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) { $res = purgeSessions(session_id()); } // Lock new sessions if ($action == 'confirm_lock' && $confirm == 'yes' && $user->admin) { if (dolibarr_set_const($db, 'MAIN_ONLY_LOGIN_ALLOWED', $user->login, 'text', 1, 'Logon is restricted to a particular user', 0) < 0) { dol_print_error($db); } } // Unlock new sessions if ($action == 'confirm_unlock' && $user->admin) { if (dolibarr_del_const($db, 'MAIN_ONLY_LOGIN_ALLOWED', -1) < 0) { dol_print_error($db); } } /* * View */ llxHeader(); $form = new Form($db); $userstatic = new User($db);
/** * Function called when module is enabled. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * It also creates data directories * * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ function init($options = '') { global $db, $conf; $sql = array(); if (!empty($conf->cashdesk->enabled)) { if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity); } } return $this->_init($sql, $options); }
/** * Function called when module is enabled. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * It also creates data directories. * @return int 1 if OK, 0 if KO */ function init() { global $db, $conf, $langs; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $dirodt = DOL_DATA_ROOT . '/produit'; dol_mkdir($dirodt); dol_copy(dol_buildpath('/pos/frontend/img/noimage.jpg', 0), $dirodt . '/noimage.jpg', 0, 0); if (empty($conf->global->POS_TICKET) && empty($conf->global->POS_FACTURE)) { dolibarr_set_const($db, "POS_FACTURE", '1', 'chaine', 0, '', $conf->entity); } if (empty($conf->global->POS_MAX_TTC)) { dolibarr_set_const($db, "POS_MAX_TTC", '100', 'chaine', 0, '', $conf->entity); } $sql = array(); $result = $this->load_tables(); return $this->_init($sql); }
if (!$result > 0) { $error++; } } if (!$error) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null); } else { $db->rollback(); dol_print_error($db); } $action = ''; } if ($action == 'setvalue' && $user->admin) { $db->begin(); $result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity); if (!$result > 0) { $error++; } if (!$error) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null); } else { $db->rollback(); dol_print_error($db); } $action = ''; } /* * View */
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT",$_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'',$conf->entity); $_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer Header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); exit; } /* * View */ $wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; llxHeader('',$langs->trans("Setup"),$wikihelp);
$langs->load("salaries"); // Security check if (!$user->admin) { accessforbidden(); } $action = GETPOST('action', 'alpha'); // Other parameters SALARIES_* $list = array('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'SALARIES_ACCOUNTING_ACCOUNT_CHARGE'); /* * Actions */ if ($action == 'update') { $error = 0; foreach ($list as $constname) { $constvalue = GETPOST($constname, 'alpha'); if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error++; } } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } /* * View */ llxHeader('', $langs->trans('SalariesSetup')); $form = new Form($db); if (!empty($conf->accounting->enabled)) {
if (!dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_ZIP', GETPOST("fieldzip"), 'chaine', 0, '', $conf->entity)) { $error++; } if (!dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_TOWN', GETPOST("fieldtown"), 'chaine', 0, '', $conf->entity)) { $error++; } if (!dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_COUNTRY', GETPOST("fieldcountry"), 'chaine', 0, '', $conf->entity)) { $error++; } // This one must be after the others $valkey = ''; $key = GETPOST("key"); if ($key) { $valkey = $conf->global->{$key}; } if (!dolibarr_set_const($db, 'LDAP_KEY_CONTACTS', $valkey, 'chaine', 0, '', $conf->entity)) { $error++; } if (!$error) { $db->commit(); setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); dol_print_error($db); } } /* * View */ llxHeader('', $langs->trans("LDAPSetup"), 'EN:Module_LDAP_En|FR:Module_LDAP|ES:Módulo_LDAP'); $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
*/ } else { // Ajoute boite box_external_rss dans definition des boites $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)"; $sql.= " VALUES ('box_external_rss.php','".$db->escape($_POST["norss"].' ('.$_POST[$external_rss_title]).")')"; if (! $db->query($sql)) { dol_print_error($db); $err++; } } $result1=dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_" . $_POST["norss"],$_POST[$external_rss_title],'chaine',0,'',$conf->entity); if ($result1) $result2=dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_" . $_POST["norss"],$_POST[$external_rss_urlrss],'chaine',0,'',$conf->entity); if ($result1 && $result2) { $db->commit(); //$mesg='<div class="ok">'.$langs->trans("Success").'</div>'; header("Location: ".$_SERVER["PHP_SELF"]); exit; } else { $db->rollback(); dol_print_error($db); } } }
} if ($action == "updatename") { $sql = "SELECT name from " . MAIN_DB_PREFIX . "pos_places_bar where name='{$after}'"; $resql_check = $db->query($sql); while ($row_check = $db->fetch_array($resql_check)) { exit; } $db->begin(); $db->query("update " . MAIN_DB_PREFIX . "pos_places_bar set name='{$after}' where name='{$place}'"); $db->commit(); } if ($action == "add") { $sql = "CREATE TABLE IF NOT EXISTS llx_pos_places_bar\n(\n rowid \tinteger AUTO_INCREMENT PRIMARY KEY,\n\n entity\t\t\t\tinteger DEFAULT 1 \tNOT NULL,\n name\t\t \tvarchar(30) UNIQUE \tNOT NULL,\n description \t\t\ttext,\n terminal \tinteger DEFAULT NULL,\n status\t\t\t \tinteger DEFAULT 1 \tNOT NULL,\n fk_user_c\t\t \tinteger,\n fk_user_m\t\t \tinteger,\n datec\t\t\t\t\tdatetime,\n datea\t\t\t\t\tdatetime,\n left_pos\t\t\t\tfloat,\n top_pos\t\t\t\tfloat,\n zone\t\t\t\t\tint(3)\n \n)ENGINE=innodb;"; $db->query($sql); $sql = "SELECT name from " . MAIN_DB_PREFIX . "pos_places_bar"; $resql = $db->query($sql); $data = array(); $i = 0; while ($row = $db->fetch_array($resql)) { $data[$i++] = $row[0]; } $data[$i++] = 0; $nextplace = max(array_values($data)); $nextplace++; $db->begin(); $db->query("insert into " . MAIN_DB_PREFIX . "pos_places_bar (name, left_pos, top_pos, zone) values ('{$nextplace}', '25', '25', {$zone})"); $db->commit(); } if ($action == "updatezonename") { dolibarr_set_const($db, "DOLIPOSBAR_CUSTOM_ZONE_NAME{$zone}", $after, 'chaine', 0, '', $conf->entity); }
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') { $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessage($langs->trans("SetupSaved")); } else { setEventMessage($langs->trans("Error"), 'errors'); } } //Order display of bank account if ($action == 'setbankorder') { if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0) { header("Location: " . $_SERVER["PHP_SELF"]); exit; } else { dol_print_error($db); } } /* * view */ llxHeader("", $langs->trans("BankSetupModule")); $form = new Form($db); $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>'; print_fiche_titre($langs->trans("BankSetupModule"), $linkback, 'setup'); print '<br>'; print '<table class="noborder" width="100%">';
} $langs->load("admin"); $langs->load("errors"); $action = GETPOST("action"); /* * Actions */ if ($action == 'set') { $error = 0; $gimcdf = GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE"); if (!$gimcdf && !file_exists($gimcdf)) { setEventMessage($langs->trans("ErrorFileNotFound", $gimcdf), 'errors'); $error++; } if (!$error) { $res = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessage($langs->trans("SetupSaved")); } else { setEventMessage($langs->trans("Error"), 'errors'); } } } /* * View */ $form = new Form($db); llxHeader();
if (preg_match('/del_(.*)/', $action, $reg)) { $code = $reg[1]; if (dolibarr_del_const($db, $code, $conf->entity) > 0) { Header("Location: " . $_SERVER["PHP_SELF"]); exit; } else { dol_print_error($db); } } else { if ($action == 'updateform') { $res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"], 'chaine', 0, '', $conf->entity); $res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"], 'chaine', 0, '', $conf->entity); $res3 = dolibarr_set_const($db, 'MAIN_UPLOAD_DOC', $_POST["MAIN_UPLOAD_DOC"], 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"], 'chaine', 0, '', $conf->entity); $res5 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"], 'chaine', 0, '', $conf->entity); $res6 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"], 'chaine', 0, '', $conf->entity); if ($res1 && $res2 && $res3 && $res4 && $res5 && $res6) { setEventMessage($langs->trans("RecordModifiedSuccessfully")); } } else { if ($action == 'delete') { $langs->load("other"); $file = $conf->admin->dir_temp . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $ret = dol_delete_file($file); if ($ret) { setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); } else { setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); } Header('Location: ' . $_SERVER["PHP_SELF"]);
} else { if ($action == 'setart238') { $setart238 = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "DONATION_ART238", $setart238, 'yesno', 0, '', $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessage($langs->trans("SetupSaved"), 'mesgs'); } else { setEventMessage($langs->trans("Error"), 'mesgs'); } } else { if ($action == 'setart885') { $setart885 = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "DONATION_ART885", $setart885, 'yesno', 0, '', $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessage($langs->trans("SetupSaved"), 'mesgs'); } else { setEventMessage($langs->trans("Error"), 'mesgs'); } } } } } /* * View */
$mesg.='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Server")).'</div>'; } if (! $error) { $ftp_port = "FTP_PORT_" . $_POST["numero_entry"]; $ftp_user = "******" . $_POST["numero_entry"]; $ftp_password = "******" . $_POST["numero_entry"]; $db->begin(); $result1=dolibarr_set_const($db, "FTP_PORT_" . $_POST["numero_entry"],$_POST[$ftp_port],'chaine',0,'',$conf->entity); if ($result1) $result2=dolibarr_set_const($db, "FTP_SERVER_" . $_POST["numero_entry"],$_POST[$ftp_server],'chaine',0,'',$conf->entity); if ($result2) $result3=dolibarr_set_const($db, "FTP_USER_" . $_POST["numero_entry"],$_POST[$ftp_user],'chaine',0,'',$conf->entity); if ($result3) $result4=dolibarr_set_const($db, "FTP_PASSWORD_" . $_POST["numero_entry"],$_POST[$ftp_password],'chaine',0,'',$conf->entity); if ($result4) $result5=dolibarr_set_const($db, "FTP_NAME_" . $_POST["numero_entry"],$_POST[$ftp_name],'chaine',0,'',$conf->entity); if ($result1 && $result2 && $result3 && $result4 && $result5) { $db->commit(); //$mesg='<div class="ok">'.$langs->trans("Success").'</div>'; header("Location: ".$_SERVER["PHP_SELF"]); exit; } else { $db->rollback(); dol_print_error($db); } } }
if (empty($langtosearch)) { $langtosearch = $conf->global->MAIN_LANG_DEFAULT; } $search_option = GETPOST('search_option'); if (empty($search_option)) { $search_option = 'custom'; } $other_options = GETPOST('other_options'); // Init LostInTranslationObject $lit = new LostInTranslation($langtosearch); /* * Actions */ if (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; if (dolibarr_set_const($db, $code, GETPOST($code), 'chaine', 0, '', $conf->entity) > 0) { header("Location: " . $_SERVER["PHP_SELF"]); exit; } else { dol_print_error($db); } } if (preg_match('/del_(.*)/', $action, $reg)) { $code = $reg[1]; if (dolibarr_del_const($db, $code, 0) > 0) { Header("Location: " . $_SERVER["PHP_SELF"]); exit; } else { dol_print_error($db); } }
$langs->load("admin"); if (! $user->admin) accessforbidden(); $actionsave=GETPOST("save"); $mesg=''; // Sauvegardes parametres if ($actionsave) { $i=0; $db->begin(); $i+=dolibarr_set_const($db,'WEBSERVICES_KEY',trim(GETPOST("WEBSERVICES_KEY")),'chaine',0,'',$conf->entity); if ($i >= 1) { $db->commit(); $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; } else { $db->rollback(); $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; } } /*
accessforbidden(); } /* * Actions */ if ($action == 'update') { $public = GETPOST('MEMBER_ENABLE_PUBLIC'); $amount = GETPOST('MEMBER_NEWFORM_AMOUNT'); $editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE'); $email = GETPOST('MEMBER_PAYONLINE_SENDEMAIL'); $res = dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_PAYONLINE_SENDEMAIL", $email, 'chaine', 0, '', $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } /* * View */ $form = new Form($db); $help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; llxHeader('', $langs->trans("MembersSetup"), $help_url);
} } else { if ($action == 'set_FICHINTER_DRAFT_WATERMARK') { $draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha'); $res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') { $val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha'); $res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS", $val == 'on' ? 1 : 0, 'bool', 0, '', $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } } } } } } }
private function setTab() { global $db; dol_include_once('/core/lib/admin.lib.php'); $tab = $this->tab_object . ':+tabQuery' . $this->getId() . ':' . $this->title . ':query@query:' . $this->getUrl() . '&tab_object=' . $this->tab_object . '&fk_object=__ID__&menuId=' . $this->getId(); dolibarr_set_const($db, 'MAIN_MODULE_QUERY_TABS_' . $this->getId(), $tab); }
$consttype = $_POST["consttype"][$key]; $constnote = $_POST["constnote"][$key]; $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); if (!$res > 0) { $error++; } } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } // Action activation d'un sous module du module adherent if ($action == 'set') { $result = dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity); if ($result < 0) { dol_print_error($db); } } // Action desactivation d'un sous module du module adherent if ($action == 'unset') { $result = dolibarr_del_const($db, $_GET["name"], $conf->entity); if ($result < 0) { dol_print_error($db); } } if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf->global->ADHERENT_USE_MAILMAN)) { $email = GETPOST($action . 'email'); if (!isValidEmail($email)) { $langs->load("errors");
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"], 'chaine', 0, '', 0); // Param for all entities dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"], 'chaine', 0, '', 0); // Param for all entities dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"], 'chaine', 0, '', $conf->entity); // This one is not always defined if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) { dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"], 'chaine', 0, '', $conf->entity); } $_SESSION["mainmenu"] = ""; // Le gestionnaire de menu a pu changer header("Location: " . $_SERVER["PHP_SELF"] . "?mainmenu=home&leftmenu=setup"); exit; } /* * View */ $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; llxHeader('', $langs->trans("Setup"), $wikihelp); $form = new Form($db); $formother = new FormOther($db); $formadmin = new FormAdmin($db); print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
/* * Actions */ if ($action == 'activate_hidemenu') { dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", '1', 'chaine', 0, '', $conf->entity); header("Location: " . $_SERVER["PHP_SELF"]); exit; } else { if ($action == 'disable_hidemenu') { dolibarr_del_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", $conf->entity); header("Location: " . $_SERVER["PHP_SELF"]); exit; } } if ($action == 'activate_layoutmenu') { dolibarr_set_const($db, "MAIN_MENU_USE_JQUERY_LAYOUT", '1', 'chaine', 0, '', $conf->entity); header("Location: " . $_SERVER["PHP_SELF"]); exit; } else { if ($action == 'disable_layoutmenu') { dolibarr_del_const($db, "MAIN_MENU_USE_JQUERY_LAYOUT", $conf->entity); header("Location: " . $_SERVER["PHP_SELF"]); exit; } } /* * View */ llxHeader('', $langs->trans("Setup")); print_fiche_titre($langs->trans("Menus"), '', 'setup'); $h = 0;
* \file htdocs/admin/ecm.php * \ingroup core * \brief Page to setup ECM (GED) module */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; $langs->load("admin"); if (!$user->admin) { accessforbidden(); } /* * Action */ if (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) { header("Location: " . $_SERVER["PHP_SELF"]); exit; } else { dol_print_error($db); } } if (preg_match('/del_(.*)/', $action, $reg)) { $code = $reg[1]; if (dolibarr_del_const($db, $code, $conf->entity) > 0) { header("Location: " . $_SERVER["PHP_SELF"]); exit; } else { dol_print_error($db); } }
$type='company'; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql.= " WHERE nom='".$db->escape($_GET["value"])."' AND type='".$type."' AND entity=".$conf->entity; if ($db->query($sql)) { } else dol_print_error($db); } // Define default generator if ($_GET["action"] == 'setdoc') { $db->begin(); if (dolibarr_set_const($db, "COMPANY_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity)) { $conf->global->COMPANY_ADDON_PDF = $_GET["value"]; } // On active le modele $type='company'; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql_del.= " WHERE nom = '".$db->escape($_GET["value"])."'"; $sql_del.= " AND type = '".$type."'"; $sql_del.= " AND entity = ".$conf->entity; dol_syslog("societe.php ".$sql); $result1=$db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql.= " VALUES ('".$db->escape($_GET["value"])."', '".$type."', ".$conf->entity.", ";
} $consttype = GETPOST('consttype', 'alpha'); $constnote = GETPOST('constnote'); $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } // Action activation d'un sous module du module adherent if ($action == 'set') { $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity); if ($result < 0) { print $db->error(); } } // Action desactivation d'un sous module du module adherent if ($action == 'unset') { $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity); if ($result < 0) { print $db->error(); } } /* * View */ $form = new Form($db);
} if ($action == 'setlistsorttodo') { $setlistsorttodo = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'mesgs'); } } if ($action == 'setlistsortdone') { $setlistsortdone = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'mesgs'); } } /* * View */ llxHeader(); $form = new Form($db); $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
} else { if ($action == 'set_COMMANDE_FREE_TEXT') { $freetext = GETPOST("COMMANDE_FREE_TEXT"); // No alpha here, we want exact string $res = dolibarr_set_const($db, "COMMANDE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); if (!$res > 0) { $error++; } if (!$error) { setEventMessage($langs->trans("SetupSaved")); } else { setEventMessage($langs->trans("Error"), 'errors'); } } else { if ($action == 'setModuleOptions') { if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF_ODT_PATH", GETPOST('value1'), 'chaine', 0, '', $conf->entity)) { // La constante qui a ete lue en avant du nouveau set // on passe donc par une variable pour avoir un affichage coherent $conf->global->COMMANDE_ADDON_PDF_ODT_PATH = GETPOST('value1'); } } } } } } } } /* * View */ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
} } $activeModules = $newActiveModules; dolibarr_set_const($db, 'SYSLOG_HANDLERS', json_encode($activeModules), 'chaine', 0, '', 0); if (!$error) { $db->commit(); setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); setEventMessage($langs->trans("Error"), 'errors'); } } // Set level if ($action == 'setlevel') { $level = GETPOST("level"); $res = dolibarr_set_const($db, "SYSLOG_LEVEL", $level, 'chaine', 0, '', 0); dol_syslog("admin/syslog: level " . $level); if (!$res > 0) { $error++; } if (!$error) { setEventMessage($langs->trans("SetupSaved")); } else { setEventMessage($langs->trans("Error"), 'errors'); } } /* * View */ llxHeader(); $form = new Form($db);