Bug 38266 - Incorrect attribute disabled in patron batch modification
Summary: Incorrect attribute disabled in patron batch modification
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Nick Clemens (kidclamp)
QA Contact: Emily Lamancusa (emlam)
URL:
Keywords:
Depends on: 21083
Blocks:
  Show dependency treegraph
 
Reported: 2024-10-24 18:17 UTC by Nick Clemens (kidclamp)
Modified: 2025-02-03 16:35 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 38266: (bug 21083 follow-up) Increment after comparison (1.52 KB, patch)
2024-10-24 18:21 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 38266: (bug 21083 follow-up) Increment after comparison (1.58 KB, patch)
2024-10-25 11:31 UTC, Phil Ringnalda
Details | Diff | Splinter Review
Bug 38266: (bug 21083 follow-up) Increment after comparison (1.65 KB, patch)
2024-10-28 17:29 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 Nick Clemens (kidclamp) 2024-10-24 18:17:17 UTC
Bug 21083 moved from a loop of checking disabled attributes to a grep.

When looping we did ++$i for each iteration

For the grep we need to check the current i before incrementing, but we are doing the increment first here:
$attributes->{$code}->{disabled} = grep { $_ eq sprintf("attr%s_value", ++$i) } @disabled;

Just need to move the pluses to the right
Comment 1 Nick Clemens (kidclamp) 2024-10-24 18:21:51 UTC
Created attachment 173304 [details] [review]
Bug 38266: (bug 21083 follow-up) Increment after comparison

To test:
 1 - Define a patron attribute as repeatable
 2 - Add multiple values to a patron (I used borrowernumber 5)
 3 - Tools->Batch patron modification
 4 - Modify the patron from step 1, selecting the attribute you created and checking the box to clear
 5 - View the patron, they look correct
 6 - Check the DB:
    SELECT * FROM borrower_attributes WHERE borrowernumber=5;
 7 - There is one blank value
 8 - Apply patch
 9 - Repeat batch modification
10 - Check the DB, no attribute!
11 - Test with multiple attributes in the batch modification and ensure only the correct one is removed
12 - Sign off
Comment 2 Phil Ringnalda 2024-10-25 11:31:34 UTC
Created attachment 173348 [details] [review]
Bug 38266: (bug 21083 follow-up) Increment after comparison

To test:
 1 - Define a patron attribute as repeatable
 2 - Add multiple values to a patron (I used borrowernumber 5)
 3 - Tools->Batch patron modification
 4 - Modify the patron from step 1, selecting the attribute you created and checking the box to clear
 5 - View the patron, they look correct
 6 - Check the DB:
    SELECT * FROM borrower_attributes WHERE borrowernumber=5;
 7 - There is one blank value
 8 - Apply patch, restart_all
 9 - Repeat batch modification
10 - Check the DB, no attribute!
11 - Test with multiple attributes in the batch modification and ensure only the correct one is removed
12 - Sign off

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Comment 3 Emily Lamancusa (emlam) 2024-10-28 17:29:23 UTC
Created attachment 173579 [details] [review]
Bug 38266: (bug 21083 follow-up) Increment after comparison

To test:
 1 - Define a patron attribute as repeatable
 2 - Add multiple values to a patron (I used borrowernumber 5)
 3 - Tools->Batch patron modification
 4 - Modify the patron from step 1, selecting the attribute you created and checking the box to clear
 5 - View the patron, they look correct
 6 - Check the DB:
    SELECT * FROM borrower_attributes WHERE borrowernumber=5;
 7 - There is one blank value
 8 - Apply patch
 9 - Repeat batch modification
10 - Check the DB, no attribute!
11 - Test with multiple attributes in the batch modification and ensure only the correct one is removed
12 - Sign off

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 4 Katrin Fischer 2024-10-30 06:48:52 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 5 Martin Renvoize (ashimema) 2024-11-28 16:54:24 UTC
This is needed for 23.11 and 23.05 too
Comment 6 Lucas Gass (lukeg) 2024-12-05 21:12:50 UTC
Backported to 24.05.x for upcoming 24.05.06
Comment 7 Fridolin Somers 2024-12-18 09:31:19 UTC
Pushed to 23.11.x for 23.11.11
Comment 8 Jesse Maseto 2025-02-03 16:35:36 UTC
Not pushed to LTS. Marked Resolved.

If you feel this should be in LTS please reply with your reason.