Skip to content
Snippets Groups Projects
Commit 47293b67 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Merge branch 'hotline_#14170' into 'hotline_6.45'

Hotline #14170
parents 31b548ce 6eb190a8
Branches
Tags
2 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!215Dev#12992 Custom Fields
......@@ -143,9 +143,10 @@ class AbonneController extends ZendAfi_Controller_Action {
public function delavisnoticeAction(){
$this->_forward('delavisnotice', 'blog', 'opac', ['id' => $this->_getParam('id'),
'redirect' => 'abonne/viewavis/id/'.$this->_user->getId()]);
'redirect' =>'abonne/viewavis/id/'.$this->_user->getId(),
'js_redirect' => $this->_getParam('expressionRecherche')? true: false]);
}
private function handleAvis($readSourceMethod, $writeAvisMethod) {
$cls_user= new Class_Users();
......
......@@ -22,7 +22,7 @@
// OPAC3: Blog
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class BlogController extends Zend_Controller_Action {
class BlogController extends ZendAfi_Controller_Action {
use Trait_Translator;
private $_user = null; // Le user connecté
......@@ -75,9 +75,13 @@ class BlogController extends Zend_Controller_Action {
$avis->delete();
$this->_helper->notify($this->_("Avis supprimé"));
}
if(!$this->_getParam('js_redirect') === true){
$redirect = $this->_getParam('redirect', 'blog/viewauteur/id/'.$avis->getIdUser());
$this->_redirect($redirect);
return;
}
$redirect = $this->_getParam('redirect', 'blog/viewauteur/id/'.$avis->getIdUser());
$this->_redirect($redirect);
$this->_javascriptRedirectToReferrer();
}
......
......@@ -71,7 +71,7 @@ class ZendAfi_View_Helper_Notice_Avis extends Zend_View_Helper_HtmlElement {
$avis_helper = $this->view->getHelper('Avis');
if (($user = Class_Users::getIdentity())
&& $user->isBibliothecaire())
$avis_helper->setAdminActions(['edit']);
$avis_helper->setAdminActions(['edit', 'del']);
$html.='<tr><td colspan="3">&nbsp;</td></tr>';
$html.='<tr><td class="notice_info_ligne_titre" align="left" colspan="3">' . $avis[$source]["titre"] . '</td></tr>';
......
......@@ -862,4 +862,29 @@ class AbonneControllerEditAvisNoticeAdminLoggedPostActionTest extends AbstractCo
}
}
class AbonneControllerDeleteAvisNoticeAdminLoggedActionTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$_SERVER['HTTP_REFERER'] ='opac/recherche/viewnotice/id/1';
$avis = $this->fixture('Class_AvisNotice', ['id' => 54,
'entete' => 'Bonjour !',
'avis' => 'Ceci est le contenu de l\'avis']);
$this->dispatch('/opac/abonne/delavisnotice/id/54/expressionRecherche/1', true);
}
/** @test */
public function avisShouldBeRemoved() {
$this->assertEmpty(Class_AvisNotice::findAll());
}
/** @test */
public function shouldContainsSciptToRedirectToReferer() {
$this->assertContains('window.location=\"opac\/recherche\/viewnotice\/id\/1\"', $this->_response->getBody());
}
}
?>
\ No newline at end of file
......@@ -1053,6 +1053,12 @@ class NoticeAjaxControllerNoticeWithAvisEditLinkModoLoggedTest extends NoticeAja
public function editLinkShouldBePopup() {
$this->assertXPath('//a[contains(@href, "abonne/editavisnotice")][@data-popup="true"]');
}
/** @test */
public function deleteLinkShouldBePresent() {
$this->assertXPath('//a[contains(@href, "abonne/delavisnotice")]');
}
}
......
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