diff --git a/VERSIONS_HOTLINE/81317 b/VERSIONS_HOTLINE/81317 new file mode 100644 index 0000000000000000000000000000000000000000..28c9c28e2cdb1b513ea66e1299e1fc0e8d820a07 --- /dev/null +++ b/VERSIONS_HOTLINE/81317 @@ -0,0 +1 @@ + - ticket #81317 : Page notice : prise en compte de la feuille de style XSLT pour les périodiques \ No newline at end of file diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index 6563d0e58837c893bb29cec19b0ec8e6c57a4f60..748afc908e7ca8a7f034a5047843d41c98c7127e 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -154,17 +154,17 @@ class NoticeAjaxController extends Zend_Controller_Action { return; } + $xsl = (new Class_Notice_Xsl($notice, Class_Profil::getCurrentProfil())); + if ($xsl->isEnabled()) + return $this->_sendResponseWithScripts($this->view->Notice_Xsl($xsl)); + if ($notice->isPeriodique()) { $periodiques = $this->notice->getArticlesPeriodique($this->id_notice); - $this->_sendResponseWithScripts($this->notice_html->getArticlesPeriodique($periodiques)); - return; + return $this->_sendResponseWithScripts($this->notice_html->getArticlesPeriodique($periodiques)); } - $xsl = (new Class_Notice_Xsl($notice, Class_Profil::getCurrentProfil())); - $html = $xsl->isEnabled() - ? $this->view->Notice_Xsl($xsl) - : $this->view->notice_Entete($notice, ['entete' => Class_Codification::CHAMPS]); + $html = $this->view->notice_Entete($notice, ['entete' => Class_Codification::CHAMPS]); $this->_sendResponseWithScripts($html); } diff --git a/tests/scenarios/Xsl/XslTest.php b/tests/scenarios/Xsl/XslTest.php index 20122d6be11d900bd4fdcf0d231a3eb85203a681..1c53428996ea647d04cf1bce52b61ccab8a634ae 100644 --- a/tests/scenarios/Xsl/XslTest.php +++ b/tests/scenarios/Xsl/XslTest.php @@ -111,14 +111,12 @@ class XslDocTypeConfigurationPostDispatchTest extends Admin_AbstractControllerTe } - -class XslNoticeajaxDetailDispatchTest extends AbstractControllerTestCase { - +abstract class XslNoticeajaxDetailTestCase extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); - Storm_Cache::beVolatile(); $disk = $this->mock() @@ -173,15 +171,61 @@ class XslNoticeajaxDetailDispatchTest extends AbstractControllerTestCase { 'type_doc' => 1, 'unimarc' => "01185nam0 2200217 450 0010005000000100031000050350016000360900009000520990038000611000041000991010008001402000036001482100013001842150011001973300660002083330010008686760006008787000028008848010026009129020029009382774 a2-84563-280-0d19,90 Euros aALOES355754 a2774 c2017-12-11d2018-03-16tLIVREx12 a20171211 frey50 afre aSeras-tu là ?fGuillaume Musso cXOd2012 a301 p. aUn seul geste aurait suffi pour tout changer. Qui n'a jamais rêvé de revenir à cet instant décisif où le bonheur était possible ? San Francisco. Elliott, médecin passionné, ne s'est jamais consolé de la disparition d'Ilena, la femme qu'il aimait, morte il y a trente ans. Un jour, par une circonstance extraordinaire, il est ramené en arrière et rencontre le jeune homme qu'il était, trente ans plus tôt. Il est revenu à l'instant décisif où un geste de lui peut sauver Ilena. Et modifier l'implacable destin qui a figé son sort à jamais. Un stupéfiant face-à -face, Une histoire d'amour bouleversante, Un suspense à couper le souffle. aAG 14 aR aMussobGuillaume960415 aFRbCALUIREc20060516 981440aroman francophone"]); - $this->dispatch('/opac/noticeajax/detail/id_notice/5', true); } + + public function tearDown() { Storm_Cache::setDefaultZendCache(null); parent::tearDown(); } +} + + + + +class XslNoticeBookAjaxDetailDispatchTest extends XslNoticeajaxDetailTestCase { + public function setUp() { + parent::setUp(); + + $this->dispatch('/opac/noticeajax/detail/id_notice/5', true); + } + + + /** @test */ + public function shouldNotRedirect() { + $this->assertNotRedirect(); + } + + + /** @test */ + public function shouldDisplayMarcWithXslt() { + $this->assertContains('<strong>Numéro de notice Koha : </strong>2774</li><br><li>', $this->_response->getBody()); + } +} + + + + +class XslNoticeSerialAjaxDetailDispatchTest extends XslNoticeajaxDetailTestCase { + public function setUp() { + parent::setUp(); + Class_Notice::find(5) + ->setTypeDoc(Class_TypeDoc::PERIODIQUE) + ->assertSave(); + + $profile = Class_Profil::getCurrentProfil(); + $profile->setCfgModulesPreferences(['xslt' => '/tests/scenarios/Xsl/record_description.xsl'], + 'recherche', + 'viewnotice', + Class_TypeDoc::PERIODIQUE); + $profile->save(); + + $this->dispatch('/opac/noticeajax/detail/id_notice/5', true); + } + /** @test */ public function shouldNotRedirect() {