2
0
forked from Wavyzz/dolibarr

Easy way to use conf->global

This commit is contained in:
Givriz
2021-04-16 17:10:11 +02:00
parent 0a0804e7d5
commit 86bfcd9510
3 changed files with 9 additions and 9 deletions

View File

@@ -172,7 +172,7 @@ if ($action == 'edit') {
// Disable // Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_SMS").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_SMS").'</td><td>';
print $form->selectyesno('MAIN_DISABLE_ALL_SMS', empty($conf->global->MAIN_DISABLE_ALL_SMS) ? '' : $conf->global->MAIN_DISABLE_ALL_SMS, 1); print $form->selectyesno('MAIN_DISABLE_ALL_SMS', getDolGlobalString('MAIN_DISABLE_ALL_SMS'), 1);
print '</td></tr>'; print '</td></tr>';
// Separator // Separator
@@ -189,7 +189,7 @@ if ($action == 'edit') {
// From // From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM", $langs->transnoentities("Undefined")).'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM", $langs->transnoentities("Undefined")).'</td>';
print '<td><input class="flat" name="MAIN_MAIL_SMS_FROM" size="32" value="'.(empty($conf->global->MAIN_MAIL_SMS_FROM) ? '' : $conf->global->MAIN_MAIL_SMS_FROM); print '<td><input class="flat" name="MAIN_MAIL_SMS_FROM" size="32" value="'.getDolGlobalString('MAIN_MAIL_SMS_FROM');
print '"></td></tr>'; print '"></td></tr>';
// Autocopy to // Autocopy to
@@ -213,14 +213,14 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Disable // Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_SMS").'</td><td>'.yn(empty($conf->global->MAIN_DISABLE_ALL_SMS) ? '' : $conf->global->MAIN_DISABLE_ALL_SMS).'</td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_SMS").'</td><td>'.yn(getDolGlobalString('MAIN_DISABLE_ALL_SMS')).'</td></tr>';
// Separator // Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>'; print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// Method // Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
$text = empty($conf->global->MAIN_SMS_SENDMODE) ? '' : $listofmethods[$conf->global->MAIN_SMS_SENDMODE]; $text = empty(getDolGlobalString('MAIN_SMS_SENDMODE')) ? '' : $listofmethods[getDolGlobalString('MAIN_SMS_SENDMODE')];
if (empty($text)) { if (empty($text)) {
$text = $langs->trans("Undefined").' '.img_warning(); $text = $langs->trans("Undefined").' '.img_warning();
} }
@@ -229,7 +229,7 @@ if ($action == 'edit') {
// From // From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM", $langs->transnoentities("Undefined")).'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM", $langs->transnoentities("Undefined")).'</td>';
print '<td>'.(empty($conf->global->MAIN_MAIL_SMS_FROM) ? '' : $conf->global->MAIN_MAIL_SMS_FROM); print '<td>'.getDolGlobalString('MAIN_MAIL_SMS_FROM');
if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && !isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) { if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && !isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) {
print ' '.img_warning($langs->trans("ErrorBadPhone")); print ' '.img_warning($langs->trans("ErrorBadPhone"));
} }

View File

@@ -1228,14 +1228,14 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab
// We discard modules according to features level (PS: if module is activated we always show it) // We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && empty($conf->global->$const_name)) { if ($objMod->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2 && empty(getDolGlobalString($const_name))) {
$modulequalified = 0; $modulequalified = 0;
} }
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && empty($conf->global->$const_name)) { if ($objMod->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1 && empty(getDolGlobalString($const_name))) {
$modulequalified = 0; $modulequalified = 0;
} }
//If module is not activated disqualified //If module is not activated disqualified
if (empty($conf->global->$const_name)) { if (empty(getDolGlobalString($const_name))) {
$modulequalified = 0; $modulequalified = 0;
} }

View File

@@ -177,7 +177,7 @@ class modPartnership extends DolibarrModules
// Array to add new pages in new tabs // Array to add new pages in new tabs
$this->tabs = array(); $this->tabs = array();
$tabtoadd = (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') ? 'member' : 'thirdparty'; $tabtoadd = (!empty(getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR')) && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') ? 'member' : 'thirdparty';
if ($tabtoadd == 'member') { if ($tabtoadd == 'member') {
$this->tabs[] = array('data'=>'member:+partnership:Partnership:partnership@partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__'); $this->tabs[] = array('data'=>'member:+partnership:Partnership:partnership@partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__');