From eb358ecc5cc3bec6dece014027333797c9c448d0 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 --- 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 bb5f820400..7d661a4228 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -331,7 +331,7 @@ sub import_patrons { } } } - if ($extended) { + if ($extended && @$patron_attributes) { if ($ext_preserve) { $patron_attributes = $patron->extended_attributes->merge_and_replace_with( $patron_attributes ); } @@ -391,7 +391,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.30.2