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 <chris@bigballofwax.co.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 40cff1a774)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 4e4fac9314)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Nick Clemens 2022-09-21 16:10:34 +00:00 committed by Arthur Suzuki
parent 92b0dc2cdb
commit c9e44c6e0b
1 changed files with 2 additions and 2 deletions

View File

@ -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);