From 9100b8a5486857f964b577e9c81d612ea6253317 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Feb 2020 13:41:10 +0100 Subject: [PATCH] FIX SQL request and phpunit --- htdocs/holiday/class/holiday.class.php | 2 +- test/phpunit/HolidayTest.php | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 66a118c744b..0c058313ad6 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1712,7 +1712,7 @@ class Holiday extends CommonObject // We want only list of vacation balance for user ids $sql = "SELECT DISTINCT cpu.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu, ".MAIN_DB_PREFIX."user as u"; - $sql.= " WHERE cpu.fk_user = u.user"; + $sql.= " WHERE cpu.fk_user = u.rowid"; if ($filters) $sql.=$filters; $resql=$this->db->query($sql); diff --git a/test/phpunit/HolidayTest.php b/test/phpunit/HolidayTest.php index ce3312ba441..190496cf5bf 100644 --- a/test/phpunit/HolidayTest.php +++ b/test/phpunit/HolidayTest.php @@ -247,21 +247,17 @@ class HolidayTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; - //$localobject->fetch($localobject->id); + $result = $localobject->fetchUsers(true, true, ''); + $this->assertNotEquals($result, -1); - /* - $result=$localobject->getNomUrl(1); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertNotEquals($result, ''); + $result = $localobject->fetchUsers(true, false, ''); + $this->assertNotEquals($result, -1); - $result=$localobject->getFullAddress(1); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertContains("New address\nNew zip New town\nBelgium", $result); + $result = $localobject->fetchUsers(false, true, ''); + $this->assertNotEquals($result, -1); - $localobject->info($localobject->id); - print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n"; - $this->assertNotEquals($localobject->date_creation, ''); - */ + $result = $localobject->fetchUsers(false, false, ''); + $this->assertNotEquals($result, -1); return $localobject->id; }