diff --git a/library/Class/AdminVar.php b/library/Class/AdminVar.php index d47339a06604b897c041d32f2b6cd2f07ab1fc7f..dd8ded60ccdecaa193e2feec635df8fec41d85ca 100644 --- a/library/Class/AdminVar.php +++ b/library/Class/AdminVar.php @@ -154,7 +154,8 @@ class Class_AdminVarLoader extends Storm_Model_Loader { 'FACETTE_MATIERE_LIBELLE' => Class_AdminVar_Meta::newDefault('Libellé de la facette matière'), 'FACETTE_TAG_LIBELLE' => Class_AdminVar_Meta::newDefault('Libellé de la facette tag'), 'UNLEASHED_FACETS' => Class_AdminVar_Meta::newMultiInput($this->_('Liste des codes des facettes qui ne sont pas limitées à l\'affichage dans le résultat de recherche<br/>Exemple : T => Type de doc, Y => Annexe, B => Bibliothèque, ... (Voir <a href="' . BOKEH_REMOTE_FILES . 'blob/' . BOKEH_VERSION . '/library/Class/Codification.php#L24">la liste complète</a>)')), - 'AFFICHER_DISPONIBILITE_SUR_RECHERCHE' => Class_AdminVar_Meta::newOnOff($this->_('Activation de la disponibilite dans le resultat de recherche.')), + 'AFFICHER_DISPONIBILITE_SUR_RECHERCHE' => Class_AdminVar_Meta::newOnOff($this->_('Activation de la disponibilite dans le resultat de recherche au survol de la couverture du document, calculé en temps réel.')), + 'AFFICHER_DISPONIBILITE_SUR_RECHERCHE_MODE_FACETTE' => Class_AdminVar_Meta::newOnOff($this->_('Activation de la disponibilite dans le resultat de recherche. Calculé grâce à la facette "En rayon".')), 'SEARCH_ALSO_IN' => Class_AdminVar_Meta::newMultiInput($this->_('Liste des sites de recherche élargie (la chaine \'%s\' dans l\'url sera remplacée par le terme de recherche)'), [ 'options' => ['fields' => [['name' => 'site_label', 'label' => $this->_('Nom du site')], ['name' => 'site_url', 'label' => $this->_('Url de recherche')] ]]]), @@ -774,6 +775,11 @@ class Class_AdminVarLoader extends Storm_Model_Loader { } + public function isShowAvailabilityFromFacetEnabled() { + return Class_AdminVar::isModuleEnabled('AFFICHER_DISPONIBILITE_SUR_RECHERCHE_MODE_FACETTE'); + } + + public function isAlbumMediaNoAutoindexTitleEnabled() { return Class_AdminVar::isModuleEnabled('ALBUM_MEDIA_NO_AUTOINDEX_TITLE'); } diff --git a/library/Class/AdminVar/Meta.php b/library/Class/AdminVar/Meta.php index 48e17d3ea73e010382dbd2c8811fa4c9eee86fc7..f1ddeb7e6301b01667672d54a5fb98ceb68d86cf 100644 --- a/library/Class/AdminVar/Meta.php +++ b/library/Class/AdminVar/Meta.php @@ -144,6 +144,7 @@ class Class_AdminVar_Meta { return $this->getAttribute('value', ''); } + public function bePrivate() { $this->_attributes['role_level'] = ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN; return $this; diff --git a/library/ZendAfi/View/Helper/ListeNotices/Abstract.php b/library/ZendAfi/View/Helper/ListeNotices/Abstract.php index e9121cf77ed11931cb31da1af79bb78f73a7948a..fd360f5fbe081f162e8e7a11bea57f592e811306 100644 --- a/library/ZendAfi/View/Helper/ListeNotices/Abstract.php +++ b/library/ZendAfi/View/Helper/ListeNotices/Abstract.php @@ -40,13 +40,24 @@ abstract class ZendAfi_View_Helper_ListeNotices_Abstract extends ZendAfi_View_He protected function _recordAvailability($record) { - if(!$this->_isAllowedToDisplayAvailabilty($record)) + if(!$this->_isAllowedToDisplayAvailabiltyFromFacet($record)) return ''; return $this->view->Notice_Availability($record); } + protected function _isAllowedToDisplayAvailabiltyFromFacet($record) { + if(!Class_AdminVar::isShowAvailabilityFromFacetEnabled()) + return false; + + if($record->isRessourceNumerique()) + return false; + + return true; + } + + protected function _isAllowedToDisplayAvailabilty($record) { if(!Class_AdminVar::isAfficherDispoSurRechercheEnabled()) return false; diff --git a/tests/library/ZendAfi/View/Helper/ListeNotices/MurTest.php b/tests/library/ZendAfi/View/Helper/ListeNotices/MurTest.php index c5de8c4ed166dfc407eb8ffb481a1a2e3543d7bf..37d747b3deceff924a1387c4492e89390bbc2fab 100644 --- a/tests/library/ZendAfi/View/Helper/ListeNotices/MurTest.php +++ b/tests/library/ZendAfi/View/Helper/ListeNotices/MurTest.php @@ -41,6 +41,7 @@ abstract class ZendAfi_View_Helper_ListeNotices_MurTestCase extends ViewHelperTe class ZendAfi_View_Helper_ListeNotices_MurForNoticeTest extends ZendAfi_View_Helper_ListeNotices_MurTestCase { public function setUp() { parent::setUp(); + $this->fixture('Class_AdminVar', ['id'=>'AFFICHER_DISPONIBILITE_SUR_RECHERCHE_MODE_FACETTE', 'valeur'=>1] ); $time_source = new TimeSourceForTest('2013-12-14 09:00:00'); Class_Notice::setTimeSource($time_source); diff --git a/tests/library/ZendAfi/View/Helper/ListeNotices/VERSIONS_HOTLINE/52819 b/tests/library/ZendAfi/View/Helper/ListeNotices/VERSIONS_HOTLINE/52819 new file mode 100644 index 0000000000000000000000000000000000000000..c15823e7030714b37acc3b9c3bd2ba8230f9d5cf --- /dev/null +++ b/tests/library/ZendAfi/View/Helper/ListeNotices/VERSIONS_HOTLINE/52819 @@ -0,0 +1 @@ + - ticket #52819 : Administration : ajout d'une variable pour gérer l'affichage de la disponibilité dans le résultat de recherche calculé avec la facette "En rayon". \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/ListeNotices/VignettesTest.php b/tests/library/ZendAfi/View/Helper/ListeNotices/VignettesTest.php index bf63fa1058dd0cb1e44b3d8a9dcc8085b75dd465..f3c7d475bf530bd819311c39babdc05d928811d2 100644 --- a/tests/library/ZendAfi/View/Helper/ListeNotices/VignettesTest.php +++ b/tests/library/ZendAfi/View/Helper/ListeNotices/VignettesTest.php @@ -25,6 +25,7 @@ class VignettesRGAATest extends ViewHelperTestCase { public function setUp() { parent::setUp(); + $this->fixture('Class_AdminVar', ['id'=>'AFFICHER_DISPONIBILITE_SUR_RECHERCHE_MODE_FACETTE', 'valeur'=>1] ); $this->fixture('Class_AdminVar', ['id'=>'AFFICHER_DISPONIBILITE_SUR_RECHERCHE', 'valeur'=>1] ); defineConstant('PATH_SKIN', './public/opac/skins/original/');