Browse Source

Bug 20517: (QA follow-up) Add ability to override syspref with account level settings in SIP config file

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
rmain2205
Kyle Hall 6 months ago
committed by Fridolin Somers
parent
commit
373d1a7ed3
  1. 19
      C4/SIP/ILS/Transaction/Checkin.pm
  2. 3
      etc/SIPconfig.xml

19
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;

3
etc/SIPconfig.xml

@ -73,6 +73,9 @@
prevcheckout_block_checkout="0"
overdues_block_checkout="1"
format_due_date="0">
<!-- Refer to syspref SIP2SortBinMapping for full explanation of sort bin mapping -->
<sort_bin_mapping mapping="CPL:itype:eq:BK:1"/>
<sort_bin_mapping mapping="CPL:location:eq:OFFICE:2"/>
<screen_msg_regex find="Greetings from Koha." replace="Welcome to your library!" />
<screen_msg_regex find="Invalid patron barcode." replace="Barcode not found, are you sure this is your library card?" />
<patron_attribute field="XY" code="CODE" />

Loading…
Cancel
Save