From d15d61dcf41c928cdc08f85ba75675e324fed998 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 7 Jun 2022 11:27:04 +0200 Subject: [PATCH] Bug 30909: Retain permanent_location if mapped MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If items.permanent_location is mapped to a MARC subfields we must retain the value, not using items.location Test plan: 1 - Map permanent_location to a marc field 2 - Expose that field in the item editor 3 - Change the location of the item and retain the permanent location on saving 4 - note that permanent location has not changed Test the different other situation, when adding and editing: Empty the field, change only location, change only permanent_location, etc. Signed-off-by: andrew Signed-off-by: Joonas Kylmälä Signed-off-by: Tomas Cohen Arazi (cherry picked from commit e2668a685702a0cd9adf3deeafcc9e4433199e0f) Signed-off-by: Lucas Gass (cherry picked from commit 346be764e71a1bdd60aa4d267598e22a85448610) Signed-off-by: Arthur Suzuki --- cataloguing/additem.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 5572d05a27..42e4781158 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -177,8 +177,11 @@ if ($op eq "additem") { my @v = grep { $_ ne "" } uniq $input->multi_param( "items." . $c ); - next if !@v - && $c ne 'permanent_location'; # See 27837 + next unless @v; + + if ( $c eq 'permanent_location' ) { # See 27837 + $item->make_column_dirty('permanent_location'); + } $item->$c(join ' | ', @v); } @@ -442,6 +445,10 @@ if ($op eq "additem") { my @v = map { ( defined $_ && $_ eq '' ) ? undef : $_ } $input->multi_param( "items." . $c ); next unless @v; + if ( $c eq 'permanent_location' ) { # See 27837 + $item->make_column_dirty('permanent_location'); + } + if ( scalar(@v) == 1 && not defined $v[0] ) { delete $new_values->{$c}; } else { -- 2.39.5