Bug 23929 - Invoice adjustments should filter inactive funds
Summary: Invoice adjustments should filter inactive funds
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P3 normal
Assignee: Blou
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-30 21:13 UTC by David Roberts
Modified: 2021-12-13 21:08 UTC (History)
13 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.04,20.05.10
Circulation function:


Attachments
Screenshot of unfiltered funds in adjustments (118.06 KB, image/png)
2019-10-30 21:13 UTC, David Roberts
Details
Bug 23929 : Invoice adjustments should filter inactive funds (1.56 KB, patch)
2020-01-14 15:18 UTC, Koha Team University Lyon 3
Details | Diff | Splinter Review
Bug 23929 - Invoice adjustments should filter inactive funds (1.62 KB, patch)
2020-01-15 15:54 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 23929 - Invoice adjustments should filter inactive funds (3.85 KB, patch)
2021-01-26 20:53 UTC, Blou
Details | Diff | Splinter Review
Bug 23929 - Invoice adjustments should filter inactive funds (3.91 KB, patch)
2021-01-29 17:35 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 23929: Invoice adjustments should filter inactive funds (3.97 KB, patch)
2021-02-22 16:21 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 23929: [20.05.x] Invoice adjustments should filter inactive funds (4.46 KB, patch)
2021-03-19 19:17 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Roberts 2019-10-30 21:13:53 UTC
Created attachment 94893 [details]
Screenshot of unfiltered funds in adjustments

When adding an adjustment to an invoice, the funds dropdown shows all funds. There should be a filter to allow only active funds, similar to the one on the shipping fund dropdown, as it is impossible to identify the active fund when they are similarly named. See screenshot.
Comment 1 Katrin Fischer 2019-12-07 11:29:55 UTC
Not sure if this is not a bug instead of an enh?
Comment 2 Koha Team University Lyon 3 2020-01-14 15:18:37 UTC
Created attachment 97354 [details] [review]
Bug 23929 : Invoice adjustments should filter inactive funds

Test plan :
Go to details of an invoice.
In the adjustments block, click on Add an adjustment and click again on Fund select list.
If you have been using Koha for some years, you risk to see many funds with same name listed successively (inactive funds from past years).

Install the patch.
click again the Fund select list in ajustment block : now, you have only active funds. 

Olivier Crouzet
Comment 3 Biblibre Sandboxes 2020-01-15 15:54:11 UTC
Patch tested with a sandbox, by Marjorie Barry-Vila <marjorie.barry-vila@collecto.ca>
Comment 4 Biblibre Sandboxes 2020-01-15 15:54:36 UTC
Created attachment 97399 [details] [review]
Bug 23929 - Invoice adjustments should filter inactive funds

Signed-off-by: Marjorie Barry-Vila <marjorie.barry-vila@collecto.ca>
Comment 5 Jonathan Druart 2020-01-21 14:47:27 UTC
We usually have a "Show inactive" checkbox right after the dropdown list. Should not we implement that here as well?
Comment 6 Jonathan Druart 2020-02-21 10:34:45 UTC
(In reply to Jonathan Druart from comment #5)
> We usually have a "Show inactive" checkbox right after the dropdown list.
> Should not we implement that here as well?

Failing QA to get feedback on that.
Comment 7 Katrin Fischer 2020-10-18 17:12:30 UTC
(In reply to Jonathan Druart from comment #5)
> We usually have a "Show inactive" checkbox right after the dropdown list.
> Should not we implement that here as well?

I Believe that would probably be the most consistent solution in regard to the rest of the GUI. 

But I think we should fix this with some urgency as the list of funds can get pretty confusing for libraries with several years of acq data right now.
Comment 8 Blou 2021-01-26 20:53:28 UTC
Created attachment 115836 [details] [review]
Bug 23929 - Invoice adjustments should filter inactive funds

Looking at invoice details, this makes the Adjustments Fund dropdown act
exactly like the Shipping Fund dropdown above, with a Show inactive
checkbox to help filter (by default) the inactive funds out of the list.

Test plan:
0) requires a database with inactive (old) funds along with active ones.
1) Go to invoice details page
2) Click "Add adjustment"
3) Open the drop down beside the Fund label, you should see EVERY fund in database.
4) Compare with behavior of Shipping fund dropdown above.  Not every fund is listed there
5) Apply patch
6) Now behavior is the same, only active fund are listed by default.
7) click "Show inactive" checkbox and see all the funds in the dropdown.
Comment 9 Blou 2021-01-26 20:58:05 UTC
I coded that fix in 20.05 and rebased it for master.

