From db32cdde078e99916a0818c731c685490c2c4f9d Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Fri, 4 Oct 2019 15:00:19 +0000
Subject: [PATCH] Bug 22114: Untranslatable "Patron note:" in checkout.js
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch modifies JavaScript used in circulation, replacing an
untranslatable English string in the script with a variable defined in
strings.inc which can be translated.

To test you should have the AllowCheckoutNotes system preference
enabled.

 - Apply the patch and log in to the OPAC as a user who has two or more
   items checked out.
 - From the list of checkouts on the "Your summary" page, add a note to
   two or more checked-out items.
 - Log in to the staff client and open the checkout page for that user.
   - In the table of checkouts, check the "Check in" checkbox next to
     one of the titles you added a note to.
   - Click "Renew or check in selected items."
   - A message should appear in that table row showing your note,
     prefixed with the text "Patron note:"

To test translation, update and install the de-DE template:

 > cd misc/translator
 > perl translate update de-DE
 > perl translate install de-DE

 - Go to Administration -> System preferences and enable the "Deutsch
   (de-DE)" language under I18N/L10N preferences -> language.
 - Switch to the "Deutsch" translation.
 - Go to Ausleihe (Circulation) and check out to the same patron.
   - In the table of checkouts, check the checkbox in the "Rückgabe"
     column next to another title you added a note to.
   - Click the "Markierte Exemplare zurückgeben oder verlängern" button.
   - A message should appear in that table row showing your note
     prefixed with the text "Benutzernotizen:"

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc | 1 +
 koha-tmpl/intranet-tmpl/prog/js/checkouts.js         | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc
index eb7bfda139..e88a90fb6d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc
@@ -46,4 +46,5 @@
     var CURRENT = _(" (current) ");
     var MSG_NO_ITEMTYPE = _("No itemtype");
     var MSG_CHECKOUTS_BY_ITEMTYPE = _("Number of checkouts by item type");
+    var PATRON_NOTE = _("Patron note");
 </script>
diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
index da69276e4a..e317f5747d 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js
@@ -1,3 +1,5 @@
+/* global PATRON_NOTE */
+
 $(document).ready(function() {
     $.ajaxSetup ({ cache: false });
 
@@ -117,7 +119,7 @@ $(document).ready(function() {
                     $(id).parent().parent().addClass('ok');
                     $('#date_due_' + data.itemnumber).html(CIRCULATION_RETURNED);
                     if ( data.patronnote != null ) {
-                        $('.patron_note_' + data.itemnumber).html("Patron note: " + data.patronnote);
+                        $('.patron_note_' + data.itemnumber).html( PATRON_NOTE + ": " + data.patronnote);
                     }
                 } else {
                     content = CIRCULATION_NOT_RETURNED;
-- 
2.11.0