From 2d674efbe7911bf85b5c3cdc10f5df26027303d5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 16 Jan 2026 08:03:49 +0000 Subject: [PATCH] Bug 41649: Add option to set magnetic flag for item itemtypes This patch adds the ability to set an item type as magentic for SIP response purposes. Test plan: 1) Run included database updates 2) Navigate to admin > itemtypes 3) Edit/Add an itemtype and scroll to the 'Sip media types' input 4) A new 'Sip magnetic' checkbox should be available 5) Confirm setting/unsetting it works as expected 6) The SIP magnetic flag bit should respect the setting --- C4/SIP/ILS/Item.pm | 4 +--- admin/itemtypes.pl | 3 +++ .../intranet-tmpl/prog/en/modules/admin/itemtypes.tt | 9 +++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/C4/SIP/ILS/Item.pm b/C4/SIP/ILS/Item.pm index 36d505c3969..f2b2cb17b25 100644 --- a/C4/SIP/ILS/Item.pm +++ b/C4/SIP/ILS/Item.pm @@ -108,9 +108,7 @@ sub new { my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find($it); 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; - } + $self->{magnetic_media} = $itemtype->sip_magnetic; } # check if its on issue and if so get the borrower diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 342639da408..c098b33e72d 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -52,6 +52,7 @@ my $dbh = C4::Context->dbh; my $sip_media_type = $input->param('sip_media_type'); undef($sip_media_type) if defined($sip_media_type) and $sip_media_type =~ /^\s*$/; +my $sip_magnetic = $input->param('sip_magnetic') ? 1 : 0; if ( $op eq 'add_form' ) { my $itemtype = Koha::ItemTypes->find($itemtype_code); @@ -115,6 +116,7 @@ if ( $op eq 'add_form' ) { $itemtype->checkinmsg($checkinmsg); $itemtype->checkinmsgtype($checkinmsgtype); $itemtype->sip_media_type($sip_media_type); + $itemtype->sip_magnetic($sip_magnetic); $itemtype->hideinopac($hideinopac); $itemtype->searchcategory($searchcategory); $itemtype->rentalcharge_daily_calendar($rentalcharge_daily_calendar); @@ -150,6 +152,7 @@ if ( $op eq 'add_form' ) { checkinmsg => $checkinmsg, checkinmsgtype => $checkinmsgtype, sip_media_type => $sip_media_type, + sip_magnetic => $sip_magnetic, hideinopac => $hideinopac, searchcategory => $searchcategory, rentalcharge_daily_calendar => $rentalcharge_daily_calendar, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt index 53e0757b5dc..a9dc4cfec2e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -342,6 +342,15 @@ [% END %] +
  • + + [% IF itemtype.magnetic %] + + [% ELSE %] + + [% END %] + If checked, items of this type are flagged as magnetic media for SIP responses. +