Clean code

This commit is contained in:
Laurent Destailleur 2021-11-05 14:23:19 +01:00
parent e8a550cb21
commit 897b00faf0
18 changed files with 23 additions and 51 deletions

View File

@ -275,8 +275,7 @@ print '<br><br>';
/*
* Document templates generators
*/
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
//{
print load_fiche_titre($langs->trans("BankAccountModelModule"), '', '');
// Load array def with activated templates
@ -466,8 +465,7 @@ print '<br><br>';
/*
* Document templates generators
*/
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
//{
print load_fiche_titre($langs->trans("Other"), '', '');
print "<table class=\"noborder\" width=\"100%\">\n";

View File

@ -542,7 +542,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1);
$moreforfilter .= '</div>';
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
if ($conf->global->MAIN_FEATURES_LEVEL < 0) {
$array_version['deprecated'] = $langs->trans("Deprecated");

View File

@ -297,7 +297,7 @@ foreach ($dirmodels as $reldir)
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified) {

View File

@ -187,8 +187,6 @@ if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY) && $user->entity) {
}
//print "conf->global->MAIN_FEATURES_LEVEL = ".$conf->global->MAIN_FEATURES_LEVEL."<br><br>\n";
// Output mode
print load_fiche_titre($langs->trans("SyslogOutput"), '', '');
@ -207,7 +205,7 @@ foreach ($syslogModules as $moduleName) {
$moduleactive = (int) $module->isActive();
//print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)."<br>\n";
if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) {
if (($moduleactive == -1) && getDolGlobalInt('MAIN_FEATURES_LEVEL') == 0) {
continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them)
}

View File

@ -556,7 +556,7 @@ if ($mode == 'searchkey') {
print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.urlencode($langcode).'&transkey='.urlencode($key).'">'.img_edit_add($langs->trans("TranslationOverwriteKey")).'</a>';
}
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$transifexlangfile = '$'; // $ means 'All'
//$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?q=key%3A'.$key;

View File

@ -2679,7 +2679,7 @@ if ($action == 'create') {
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
// Show online signature link
$useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok
$useonlinesignature = 1; // Replace this with 1 when feature to make online signature is ok
if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) {
print '<br><!-- Link to sign -->';

View File

@ -304,7 +304,7 @@ class FormAdmin
if (preg_match('/\.lib/i', $filelib)) {
continue;
}
if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file, $expdevmenu)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') == 0 && in_array($file, $expdevmenu)) {
continue;
}

View File

@ -37,7 +37,7 @@ class InfoBox
{
global $conf;
if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
return array(
0 => 'Home',
1 => 'UsersHome',

View File

@ -589,7 +589,7 @@ class Translate
}
/* Disabled. There is too many cases where translation of $newstr is not defined is normal (like when output with setEventMessage an already translated string)
if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2)
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2)
{
dol_syslog(__METHOD__." MAIN_FEATURES_LEVEL=DEVELOP: missing translation for key '".$newstr."' in ".$_SERVER["PHP_SELF"], LOG_DEBUG);
}*/

View File

@ -83,8 +83,8 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$appli .= " ".DOL_VERSION;
}
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
$appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$appli .= "<br>".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL');
}
$logouttext = '';

View File

@ -4537,7 +4537,7 @@ function dol_print_error($db = '', $error = '', $errors = null)
if ($_SERVER['DOCUMENT_ROOT']) { // Mode web
$out .= $langs->trans("DolibarrHasDetectedError").".<br>\n";
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) {
$out .= "You use an experimental or develop level of features, so please do NOT report any bugs or vulnerability, except if problem is confirmed after moving option MAIN_FEATURES_LEVEL back to 0.<br>\n";
}
$out .= $langs->trans("InformationToHelpDiagnose").":<br>\n";
@ -4545,7 +4545,7 @@ function dol_print_error($db = '', $error = '', $errors = null)
$out .= "<b>".$langs->trans("Date").":</b> ".dol_print_date(time(), 'dayhourlog')."<br>\n";
$out .= "<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION." - https://www.dolibarr.org<br>\n";
if (isset($conf->global->MAIN_FEATURES_LEVEL)) {
$out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".dol_htmlentities($conf->global->MAIN_FEATURES_LEVEL, ENT_COMPAT)."<br>\n";
$out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".getDolGlobalInt('MAIN_FEATURES_LEVEL')."<br>\n";
}
if (function_exists("phpversion")) {
$out .= "<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n";

View File

@ -471,14 +471,6 @@ function project_timesheet_prepare_head($mode, $fuser = null)
$h++;
}
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perline.php".($param?'?'.$param:'');
$head[$h][1] = $langs->trans("InputDetail");
$head[$h][2] = 'inputperline';
$h++;
}*/
complete_head_from_modules($conf, $langs, null, $head, $h, 'project_timesheet');
complete_head_from_modules($conf, $langs, null, $head, $h, 'project_timesheet', 'remove');
@ -517,7 +509,7 @@ function project_admin_prepare_head()
$head[$h][2] = 'attributes_task';
$h++;
if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
$langs->load("members");
$head[$h][0] = DOL_URL_ROOT.'/projet/admin/website.php';

