Bug 32478: (follow-up) UpdateItemLocationOnCheckin no longer needs flattening
This patch removes a line flattening the arrays generated by get_yaml_pref_hash as it is no longer necessary Conditionals are adjusted to avoid warnings in tests Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
dc35755238
commit
ae9163d415
1 changed files with 2 additions and 3 deletions
|
@ -2138,7 +2138,6 @@ sub AddReturn {
|
|||
my $patron_unblessed = $patron ? $patron->unblessed : {};
|
||||
|
||||
my $update_loc_rules = C4::Context->yaml_preference('UpdateItemLocationOnCheckin');
|
||||
map { $update_loc_rules->{$_} = $update_loc_rules->{$_}[0] } keys %$update_loc_rules; #We can only move to one location so we flatten the arrays
|
||||
if ($update_loc_rules) {
|
||||
if (defined $update_loc_rules->{_ALL_}) {
|
||||
if ($update_loc_rules->{_ALL_} eq '_PERM_') { $update_loc_rules->{_ALL_} = $item->permanent_location; }
|
||||
|
@ -2154,8 +2153,8 @@ sub AddReturn {
|
|||
else {
|
||||
foreach my $key ( keys %$update_loc_rules ) {
|
||||
if ( $update_loc_rules->{$key} eq '_PERM_' ) { $update_loc_rules->{$key} = $item->permanent_location; }
|
||||
if ( $update_loc_rules->{$key} eq '_BLANK_') { $update_loc_rules->{$key} = '' ;}
|
||||
if ( ($item->location eq $key && $item->location ne $update_loc_rules->{$key}) || ($key eq '_BLANK_' && $item->location eq '' && $update_loc_rules->{$key} ne '') ) {
|
||||
elsif ( $update_loc_rules->{$key} eq '_BLANK_') { $update_loc_rules->{$key} = '' ;}
|
||||
if ( (defined $item->location && $item->location eq $key && $item->location ne $update_loc_rules->{$key}) || ($key eq '_BLANK_' && ( !defined $item->location || $item->location eq '' ) && $update_loc_rules->{$key} ne '') ) {
|
||||
$messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{$key} };
|
||||
$item->location($update_loc_rules->{$key})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1});
|
||||
last;
|
||||
|
|
Loading…
Reference in a new issue