Bug 20110 - Don't allow adding same user multiple times to same budget fund
Summary: Don't allow adding same user multiple times to same budget fund
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: paxed
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-31 09:37 UTC by paxed
Modified: 2018-06-04 20:15 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Fix adding same user to the same budget fund multiple times (1.74 KB, patch)
2018-01-31 09:39 UTC, paxed
Details | Diff | Splinter Review
Bug 20110: Adding same user multiple times to same budget (1.79 KB, patch)
2018-01-31 19:46 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 20110: Adding same user multiple times to same budget (1.85 KB, patch)
2018-02-04 12:24 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description paxed 2018-01-31 09:37:04 UTC
It is possible to add the same user multiple times into the same budget fund
Comment 1 paxed 2018-01-31 09:39:48 UTC
Created attachment 71082 [details] [review]
Fix adding same user to the same budget fund multiple times

In javascript, using indexOf to test if a number exists in an array
of strings doesn't work, and makes it possible to add the same user
multiple times into the same budget fund.
Make borrowernumber into string and compare that instead.

Test plan:

1) Go to Home -> Administration -> Budgets -> Funds -> Add Fund
2) Add a user to the fund
3) Try to add the same user again to the same fund. No error.
4) Apply patch
5) Do 1, 2, and 3 again. You should now get an error message
   saying the user is already in the list.
Comment 2 M. Tompsett 2018-01-31 19:46:35 UTC
Created attachment 71099 [details] [review]
Bug 20110: Adding same user multiple times to same budget

In javascript, using indexOf to test if a number exists in an array
of strings doesn't work, and makes it possible to add the same user
multiple times into the same budget fund.
Make borrowernumber into string and compare that instead.

Test plan:

1) Go to Home -> Administration -> Budgets -> Funds -> Add Fund
2) Add a user to the fund
3) Try to add the same user again to the same fund. No error.
4) Apply patch
5) Do 1, 2, and 3 again. You should now get an error message
   saying the user is already in the list.

Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 3 Katrin Fischer 2018-02-04 12:24:21 UTC
Created attachment 71174 [details] [review]
Bug 20110: Adding same user multiple times to same budget

In javascript, using indexOf to test if a number exists in an array
of strings doesn't work, and makes it possible to add the same user
multiple times into the same budget fund.
Make borrowernumber into string and compare that instead.

Test plan:

1) Go to Home -> Administration -> Budgets -> Funds -> Add Fund
2) Add a user to the fund
3) Try to add the same user again to the same fund. No error.
4) Apply patch
5) Do 1, 2, and 3 again. You should now get an error message
   saying the user is already in the list.

Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Jonathan Druart 2018-02-05 13:00:59 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 5 Nick Clemens 2018-02-16 02:31:30 UTC
Awesome work all, pushed to stable for 17.11.03