Browse Source

Bug 30909: Retain permanent_location if mapped

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 <andrewfh@dubcolib.org>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
22.11.x
Jonathan Druart 2 years ago
committed by Tomas Cohen Arazi
parent
commit
e2668a6857
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 11
      cataloguing/additem.pl

11
cataloguing/additem.pl

@ -208,8 +208,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);
}
@ -477,6 +480,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 {

Loading…
Cancel
Save