From ff8b9039c9964a805345fb2516f6ccb42c3a3719 Mon Sep 17 00:00:00 2001
From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Date: Thu, 27 Mar 2014 00:32:33 -0300
Subject: [PATCH] Bug 11993 - Untranslatable confirm popup in request.tt

This patch makes confirm popup text translatable.
It implements a similar function as used on OPAC
deleteConfirm() and a JS var message.

This funcion, or variants, can also be found on
other files on intranet, I think that the only
valid places are staff-global.js and help-top.inc

Redefinitions of this function:
prog/en/modules/serials/subscription-frequencies.tt:6
prog/en/modules/tools/marc_modification_templates.tt:158
prog/en/modules/virtualshelves/shelves.tt:92

Last case is a little different

To test:
1) I'm at lost, don't know how to produce the
situation in which this message appear, perhaps
when staff personel tries to cancel a hold in
transit

If you know how, please tell me and I will
resubmit with a better test plan.

2) Check the string is not present on staff PO file
3) Apply the patch
4) Update translation files
(cd misc/translator; perl translate update xx-YY)
5) Verify the string is now present
---
 koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js |    7 ++++++-
 .../prog/en/modules/reserve/request.tt             |    3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js
index c97007f..d7986ca 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js
@@ -91,4 +91,9 @@ function toUC(f) {
     var x=f.value.toUpperCase();
     f.value=x;
     return true;
-}
\ No newline at end of file
+}
+
+function confirmDelete(message) {
+    return (confirm(message) ? true : false);
+}
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
index 93c005a..6b9bdf9 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
@@ -9,6 +9,7 @@
 [% INCLUDE 'calendar.inc' %]
 <script type="text/javascript">
     // <![CDATA[
+var MSG_CONFIRM_DELETE_HOLD   = _("Are you sure you want to cancel this hold?");
 var patron_homebranch = "[% borrower_branchname |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]";
 var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
     [% itemloo.itemnumber %]: {
@@ -456,7 +457,7 @@ function checkMultiHold() {
                     [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %]
                     [% IF ( itemloo.canreservefromotherbranches ) %]for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedForBorrowernumber %]">[% itemloo.ReservedForFirstname %] [% itemloo.ReservedForSurname %]</a>[% END %] [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% itemloo.ExpectedAtLibrary %]
                     since
-                    [% IF ( itemloo.waitingdate ) %][% itemloo.waitingdate | $KohaDates %][% ELSE %][% IF ( itemloo.reservedate ) %][% itemloo.reservedate %][% END %][% END %]. <a class="info" href="modrequest.pl?CancelBiblioNumber=[% itemloo.biblionumber %]&amp;CancelBorrowerNumber=[% itemloo.ReservedForBorrowernumber %]&amp;CancelItemnumber=[% itemloo.itemnumber %]"  onclick="if (window.confirm('Are you sure you want to delete this hold?')) {return true;} else {return false;}">Cancel hold</a>
+                    [% IF ( itemloo.waitingdate ) %][% itemloo.waitingdate | $KohaDates %][% ELSE %][% IF ( itemloo.reservedate ) %][% itemloo.reservedate %][% END %][% END %]. <a class="info" href="modrequest.pl?CancelBiblioNumber=[% itemloo.biblionumber %]&amp;CancelBorrowerNumber=[% itemloo.ReservedForBorrowernumber %]&amp;CancelItemnumber=[% itemloo.itemnumber %]"  onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);">Cancel hold</a>
 
                     [% END %]
             [% ELSE %]
-- 
1.7.9.5