From e2b8ad2035c4768e112c6c9d66f17ecc453a6658 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Sep 2013 03:43:59 +0200 Subject: [PATCH] Fix: not defined value --- htdocs/user/class/usergroup.class.php | 18 ++++++++---------- test/README | 2 +- test/phpunit/ModulesTest.php | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 8d85e323f5c..fa9290b589e 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -1,6 +1,6 @@ - * Copyright (c) 2005-2012 Laurent Destailleur + * Copyright (c) 2005-2013 Laurent Destailleur * Copyright (c) 2005-2012 Regis Houssin * Copyright (C) 2012 Florian Henry * @@ -28,8 +28,7 @@ if (! empty($conf->ldap->enabled)) require_once (DOL_DOCUMENT_ROOT."/core/class/ /** - * \class UserGroup - * \brief Class to manage user groups + * Class to manage user groups */ class UserGroup extends CommonObject { @@ -573,11 +572,10 @@ class UserGroup extends CommonObject $error=0; $now=dol_now(); - $entity=$conf->entity; - if(! empty($conf->multicompany->enabled) && $conf->entity == 1) - { - $entity=$this->entity; - } + if (! isset($this->entity)) $this->entity=$conf->entity; // If not defined, we use default value + + $entity=$this->entity; + if (! empty($conf->multicompany->enabled) && $conf->entity == 1) $entity=$this->entity; $sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup ("; $sql.= "datec"; @@ -589,7 +587,7 @@ class UserGroup extends CommonObject $sql.= ",".$entity; $sql.= ")"; - dol_syslog("UserGroup::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); $result=$this->db->query($sql); if ($result) { @@ -612,7 +610,7 @@ class UserGroup extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("UserGroup::Create ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::create ".$this->error,LOG_ERR); return -1; } } diff --git a/test/README b/test/README index a5280277344..929c9df05e8 100644 --- a/test/README +++ b/test/README @@ -37,7 +37,7 @@ If using Eclipse, select the test and click on menu "Run external tools and choo Note that xdebug must be installed for this feature to work. * Generate a report of Unit tests code coverage among all Dolibarr classes: -Increase your PHP memory (memory_limit and suhosin.memory_limit in php.ini) to 4G. +Increase your PHP memory (memory_limit and suhosin.memory_limit in php.ini) to 4G. Note: Version 3.5 need 1.5G > cd test > phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-html ./report --coverage-clover ./report/logs/phpunit.coverage.xml --log-junit ./report/logs/phpunit.xml phpunit/AllTests.php diff --git a/test/phpunit/ModulesTest.php b/test/phpunit/ModulesTest.php index 216b19ce9eb..7a398b905fa 100755 --- a/test/phpunit/ModulesTest.php +++ b/test/phpunit/ModulesTest.php @@ -129,7 +129,7 @@ class ModulesTest extends PHPUnit_Framework_TestCase 'CashDesk','Categorie','ClickToDial','Commande','Comptabilite','Contrat','Cron','Deplacement','Document','Don', 'ECM','Expedition','Export','ExternalRss','ExternalSite','Facture', 'Fckeditor','Ficheinter','Fournisseur','FTP','GeoIPMaxmind','Gravatar','Holiday','Import','Label','Ldap','Mailing', - 'Notification','Opensurvey','Paybox','Paypal','Prelevement','Product','Projet','Propale', + 'Notification','OpenSurvey','Paybox','Paypal','Prelevement','Product','Projet','Propale', 'Service','Societe','Stock','Syslog','Tax','User','WebServices','Workflow'); foreach($modulelist as $modlabel) {