mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
Fix empty on getDolGlobal
This commit is contained in:
@@ -656,7 +656,7 @@ if ($action == 'edit') {
|
||||
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
|
||||
// Force e-mail recipient
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO');
|
||||
if (!empty(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) {
|
||||
if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) {
|
||||
if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) {
|
||||
print img_warning($langs->trans("ErrorBadEMail"));
|
||||
} else {
|
||||
|
||||
@@ -221,7 +221,7 @@ if ($action == 'edit') {
|
||||
|
||||
// Method
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
|
||||
$text = empty(getDolGlobalString('MAIN_SMS_SENDMODE')) ? '' : $listofmethods[getDolGlobalString('MAIN_SMS_SENDMODE')];
|
||||
$text = getDolGlobalString('MAIN_SMS_SENDMODE') ? $listofmethods[getDolGlobalString('MAIN_SMS_SENDMODE')] : '';
|
||||
if (empty($text)) {
|
||||
$text = $langs->trans("Undefined").' '.img_warning();
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
// Check if email exists
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
|
||||
print '<td class="left">';
|
||||
if (empty(getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS'))) {
|
||||
if (!getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS')) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
|
||||
} else {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
|
||||
@@ -334,7 +334,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
/*
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
|
||||
print '<td class="left">';
|
||||
if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
|
||||
if (!getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST')) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
|
||||
} else {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
|
||||
|
||||
@@ -1330,14 +1330,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)
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
||||
if ($objMod->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2 && empty(getDolGlobalString($const_name))) {
|
||||
if ($objMod->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2 && !getDolGlobalString($const_name)) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($objMod->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1 && empty(getDolGlobalString($const_name))) {
|
||||
if ($objMod->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1 && !getDolGlobalString($const_name)) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
//If module is not activated disqualified
|
||||
if (empty(getDolGlobalString($const_name))) {
|
||||
// If module is not activated disqualified
|
||||
if (!getDolGlobalString($const_name)) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -565,7 +565,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
$ok=false;
|
||||
break;
|
||||
}
|
||||
$this->assertTrue($ok, 'Found code empty($user->hasRight in file '.$file['relativename'].'. empty() must not be used with hasRight.');
|
||||
$this->assertTrue($ok, 'Found code empty($user->hasRight in file '.$file['relativename'].'. empty() must not be used on a var not on a function.');
|
||||
|
||||
// Test we don't have empty(DolibarrApiAccess::$user->hasRight
|
||||
$ok=true;
|
||||
@@ -575,7 +575,17 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
|
||||
$ok=false;
|
||||
break;
|
||||
}
|
||||
$this->assertTrue($ok, 'Found code empty(DolibarrApiAccess::$user->hasRight in file '.$file['relativename'].'. empty() must not be used with hasRight.');
|
||||
$this->assertTrue($ok, 'Found code empty(DolibarrApiAccess::$user->hasRight in file '.$file['relativename'].'. empty() must not be used on a var not on a function.');
|
||||
|
||||
// Test we don't have empty($user->hasRight
|
||||
$ok=true;
|
||||
$matches=array();
|
||||
preg_match_all('/empty\(getDolGlobal/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $key => $val) {
|
||||
$ok=false;
|
||||
break;
|
||||
}
|
||||
$this->assertTrue($ok, 'Found code empty(getDolGlobal... in file '.$file['relativename'].'. empty() must be used on a var not on a function.');
|
||||
|
||||
// Test we don't have @var array(
|
||||
$ok=true;
|
||||
|
||||
Reference in New Issue
Block a user