From f2c3d7aedfbb4028595a4ed8e8128f1d25b3eae0 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 31 Jan 2018 11:11:56 +0200 Subject: [PATCH] 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 Signed-off-by: Mark Tompsett Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart Conflicts: koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt Signed-off-by: Nick Clemens --- koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt index f7d8e4b953..170ac31691 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt @@ -52,7 +52,7 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") function add_user(borrowernumber, borrowername) { var ids = $("#budget_users_id").val().split(':'); - if(borrowernumber && ids.indexOf(borrowernumber) == -1) { + if(borrowernumber && ids.indexOf(borrowernumber.toString()) == -1) { var li = '
  • ' + '' + borrowername + ' ' -- 2.39.2