From 585298dc9b805b0f02da87da8a82d3bd591ac08f Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 2 Aug 2016 05:47:28 +0000 Subject: [PATCH] Bug 17016: Button to clear all fields in budget planning I have used the function from admin --> circ and fines rules To test: 1) Go to Admin --> Budgets 2) Click a budget 3) Click Planning -> any option 4) Test the Auto-fill button to see what it does 5) Apply patch and refresh page 6) Should now be a Clear button. Both buttons should show as font-awesome buttons with appropriate icons 7) Click Clear button. Confirm it clears all fields, which then refresh to have 0.00 etc. (default values) Sponsored-by: Catalyst IT --- .../intranet-tmpl/prog/en/modules/admin/aqplan.tt | 30 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt index 66f6b9f..a33d705 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt @@ -37,6 +37,26 @@ alert(alertString2); } } + + function clear_edit() { + var cancel = confirm(_("Are you sure you want to cancel your changes?")); + if ( !cancel ) return; + var edit_row = $("#edit_row"); + $(edit_row).find("input").each(function(){ + var type = $(this).attr("type"); + if (type != "button" && type != "submit" ) { + $(this).val(""); + $(this).prop('disabled', false); + } + if ( type == "checkbox" ) { + $(this).prop('checked', false); + } + }); + $(edit_row).find("select").prop('disabled', false); + $(edit_row).find("select option:first").attr("selected", "selected"); + $(edit_row).find("td:last input[name='clear']").remove(); + } + $(document).ready(function() { $("#selections input").on("change",function(e){ var num = $(this).attr("id"); @@ -114,13 +134,14 @@ [% authvals_ro.code %] [% END %] - Fund remaining  + Fund remaining + Actions [% FOREACH budget_line IN budget_lines %] - + [% IF ( budget_line.budget_lock ) %] [% ELSE %] @@ -186,9 +207,10 @@ - + [% UNLESS ( budget_line.budget_lock ) %] - + + [% ELSE %]
not owned
[% END %] -- 2.1.4