Bug 17016

Summary: Button to clear all fields in budget planning
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: System AdministrationAssignee: Aleisha Amohia <aleisha>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: 1joynelson, bouzid.fergani, claire_gravely, gmcharlt, jonathan.druart, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00
Attachments: Bug 17016: Button to clear all fields in budget planning
Bug 17016: Button to clear all fields in budget planning
Bug 17016: Button to clear all fields in budget planning
Bug 17016: Button to clear all fields in budget planning
Bug 17016: (follow-up) Removing unnecessary code
Bug 17016: Button to clear all fields in budget planning
Bug 17016: (follow-up) Removing unnecessary code
Bug 17016: Clear with 0.00 instead of blank
Bug 17016: Button to clear all fields in budget planning
Bug 17016: (follow-up) Removing unnecessary code
Bug 17016: Clear with 0.00 instead of blank
Bug 17016: (follow-up) Clear with 0.00 instead of blank (Use Price)

Description Aleisha Amohia 2016-08-02 05:47:22 UTC
Currently there is an auto-fill button, but if you want to undo this, now all fields are filled. There should be a clear option.
Comment 1 Aleisha Amohia 2016-08-02 05:51:21 UTC
Created attachment 53872 [details] [review]
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
Comment 2 Claire Gravely 2016-08-04 14:14:43 UTC
Hi,
After applying the patch both buttons appear.
After clicking on the auto-fill button the fields briefly populate, but then the page refeshes and they clear back to 0.00 again.
Comment 3 Owen Leonard 2016-08-05 13:34:37 UTC
> After clicking on the auto-fill button the fields briefly populate, but then
> the page refreshes and they clear back to 0.00 again.

I get this too.

Could you please try to rework the patch so that it doesn't use an inline event attribute? We shouldn't be adding new code which uses things attributes "onclick."

The "edit_row" ID on the <tr> is problematic because it is repeated for each row in the table, thus it isn't unique. If you're looking for a hook to target each individual row you could so something like <tr id="edit_row_[% budget_line.budget_id %]">
Comment 4 Aleisha Amohia 2020-01-29 03:58:45 UTC
Created attachment 98049 [details] [review]
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
Comment 5 David Nind 2020-01-29 11:21:29 UTC
Created attachment 98060 [details] [review]
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 <david@davidnind.com>
Comment 6 Bouzid Fergani 2020-02-14 21:23:33 UTC
Created attachment 99047 [details] [review]
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 <david@davidnind.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Comment 7 Jonathan Druart 2020-02-21 15:21:30 UTC
Comment on attachment 99047 [details] [review]
Bug 17016: Button to clear all fields in budget planning

Review of attachment 99047 [details] [review]:
-----------------------------------------------------------------

::: koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt
@@ +6,5 @@
>  <title>Koha &rsaquo; Administration &rsaquo; Budgets &rsaquo; Funds &rsaquo; Planning for [% budget_period_description | html %] by [% authcat | html %]</title>
>  [% INCLUDE 'doc-head-close.inc' %]
>  <style>td.locked { background-image: url('[% interface | html %]/[% theme | html %]/img/locked.png'); padding-left : 20px; background-repeat: no-repeat; background-position: 5px 5px; } a.control { font-size:85%;text-decoration:none; } .plan_entry { text-align: right; width:90%; }</style>
> +<script>
> +</script>

Not needed.

@@ +317,5 @@
> +                    if (type != "button" && type != "submit" ) {
> +                      $(this).val("");
> +                      $(this).prop('disabled', false);
> +                    }
> +                    if ( type == "checkbox" ) {

When is it a checkbox?
I always see text inputs.
Comment 8 Aleisha Amohia 2020-02-25 04:19:53 UTC
Created attachment 99552 [details] [review]
Bug 17016: (follow-up) Removing unnecessary code
Comment 9 David Nind 2020-02-25 09:45:31 UTC
Created attachment 99557 [details] [review]
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: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: David Nind <david@davidnind.com>
Comment 10 David Nind 2020-02-25 09:45:35 UTC
Created attachment 99558 [details] [review]
Bug 17016: (follow-up) Removing unnecessary code

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 Jonathan Druart 2020-02-25 10:55:25 UTC
Created attachment 99569 [details] [review]
Bug 17016: Clear with 0.00 instead of blank
Comment 12 Jonathan Druart 2020-02-25 10:56:14 UTC
Aleisha, David, what about clearing with the previous value 0.00, instead of blank?
Comment 13 Katrin Fischer 2020-02-29 22:50:29 UTC
Created attachment 99842 [details] [review]
Bug 17016: Button to clear all fields in budget planning

Currently there is no way to undo the 'auto-fill'. This
patch adds a 'clear' option that resets the row.

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 <david@davidnind.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Katrin Fischer 2020-02-29 22:50:32 UTC
Created attachment 99843 [details] [review]
Bug 17016: (follow-up) Removing unnecessary code

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Katrin Fischer 2020-02-29 22:50:36 UTC
Created attachment 99844 [details] [review]
Bug 17016: Clear with 0.00 instead of blank

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 16 Jonathan Druart 2020-03-02 10:34:10 UTC
Created attachment 99876 [details] [review]
Bug 17016: (follow-up) Clear with 0.00 instead of blank (Use Price)

Using Price, to formatted it correctly if needed
So far it will not do anything as 'on_editing => 1' we keep 0.00, but it
must be improved later (when we will handle that)
Comment 17 Martin Renvoize 2020-03-02 10:35:08 UTC
Thanks for the quick followup Jonathan :)
Comment 18 Martin Renvoize 2020-03-02 10:42:59 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 19 Joy Nelson 2020-03-31 22:45:09 UTC
enhancement not backported to 19.11.x