Lines 2139-2162
sub AddReturn {
Link Here
|
2139 |
|
2139 |
|
2140 |
my $update_loc_rules = C4::Context->yaml_preference('UpdateItemLocationOnCheckin'); |
2140 |
my $update_loc_rules = C4::Context->yaml_preference('UpdateItemLocationOnCheckin'); |
2141 |
if ($update_loc_rules) { |
2141 |
if ($update_loc_rules) { |
2142 |
if (defined $update_loc_rules->{_ALL_}) { |
2142 |
if ( defined $update_loc_rules->{_ALL_} ) { |
2143 |
if ($update_loc_rules->{_ALL_} eq '_PERM_') { $update_loc_rules->{_ALL_} = $item->permanent_location; } |
2143 |
if ( $update_loc_rules->{_ALL_} eq '_PERM_' ) { |
2144 |
if ($update_loc_rules->{_ALL_} eq '_BLANK_') { $update_loc_rules->{_ALL_} = ''; } |
2144 |
$update_loc_rules->{_ALL_} = $item->permanent_location; |
|
|
2145 |
} |
2146 |
if ( $update_loc_rules->{_ALL_} eq '_BLANK_' ) { |
2147 |
$update_loc_rules->{_ALL_} = ''; |
2148 |
} |
2145 |
if ( |
2149 |
if ( |
2146 |
( defined $item->location && $item->location ne $update_loc_rules->{_ALL_}) || |
2150 |
( |
2147 |
(!defined $item->location && $update_loc_rules->{_ALL_} ne "") |
2151 |
defined $item->location |
2148 |
) { |
2152 |
&& $item->location ne $update_loc_rules->{_ALL_} |
2149 |
$messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{_ALL_} }; |
2153 |
) |
2150 |
$item->location($update_loc_rules->{_ALL_})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1}); |
2154 |
|| ( !defined $item->location |
|
|
2155 |
&& $update_loc_rules->{_ALL_} ne "" ) |
2156 |
) |
2157 |
{ |
2158 |
$messages->{'ItemLocationUpdated'} = |
2159 |
{ from => $item->location, to => $update_loc_rules->{_ALL_} }; |
2160 |
$item->location( $update_loc_rules->{_ALL_} )->store( |
2161 |
{ |
2162 |
log_action => 0, |
2163 |
skip_record_index => 1, |
2164 |
skip_holds_queue => 1 |
2165 |
} |
2166 |
); |
2151 |
} |
2167 |
} |
2152 |
} |
2168 |
} |
2153 |
else { |
2169 |
else { |
2154 |
foreach my $key ( keys %$update_loc_rules ) { |
2170 |
foreach my $key ( keys %$update_loc_rules ) { |
2155 |
if ( $update_loc_rules->{$key} eq '_PERM_' ) { $update_loc_rules->{$key} = $item->permanent_location; } |
2171 |
if ( $update_loc_rules->{$key} eq '_PERM_' ) { |
2156 |
elsif ( $update_loc_rules->{$key} eq '_BLANK_') { $update_loc_rules->{$key} = '' ;} |
2172 |
$update_loc_rules->{$key} = $item->permanent_location; |
2157 |
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 '') ) { |
2173 |
} |
2158 |
$messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{$key} }; |
2174 |
elsif ( $update_loc_rules->{$key} eq '_BLANK_' ) { |
2159 |
$item->location($update_loc_rules->{$key})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1}); |
2175 |
$update_loc_rules->{$key} = ''; |
|
|
2176 |
} |
2177 |
if ( |
2178 |
( |
2179 |
defined $item->location |
2180 |
&& $item->location eq $key |
2181 |
&& $item->location ne $update_loc_rules->{$key} |
2182 |
) |
2183 |
|| ( $key eq '_BLANK_' |
2184 |
&& ( !defined $item->location || $item->location eq '' ) |
2185 |
&& $update_loc_rules->{$key} ne '' ) |
2186 |
) |
2187 |
{ |
2188 |
$messages->{'ItemLocationUpdated'} = { |
2189 |
from => $item->location, |
2190 |
to => $update_loc_rules->{$key} |
2191 |
}; |
2192 |
$item->location( $update_loc_rules->{$key} )->store( |
2193 |
{ |
2194 |
log_action => 0, |
2195 |
skip_record_index => 1, |
2196 |
skip_holds_queue => 1 |
2197 |
} |
2198 |
); |
2160 |
last; |
2199 |
last; |
2161 |
} |
2200 |
} |
2162 |
} |
2201 |
} |
2163 |
- |
|
|