diff --git a/application/modules/opac/views/scripts/abonne/prets.phtml b/application/modules/opac/views/scripts/abonne/prets.phtml index ec9698b836f121bed7e057eeacc63bf5c754a0e8..362847e6fea17b7d18233cd548257036f03afc60 100644 --- a/application/modules/opac/views/scripts/abonne/prets.phtml +++ b/application/modules/opac/views/scripts/abonne/prets.phtml @@ -26,7 +26,8 @@ if($this->fiche["erreur"]) echo '<p class="error">' . $this->fiche["erreur"] . ' echo '<td width="15px" align="center"><b>'.$num++.'</b></td>'; echo '<td>'.$this->tagAnchor($this->url(array('controller' => 'recherche', 'action' => 'viewnotice', - 'id' => $emprunt->getNoticeOPACId())), + 'id' => $emprunt->getNoticeOPACId(), + 'retour_abonne' => 'prets')), $emprunt->getTitre()).'</td>'; echo '<td>'.$emprunt->getAuteur().'</td>'; echo '<td>'.$emprunt->getBibliotheque().'</td>'; diff --git a/application/modules/opac/views/scripts/abonne/reservations.phtml b/application/modules/opac/views/scripts/abonne/reservations.phtml index 845e290af9208ed70ba3a86362353d740386643b..daba51f16a31ab7ac7b1c19aaf7234385d9939f6 100644 --- a/application/modules/opac/views/scripts/abonne/reservations.phtml +++ b/application/modules/opac/views/scripts/abonne/reservations.phtml @@ -34,8 +34,9 @@ <td width="15px" align="center"><b><?php echo $num++;?></b></td> <td> <?php echo $this->tagAnchor($this->url(array('controller' => 'recherche', - 'action' => 'viewnotice', - 'id' => $resa->getNoticeOPACId())), + 'action' => 'viewnotice', + 'id' => $resa->getNoticeOPACId(), + 'retour_abonne' => 'reservations')), $resa->getTitre()); ?> </td> diff --git a/library/Class/CriteresRecherche.php b/library/Class/CriteresRecherche.php index 96e51176136ebb0e530aa755d4dff16e33d8fde2..9c5ab29520ff5d3c606f71e3d44fc6e16282fb97 100644 --- a/library/Class/CriteresRecherche.php +++ b/library/Class/CriteresRecherche.php @@ -41,6 +41,7 @@ class Class_CriteresRecherche { 'id_catalogue' => "Catalogue", 'id_panier' => "Panier", 'retour_panier' => "Panier", + 'retour_abonne' => "Retour compte", 'operateur_editeur'=> "op editeur", 'operateur_titres'=> '', 'operateur_auteurs'=> '', @@ -497,6 +498,10 @@ class Class_CriteresRecherche { 'action' => 'index', 'id_panier' => $this->_params['retour_panier']] ; + if (array_key_exists('retour_abonne',$this->_params)) + return ['controller' => 'abonne', + 'action' => $this->_params['retour_abonne']] ; + if (array_key_exists('id_panier',$this->_params)) return ['controller' => 'recherche', 'action' => 'simple', diff --git a/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php b/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php index be58cd4a854910ed9c03e6401f9189849c56e736..8fe1e750cf5d1d625ae3df6988f5fc9b8775fd81 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerPretsTest.php @@ -84,6 +84,15 @@ class AbonneControllerPretsListTwoPretsTest extends AbstractAbonneControllerPret 'Bibliotheque' => 'Almont', 'N° de notice' => '5678')); + $exemplaire_alice = Class_Exemplaire::newInstanceWithId(918, ['id_origine' => 5678, + 'notice' => Class_Notice::newInstanceWithId(827, + ['titre_principal' => 'Alice'])]); + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Exemplaire') + ->whenCalled('findFirstBy') + ->with(['id_origine' => 5678]) + ->answers($exemplaire_alice); + + $emprunteur = new Class_WebService_SIGB_Emprunteur('1234', 'Florence'); $emprunteur->empruntsAddAll(array($potter, $alice)); @@ -131,7 +140,8 @@ class AbonneControllerPretsListTwoPretsTest extends AbstractAbonneControllerPret } public function testViewTitreAlice() { - $this->assertXPathContentContains("//tbody/tr[1][@class=\"pret_en_retard\"]//td", 'Alice'); + $this->assertXPathContentContains("//tbody/tr[1][@class=\"pret_en_retard\"]//td//a[contains(@href, '/recherche/viewnotice/id/827/retour_abonne/prets')]", + 'Alice'); } public function testViewBibAliceIsAlmont() { @@ -177,16 +187,24 @@ class AbonneControllerPretsListTwoPretsTest extends AbstractAbonneControllerPret class AbonneControllerPretsListReservationTest extends AbstractAbonneControllerPretsTestCase { - protected $_potter; - public function setUp() { parent::setUp(); $potter = new Class_WebService_SIGB_Reservation('12', new Class_WebService_SIGB_Exemplaire(123)); - $this->_potter = $potter->getExemplaire()->setTitre('Potter'); + $potter->getExemplaire()->setTitre('Potter'); $potter->parseExtraAttributes(array('Etat' => 'Réservation émise', 'Rang' => '2', - 'Bibliotheque' => 'Tombouctou')); + 'Bibliotheque' => 'Tombouctou', + 'N° de notice' => 564)); + + $exemplaire_potter = Class_Exemplaire::newInstanceWithId(918, ['id_origine' => 564, + 'notice' => Class_Notice::newInstanceWithId(823, + ['titre_principal' => 'Potter'])]); + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Exemplaire') + ->whenCalled('findFirstBy') + ->with(['id_origine' => 564]) + ->answers($exemplaire_potter); + $emprunteur = new Class_WebService_SIGB_Emprunteur('1234', 'Florence'); $emprunteur->reservationsAddAll(array($potter)); @@ -241,8 +259,10 @@ class AbonneControllerPretsListReservationTest extends AbstractAbonneControllerP /** @test */ - public function titreShouldBePotter() { - $this->assertXPathContentContains('//tbody/tr[1]//td', 'Potter'); + public function titreShouldBePotterAndLinkToNotice() { + $this->assertXPathContentContains('//tbody/tr[1]//td//a[contains(@href, "recherche/viewnotice/id/823/retour_abonne/reservations")]', + 'Potter', + $this->_response->getBody()); } diff --git a/tests/library/Class/CriteresRechercheTest.php b/tests/library/Class/CriteresRechercheTest.php index 1e731fe61aaaba214547bcc655e554dabb0f5b28..256e5a5b40882fd5b455504df052597304f6264b 100644 --- a/tests/library/Class/CriteresRechercheTest.php +++ b/tests/library/Class/CriteresRechercheTest.php @@ -70,6 +70,12 @@ class CriteresRerchercheRetourTest extends AbstractControllerTestCase { [['retour_panier' => '23'], ['controller' => 'panier', 'action' => 'index', 'id_panier' => '23']], + + [['retour_abonne' => 'prets'], ['controller' => 'abonne', + 'action' => 'prets']], + + [['retour_abonne' => 'reservations'], ['controller' => 'abonne', + 'action' => 'reservations']], ]; }