From 5f586e3d963be70dc1d3b5f55494f40227e43adf Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 17 Mar 2020 18:44:23 +0000 Subject: [PATCH] Bug 16962: Remove the use of "onclick" from serial collection template This patch removes the use of event attributes like "onclick" from the serial collection template. Events are now defined in JavaScript. To test, apply the patch and go to Serials - Locate or create a subscription for which an item record is NOT created when receiving. - On the serial collection page for this subscription, test that the "Multi receiving" button works correctly. - For any subscription, test that the "Generate next" button works correctly. - In each tab, test that the "select all" and "clear all" links work correctly and affect only that tab. - On a subscription which has expired, test that the "Renew" button works correctly. Signed-off-by: David Nind Signed-off-by: Josef Moravec Signed-off-by: Martin Renvoize --- .../en/modules/serials/serials-collection.tt | 65 +++++++++++-------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt index 192565e88f..a67be01377 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt @@ -102,12 +102,8 @@ Create routing list [% END %] [% END %] - [% IF ( subscription.abouttoexpire ) %] Renew - [% ELSE %] - [% IF ( subscription.subscriptionexpired ) %] Renew - [% ELSE %] -   - [% END %] + [% IF ( subscription.abouttoexpire || subscription.subscriptionexpired) %] + Renew [% END %] [% ELSE %]   @@ -145,7 +141,9 @@

[% UNLESS subscription.closed %] -
+
+ +
[% IF ( subscriptions.size == 1 and !serialsadditems ) %] 
[% END %] @@ -154,10 +152,10 @@

[% END %] - Select all + Select all | - Clear all + Clear all @@ -278,7 +276,7 @@ [% IF ( routing ) %] [% END %] @@ -329,29 +327,12 @@ } } - function print_slip(subscriptionid,issue){ - var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue; - window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes'); - } - - function popup(subscriptionid) { - newin=window.open('subscription-renew.pl?mode=popup&subscriptionid='+subscriptionid,'popup','width=500,height=400,toolbar=false,scrollbars=yes'); - } - function generateNext(subscriptionid) { if(confirm(_("Do you really want to generate next serial?"))){ document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid; } } - function CheckAll( node ) { - $("#"+node).checkCheckboxes(); - return false; - } - function CheckNone( node ) { - $("#"+node).unCheckCheckboxes(); - return false; - } $(document).ready(function() { $('#subscription_years').tabs(); $(".subscription-year-table").dataTable($.extend(true, {}, dataTablesDefaults, { @@ -367,6 +348,36 @@ "bFilter": false, } )); + $(".CheckAll").on("click", function(e){ + e.preventDefault(); + var years = $(this).data("year"); + $("#subscription-year-" + years ).checkCheckboxes(); + }); + + $(".CheckNone").on("click", function(e){ + e.preventDefault(); + var years = $(this).data("year"); + $("#subscription-year-" + years ).unCheckCheckboxes(); + }); + + $(".generatenext").on("click", function(e){ + e.preventDefault(); + var subscriptionid = $(this).data("subscriptionid"); + generateNext( subscriptionid ); + }); + + $(".subscription_renew").on("click", function(e){ + e.preventDefault(); + var subscriptionid = $(this).data("subscriptionid"); + popup( subscriptionid ); + }); + + $(".print_list").on("click", function(e){ + e.preventDefault(); + var url = $(this).attr("href"); + window.open( url,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes'); + }); + $('#multi_receiving').on('show', function () { $(this).find(".modal-body").html($(".serials_multi_receiving")[0].outerHTML); }); -- 2.39.5
- Print list + Print list