diff --git a/VERSIONS_HOTLINE/138657 b/VERSIONS_HOTLINE/138657 new file mode 100644 index 0000000000000000000000000000000000000000..52bf11b38d52f10faa07ddf70b5aedea41bd0d5b --- /dev/null +++ b/VERSIONS_HOTLINE/138657 @@ -0,0 +1 @@ + - ticket #138657 : Administration : correction du lien d'accès aux paniers dans la liste des utilisateurs dans le contexte du magasin de thèmes. \ No newline at end of file diff --git a/application/modules/opac/views/scripts/panier/viewauteur.phtml b/application/modules/opac/views/scripts/panier/viewauteur.phtml index 443d230e709216fdad487872fcfb8573689162df..3a490d305775b4dbcfa1c0430d4922a9b796b09b 100644 --- a/application/modules/opac/views/scripts/panier/viewauteur.phtml +++ b/application/modules/opac/views/scripts/panier/viewauteur.phtml @@ -1,31 +1,2 @@ <?php -$this->openBoite($this->_('Les paniers de %s',$this->name)); - -echo $this->tag('span', - $this->_plural(count($this->paniers), - "Il n\'y a aucun panier.", - "Il y a %d panier", - "Il y a %d paniers", - count($this->paniers)), - ['class' => 'abonne', - 'id' => 'abonne_erreur']); - -$panier_domain = $this->tagAnchor($this->url(['controller' => 'panier', - 'action' => 'domain'], null ,true), - $this->_('Voir les paniers rangés dans des domaines'), - ['class' => 'bouton']); - -$panier_pro = $this->tagAnchor($this->url(['controller' => 'panier', - 'action' => 'pro'], null ,true), - $this->_('Voir les paniers des professionnels'), - ['class' => 'bouton']); - -echo $this->tag('div', $panier_domain . $panier_pro); - -echo $this->panier_Table($this->paniers, [], [], [], 2); - -if($this->erreur) - echo $this->tag('script', sprintf('alert("%s")', $this->erreur)); - -$this->closeBoite(); -?> +echo $this->Panier_Viewauteur($this->name, $this->paniers); diff --git a/library/ZendAfi/View/Helper/Panier/Viewauteur.php b/library/ZendAfi/View/Helper/Panier/Viewauteur.php new file mode 100644 index 0000000000000000000000000000000000000000..bbb8a8edd5083cb979aaa67ce7bf762a737f1a45 --- /dev/null +++ b/library/ZendAfi/View/Helper/Panier/Viewauteur.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_View_Helper_Panier_Viewauteur extends ZendAfi_View_Helper_BaseHelper { + public function Panier_Viewauteur($name, $paniers) { + $html = [$this->view->openBoiteContent($this->_('Les paniers de %s',$name)), + $this->_tag('span', + $this->_plural(count($paniers), + "Il n\'y a aucun panier.", + "Il y a %d panier", + "Il y a %d paniers", + count($paniers)), + ['class' => 'abonne', + 'id' => 'abonne_erreur'])]; + + $panier_domain = $this->view->tagAnchor($this->view->url(['controller' => 'panier', + 'action' => 'domain'], null ,true), + $this->_('Voir les paniers rangés dans des domaines'), + ['class' => 'bouton']); + + $panier_pro = $this->view->tagAnchor($this->view->url(['controller' => 'panier', + 'action' => 'pro'], null ,true), + $this->_('Voir les paniers des professionnels'), + ['class' => 'bouton']); + + $html [] = $this->_tag('div', $panier_domain . $panier_pro); + + $html [] = $this->view->panier_Table($paniers, [], [], [], 2); + + if($this->view->erreur) + $html [] = $this->_tag('script', sprintf('alert("%s")', $this->view->erreur)); + + $html [] = $this->view->closeBoiteContent(); + + return implode($html); + } +} diff --git a/library/templates/Intonation/System/Abstract.php b/library/templates/Intonation/System/Abstract.php index 524d1486954d81d0be6eebde2b88354ce0bdb548..d92e336cd2d6121f5078390762f318f2c30ac258 100644 --- a/library/templates/Intonation/System/Abstract.php +++ b/library/templates/Intonation/System/Abstract.php @@ -166,6 +166,7 @@ abstract class Intonation_System_Abstract { if($this->isVisibleForUserController()) { $controllers [] = 'abonne'; + $controllers [] = 'panier'; $controllers [] = 'drive-checkout'; } diff --git a/library/templates/Intonation/View/Panier/Viewauteur.php b/library/templates/Intonation/View/Panier/Viewauteur.php new file mode 100644 index 0000000000000000000000000000000000000000..c42f3a4f38584b1516322ba1a6f9cb2f7073924a --- /dev/null +++ b/library/templates/Intonation/View/Panier/Viewauteur.php @@ -0,0 +1,28 @@ +<?php +/** + * Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Intonation_View_Panier_Viewauteur extends ZendAfi_View_Helper_BaseHelper { + public function Panier_Viewauteur($name, $paniers) { + $this->view->titre = $this->_('Les sélections de %s', $name); + return $this->view->abonne_Selections($paniers); + } +} diff --git a/library/templates/Intonation/View/SocialNetworksActions.php b/library/templates/Intonation/View/SocialNetworksActions.php index 520934b0c89a071dc1ed9a141d1cf56f78ccd305..74cf210198be5993fb84c630fcc1d91d8735e2bc 100644 --- a/library/templates/Intonation/View/SocialNetworksActions.php +++ b/library/templates/Intonation/View/SocialNetworksActions.php @@ -47,7 +47,7 @@ class Intonation_View_SocialNetworksActions extends ZendAfi_View_Helper_ReseauxS public function links($info_to_share) { $this->shareLinkHtmlHeader($info_to_share); - $this->_actions [] = $this->view->permalink($this->view->absoluteUrl($info_to_share['url_to_share'])); + $this->_actions [] = $this->view->Template_Permalink($this->view->absoluteUrl($info_to_share['url_to_share'])); return ''; } } diff --git a/library/templates/Intonation/View/Permalink.php b/library/templates/Intonation/View/Template/Permalink.php similarity index 91% rename from library/templates/Intonation/View/Permalink.php rename to library/templates/Intonation/View/Template/Permalink.php index 09a20893195046970a69e16a8b38705612596ad3..afe778af0c17cf760bb4e0e15303d0971fd14425 100644 --- a/library/templates/Intonation/View/Permalink.php +++ b/library/templates/Intonation/View/Template/Permalink.php @@ -18,9 +18,9 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Intonation_View_Permalink extends ZendAfi_View_Helper_BaseHelper { +class Intonation_View_Template_Permalink extends ZendAfi_View_Helper_BaseHelper { - public function permalink($url) { + public function Template_Permalink($url) { return (new Intonation_Library_Link) ->setText($this->_('Lien …')) ->setImage($this->view->templateIco('permalink', 'utils')) diff --git a/tests/scenarios/Templates/TemplatesAbonneSelectionsTest.php b/tests/scenarios/Templates/TemplatesAbonneSelectionsTest.php index 1c7d91c1e8253ec49d9464a32e5c0c92b4213ef3..5e702dbf00b9065170156dd9e7795f6aedeb9741 100644 --- a/tests/scenarios/Templates/TemplatesAbonneSelectionsTest.php +++ b/tests/scenarios/Templates/TemplatesAbonneSelectionsTest.php @@ -71,6 +71,36 @@ abstract class TemplatesAbonneSelectionsTestCase extends TemplatesIntonationTest +class TemplatesAbonneShowUserCartAsAdminTest extends Admin_AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + + $this->_buildTemplateProfil(['id' => 2]); + + $admin = Class_Users::newInstanceWithId('123456',['nom'=>'Zozor'])->beAdminPortail(); + + $this->fixture(Class_PanierNotice::class, + ['id' => 67, + 'libelle' => 'Zozor sélection', + 'id_user' => 123456]); + + $this->dispatch('/opac/panier/viewauteur/id/123456'); + } + + + /** @test */ + public function shouldRenderZozorSelection() { + $this->assertXPathContentContains('//body[contains(@class, "template_INTONATION")]//div[contains(@class,"card-title")]//a[contains(@href, "id_panier/67")]', 'Zozor sélection'); + } +} + + + + class TemplatesAbonneSelectionsAsAbonneTest extends TemplatesAbonneSelectionsTestCase { public function setUp() { parent::setUp();