From a8b9728ddce45b04fe411b188be6c29418d4ef65 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT <hdlaurent@afi-sa.fr> Date: Tue, 14 Sep 2021 16:54:28 +0200 Subject: [PATCH] hotline#137304 : Worklfow : link sent in email for article validation in workflow is now pointing intranet --- VERSIONS_HOTLINE/137304 | 1 + library/Class/Article/WorkflowNotification.php | 2 +- library/ZendAfi/View/Helper/TagEditArticle.php | 14 ++++++++++---- .../admin/controllers/CmsControllerTest.php | 8 ++++---- 4 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 VERSIONS_HOTLINE/137304 diff --git a/VERSIONS_HOTLINE/137304 b/VERSIONS_HOTLINE/137304 new file mode 100644 index 00000000000..0e487e0b7b4 --- /dev/null +++ b/VERSIONS_HOTLINE/137304 @@ -0,0 +1 @@ + - ticket #137304 : workflow : L'url dans le mail de notification d'article à valider pointe maintenant sur l'interface professionnelle \ No newline at end of file diff --git a/library/Class/Article/WorkflowNotification.php b/library/Class/Article/WorkflowNotification.php index 8dbdafc26b3..eba88cba601 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' => Class_Url::absolute($this->_article->getUrl(), null, true), + 'URL_ARTICLE' => (new ZendAfi_View_Helper_TagEditArticle)->getEditUrl($this->_article), '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 6a5405556f6..ff629920a19 100644 --- a/library/ZendAfi/View/Helper/TagEditArticle.php +++ b/library/ZendAfi/View/Helper/TagEditArticle.php @@ -59,10 +59,8 @@ class ZendAfi_View_Helper_TagEditArticle extends ZendAfi_View_Helper_BaseHelper protected function _renderEdit() { return $this ->_renderActionLink('edit', $this->_('Modifier l\'article %s', $this->_article->getTitre()), - ['module' => 'admin', - 'controller' => 'cms', - 'action' => 'edit', - 'id' => $this->_article->getId()]); + $this->getEditUrl($this->_article)); + } @@ -86,4 +84,12 @@ class ZendAfi_View_Helper_TagEditArticle extends ZendAfi_View_Helper_BaseHelper return $this->view->tagAnchor($url, $icon, ['data-popup' => 'true', 'title' => $label]); } + + + public function getEditUrl($article) { + return Class_Url::absolute(['module' => 'admin', + 'controller' => 'cms', + 'action' => 'edit', + 'id' => $article->getId()]); + } } diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index 8859c19d9ca..79f90eccddf 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -1722,7 +1722,7 @@ class CmsControllerNewsAddActionPostWithWorkflowTest /** @test */ public function sentMailToAuthorWhenNewsIsValidatedShouldContainsDefaultBody() { $this->postArticleValidated(); - $this->assertEquals('L\'article Katsuhiro Otomo en dédicace ! a été validé par Mario Super. http://localhost'.BASE_URL.'/cms/articleview/id/18',quoted_printable_decode($this->mock_transport->getSentMails()[0]->getBodyText()->getContent())); + $this->assertEquals('L\'article Katsuhiro Otomo en dédicace ! a été validé par Mario Super. http://localhost'.BASE_URL.'/admin/cms/edit/id/18',quoted_printable_decode($this->mock_transport->getSentMails()[0]->getBodyText()->getContent())); } @@ -1819,7 +1819,7 @@ class CmsControllerNewsAddActionPostWithWorkflowTest /** @test */ public function sentMailToAdminWhenValidationPendingShouldContainsDefaultText() { $this->postArticleAValider(); - $this->assertEquals('Un nouvel article de Batman est à valider. Katsuhiro Otomo en dédicace ! http://localhost'.BASE_URL.'/cms/articleview/id/18',quoted_printable_decode($this->mock_transport->getSentMails()[0]->getBodyText()->getContent())); + $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())); } @@ -1939,7 +1939,7 @@ class CmsControllerNewsAddActionPostWithDynamicWorkflowTest extends CmsControll * @test */ public function sentMailShouldContainsStatuses($content) { - $this->assertEquals('Un nouvel article de Mario Super est passé dans l\'état "À valider" et vous devez vérifier pour l\'état "A lire". Katsuhiro Otomo en dédicace ! http://localhost'.BASE_URL.'/cms/articleview/id/5', + $this->assertEquals('Un nouvel article de Mario Super est passé dans l\'état "À valider" et vous devez vérifier pour l\'état "A lire". Katsuhiro Otomo en dédicace ! http://localhost'.BASE_URL.'/admin/cms/edit/id_cat/23/id/5', $content); } @@ -2037,7 +2037,7 @@ class CmsControllerWorkflowArticleRefusedTest extends CmsControllerWorkflowTestC ->getBodyText() ->getContent()); $this->assertContains('L\'article "Katsuhiro Otomo en dédicace !', $body_mail); - $this->assertContains('/cms/articleview/id/4', $body_mail); + $this->assertContains('/admin/cms/edit/id/4', $body_mail); $this->assertContains('a été refusé par "Mario Super". Votre article laisse à désirer, à revoir de fond en comble immédiatement.', $body_mail); -- GitLab