diff --git a/VERSIONS_HOTLINE/154406 b/VERSIONS_HOTLINE/154406 new file mode 100644 index 0000000000000000000000000000000000000000..f07e652b91d016f3544e37a171999df6ebfe7711 --- /dev/null +++ b/VERSIONS_HOTLINE/154406 @@ -0,0 +1 @@ + - correctif #154406 : Administration : correction des liens d'accès aux articles à valider dans les emails. Lorsqu'un article brouillon était modifié dans un popup, le contexte de popup était ajouté au lien dans l'email. \ No newline at end of file diff --git a/library/Class/Article/WorkflowNotification.php b/library/Class/Article/WorkflowNotification.php index eba88cba6017c4a3120c281b1c7e6044bcfc9282..032d1fb81c6d30cec58cad1b56002e11d23a5c32 100644 --- a/library/Class/Article/WorkflowNotification.php +++ b/library/Class/Article/WorkflowNotification.php @@ -86,7 +86,7 @@ class Class_Article_WorkflowNotification { protected function _bodyText() { $replacements = ['TITRE_ARTICLE' => $this->_article->getTitre(), - 'URL_ARTICLE' => (new ZendAfi_View_Helper_TagEditArticle)->getEditUrl($this->_article), + 'URL_ARTICLE' => (new ZendAfi_View_Helper_TagEditArticle)->getEditUrl($this->_article, ['render' => null]), 'AUTHOR_ARTICLE' => $this->_article->getNomCompletAuteur(), 'SAVED_BY_ARTICLE' => $this->_user->getNomComplet(), 'NEXT_STATUS_ARTICLE' => $this->_article->getNextWorkflowStatusLabel(), diff --git a/library/ZendAfi/View/Helper/TagEditArticle.php b/library/ZendAfi/View/Helper/TagEditArticle.php index ff629920a19b1d8362a997e7948701d7e3577265..c69fef6a4913006bbcbba5144dea082d98745057 100644 --- a/library/ZendAfi/View/Helper/TagEditArticle.php +++ b/library/ZendAfi/View/Helper/TagEditArticle.php @@ -86,10 +86,12 @@ class ZendAfi_View_Helper_TagEditArticle extends ZendAfi_View_Helper_BaseHelper } - public function getEditUrl($article) { - return Class_Url::absolute(['module' => 'admin', - 'controller' => 'cms', - 'action' => 'edit', - 'id' => $article->getId()]); + public function getEditUrl(Class_Article $article, array $params = []) : string { + return + Class_Url::absolute(array_merge(['module' => 'admin', + 'controller' => 'cms', + 'action' => 'edit', + 'id' => $article->getId()], + $params)); } } diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index eda6f8f2a3ee2c174c42ac9fa36f29cf46d39a72..f0f31437dd46d5a3fab5de980c1a1e63262b99f0 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -1868,6 +1868,22 @@ class CmsControllerNewsAddActionPostWithWorkflowTest $this->assertEquals(Class_Article::STATUS_DRAFT, Class_Article::findFirstBy(['order' => 'id desc'])->getStatus()); } + + + /** @test */ + public function sentMailToAdminWhenValidationPendingInPopupShouldURLWithoutRenderPopup() { + Class_Article::find(18)->setStatus(Class_Article::STATUS_DRAFT)->save(); + $data = $this->_basePostDatas; + $data['status'] = Class_Article::STATUS_VALIDATION_PENDING; + $this->postDispatch('/admin/cms/edit/id/18/render/popup', $data); + $this->assertEquals('Un nouvel article de Batman est à valider. Katsuhiro Otomo en dédicace ! http://localhost' + . BASE_URL + . '/admin/cms/edit/id/18', + quoted_printable_decode(($this->mock_transport + ->getSentMails()[0] + ->getBodyText() + ->getContent()))); + } }