Bug 37863: Fix checking if a patron is already in the list adding users to a patron card batch

If the patron is already in the card batch it won't add it and it will show an error message

Test plan:
1 Create or edit an patron card batch
2 Try adding twice or more the same patron. It will show a success message everytime and you will end up with the same patron several times in the card batch
3 Apply patch, restart services
4 Repeat step 2. The first time you click on add user, it will do it and show the success message (Patron 'Patron name' added.), but after that it won't add the user and it will display an error message (Patron 'Patron name' is already in the list.)

Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 293afd3de6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Adolfo Rodríguez 2024-09-09 09:20:08 +02:00 committed by Lucas Gass
parent c2606618c0
commit 0e2778159d
1 changed files with 6 additions and 1 deletions

View File

@ -231,7 +231,12 @@
};
function add_user(borrowernumber) {
$("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
var list = $("#bor_num_list").val();
if (list.indexOf(borrowernumber) == -1) {
$("#bor_num_list").val(list+borrowernumber+"\r\n");
} else {
return -1;
}
}
function DeDuplicate() {