From f4491f801d66bcda9151d74faa262c7b5a6dfdda Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 27 Apr 2023 07:21:41 +0200 Subject: [PATCH] Bug 31187: Make sure to not count twice There is another modified++ right after, we don't want to count it twice --- Koha/Items.pm | 1 + t/db_dependent/Koha/Items/BatchUpdate.t | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Koha/Items.pm b/Koha/Items.pm index 0615901fae7..390122a9e5b 100644 --- a/Koha/Items.pm +++ b/Koha/Items.pm @@ -304,6 +304,7 @@ sub batch_update { $modified++; $new_values->{permanent_location} = $old; $item->make_column_dirty('permanent_location'); + next; } $modified++ if ( defined $old xor defined $new ) diff --git a/t/db_dependent/Koha/Items/BatchUpdate.t b/t/db_dependent/Koha/Items/BatchUpdate.t index 9fc6ff1fa21..8c728f11ab8 100755 --- a/t/db_dependent/Koha/Items/BatchUpdate.t +++ b/t/db_dependent/Koha/Items/BatchUpdate.t @@ -171,8 +171,7 @@ subtest 'permanent_location' => sub { 'location' => 'loc' } } - ); - $items->reset; + )->reset; $item = $item->get_from_storage; is( $item->permanent_location, 'perm', 'Updated as expected when value passed'); @@ -184,8 +183,7 @@ subtest 'permanent_location' => sub { 'location' => 'new_loc' } } - ); - $items->reset; + )->reset; $item = $item->get_from_storage; is( $item->permanent_location, 'perm', 'Permanent location not updated when mapped, so key present, but no value passed '); -- 2.25.1