Fix: not defined value

This commit is contained in:
Laurent Destailleur 2013-09-09 03:43:59 +02:00
parent 94b6defd8c
commit e2b8ad2035
3 changed files with 10 additions and 12 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (c) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (c) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (c) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (c) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
* *
@ -28,8 +28,7 @@ if (! empty($conf->ldap->enabled)) require_once (DOL_DOCUMENT_ROOT."/core/class/
/** /**
* \class UserGroup * Class to manage user groups
* \brief Class to manage user groups
*/ */
class UserGroup extends CommonObject class UserGroup extends CommonObject
{ {
@ -573,11 +572,10 @@ class UserGroup extends CommonObject
$error=0; $error=0;
$now=dol_now(); $now=dol_now();
$entity=$conf->entity; if (! isset($this->entity)) $this->entity=$conf->entity; // If not defined, we use default value
if(! empty($conf->multicompany->enabled) && $conf->entity == 1)
{ $entity=$this->entity;
$entity=$this->entity; if (! empty($conf->multicompany->enabled) && $conf->entity == 1) $entity=$this->entity;
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup (";
$sql.= "datec"; $sql.= "datec";
@ -589,7 +587,7 @@ class UserGroup extends CommonObject
$sql.= ",".$entity; $sql.= ",".$entity;
$sql.= ")"; $sql.= ")";
dol_syslog("UserGroup::Create sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
@ -612,7 +610,7 @@ class UserGroup extends CommonObject
else else
{ {
$this->error=$this->db->lasterror(); $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; return -1;
} }
} }

View File

@ -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. Note that xdebug must be installed for this feature to work.
* Generate a report of Unit tests code coverage among all Dolibarr classes: * 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 > 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 > 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

View File

@ -129,7 +129,7 @@ class ModulesTest extends PHPUnit_Framework_TestCase
'CashDesk','Categorie','ClickToDial','Commande','Comptabilite','Contrat','Cron','Deplacement','Document','Don', 'CashDesk','Categorie','ClickToDial','Commande','Comptabilite','Contrat','Cron','Deplacement','Document','Don',
'ECM','Expedition','Export','ExternalRss','ExternalSite','Facture', 'ECM','Expedition','Export','ExternalRss','ExternalSite','Facture',
'Fckeditor','Ficheinter','Fournisseur','FTP','GeoIPMaxmind','Gravatar','Holiday','Import','Label','Ldap','Mailing', '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'); 'Service','Societe','Stock','Syslog','Tax','User','WebServices','Workflow');
foreach($modulelist as $modlabel) foreach($modulelist as $modlabel)
{ {