From d4db820adb79d3d542aebf96726cd3e80fed19df Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 24 Oct 2024 18:17:54 +0000 Subject: [PATCH] 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 Signed-off-by: Emily Lamancusa Signed-off-by: Katrin Fischer (cherry picked from commit a62953aa9ee8c5ac80e6e5cc6dd5300725b89e5e) Signed-off-by: Lucas Gass (cherry picked from commit 5178687b67cefb9ca0c9847c6aeb123366d0a59c) Signed-off-by: Fridolin Somers --- tools/modborrowers.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl index 9eceff6402..56eed9d0c5 100755 --- a/tools/modborrowers.pl +++ b/tools/modborrowers.pl @@ -396,9 +396,9 @@ if ( $op eq 'do' ) { my @attr_values = $input->multi_param('patron_attributes_value'); my $attributes; my $i = 0; - for my $code ( @attributes ) { - push @{ $attributes->{$code}->{values} }, shift @attr_values; # Handling repeatables - $attributes->{$code}->{disabled} = grep { $_ eq sprintf("attr%s_value", ++$i) } @disabled; + for my $code (@attributes) { + push @{ $attributes->{$code}->{values} }, shift @attr_values; # Handling repeatables + $attributes->{$code}->{disabled} = grep { $_ eq sprintf( "attr%s_value", $i++ ) } @disabled; } for my $code ( keys %$attributes ) {