From 611decfec930eeb36e56bf10635176ec3b644a8a 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 7) Auto-fill the row then click Clear button. Confirm it clears all fields and sets the fund remaining back to the original amount and styles. 8) Add another fund and confirm that this still works with multiple funds. Sponsored-by: Catalyst IT Signed-off-by: David Nind Signed-off-by: Bouzid Fergani --- .../intranet-tmpl/prog/en/modules/admin/aqplan.tt | 26 +++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 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 7fff2ce..768393f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt @@ -6,6 +6,8 @@ Koha › Administration › Budgets › Funds › Planning for [% budget_period_description | html %] by [% authcat | html %] [% INCLUDE 'doc-head-close.inc' %] + @@ -63,13 +65,14 @@ [% authvals_ro.code | html %] [% END %] - Fund remaining  + Fund remaining + Actions [% FOREACH budget_line IN budget_lines %] - + [% IF ( budget_line.budget_lock ) %] [% ELSE %] @@ -135,9 +138,10 @@ - + [% UNLESS ( budget_line.budget_lock ) %] + [% ELSE %]
not owned
[% END %] @@ -305,6 +309,22 @@ var budget_id = $(this).data("budget-id"); autoFillRow( budget_id ); }); + $(".clear_fields").on("click",function(){ + var budget_id = $(this).data("budget-id"); + var edit_row = $("#"+budget_id); + $(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); + } + }); + $("#budget_est_"+budget_id).text($("#budget_tot_"+budget_id).prev().text()); + $("#budget_est_"+budget_id).css("color","green"); + }); }); [% END %] -- 2.7.4