Commit d2adf40c authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline #72655 fix redirectToReferer when called from popup action

parent 6b388083
Pipeline #3698 failed with stage
in 31 minutes and 4 seconds
- ticket #72655 : Avis : correction de l'affichage après un ajout depuis la vue notice.
\ No newline at end of file
......@@ -177,6 +177,7 @@ class AbonneController extends ZendAfi_Controller_Action {
$this->_user
->setPseudo($this->_request->getParam('avisSignature'))
->save();
$this->_helper->notify($this->_('Votre avis à bien été enregistré'));
return $this->_redirectToReferer();
}
......
......@@ -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;
}
......@@ -232,7 +231,9 @@ class ZendAfi_Controller_Action extends Zend_Controller_Action {
public function _redirectToReferer() {
return $this->_redirect($this->_getReferer());
return $this->isPopupRequest()
? $this->_javascriptRedirectToReferrer()
: parent::_redirect($this->_getReferer());
}
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment