From 373d1a7ed38ce2b19391011c13c1f89ff52a7f87 Mon Sep 17 00:00:00 2001 From: Kyle Hall Date: Wed, 30 Mar 2022 08:27:59 -0400 Subject: [PATCH] Bug 20517: (QA follow-up) Add ability to override syspref with account level settings in SIP config file Signed-off-by: Kyle M Hall Signed-off-by: Fridolin Somers --- C4/SIP/ILS/Transaction/Checkin.pm | 19 +++++++++++++------ etc/SIPconfig.xml | 3 +++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm index 0e3babe023..c420c2a63a 100644 --- a/C4/SIP/ILS/Transaction/Checkin.pm +++ b/C4/SIP/ILS/Transaction/Checkin.pm @@ -170,7 +170,7 @@ sub do_checkin { # Set sort bin based on info in the item associated with the issue, and the # mapping from SIP2SortBinMapping - $self->sort_bin( _get_sort_bin( $item, $branch ) ); + $self->sort_bin( _get_sort_bin( $item, $branch, $account ) ); $self->ok($return); @@ -231,13 +231,20 @@ Returns the ID of the appropriate sort_bin, if there is one, or undef. sub _get_sort_bin { # We should get an item represented as a hashref here - my ( $item, $branch ) = @_; + my ( $item, $branch, $account ) = @_; return unless $item; - # Get the mapping and split on newlines - my $raw_map = C4::Context->preference('SIP2SortBinMapping'); - return unless $raw_map; - my @lines = split /\r\n/, $raw_map; + my @lines; + # Mapping in SIP config takes precedence over syspref + if ( my $mapping = $account->{sort_bin_mapping} ) { + @lines = map { $_->{mapping} } @$mapping; + } + else { + # Get the mapping and split on newlines + my $raw_map = C4::Context->preference('SIP2SortBinMapping'); + return unless $raw_map; + @lines = split /\r\n/, $raw_map; + } # Iterate over the mapping. The first hit wins. my $rule = 0; diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml index 9e94594bdd..c4f174d9f5 100644 --- a/etc/SIPconfig.xml +++ b/etc/SIPconfig.xml @@ -73,6 +73,9 @@ prevcheckout_block_checkout="0" overdues_block_checkout="1" format_due_date="0"> + + + -- 2.39.5