From 1fccc1ea5d6e753fb689c83d12764e3c599e0b5e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 22 Jul 2016 11:32:54 -0400 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../modules/serials/showpredictionpattern.tt | 19 +++-- .../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 da045631f2..e23f9121de 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 76aaabe2d3..cd671b560d 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 @@ -38,12 +38,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'); } @@ -193,10 +193,6 @@ function displaymoreoptions() { } } -function toggleAdvancedPattern() { - $("#advancedpredictionpattern").toggle(); -} - function modifyAdvancedPattern() { $("#patternname").prop('readOnly', false).val(''); $("#numberingmethod").prop('readOnly', false); @@ -461,6 +457,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(); + }); }); //]]> @@ -475,7 +519,7 @@ $(document).ready(function() {

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

-
+ [% IF ( modify ) %] @@ -495,18 +539,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 %]
    @@ -622,7 +666,7 @@ $(document).ready(function() {
    - +
  • @@ -766,7 +810,10 @@ $(document).ready(function() { -
  • Show/Hide advanced pattern
  • +
  • + Show advanced pattern + +
  • @@ -891,8 +938,8 @@ $(document).ready(function() { [% END %]
    - - + +
    -- 2.39.5