From e85b340d782184c6688476d586ab2574672a3202 Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@afi-sa.fr>
Date: Fri, 25 Sep 2015 10:33:41 +0200
Subject: [PATCH] dev #17782 print fusion

Better print link
---
 .../scripts/recherche/resultatRecherche.phtml | 31 ++++++++++---------
 library/ZendAfi/View/Helper/TagPrintLink.php  | 16 ++++++----
 public/opac/css/global.css                    |  6 ++++
 .../RechercheControllerPrintActionTest.php    |  4 ++-
 4 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml b/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml
index fb80ae1d1db..14c74a9b7aa 100644
--- a/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml
+++ b/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml
@@ -34,31 +34,32 @@ if ($this->is_pertinence) {
     <span>
       <?php
       echo $this->tagAnchor($this->url($this->criteres_recherche->getUrlRetourRechercheInitiale(), null, true),
-                            sprintf('&raquo; %s',
-                                    $this->_('Retour à la recherche initiale')));?>
+                            $this->_('Retour à la recherche initiale'));?>
     </span>
 
     <span>
       <?php echo $this->tagAnchor($this->url($this->criteres_recherche->getUrlNouvelleRecherche(), null, true),
-                                  '&raquo; '.$this->_('Nouvelle recherche')); ?>
+                                  $this->_('Nouvelle recherche')); ?>
     </span>
 
 
-    <span>
-      <?php if ((int)$preferences['suggestion_achat'] == 1)
-        echo $this->tagAnchor(['controller' => 'abonne',
-                               'action' => 'suggestion-achat'],
-                              '&raquo; '.$this->_('Suggérer un achat'));?>
-    </span>
-<span class="print">
-<?php
-  echo $this->tagPrintLink($this->search_result->fetchRecords(), 'Notice_List');
-?>
-</span>
 
-  </div>
+    <?php
+    if ((int)$preferences['suggestion_achat'] == 1)
+      echo $this->tag('span',
+                      $this->tagAnchor(['controller' => 'abonne',
+                                        'action' => 'suggestion-achat'],
+                                       $this->_('Suggérer un achat')));
+    ?>
 
+    <span class="print">
+      <?php
+      echo $this->tagPrintLink($this->search_result->fetchRecords(), 'Notice_List');
+      ?>
+    </span>
+  </div>
 </div>
+
 <?php
 $this->closeBoite();
 ?>
diff --git a/library/ZendAfi/View/Helper/TagPrintLink.php b/library/ZendAfi/View/Helper/TagPrintLink.php
index 2d7b1559eb3..65344b69958 100644
--- a/library/ZendAfi/View/Helper/TagPrintLink.php
+++ b/library/ZendAfi/View/Helper/TagPrintLink.php
@@ -26,15 +26,17 @@ class ZendAfi_View_Helper_TagPrintLink  extends Zend_View_Helper_HtmlElement {
     if(!$models)
       return '';
 
-    if (!$model_fusion=Class_ModeleFusion::getFusionForStrategyAndProfil($strategy,       Class_Profil::getCurrentProfil()->getId())) {
+    if (!$model_fusion=Class_ModeleFusion::getFusionForStrategyAndProfil($strategy,
+                                                                         Class_Profil::getCurrentProfil()->getId())) {
       if(!$model_fusion = Class_ModeleFusion::getFusionForStrategy($strategy))
         return '';
     }
 
-    $ids = array_map(function($model) {
-                                         return $model->getId();
-
-                                       }, $models);
+    $ids = array_map(
+                     function($model) {
+                       return $model->getId();
+                     },
+                     $models);
 
 
     $url = $this->view->url( ['action' => 'print',
@@ -42,7 +44,9 @@ class ZendAfi_View_Helper_TagPrintLink  extends Zend_View_Helper_HtmlElement {
                               'strategy' => $strategy,
                               'modele_fusion' => $model_fusion->getId()]);
 
-    return  $this->view->tagAnchor($url, $this->view->_('Imprimer'));
+    return  $this->view->tagAnchor($url,
+                                   $this->view->_('Imprimer'),
+                                   ['target' => '_blank']);
   }
 }
 ?>
\ No newline at end of file
diff --git a/public/opac/css/global.css b/public/opac/css/global.css
index 305d4d6485a..1be6e988a55 100644
--- a/public/opac/css/global.css
+++ b/public/opac/css/global.css
@@ -1366,6 +1366,12 @@ body.abonne_multimedia-hold-view .actions a {
     padding-right: 10px;
 }
 
+
+.recherche_actions a:before {
+    content: "» ";
+}
+
+
 #menu_horizontal {
     position: relative;
 }
diff --git a/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php b/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php
index 04d1e6fe44b..d031b70f434 100644
--- a/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php
+++ b/tests/application/modules/opac/controllers/RechercheControllerPrintActionTest.php
@@ -51,7 +51,9 @@ class RechercheControllerPrintActionLinkTest extends AbstractControllerTestCase
 
   /** @test */
   public function printLinkShouldBePresent() {
-    $this->assertXPathContentContains('//a[contains(@href, "/recherche/print/id_catalogue/3/id_module/9/aleatoire/1/filtres/APaul%3B/ids/1/strategy/Notice_List/modele_fusion/1")]', 'Imprimer',$this->_response->getBody());
+    $this->assertXPathContentContains('//a[contains(@href, "/recherche/print/id_catalogue/3/id_module/9/aleatoire/1/filtres/APaul%3B/ids/1/strategy/Notice_List/modele_fusion/1")][@target="_blank"]',
+                                      'Imprimer',
+                                      $this->_response->getBody());
   }
 }
 
-- 
GitLab