From c9e44c6e0b0241bb786b91ce2c8833afe31a14fe Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 21 Sep 2022 16:10:34 +0000 Subject: [PATCH] Bug 31595: Don't process extended attributes if none are inlcuded in the file This patch simply adds a check to the import process to only process attrbutes if they have been found in the data To test: 1 - Import some patrons without extended attributes 2 - Import patrons including extended attributes 3 - Confirm both work unchanged Signed-off-by: Chris Cormack Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 40cff1a774a3a9deea2effb375b3e7272003444c) Signed-off-by: Lucas Gass (cherry picked from commit 4e4fac93144c174003d49a9d049a52960f34c6e1) Signed-off-by: Arthur Suzuki --- Koha/Patrons/Import.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm index fe3fd80c11..fcd7491619 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -326,7 +326,7 @@ sub import_patrons { } } } - if ($extended) { + if ($extended && @$patron_attributes) { if ($ext_preserve) { $patron_attributes = $patron->extended_attributes->merge_and_replace_with( $patron_attributes ); } @@ -386,7 +386,7 @@ sub import_patrons { ); } - if ($extended) { + if ($extended && @$patron_attributes) { # FIXME Hum, we did not filter earlier and now we do? $patron->extended_attributes->filter_by_branch_limitations->delete; $patron->extended_attributes($patron_attributes); -- 2.39.5