Lines 170-176
sub do_checkin {
Link Here
|
170 |
|
170 |
|
171 |
# Set sort bin based on info in the item associated with the issue, and the |
171 |
# Set sort bin based on info in the item associated with the issue, and the |
172 |
# mapping from SIP2SortBinMapping |
172 |
# mapping from SIP2SortBinMapping |
173 |
$self->sort_bin( _get_sort_bin( $item, $branch ) ); |
173 |
$self->sort_bin( _get_sort_bin( $item, $branch, $account ) ); |
174 |
|
174 |
|
175 |
$self->ok($return); |
175 |
$self->ok($return); |
176 |
|
176 |
|
Lines 231-243
Returns the ID of the appropriate sort_bin, if there is one, or undef.
Link Here
|
231 |
sub _get_sort_bin { |
231 |
sub _get_sort_bin { |
232 |
|
232 |
|
233 |
# We should get an item represented as a hashref here |
233 |
# We should get an item represented as a hashref here |
234 |
my ( $item, $branch ) = @_; |
234 |
my ( $item, $branch, $account ) = @_; |
235 |
return unless $item; |
235 |
return unless $item; |
236 |
|
236 |
|
237 |
# Get the mapping and split on newlines |
237 |
my @lines; |
238 |
my $raw_map = C4::Context->preference('SIP2SortBinMapping'); |
238 |
# Mapping in SIP config takes precedence over syspref |
239 |
return unless $raw_map; |
239 |
if ( my $mapping = $account->{sort_bin_mapping} ) { |
240 |
my @lines = split /\r\n/, $raw_map; |
240 |
@lines = map { $_->{mapping} } @$mapping; |
|
|
241 |
} |
242 |
else { |
243 |
# Get the mapping and split on newlines |
244 |
my $raw_map = C4::Context->preference('SIP2SortBinMapping'); |
245 |
return unless $raw_map; |
246 |
@lines = split /\r\n/, $raw_map; |
247 |
} |
241 |
|
248 |
|
242 |
# Iterate over the mapping. The first hit wins. |
249 |
# Iterate over the mapping. The first hit wins. |
243 |
my $rule = 0; |
250 |
my $rule = 0; |