From 5b3db35925dba968abf9f9e0e3f97b33ca5ee3d8 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 22 Jul 2016 11:32:54 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 16963 - Remove the use of "onclick" from subscription add template This patch removes the use of event attributes from the subscription add template and the template for testing prediction patterns. Events are now defined in the JavaScript. To test, go to Serials -> New subscription. - Test that the "Search for vendor," "Search for record," and "Create record" links work correctly. - Test the "Next" button without entering a vendor or a biblionumber. You should be warned about selecting a vendor and biblionumber. - After selecting a bibliographic record to link to the subscription, click the "Next" button. The second section of the subscription add form should be displayed. - Under frequency, choose "1/day." - Confirm that the "Show advanced pattern" link correctly toggles display of the advanced pattern form. - Under the advanced pattern form, test the "Modify pattern" button. It should enable editing in the form. - Test the "Cancel modifications" and "Save as new pattern" buttons. - Test the "Test prediction pattern" button. - In the "Prediction pattern" box, test that the checkboxes next to each day of the week, when checked, trigger the corresponding issue number to be marked as "not published." - Finally, confirm that your subscription is saved correctly. Signed-off-by: Aleisha Amohia --- .../en/modules/serials/showpredictionpattern.tt | 19 +++-- .../prog/en/modules/serials/subscription-add.tt | 83 +++++++++++++++++----- 2 files changed, 77 insertions(+), 25 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt index da04563..e23f912 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt @@ -20,25 +20,30 @@ }); } } + $(document).ready(function(){ + $(".skipday").on("change",function(){ + Check_boxes( $(this).data("dow")); + }); + }); //]]>

If there is a day (or more) in the week where issues are never published, you can check corresponding boxes below.

- + - + - + - + - + - + - + [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt index 637c843..ffe890b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -37,12 +37,12 @@ function addbiblioPopup(biblionumber) { window.open(destination,'AddBiblioPopup','width=1024,height=768,toolbar=no,scrollbars=yes'); } -function Plugin(f) +function Plugin() { window.open('subscription-bib-search.pl','FindABibIndex','width=800,height=400,toolbar=no,scrollbars=yes'); } -function FindAcqui(f) +function FindAcqui() { window.open('acqui-search.pl','FindASupplier','width=800,height=400,toolbar=no,scrollbars=yes'); } @@ -192,10 +192,6 @@ function displaymoreoptions() { } } -function toggleAdvancedPattern() { - $("#advancedpredictionpattern").toggle(); -} - function modifyAdvancedPattern() { $("#patternname").prop('readOnly', false).val(''); $("#numberingmethod").prop('readOnly', false); @@ -460,6 +456,54 @@ $(document).ready(function() { [% END %] show_page_1(); + $("#subscription_add_form").on("submit",function(){ + return Check_page2(); + }); + $("#vendor_search").on("click",function(e){ + e.preventDefault(); + FindAcqui(); + }); + $("#record_search").on("click",function(e){ + e.preventDefault(); + Plugin(); + }); + $("#biblio_add_edit").on("click",function(e){ + e.preventDefault(); + if( $(this).data("biblionumber") ){ + addbiblioPopup( $(this).data("biblionumber") ); + } else { + addbiblioPopup(); + } + }); + $("#subscription_add_next").on("click",function(){ + if ( Check_page1() ){ + show_page_2(); + } + }); + $("#subscription_add_previous").on("click",function(){ + show_page_1(); + }); + $(".toggle_advanced_pattern").on("click",function(e){ + e.preventDefault(); + $("#advancedpredictionpattern").toggle(); + $(".toggle_advanced_pattern").toggle(); + }); + $("#modifyadvancedpatternbutton").on("click",function(e){ + e.preventDefault(); + modifyAdvancedPattern(); + }); + $("#restoreadvancedpatternbutton").on("click",function(e){ + e.preventDefault(); + restoreAdvancedPattern(); + }); + $("#saveadvancedpatternbutton").on("click",function(e){ + e.preventDefault(); + saveAdvancedPattern(); + }); + $("#testpatternbutton").on("click",function(e){ + e.preventDefault(); + testPredictionPattern(); + }); }); //]]> @@ -474,7 +518,7 @@ $(document).ready(function() {

[% IF ( modify ) %] Modify subscription for [% bibliotitle |html %][% ELSE %]Add a new subscription[% END %] (1/2)

-
+ [% IF ( modify ) %] @@ -494,18 +538,18 @@ $(document).ready(function() { [% END %]
  • - () Search for a vendor + () Search for a vendor
  • () Required -
    Search for record +
    Search for record [% IF ( CAN_user_editcatalogue ) %] [% IF ( modify ) %] - | Edit record + | Edit record [% ELSE %] - | Create record + | Create record [% END %] [% END %]
    @@ -623,7 +667,7 @@ $(document).ready(function() {
    - +
  • @@ -767,7 +811,10 @@ $(document).ready(function() { -
  • Show/Hide advanced pattern
  • +
  • + Show advanced pattern + +
  • @@ -892,8 +939,8 @@ $(document).ready(function() { [% END %]
    - - + +
    -- 2.1.4