From 37135fac4bc365e991c35bf0620f8f965caa092f Mon Sep 17 00:00:00 2001
From: Ghislain Loas <ghislo@sandbox.pergame.net>
Date: Thu, 21 Jan 2016 16:43:40 +0100
Subject: [PATCH] hotline #37032 fix multiple issues

---
 VERSIONS_HOTLINE/37032                                |  1 +
 .../modules/admin/views/scripts/catalogue/form.phtml  |  2 +-
 library/ZendAfi/View/Helper/Abonne/Abstract.php       |  4 ++--
 library/ZendAfi/View/Helper/Abonne/Settings.php       |  3 ++-
 .../admin/controllers/CatalogueControllerTest.php     |  7 +++++++
 .../opac/controllers/AbonneControllerFicheTest.php    | 11 +++++++++++
 6 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 VERSIONS_HOTLINE/37032

diff --git a/VERSIONS_HOTLINE/37032 b/VERSIONS_HOTLINE/37032
new file mode 100644
index 00000000000..07d22b1b92e
--- /dev/null
+++ b/VERSIONS_HOTLINE/37032
@@ -0,0 +1 @@
+ - ticket #37032 : Correction du lien de gestion des favoris situé sur l'icone. Ajout d'un message dans le formulaire des domaines sur la case à cocher "Peut être un favori utilisateur" indiquant la nécessité d'une intégration pour que le paramètrage fonctionne.
\ No newline at end of file
diff --git a/application/modules/admin/views/scripts/catalogue/form.phtml b/application/modules/admin/views/scripts/catalogue/form.phtml
index 0a444f5a267..229ab42adf6 100644
--- a/application/modules/admin/views/scripts/catalogue/form.phtml
+++ b/application/modules/admin/views/scripts/catalogue/form.phtml
@@ -46,7 +46,7 @@
             <td class="gauche"><?php echo $this->formCheckbox('indexer',
                                                               (int)$this->catalogue->getIndexer(),
                                                               null,
-                                                              [1, 0]); ?></td>
+                                                              [1, 0]); ?><span style="font-weight: bold; font-size: 0.9em;"><?php echo $this->traduire('Nécessite une intégration du catalogue pour être actif'); ?></span></td>
           </tr>
         </table>
       </fieldset>
diff --git a/library/ZendAfi/View/Helper/Abonne/Abstract.php b/library/ZendAfi/View/Helper/Abonne/Abstract.php
index d4c5bc5f7d4..8e1d526e1f9 100644
--- a/library/ZendAfi/View/Helper/Abonne/Abstract.php
+++ b/library/ZendAfi/View/Helper/Abonne/Abstract.php
@@ -19,13 +19,13 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
  */
 abstract class ZendAfi_View_Helper_Abonne_Abstract extends ZendAfi_View_Helper_BaseHelper {
-  public function tagFicheAbonne($html, $icone='', $url='') {
+  public function tagFicheAbonne($html, $icone='', $url='', $attribs = []) {
     if ($icone && $url) {
       $html = $this->view->tagAnchor($url,
                                      $this->view->tagImg(Class_Profil::getCurrentProfil()
                                                          ->getUrlImage('/abonnes/'.$icone.'.png'),
                                                          ['alt' => $icone]) . $html,
-                                     ['class' => $icone]);
+                                     array_merge(['class' => $icone], $attribs));
     }
     return '<div class="abonneFiche '.$icone.'">'.$html.'<div class="clear"></div></div>';
   }
diff --git a/library/ZendAfi/View/Helper/Abonne/Settings.php b/library/ZendAfi/View/Helper/Abonne/Settings.php
index 7be6a79cccc..114297ea61c 100644
--- a/library/ZendAfi/View/Helper/Abonne/Settings.php
+++ b/library/ZendAfi/View/Helper/Abonne/Settings.php
@@ -32,7 +32,8 @@ class ZendAfi_View_Helper_Abonne_Settings extends ZendAfi_View_Helper_Abonne_Abs
                                          $action_url,
                                          $this->view->_('Gérer mes favoris')),
                                  'settings',
-                                 $action_url);
+                                 $action_url,
+                                 ['data-popup' => 'true']);
   }
 }
 ?>
\ No newline at end of file
diff --git a/tests/application/modules/admin/controllers/CatalogueControllerTest.php b/tests/application/modules/admin/controllers/CatalogueControllerTest.php
index 82c68019b27..c00f210df2e 100644
--- a/tests/application/modules/admin/controllers/CatalogueControllerTest.php
+++ b/tests/application/modules/admin/controllers/CatalogueControllerTest.php
@@ -268,6 +268,13 @@ class CatalogueControllerWithAdminBibAndRightTotalAccessTest extends AdminCatalo
     $this->dispatch('/admin/catalogue/edit/id_catalogue/300');
     $this->assertXPathContentContains('//td', 'Valider');
   }
+
+
+  /** @test */
+  public function editCatalogueShouldAddToBookmarksCheckboxBePresent() {
+    $this->dispatch('/admin/catalogue/edit/id_catalogue/300');
+    $this->assertXPathContentContains('//td//input[@type="checkbox"][@id="indexer"]/following-sibling::span', 'Nécessite une intégration');
+  }
 }
 
 
diff --git a/tests/application/modules/opac/controllers/AbonneControllerFicheTest.php b/tests/application/modules/opac/controllers/AbonneControllerFicheTest.php
index 710ab757907..a6e1bbc325c 100644
--- a/tests/application/modules/opac/controllers/AbonneControllerFicheTest.php
+++ b/tests/application/modules/opac/controllers/AbonneControllerFicheTest.php
@@ -158,4 +158,15 @@ class AbonneControllerFicheAsAdminDisableSuggestTest extends AbstractAbonneContr
     $this->assertNotXPathContentContains('//a[contains(@href, "/abonne/suggestion-achat")]',
                                          'Suggérer un achat');
   }
+
+  /** @test */
+  public function settingsLinkShouldBePopup() {
+    $this->assertXPath('//div//a[2][@data-popup="true"]');
+  }
+
+
+  /** @test */
+  public function settingsLinkWithImageShouldBePopup() {
+    $this->assertXPath('//div//a[@data-popup="true"]/img[contains(@src, "abonnes/settings")]');
+  }
 }
-- 
GitLab