diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index e975fd6634d..e03e50eb0dd 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -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; diff --git a/test/phpunit/HolidayTest.php b/test/phpunit/HolidayTest.php index a352a1722b9..3e7ddfb7f0f 100644 --- a/test/phpunit/HolidayTest.php +++ b/test/phpunit/HolidayTest.php @@ -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(); + } + }