From 3452bdf940bc763b8171e934d4b0e58d17968370 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 7) To test SIP functionality: a) Start the SIP server (e.g., koha-sip service) b) Create an item with an itemtype that has sip_magnetic checked c) Use misc/sip_cli_emulator.pl to send a checkout request: perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su -sp -l --patron --password --item -m checkout d) Check the SIP response to ensure it handles magnetic media correctly (e.g., no desensitization flag) --- C4/SIP/ILS/Item.pm | 4 +--- admin/itemtypes.pl | 3 +++ api/v1/swagger/definitions/item_type.yaml | 5 +++++ .../intranet-tmpl/prog/en/modules/admin/itemtypes.tt | 9 +++++++++ 4 files changed, 18 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/api/v1/swagger/definitions/item_type.yaml b/api/v1/swagger/definitions/item_type.yaml index 44801329a99..ce2bb223635 100644 --- a/api/v1/swagger/definitions/item_type.yaml +++ b/api/v1/swagger/definitions/item_type.yaml @@ -77,6 +77,11 @@ properties: type: - string - "null" + sip_magnetic: + description: Whether this item type is magnetic media for SIP2 purposes + type: + - boolean + - "null" hide_in_opac: description: Hide the item type from the search options in OPAC type: boolean 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..aa88e92fc4c 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.sip_magnetic %] + + [% ELSE %] + + [% END %] + If checked, items of this type are flagged as magnetic media for SIP responses. +