View File

@ -151,7 +151,6 @@ $sqlusedforexport = '';
$head = array();
$upload_dir = $conf->export->dir_temp.'/'.$user->id;
//$usefilters=($conf->global->MAIN_FEATURES_LEVEL > 1);
$usefilters = 1;
// Security check

View File

@ -523,7 +523,6 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt(
dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (invalid token), so we disable POST and some GET parameters - referer=".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING);
//print 'Unset POST by CSRF protection in main.inc.php.'; // Do not output anything because this create problems when using the BACK button on browsers.
setEventMessages('SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null, 'warnings');
//if ($conf->global->MAIN_FEATURES_LEVEL >= 1) setEventMessages('Unset POST and GET params by CSRF protection in main.inc.php (Token provided was not generated by the previous page).'."<br>\n".'$_SERVER[REQUEST_URI] = '.$_SERVER['REQUEST_URI'].' $_SERVER[REQUEST_METHOD] = '.$_SERVER['REQUEST_METHOD'].' GETPOST(token) = '.GETPOST('token', 'alpha').' $_SESSION[token] = '.$_SESSION['token'], null, 'warnings');
if (isset($_POST['id'])) $savid = ((int) $_POST['id']);
unset($_POST);
//unset($_POST['action']); unset($_POST['massaction']);
@ -1437,8 +1436,8 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
print '<meta name="robots" content="noindex'.($disablenofollow ? '' : ',nofollow').'">'."\n"; // Do not index
print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n"; // Scale for mobile device
print '<meta name="author" content="Dolibarr Development Team">'."\n";
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
print '<meta name="MAIN_FEATURES_LEVEL" content="'.$conf->global->MAIN_FEATURES_LEVEL.'">'."\n";
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
print '<meta name="MAIN_FEATURES_LEVEL" content="'.getDolGlobalInt('MAIN_FEATURES_LEVEL').'">'."\n";
}
// Favicon
$favicon = DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png';
@ -1628,11 +1627,6 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
} else {
print '<script src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
}
/*if (! empty($conf->global->MAIN_FEATURES_LEVEL) && ! defined('JS_JQUERY_MIGRATE_DISABLED'))
{
if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) print '<script src="'.JS_JQUERY_MIGRATE.'jquery-migrate.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
else print '<script src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-migrate.min.js'.($ext?'?'.$ext:'').'"></script>'."\n";
}*/
if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) {
print '<script src="'.JS_JQUERY_UI.'jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
} else {
@ -1842,8 +1836,8 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
$appli .= " ".DOL_VERSION;
}
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
$appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$appli .= "<br>".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL');
}
$logouttext = '';

View File

@ -833,7 +833,7 @@ print '</a></td>';
print '</tr>';
if (!empty($conf->expedition->enabled)) {
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal)
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal)
print '<tr class="oddeven">';
print '<td width="80%">'.$langs->trans("AskForPreferredShippingMethod").'</td>';
print '<td>&nbsp;</td>';

View File

@ -848,7 +848,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
}
}
if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
$permissiontowrite = $user->rights->societe->creer;
$stripesupplieracc = $stripe->getStripeAccount($service, $object->id); // Get Stripe OAuth connect account (no network access here)

View File

@ -356,7 +356,7 @@ print img_picto('', 'bank_account').' ';
$form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1);
print '</td></tr>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // What is this for ?
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // What is this for ?
print '<tr class="oddeven"><td>';
print $langs->trans("BankAccountForBankTransfer").'</td><td>';
print img_picto('', 'bank_account').' ';
@ -446,15 +446,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
print '</td></tr>';
}
// Warehouse for automatic decrement
//if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment
//{
// print '<tr class="oddeven"><td>';
// print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").'</td><td>';
// print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE, 'ONLINE_PAYMENT_WAREHOUSE', '', 1, $disabled);
// print '</td></tr>';
//}
print '<tr class="oddeven"><td>';
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'">';

View File

@ -53,7 +53,7 @@ div.mainmenu.bank::before {
content: "\f19c";
}
<?php if ($conf->global->MAIN_FEATURES_LEVEL == 2) { ?>
<?php if (getDolGlobalInt('MAIN_FEATURES_LEVEL') == 2) { ?>
/* TESTING USAGE OF SVG WITHOUT FONT */
div.mainmenu.cashdesk {
line-height: 26px;