From 4e4fac93144c174003d49a9d049a52960f34c6e1 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 --- 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 96ab01e332..426d922140 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -330,7 +330,7 @@ sub import_patrons { } } } - if ($extended) { + if ($extended && @$patron_attributes) { if ($ext_preserve) { $patron_attributes = $patron->extended_attributes->merge_and_replace_with( $patron_attributes ); } @@ -390,7 +390,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.20.1