From a4b98df4ab5cf12ca4f251e8e09032f1f5f799e7 Mon Sep 17 00:00:00 2001 From: pbarroca <pbarroca@afi-sa.fr> Date: Wed, 14 Dec 2016 17:48:33 +0100 Subject: [PATCH] hotline #52108 : fix zone loading for libraries select --- VERSIONS_HOTLINE/52108 | 1 + library/Class/Zone.php | 11 ++++--- .../controllers/ProfilControllerTest.php | 29 +++++++++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 VERSIONS_HOTLINE/52108 diff --git a/VERSIONS_HOTLINE/52108 b/VERSIONS_HOTLINE/52108 new file mode 100644 index 00000000000..3263a3a8913 --- /dev/null +++ b/VERSIONS_HOTLINE/52108 @@ -0,0 +1 @@ + - ticket #52108 : Administration des profils : Correction du paramètre de filtrage par bibliothèque \ No newline at end of file diff --git a/library/Class/Zone.php b/library/Class/Zone.php index 26202a697e4..52cbf31e92d 100644 --- a/library/Class/Zone.php +++ b/library/Class/Zone.php @@ -43,14 +43,13 @@ class ZoneLoader extends Storm_Model_Loader { } - public function getZones($id_zone=0) - { - return - Class_Zone::getLoader()->findAllBy(array_filter(['id_zone' => $id_zone, - 'order' => 'LIBELLE'])); + public function getZones($id_zone=0) { + $params = ['order' => 'libelle']; + if ((int)$id_zone) + $params['id_zone'] = (int)$id_zone; + return Class_Zone::findAllBy($params); } - } diff --git a/tests/application/modules/admin/controllers/ProfilControllerTest.php b/tests/application/modules/admin/controllers/ProfilControllerTest.php index e16f1372da4..d25593e44e4 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerTest.php @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ abstract class Admin_ProfilControllerProfilJeunesseTestCase extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); $cfg_site = ['header_img' => "/public/jeunesse.png", @@ -1546,3 +1548,30 @@ class Admin_ProfilControllerProfilPortalLoginPagePostTest extends Admin_Abstract $this->assertEquals(2, Class_Profil::find(1)->getLoginPage()); } } + + + +/** @see http://forge.afi-sa.fr/issues/52108 */ +class Admin_ProfilControllerEditLibraryFilterTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_Bib', + ['id' => 9, + 'libelle' => 'Annecy', + 'zone' => $this->fixture('Class_Zone', + ['id' => 12, + 'libelle' => 'Haute-Savoie'])]); + + $this->dispatch('/admin/profil/edit/id_profil/1', true); + } + + + /** @test */ + public function annecyFilterShouldBePresent() { + $this->assertXPathContentContains('//select[@name="id_site"]//option[@value="9"]', + 'Annecy'); + } +} -- GitLab