Fix warning

This commit is contained in:
Laurent Destailleur 2023-04-15 03:16:53 +02:00
parent f02ff3f774
commit b55271dedb
20 changed files with 43 additions and 41 deletions

View File

@ -359,7 +359,7 @@ class Conf
$modulename = 'supplier_proposal';
}
$this->modules[$modulename] = $modulename; // Add this module in list of enabled modules
// deprecated
// deprecated in php 8.2
if (!isset($this->$modulename) || !is_object($this->$modulename)) {
$this->$modulename = new stdClass();
}

View File

@ -257,6 +257,12 @@ class User extends CommonObject
*/
public $clicktodial_poste;
/**
* @var string 0 by default, 1 if click to dial data were already loaded for this user
*/
public $clicktodial_loaded;
public $datelastlogin;
public $datepreviouslogin;
public $flagdelsessionsbefore;

View File

@ -95,13 +95,7 @@ $now = dol_now();
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." - userlogin=".$userlogin." - ".dol_print_date($now, 'dayhourrfc')." - ".gethostname()." *****\n";
// Check module cron is activated
if (empty($conf->cron->enabled)) {
print "Error: module Scheduled jobs (cron) not activated\n";
exit(-1);
}
// Check module cron is activated
if (empty($conf->cron->enabled)) {
if (!isModEnabled('cron')) {
print "Error: module Scheduled jobs (cron) not activated\n";
exit(-1);
}

View File

@ -234,13 +234,13 @@ if ($resql) {
$substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY."-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid);
$onlinepaymentenabled = 0;
if (!empty($conf->paypal->enabled)) {
if (isModEnabled('paypal')) {
$onlinepaymentenabled++;
}
if (!empty($conf->paybox->enabled)) {
if (isModEnabled('paybox')) {
$onlinepaymentenabled++;
}
if (!empty($conf->stripe->enabled)) {
if (isModEnabled('stripe')) {
$onlinepaymentenabled++;
}
if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
@ -258,7 +258,7 @@ if ($resql) {
}
}
/* For backward compatibility */
if (!empty($conf->paypal->enabled) && !empty($conf->global->PAYPAL_SECURITY_TOKEN)) {
if (isModEnabled('paypal') && !empty($conf->global->PAYPAL_SECURITY_TOKEN)) {
$substitutionarray['__SECUREKEYPAYPAL__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) {

View File

@ -83,7 +83,7 @@ class ActionCommTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->agenda->enabled)) {
if (!isModEnabled('agenda')) {
print __METHOD__." module agenda must be enabled.\n"; die(1);
}

View File

@ -37,7 +37,7 @@ if ($langs->defaultlang != 'en_US') {
print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n";
exit(1);
}
if (empty($conf->adherent->enabled)) {
if (!isModEnabled('adherent')) {
print "Error: Module member must be enabled to have significant results.\n";
exit(1);
}
@ -45,7 +45,7 @@ if (isModEnabled('ldap')) {
print "Error: LDAP module should not be enabled.\n";
exit(1);
}
if (!empty($conf->google->enabled)) {
if (isModEnabled('google')) {
print "Warning: Google module should not be enabled.\n";
}
if (empty($user->id)) {

View File

@ -112,25 +112,25 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
{
global $conf,$user,$langs,$db;
if (! $conf->facture->enabled) {
if (!isModEnabled('facture')) {
print __METHOD__." invoice module not enabled\n"; die(1);
}
if (! $conf->commande->enabled) {
if (!isModEnabled('commande')) {
print __METHOD__." order module not enabled\n"; die(1);
}
if (! $conf->propal->enabled) {
if (!isModEnabled('propal')) {
print __METHOD__." propal module not enabled\n"; die(1);
}
if (! $conf->project->enabled) {
if (!isModEnabled('project')) {
print __METHOD__." project module not enabled\n"; die(1);
}
if (! $conf->expedition->enabled) {
if (!isModEnabled('expedition')) {
print __METHOD__." shipment module not enabled\n"; die(1);
}
if (! $conf->ficheinter->enabled) {
if (!isModEnabled('ficheinter')) {
print __METHOD__." intervention module not enabled\n"; die(1);
}
if (! $conf->expensereport->enabled) {
if (!isModEnabled('expensereport')) {
print __METHOD__." expensereport module not enabled\n"; die(1);
}

View File

@ -83,7 +83,7 @@ class CommandeTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->commande->enabled)) {
if (!isModEnabled('commande')) {
print __METHOD__." module customer order must be enabled.\n"; die(1);
}

View File

@ -82,7 +82,7 @@ class EntrepotTest extends PHPUnit\Framework\TestCase
{
global $conf,$user,$langs,$db;
if (empty($conf->stock->enabled)) {
if (!isModEnabled('stock')) {
print __METHOD__." Module Stock must be enabled.\n"; die(1);
}

View File

@ -86,7 +86,7 @@ class FactureTest extends PHPUnit\Framework\TestCase
if (!isModEnabled('facture')) {
print __METHOD__." module customer invoice must be enabled.\n"; die(1);
}
if (!empty($conf->ecotaxdeee->enabled)) {
if (isModEnabled('ecotaxdeee')) {
print __METHOD__." ecotaxdeee module must not be enabled.\n"; die(1);
}

View File

@ -417,7 +417,10 @@ class FilesLibTest extends PHPUnit\Framework\TestCase
$errorstring = '';
dol_mkdir($conf->admin->dir_temp);
$conf->global->MAIN_ENABLE_LOG_TO_HTML=1; $conf->syslog->enabled=1; $_REQUEST['logtohtml']=1;
$conf->global->MAIN_ENABLE_LOG_TO_HTML=1;
$conf->syslog->enabled=1;
$conf->modules['syslog'] = 'syslog';
$_REQUEST['logtohtml']=1;
$conf->logbuffer=array();
$result=dol_compress_file($filein, $fileout, $format, $errorstring);
@ -427,6 +430,7 @@ class FilesLibTest extends PHPUnit\Framework\TestCase
$result=dol_uncompress($fileout, $dirout);
print __METHOD__." uncompress result=".join(',', $result)."\n";
print join(', ', $conf->logbuffer);
$this->assertEquals(0, count($result), "Pb with dol_uncompress_file of file ".$fileout);
// Format gz
@ -445,7 +449,10 @@ class FilesLibTest extends PHPUnit\Framework\TestCase
$errorstring = '';
dol_mkdir($conf->admin->dir_temp);
$conf->global->MAIN_ENABLE_LOG_TO_HTML=1; $conf->syslog->enabled=1; $_REQUEST['logtohtml']=1;
$conf->global->MAIN_ENABLE_LOG_TO_HTML=1;
$conf->syslog->enabled=1;
$conf->modules['syslog'] = 'syslog';
$_REQUEST['logtohtml']=1;
$conf->logbuffer=array();
$result=dol_compress_file($filein, $fileout, $format, $errorstring);

View File

@ -1141,10 +1141,10 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
$verifcond=verifCond('1==2');
$this->assertFalse($verifcond, 'Test a false comparison');
$verifcond=verifCond('$conf->facture->enabled');
$verifcond=verifCond('isModEnabled("facture")');
$this->assertTrue($verifcond, 'Test that the conf property of a module reports true when enabled');
$verifcond=verifCond('$conf->moduledummy->enabled');
$verifcond=verifCond('isModEnabled("moduledummy")');
$this->assertFalse($verifcond, 'Test that the conf property of a module reports false when disabled');
$verifcond=verifCond(0);

View File

@ -86,7 +86,7 @@ class KnowledgeRecordTest extends PHPUnit\Framework\TestCase
global $conf, $user, $langs, $db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->knowledgemanagement->enabled)) {
if (!isModEnabled('knowledgemanagement')) {
print __METHOD__." module knowledgemanagement must be enabled.\n"; die(1);
}
}

View File

@ -114,7 +114,7 @@ class MouvementStockTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs;
$db=$this->savdb;
if (empty($conf->productbatch->enabled)) {
if (!isModEnabled('productbatch')) {
print "\n".__METHOD__." module Lot/Serial must be enabled.\n"; die(1);
}

View File

@ -83,7 +83,7 @@ class PaypalTest extends PHPUnit\Framework\TestCase
{
global $conf,$user,$langs,$db;
if (empty($conf->paypal->enabled)) {
if (!isModEnabled('paypal')) {
print __METHOD__." Module Paypal must be enabled.\n"; die(1);
}

View File

@ -149,11 +149,6 @@ class PricesTest extends PHPUnit\Framework\TestCase
global $mysoc;
$mysoc=new Societe($db);
// To force status that say module multicompany is on
//$conf->multicurrency=new stdClass();
//$conf->multicurrency->enabled = 0;
/*
* Country France
*/

View File

@ -82,7 +82,7 @@ class ProductTest extends PHPUnit\Framework\TestCase
{
global $conf,$user,$langs,$db;
if (empty($conf->produit->enabled)) {
if (!isModEnabled('produit')) {
print __METHOD__." Module Product must be enabled.\n"; die(1);
}

View File

@ -73,7 +73,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
$this->savlangs=$langs;
$this->savdb=$db;
if (empty($conf->api->enabled)) {
if (!isModEnabled('api')) {
print __METHOD__." module api must be enabled.\n"; die(1);
}

View File

@ -83,7 +83,7 @@ class StripeTest extends PHPUnit\Framework\TestCase
{
global $conf,$user,$langs,$db;
if (empty($conf->stripe->enabled)) {
if (!isModEnabled('stripe')) {
print __METHOD__." Module Stripe must be enabled.\n"; die(1);
}

View File

@ -42,7 +42,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1;
$conf->global->MAIN_UMASK='0666';
if (empty($conf->service->enabled)) {
if (!isModEnabled('service')) {
print "Error: Module service must be enabled.\n";
exit(1);
}