It's clean, but it's not "nice" as it really duplicate the code from Shipment Fund.  

But the problem was serious for our customers so here's a solution that answers Jonathan's comments.
Comment 10 Jonathan Druart 2021-01-29 10:57:50 UTC
Lyon 3, Could you test this patch?
Comment 11 Koha Team University Lyon 3 2021-01-29 17:33:27 UTC
Hi,
I've tested it on a sandbox and it works as expected :
I've duplicated the budgets ans marked the initial ones as inactive, and I have changed the name of the funds to be able to identify the inactive.

In the invoice, I add an adjustment : in the fund list, I can see only the active one in the dropdown list. If I tick "show inactive", I can see all the funds but the inactive are marked with "(incative)" behind their name.
It's the same behaviour when you select the shipment fund.

Sonia
Comment 12 Biblibre Sandboxes 2021-01-29 17:35:11 UTC
Patch tested with a sandbox, by Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Comment 13 Biblibre Sandboxes 2021-01-29 17:35:38 UTC
Created attachment 116066 [details] [review]
Bug 23929 - Invoice adjustments should filter inactive funds

Looking at invoice details, this makes the Adjustments Fund dropdown act
exactly like the Shipping Fund dropdown above, with a Show inactive
checkbox to help filter (by default) the inactive funds out of the list.

Test plan:
0) requires a database with inactive (old) funds along with active ones.
1) Go to invoice details page
2) Click "Add adjustment"
3) Open the drop down beside the Fund label, you should see EVERY fund in database.
4) Compare with behavior of Shipping fund dropdown above.  Not every fund is listed there
5) Apply patch
6) Now behavior is the same, only active fund are listed by default.
7) click "Show inactive" checkbox and see all the funds in the dropdown.

Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Comment 14 Martin Renvoize (ashimema) 2021-02-22 16:21:48 UTC
Created attachment 117169 [details] [review]
Bug 23929: Invoice adjustments should filter inactive funds

Looking at invoice details, this makes the Adjustments Fund dropdown act
exactly like the Shipping Fund dropdown above, with a Show inactive
checkbox to help filter (by default) the inactive funds out of the list.

Test plan:
0) requires a database with inactive (old) funds along with active ones.
1) Go to invoice details page
2) Click "Add adjustment"
3) Open the drop down beside the Fund label, you should see EVERY fund in database.
4) Compare with behavior of Shipping fund dropdown above.  Not every fund is listed there
5) Apply patch
6) Now behavior is the same, only active fund are listed by default.
7) click "Show inactive" checkbox and see all the funds in the dropdown.

Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 15 Martin Renvoize (ashimema) 2021-02-22 16:23:06 UTC
Works well, passes qa scripts and addresses previous concerns.

Passing QA (and correcting commit title inline to squash the only QA script failure)
Comment 16 Jonathan Druart 2021-02-23 12:21:06 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 17 Fridolin Somers 2021-02-25 09:34:45 UTC
Pushed to 20.11.x for 20.11.04
Comment 18 Andrew Fuerste-Henry 2021-03-04 21:59:58 UTC
Doesn't apply cleanly to 20.05, please rebase if needed.
Comment 19 Nick Clemens (kidclamp) 2021-03-19 19:17:08 UTC
Created attachment 118552 [details] [review]
Bug 23929: [20.05.x] Invoice adjustments should filter inactive funds

Looking at invoice details, this makes the Adjustments Fund dropdown act
exactly like the Shipping Fund dropdown above, with a Show inactive
checkbox to help filter (by default) the inactive funds out of the list.

Test plan:
0) requires a database with inactive (old) funds along with active ones.
1) Go to invoice details page
2) Click "Add adjustment"
3) Open the drop down beside the Fund label, you should see EVERY fund in database.
4) Compare with behavior of Shipping fund dropdown above.  Not every fund is listed there
5) Apply patch
6) Now behavior is the same, only active fund are listed by default.
7) click "Show inactive" checkbox and see all the funds in the dropdown.

Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 20 Andrew Fuerste-Henry 2021-03-22 20:17:46 UTC
Pushed to 20.05.x for 20.05.10
Comment 21 Victor Grousset/tuxayo 2021-03-23 06:34:20 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.