From 9f8007603efac10c7c01019d321eb1a6197695d5 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Tue, 7 Dec 2021 09:41:01 +0000 Subject: [PATCH] Bug 41649: Set magnetic_media in SIP responses The `magnetic_media` flag was never set, it can be set from `sip_media_type` if it's present. `sip_media_type` is set via the Authorized Values system. Checkins will not be sorted correctly by Biblioteca without this flag. --- C4/SIP/ILS/Item.pm | 7 ++++++- C4/SIP/Sip/MsgType.pm | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/C4/SIP/ILS/Item.pm b/C4/SIP/ILS/Item.pm index 4aadb99f22d..36d505c3969 100644 --- a/C4/SIP/ILS/Item.pm +++ b/C4/SIP/ILS/Item.pm @@ -106,7 +106,12 @@ sub new { my $it = $item->effective_itemtype; $self->{itemtype} = $it; my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find($it); - $self->{sip_media_type} = $itemtype->sip_media_type() if $itemtype; + if ($itemtype) { + $self->{sip_media_type} = $itemtype->sip_media_type; + if ( defined( $self->{sip_media_type} ) && $self->{sip_media_type} =~ m/^(00[4578]|010)/ ) { + $self->{magnetic_media} = 1; + } + } # check if its on issue and if so get the borrower my $issue = Koha::Checkouts->find( { itemnumber => $item->itemnumber } ); diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index 37cb7d1a7e8..38e6d7cb156 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -752,7 +752,7 @@ sub handle_checkin { $resp .= 'U'; } - $resp .= $status->alert ? 'Y' : 'N'; + $resp .= ( $status->alert || $item->magnetic_media ) ? 'Y' : 'N'; $resp .= timestamp; $resp .= add_field( FID_INST_ID, $inst_id, $server ); $resp .= add_field( FID_ITEM_ID, $item_id, $server ); -- 2.52.0