From 216a2bc3c4df1a5fdd4e21debf5c86b01d351bf5 Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@git-test.afi-sa.fr>
Date: Mon, 17 Sep 2012 14:56:08 +0000
Subject: [PATCH] =?UTF-8?q?Kiosque:=20correction=20s=C3=A9lection=20nombre?=
 =?UTF-8?q?=20de=20notices?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 library/Class/Catalogue.php                                 | 4 ++--
 library/ZendAfi/View/Helper/EnteteAvis.php                  | 4 +---
 .../modules/opac/controllers/JavaControllerTest.php         | 6 +++---
 tests/library/Class/CatalogueTest.php                       | 2 +-
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/library/Class/Catalogue.php b/library/Class/Catalogue.php
index d45090c32e5..616fe2cfdfa 100644
--- a/library/Class/Catalogue.php
+++ b/library/Class/Catalogue.php
@@ -301,7 +301,7 @@ class Class_Catalogue extends Storm_Model_Abstract {
 	public function getNoticesByPreferences($preferences,$cache_vignette=false)	{
 		$notices = $this->getNoticesFromCacheByPreferences($preferences, $cache_vignette);
 
-		if ($preferences["aleatoire"] !== 1) 
+		if ((int)$preferences["aleatoire"] !== 1) 
 			return $notices;
 
 		shuffle($notices);
@@ -431,7 +431,7 @@ class Class_Catalogue extends Storm_Model_Abstract {
 	public function limitForCatalogueRequestByPreferences($preferences, $no_limit=false) {
 		$limite = 0;
 
-		if (isset($preferences["aleatoire"]) && $preferences["aleatoire"]==1) 
+		if (isset($preferences["aleatoire"]) && (int)$preferences["aleatoire"]==1) 
 			$limite = (int)$preferences["nb_analyse"];
 		else if (isset($preferences['nb_notices']))
 			$limite = (int)$preferences["nb_notices"];
diff --git a/library/ZendAfi/View/Helper/EnteteAvis.php b/library/ZendAfi/View/Helper/EnteteAvis.php
index 4967185e32c..b089c05cac7 100644
--- a/library/ZendAfi/View/Helper/EnteteAvis.php
+++ b/library/ZendAfi/View/Helper/EnteteAvis.php
@@ -21,9 +21,7 @@
 
 class ZendAfi_View_Helper_EnteteAvis extends ZendAfi_View_Helper_BaseHelper {
 	public function avis($avis) {
-		return sprintf('<div class="vignette_notice"><img src="%s" /></div>%s',
-									 $avis->getFirstNotice()->getUrlVignette(),
-									 $this->enteteAvis($avis));
+		return  $this->enteteAvis($avis);
 	}
 
 	public function enteteAvis($avis) {
diff --git a/tests/application/modules/opac/controllers/JavaControllerTest.php b/tests/application/modules/opac/controllers/JavaControllerTest.php
index 1ed882dfbff..6992f1b8179 100644
--- a/tests/application/modules/opac/controllers/JavaControllerTest.php
+++ b/tests/application/modules/opac/controllers/JavaControllerTest.php
@@ -23,9 +23,9 @@ require_once 'AbstractControllerTestCase.php';
 class JavaControllerTestCase extends AbstractControllerTestCase {
 	public function setUp() {
 		parent::setUp();
-		$cfg_accueil = array('modules' => array('1' => array('division' => 1,
-																												 'type_module' => 'KIOSQUE')), 
-												 'options' => 	array());
+		$cfg_accueil = ['modules' => ['1' => ['division' => 1,
+																					'type_module' => 'KIOSQUE']], 
+										'options' => 	[]];
 
 
 		
diff --git a/tests/library/Class/CatalogueTest.php b/tests/library/Class/CatalogueTest.php
index 872c3b0278a..17093bd175d 100644
--- a/tests/library/Class/CatalogueTest.php
+++ b/tests/library/Class/CatalogueTest.php
@@ -434,7 +434,7 @@ class CatalogueTestGetNoticesByPreferences extends ModelTestCase {
 
 		$this->_catalogue = Class_Catalogue::getLoader()->newInstanceWithId(666);
 		$this->_notices = $this->_catalogue->getNoticesByPreferences(array('id_catalogue' => 666,
-																																			 'aleatoire' => 1,
+																																			 'aleatoire' => '1',
 																																			 'nb_analyse' => 25,
 																																			 'nb_notices' => 40));
 	}
-- 
GitLab