From b2088447f919a8fc9888e6e0f0ffcdad11c58e40 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>
---
 .../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 b36bd22..4c242bc 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -227,7 +227,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 7e044d4..6483c7f 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
@@ -387,7 +387,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 908018d..c0bad8a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -61,11 +61,9 @@
     <div id="yui-main">
     <div class="yui-b">
 
-[%
-    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 ) %]
@@ -920,7 +918,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 type="text/javascript">
         // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
         function verify_images() {
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 289fb53..cb8645f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
@@ -23,11 +23,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>
@@ -645,7 +643,7 @@
     [% Asset.js("js/browser.js") | $raw %]
     [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %]
     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
-    [% Asset.js("prog/js/coce.js") | $raw %]
+    [% Asset.js("js/coce.js") %]
     <script type="text/javascript">
         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