Commit 28e86bf4 authored by Sebastien ANDRE's avatar Sebastien ANDRE
Browse files

hotline #119892 : action invisble should save without validation

parent 90c92c4f
- ticket #119892 : Administration : Correction de l'archivage des avis de notices du magasin de thèmes
\ No newline at end of file
...@@ -37,15 +37,22 @@ class Admin_ModoController extends ZendAfi_Controller_Action { ...@@ -37,15 +37,22 @@ class Admin_ModoController extends ZendAfi_Controller_Action {
} }
public function invisibleavisnoticeAction() { public function invisibleavisnoticeAction() {
if (!$review_id=$this->_request->getParam('id',0)) if (!$review_id = $this->_request->getParam('id', 0))
$this->_forward('index'); return $this->_redirectToAvisNotice();
if(!$review = Class_AvisNotice::find($review_id)) if (!$review = Class_AvisNotice::find($review_id))
return $this->_forward('index'); return $this->_redirectToAvisNotice();
$review->setFlags(Class_AvisNotice::ARCHIVED_FLAG)->save(); if (!$review->setFlagArchived()
$this->_stayOnPage(); ->beImportMode()
->save()) {
$this->_helper->notify($this->_('Une erreur c\'est produite l\'avis n\'a pas pu être archivé.'));
return $this->_redirectToAvisNotice();
}
$this->_helper->notify($this->_('Avis archivé'));
$this->_redirectToAvisNotice();
} }
......
...@@ -138,4 +138,10 @@ trait Trait_Avis { ...@@ -138,4 +138,10 @@ trait Trait_Avis {
public function isAvisNotice() { public function isAvisNotice() {
return 'notices_avis' == $this->_table_name; return 'notices_avis' == $this->_table_name;
} }
public function setFlagArchived() {
$this->setFlags(static::ARCHIVED_FLAG);
return $this;
}
} }
...@@ -484,4 +484,37 @@ class AdminAvisModerationControllerCmsValidateAvisTest extends AdminAvisModerati ...@@ -484,4 +484,37 @@ class AdminAvisModerationControllerCmsValidateAvisTest extends AdminAvisModerati
} }
} }
?>
\ No newline at end of file
/* hotline : #119892 */
class AdminAvisModerationControllerEnteteEmptyTest
extends AdminAvisModerationControllerTestCase {
protected $_avis_notice;
public function setUp() {
parent::setUp();
$this->_avis_notice = Class_AvisNotice::find(38);
$this->_avis_notice
->beImportMode()
->setEntete('')
->save();
$this->dispatch('/admin/modo/invisibleavisnotice/status/0/active_tab/1/page/0/id/38');
}
/** @test */
public function statusShouldBeArchived() {
$this->assertEquals(Class_AvisNotice::ARCHIVED_FLAG,
$this->_avis_notice->getFlags());
}
/** @test */
public function flashMessengerShouldContainsAvisArchive() {
$this->assertFlashMessengerContentContains('Avis archivé');
}
}
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