From 840f39bbfca2d2f22a3053cb756c872693c3ff7f Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 20 Mar 2019 15:46:26 +0000 Subject: [PATCH] Bug 14576: Rebase fixes Fix test Rebase code --- C4/Circulation.pm | 13 ++++++------- t/db_dependent/Circulation/issue.t | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 0f456e6a51..626c5f7e8f 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1424,7 +1424,6 @@ sub AddIssue { } )->store; } - if ( $item_object->location eq 'CART' && $item_object->permanent_location ne 'CART' ) { ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. CartToShelf( $item_object->itemnumber ); @@ -1886,19 +1885,19 @@ sub AddReturn { 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}; } + if ($update_loc_rules->{_ALL_} eq '_PERM_') { $update_loc_rules->{_ALL_} = $item->permanent_location; } if ($update_loc_rules->{_ALL_} eq '_BLANK_') { $update_loc_rules->{_ALL_} = ''; } - if ( $item->{location} ne $update_loc_rules->{_ALL_}) { - $messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $update_loc_rules->{_ALL_} }; + if ( $item->location ne $update_loc_rules->{_ALL_}) { + $messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{_ALL_} }; ModItem( { location => $update_loc_rules->{_ALL_} }, undef, $itemnumber ); } } 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 '_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 '') ) { - $messages->{'ItemLocationUpdated'} = { from => $item->{location}, to => $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 '') ) { + $messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{$key} }; ModItem( { location => $update_loc_rules->{$key} }, undef, $itemnumber ); last; } diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t index 31dd457252..e945876378 100644 --- a/t/db_dependent/Circulation/issue.t +++ b/t/db_dependent/Circulation/issue.t @@ -418,7 +418,7 @@ $item2 = Koha::Items->find( $itemnumber2 ); ok( $item2->location eq 'PROC' , q{UpdateItemLocationOnCheckin updates location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location value from '' to 'PROC' with setting "_BLANK_: PROC"} ); AddReturn( 'barcode_4', $branchcode_1 ); -$item2 = Koha::Items( $itemnumber2 ); +$item2 = Koha::Items->find( $itemnumber2 ); ok( $item2->location eq '' , q{UpdateItemLocationOnCheckin updates location value from 'PROC' to '' with setting "PROC: _PERM_" } ); ok( $item2->permanent_location eq '' , q{UpdateItemLocationOnCheckin does not update permanent_location from '' with setting "PROC: _PERM_" } ); -- 2.11.0