From 7394222d846d34734893bec001dbceefbeb45709 Mon Sep 17 00:00:00 2001
From: Charles Farmer <charles.farmer@inLibro.com>
Date: Wed, 8 Aug 2018 17:43:27 -0400
Subject: [PATCH] Bug 18421: (follow-up) QA fixes

Use the community's terminology, change coce.js's path, update <script>
to Asset, remove forbidden patterns

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
---
 .../data/mysql/atomicupdate/bug_18421_add_coce_intranet.perl   |  2 +-
 installer/data/mysql/sysprefs.sql                              |  2 +-
 koha-tmpl/intranet-tmpl/{prog => }/js/coce.js                  |  0
 .../prog/en/modules/admin/preferences/enhanced_content.pref    |  2 +-
 koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt    | 10 ++++------
 koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt   | 10 ++++------
 6 files changed, 11 insertions(+), 15 deletions(-)
 rename koha-tmpl/intranet-tmpl/{prog => }/js/coce.js (100%)

diff --git a/installer/data/mysql/atomicupdate/bug_18421_add_coce_intranet.perl b/installer/data/mysql/atomicupdate/bug_18421_add_coce_intranet.perl
index af27757..3b3f88f 100755
--- a/installer/data/mysql/atomicupdate/bug_18421_add_coce_intranet.perl
+++ b/installer/data/mysql/atomicupdate/bug_18421_add_coce_intranet.perl
@@ -14,7 +14,7 @@ my $current_coce_pref = C4::Context->preference('Coce') || 0;
 
 # add two new systempreferences in order to have distinct behavior between intranet and OPAC
 $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES
-        ('IntranetCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the staff intranet', 'YesNo'),
+        ('IntranetCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the staff client', 'YesNo'),
         ('OpacCoce','$current_coce_pref', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo')
         ;") or die "Error applying Bug 18421: error inserting new values into database: ". $dbh->errstr . "\n";
 
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 3857fb6..d52fd8d 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -241,7 +241,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('IntranetBiblioDefaultView','normal','normal|marc|isbd|labeled_marc','Choose the default detail view in the staff interface; choose between normal, labeled_marc, marc or isbd','Choice'),
 ('intranetbookbag','1','','If ON, enables display of Cart feature in the intranet','YesNo'),
 ('IntranetCirculationHomeHTML', '', NULL, 'Show the following HTML in a div on the bottom of the reports home page', 'Free'),
-('IntranetCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the staff intranet', 'YesNo'),
+('IntranetCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the staff client', 'YesNo'),
 ('intranetcolorstylesheet','','50','Define the color stylesheet to use in the Staff Client','free'),
 ('IntranetFavicon','','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','free'),
 ('IntranetmainUserblock','','70|10','Add a block of HTML that will display on the intranet home page','Textarea'),
diff --git a/koha-tmpl/intranet-tmpl/prog/js/coce.js b/koha-tmpl/intranet-tmpl/js/coce.js
similarity index 100%
rename from koha-tmpl/intranet-tmpl/prog/js/coce.js
rename to koha-tmpl/intranet-tmpl/js/coce.js
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref
index 9f90d15..7d1cdfc 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref
@@ -422,7 +422,7 @@ Enhanced Content:
               choices:
                   yes: Enable
                   no: "Don't enable"
-            - a Coce image cache service in the staff intranet.
+            - a Coce image cache service in the staff client.
         -
             - Coce server URL
             - pref: CoceHost
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
index 46c85b4..0217a05 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -63,11 +63,9 @@
   <div class="dialog message">The record you requested does not exist ([% biblionumber | html %]).</div>
 [% ELSE %]
 
-[%
-    IntranetCoce    = Koha.Preference('IntranetCoce')
-    CoceProviders   = Koha.Preference('CoceProviders')
-    CoceHost        = Koha.Preference('CoceHost')
-%]
+[% IntranetCoce    = Koha.Preference('IntranetCoce') %]
+[% CoceProviders   = Koha.Preference('CoceProviders') %]
+[% CoceHost        = Koha.Preference('CoceHost') %]
 
 [% INCLUDE 'cat-toolbar.inc' %]
     [% IF ( ocoins ) %]
@@ -768,7 +766,7 @@
     [% INCLUDE 'catalog-strings.inc' %]
     [% Asset.js("js/catalog.js") | $raw %]
     [% INCLUDE 'greybox.inc' %]
-    <script type="text/javascript" src="[% interface %]/prog/js/coce_[% KOHA_VERSION %].js"></script>
+    [% Asset.js("js/coce.js") %]
     <script>
         var interface = "[% interface | html %]";
         var theme = "[% theme | html %]";
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
index c803ddd..46aab16 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
@@ -27,11 +27,9 @@
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 
-[%
-    IntranetCoce    = Koha.Preference('IntranetCoce')
-    CoceProviders   = Koha.Preference('CoceProviders')
-    CoceHost        = Koha.Preference('CoceHost')
-%]
+[% IntranetCoce    = Koha.Preference('IntranetCoce') %]
+[% CoceProviders   = Koha.Preference('CoceProviders') %]
+[% CoceHost        = Koha.Preference('CoceHost') %]
 
 <div id="breadcrumbs">
     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
@@ -657,7 +655,7 @@
     [% Asset.js("js/browser.js") | $raw %]
     [% Asset.js("lib/hc-sticky.js") | $raw %]
     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
-    [% Asset.js("prog/js/coce.js") %]
+    [% Asset.js("js/coce.js") %]
     <script>
         var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
         var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be placed on hold.");
-- 
2.1.4