diff --git a/VERSIONS_HOTLINE/151080 b/VERSIONS_HOTLINE/151080 new file mode 100644 index 0000000000000000000000000000000000000000..7c465ed0316b7d13eded16093ce17975f76901d1 --- /dev/null +++ b/VERSIONS_HOTLINE/151080 @@ -0,0 +1 @@ + - correctif #151080 : Magasin de thèmes : Ne pas être identifié pour les fonctions « Localiser » \ No newline at end of file diff --git a/application/modules/opac/controllers/RechercheController.php b/application/modules/opac/controllers/RechercheController.php index 21ef8f8d04b56c84c566b05a7b520582c99e1689..8ea7b9121177ad55b5c138a2b8b95ec698b5846d 100644 --- a/application/modules/opac/controllers/RechercheController.php +++ b/application/modules/opac/controllers/RechercheController.php @@ -150,6 +150,32 @@ class RechercheController extends ZendAfi_Controller_Action { } + public function reserverAction() { + $this->view->titre = $this->_('Réserver un document'); + + if (!$record = Class_Notice::find($this->_getParam('record_id', 0))) + return $this->_response->setHttpResponseCode(520); + + $nb_notices_oeuvre = Class_Notice::countBy(['clef_oeuvre' => $record->getClefOeuvre(), + 'id_notice not' => $record->getId()]); + + if (!$record->hasExemplaires()) + return $this->_response->setHttpResponseCode(520); + + $cond = ['id_notice' => $record->getId()]; + $session = Zend_Registry::get('session'); + $cond['id_bib'] = $session->id_bibs; + + $items = ($items = Class_Exemplaire::findAllBy(array_filter($cond))) + ? $items + : Class_Exemplaire::findAllBy($params); + + $items = (new Class_Profil_ItemsFilter())->select(Class_Profil::getCurrentProfil(), $items); + + $this->view->items = (new Class_CommSigb())->getDispoExemplaires($items); + } + + protected function _saveParams($criteria) { if (!$user = Class_Users::getIdentity()) return $this; diff --git a/application/modules/opac/views/scripts/abonne/reserver.phtml b/application/modules/opac/views/scripts/recherche/reserver.phtml similarity index 100% rename from application/modules/opac/views/scripts/abonne/reserver.phtml rename to application/modules/opac/views/scripts/recherche/reserver.phtml diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index dac33546c32ba9cdbf82d55b754c6204b80a6a5c..602146e57483d2edb16cb6624be649534102738b 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -531,7 +531,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra protected function _addHoldLink($actions) { $actions [] = (new Intonation_Library_Link) - ->setUrl($this->_view->url(['controller' => 'abonne', + ->setUrl($this->_view->url(['controller' => 'recherche', 'action' => 'reserver', 'record_id' => $this->_model->getId()])) ->setImage($this->getIco('hold', 'library')) diff --git a/tests/scenarios/Templates/TemplatesAbonneTest.php b/tests/scenarios/Templates/TemplatesAbonneTest.php index a0057aea6fc8cdac581c22a2ae324b7cd16dbffd..12a39ac3c5b727060285e30dc63f75bbc1cc2896 100644 --- a/tests/scenarios/Templates/TemplatesAbonneTest.php +++ b/tests/scenarios/Templates/TemplatesAbonneTest.php @@ -1173,23 +1173,6 @@ class TemplatesAbonneInformationsTest extends TemplatesIntonationAccountTestCase -class TemplatesIntonationDispatchAbonneReserverTest extends TemplatesIntonationAccountTestCase { - /** @test */ - public function itemsShoulbBePresent() { - $record = $this->fixture('Class_Notice', - ['id' => 89, - 'titre_principal' => 'Neige', - 'type_doc' => 2, - 'clef_alpha' => 'NEIGE']); - - $this->dispatch('/opac/abonne/reserver/record_id/89/id_profil/72'); - $this->assertXPathContentContains('//div[contains(@class, "col-12")]', 'Neige'); - } -} - - - - class TemplatesDispatchAbonneClearHistoryTest extends TemplatesIntonationAccountTestCase { /** @test */ public function shouldRedirect() { diff --git a/tests/scenarios/Templates/TemplatesSearchTest.php b/tests/scenarios/Templates/TemplatesSearchTest.php index 89eae19d460d25a06702b2541dd47884e17bf9a8..48b3a5829adf14c4457ca61e91615bb20fcbd44b 100644 --- a/tests/scenarios/Templates/TemplatesSearchTest.php +++ b/tests/scenarios/Templates/TemplatesSearchTest.php @@ -325,7 +325,7 @@ class TemplatesSearchViewRecordTest extends TemplatesIntonationTestCase { public function recordActionLinks() { return [ ['add_record_to_selection', 'href', '/panier/add-record-ajax'], - ['hold_record', 'href', '/abonne/reserver'], + ['hold_record', 'href', '/recherche/reserver'], ['share_record_on_facebook', 'onclick', '/social-network/share/on/facebook'], ['share_record_on_twitter', 'onclick', '/social-network/share/on/twitter'], ['view_permalink', 'onclick', 'popupPermalink'], @@ -353,6 +353,35 @@ class TemplatesSearchViewRecordTest extends TemplatesIntonationTestCase { +class TemplatesSearchReserverActionTest extends TemplatesIntonationTestCase { + public function setUp() { + parent::setUp(); + $this->fixture(Class_Notice::class, + ['id' => 456, + 'titre_principal' => 'Psycho', + 'clef_oeuvre' => 'PSYKO', + 'facettes' => 'G13 M12']); + + $this->fixture('Class_Exemplaire', + ['id' => 12, + 'id_notice' => 456, + 'sigb_exemplaire' => (new Class_WebService_SIGB_Exemplaire(12)) + ->beReservable() + ]); + + $this->dispatch('/recherche/reserver/record_id/456'); + } + + + /** @test */ + public function reserverShouldDisplayItems() { + $this->assertXPath('//div[contains(@class,"items_wall")]'); + } +} + + + + class TemplatesSearchRecordsTest extends TemplatesIntonationTestCase { public function setUp() { parent::setUp();