Bug 37863 - Patron card batches don't detect when the patron is already in the list
Summary: Patron card batches don't detect when the patron is already in the list
Status: Pushed to oldoldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Label/patron card printing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Adolfo Rodríguez Taboada
QA Contact: Emily Lamancusa (emlam)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-09 07:13 UTC by Adolfo Rodríguez Taboada
Modified: 2024-12-18 12:20 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00,24.05.06,23.11.11
Circulation function:


Attachments
bug 37863 Fix checking if a patron is already in the list adding users to a patron card batch (1.75 KB, patch)
2024-09-09 07:21 UTC, Adolfo Rodríguez Taboada
Details | Diff | Splinter Review
bug 37863 Fix checking if a patron is already in the list adding users to a patron card batch (1.82 KB, patch)
2024-09-09 20:41 UTC, Sukhmandeep
Details | Diff | Splinter Review
Bug 37863: Fix checking if a patron is already in the list adding users to a patron card batch (1.89 KB, patch)
2024-11-01 20:00 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Adolfo Rodríguez Taboada 2024-09-09 07:13:33 UTC
When adding patrons to a batch from the modal the include file patron-search.inc is designed to show a success message (Patron '%s' added) or an error message (Patron '%s' is already in the list.) depending on the result of the function add_user. If add_user returned a negative number, it would show the error message. Otherwise it shows the success message. The problem is that the function add_user at the template edit_batch.tt doesn't return anything, so the system always adds the user, thus allowing to include several times the same user in the card batch.
Comment 1 Adolfo Rodríguez Taboada 2024-09-09 07:21:25 UTC
Created attachment 171170 [details] [review]
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.)
Comment 2 Sukhmandeep 2024-09-09 20:41:01 UTC
Created attachment 171233 [details] [review]
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>
Comment 3 Emily Lamancusa (emlam) 2024-11-01 20:00:45 UTC
Created attachment 173891 [details] [review]
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>
Comment 4 Emily Lamancusa (emlam) 2024-11-01 20:07:35 UTC
This prevents accidentally double-clicking "Add" twice on the same modal. If the patron is already in the card batch from a previous operation, it doesn't prevent adding the patron a second time.

I think that's fine for now, though. The page has a "Remove duplicates" button, so if we want to change the behavior to prevent duplicates completely, that would be a larger change and should be a separate bug.

Passing QA
Comment 5 Katrin Fischer 2024-11-07 17:51:18 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 6 Lucas Gass (lukeg) 2024-12-05 22:00:40 UTC
Backported to 24.05.x for upcoming 24.05.06
Comment 7 Fridolin Somers 2024-12-18 12:20:28 UTC
Pushed to 23.11.x for 23.11.11