Add more log and phpunit

This commit is contained in:
Laurent Destailleur 2019-07-30 20:37:07 +02:00
parent 00a4359508
commit 0ab16b739a
2 changed files with 18 additions and 3 deletions

View File

@ -1638,7 +1638,7 @@ class Holiday extends CommonObject
$sql.= " WHERE fk_user = '".$user_id."'";
if ($fk_type > 0) $sql.=" AND fk_type = ".$fk_type;
dol_syslog(get_class($this).'::getCPforUser', LOG_DEBUG);
dol_syslog(get_class($this).'::getCPforUser user_id='.$user_id.' type_id='.$fk_type, LOG_DEBUG);
$result = $this->db->query($sql);
if($result)
{
@ -1826,7 +1826,7 @@ class Holiday extends CommonObject
else
{
// List of vacation balance users
$sql = "SELECT cpu.fk_user as userid, cpu.fk_type, cpu.nb_holiday, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut, u.fk_user";
$sql = "SELECT cpu.fk_type, cpu.nb_holiday, u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut, u.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE cpu.fk_user = u.rowid";
if ($filters) $sql.=$filters;

View File

@ -47,7 +47,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1;
* @backupStaticAttributes enabled
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
*/
class HolidayTest extends PHPUnit_Framework_TestCase
class HolidayTest extends PHPUnit\Framework\TestCase
{
protected $savconf;
protected $savuser;
@ -351,4 +351,19 @@ class HolidayTest extends PHPUnit_Framework_TestCase
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2); // start afternoon and end morning
$this->assertTrue($result, 'result should be true, there is no overlapping');
}
/**
* testUpdateBalance
*
* @return void
*/
public function testUpdateBalance()
{
$localobjecta=new Holiday($this->savdb);
$localobjecta->updateConfCP('lastUpdate', '20100101120000');
$localobjecta->updateBalance();
}
}