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.

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: Marcus Michel <marcus.michel@rbkc.gov.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Colin Campbell 2021-12-07 09:41:01 +00:00 committed by Pedro Amorim
parent 03dd4cf862
commit 303deda8d3
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
2 changed files with 7 additions and 2 deletions

View File

@ -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 } );

View File

@ -756,7 +756,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 );