diff --git a/VERSIONS_HOTLINE/72655 b/VERSIONS_HOTLINE/72655 new file mode 100644 index 0000000000000000000000000000000000000000..465b1dc9841c90b67af357619f3fcb479d9f4808 --- /dev/null +++ b/VERSIONS_HOTLINE/72655 @@ -0,0 +1,2 @@ + - ticket #72655 : Avis : correction de l'affichage après un ajout depuis la vue notice. + \ No newline at end of file diff --git a/application/modules/opac/controllers/AbonneController.php b/application/modules/opac/controllers/AbonneController.php index 7a30d6aa0666f3ca85f05c63e4a7430e4f85c80b..38f4a80f32e763387b0390f37853b50d5443ab23 100644 --- a/application/modules/opac/controllers/AbonneController.php +++ b/application/modules/opac/controllers/AbonneController.php @@ -177,7 +177,8 @@ class AbonneController extends ZendAfi_Controller_Action { $this->_user ->setPseudo($this->_request->getParam('avisSignature')) ->save(); - return $this->_redirectToReferer(); + $this->_helper->notify($this->_('Votre avis à bien été enregistré')); + return $this->_redirectClose($this->_getReferer()); } $this->view->message = implode('.', $avis->getErrors()); diff --git a/library/ZendAfi/Controller/Action.php b/library/ZendAfi/Controller/Action.php index cc7ebae462ee5665e2ed770117cac2abd748f6d9..0c011abe7cad248851b9944d68d37a392b925410 100644 --- a/library/ZendAfi/Controller/Action.php +++ b/library/ZendAfi/Controller/Action.php @@ -116,7 +116,6 @@ class ZendAfi_Controller_Action extends Zend_Controller_Action { } - protected function _popupJavascriptRedirectTo($url, $message = null) { if($message) $this->_helper->notify($message); @@ -211,7 +210,7 @@ class ZendAfi_Controller_Action extends Zend_Controller_Action { $this->getHelper('flashMessenger') ->addMessage([ZendAfi_Controller_Action_Helper_FlashMessenger::POPUP => ['url' => $popup_url]]); - parent::_redirect($location ? $location :$this->_getReferer()); + parent::_redirect($location ? $location : $this->_getReferer()); return $this; } diff --git a/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php b/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php index cd7f75bc5027976d7308495617e73144e5c65759..a1aff68f6802c40724124fb80e93f99858de157f 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerAvisTest.php @@ -1052,7 +1052,7 @@ class AbonneControllerAddAvisNoticeAdminLoggedPostActionTest extends AbstractCon 'clef_alpha' => 'GARCONNIERELA--GREMILLONH--FLAMMARION-2013-1', 'type_doc' => Class_TypeDoc::LIVRE]); - $this->postDispatch('/opac/abonne/avis/id_notice/1190178', + $this->postDispatch('/opac/abonne/avis/id_notice/1190178/render/popup', ['avisEntete' => 'bye', 'avisTexte' => 'ceci n\'est pas le contenu', 'avisNote' => 4, @@ -1067,4 +1067,16 @@ class AbonneControllerAddAvisNoticeAdminLoggedPostActionTest extends AbstractCon public function avisTypeDocShouldBeBook() { $this->assertEquals(Class_TypeDoc::LIVRE, $this->avis->getTypeDoc()); } + + + /** @test */ + public function shouldRedirectWithJavascript() { + $this->assertXPathContentContains('//script', 'location.reload()'); + } + + + /** @test */ + public function shouldNotifySuccessfulSave() { + $this->assertFlashMessengerContentContains('Votre avis à bien été enregistré'); + } } \ No newline at end of file