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 <sip_username> -sp <sip_password> -l <location_code> --patron <patron_cardnumber> --password <patron_password> --item <item_barcode> -m checkout
   d) Check the SIP response to ensure it handles magnetic media correctly (e.g., no desensitization 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:
Martin Renvoize 2026-01-16 08:03:49 +00:00 committed by Pedro Amorim
parent 06bf94d455
commit df7e600587
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
4 changed files with 18 additions and 3 deletions

View File

@ -108,9 +108,7 @@ sub new {
my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find($it); my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find($it);
if ($itemtype) { if ($itemtype) {
$self->{sip_media_type} = $itemtype->sip_media_type; $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} = $itemtype->sip_magnetic;
$self->{magnetic_media} = 1;
}
} }
# check if its on issue and if so get the borrower # check if its on issue and if so get the borrower

View File

@ -51,6 +51,7 @@ my $dbh = C4::Context->dbh;
my $sip_media_type = $input->param('sip_media_type'); my $sip_media_type = $input->param('sip_media_type');
undef($sip_media_type) if defined($sip_media_type) and $sip_media_type =~ /^\s*$/; 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' ) { if ( $op eq 'add_form' ) {
my $itemtype = Koha::ItemTypes->find($itemtype_code); my $itemtype = Koha::ItemTypes->find($itemtype_code);
@ -112,6 +113,7 @@ if ( $op eq 'add_form' ) {
$itemtype->checkinmsg($checkinmsg); $itemtype->checkinmsg($checkinmsg);
$itemtype->checkinmsgtype($checkinmsgtype); $itemtype->checkinmsgtype($checkinmsgtype);
$itemtype->sip_media_type($sip_media_type); $itemtype->sip_media_type($sip_media_type);
$itemtype->sip_magnetic($sip_magnetic);
$itemtype->hideinopac($hideinopac); $itemtype->hideinopac($hideinopac);
$itemtype->searchcategory($searchcategory); $itemtype->searchcategory($searchcategory);
$itemtype->rentalcharge_daily_calendar($rentalcharge_daily_calendar); $itemtype->rentalcharge_daily_calendar($rentalcharge_daily_calendar);
@ -146,6 +148,7 @@ if ( $op eq 'add_form' ) {
checkinmsg => $checkinmsg, checkinmsg => $checkinmsg,
checkinmsgtype => $checkinmsgtype, checkinmsgtype => $checkinmsgtype,
sip_media_type => $sip_media_type, sip_media_type => $sip_media_type,
sip_magnetic => $sip_magnetic,
hideinopac => $hideinopac, hideinopac => $hideinopac,
searchcategory => $searchcategory, searchcategory => $searchcategory,
rentalcharge_daily_calendar => $rentalcharge_daily_calendar, rentalcharge_daily_calendar => $rentalcharge_daily_calendar,

View File

@ -77,6 +77,11 @@ properties:
type: type:
- string - string
- "null" - "null"
sip_magnetic:
description: Whether this item type is magnetic media for SIP2 purposes
type:
- boolean
- "null"
hide_in_opac: hide_in_opac:
description: Hide the item type from the search options in OPAC description: Hide the item type from the search options in OPAC
type: boolean type: boolean

View File

@ -338,6 +338,15 @@
[% END %] [% END %]
</select> </select>
</li> </li>
<li>
<label for="sip_magnetic">SIP magnetic flag: </label>
[% IF itemtype.sip_magnetic %]
<input type="checkbox" id="sip_magnetic" name="sip_magnetic" checked="checked" value="1" />
[% ELSE %]
<input type="checkbox" id="sip_magnetic" name="sip_magnetic" value="1" />
[% END %]
<span class="hint">If checked, items of this type are flagged as magnetic media for SIP responses.</span>
</li>
<li> <li>
<label for="library_limitation">Library limitation: </label> <label for="library_limitation">Library limitation: </label>
<select id="library_limitation" name="branches" multiple size="10"> <select id="library_limitation" name="branches" multiple size="10">