From c6798323cd16c9243b8c832d1f757bcba4d4342d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 19 Jan 2026 14:26:14 +0000 Subject: [PATCH] Bug 41649: Fix SIP Message tests for magnetic media The tests for desensitize and alert flags were failing because items were created with random itemtypes that could have sip_magnetic=1. This caused unexpected behavior since magnetic media items don't get desensitized and trigger alert flags. Fix by explicitly creating itemtypes with sip_magnetic=0 in: - test_checkout_desensitize - test_renew_desensitize - test_checkin_v2 Sponsored-by: OpenFifth Signed-off-by: Marcus Michel Signed-off-by: Kyle M Hall Signed-off-by: Pedro Amorim --- t/db_dependent/SIP/Message.t | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t index 3f3b509463..f0db09403f 100755 --- a/t/db_dependent/SIP/Message.t +++ b/t/db_dependent/SIP/Message.t @@ -1385,6 +1385,14 @@ sub test_checkin_v2 { my $card1 = $patron1->{cardnumber}; my $sip_patron1 = C4::SIP::ILS::Patron->new($card1); $findpatron = $sip_patron1; + + # Create itemtype with sip_magnetic = 0 to ensure alert flag tests work correctly + my $itemtype_obj = $builder->build_object( + { + class => 'Koha::ItemTypes', + value => { sip_magnetic => 0 }, + } + ); my $item_object = $builder->build_sample_item( { damaged => 0, @@ -1393,6 +1401,7 @@ sub test_checkin_v2 { restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode, + itype => $itemtype_obj->itemtype, } ); @@ -1679,6 +1688,14 @@ sub test_checkout_desensitize { my $sip_patron1 = C4::SIP::ILS::Patron->new($card1); my $patron_category = $sip_patron1->ptype(); $findpatron = $sip_patron1; + + # Create itemtype with sip_magnetic = 0 to ensure desensitize tests work correctly + my $itemtype_obj = $builder->build_object( + { + class => 'Koha::ItemTypes', + value => { sip_magnetic => 0 }, + } + ); my $item_object = $builder->build_sample_item( { damaged => 0, @@ -1687,6 +1704,7 @@ sub test_checkout_desensitize { restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode, + itype => $itemtype_obj->itemtype, } ); my $itemtype = $item_object->effective_itemtype; @@ -1873,6 +1891,14 @@ sub test_renew_desensitize { my $sip_patron1 = C4::SIP::ILS::Patron->new($card1); my $patron_category = $sip_patron1->ptype(); $findpatron = $sip_patron1; + + # Create itemtype with sip_magnetic = 0 to ensure desensitize tests work correctly + my $itemtype_obj = $builder->build_object( + { + class => 'Koha::ItemTypes', + value => { sip_magnetic => 0 }, + } + ); my $item_object = $builder->build_sample_item( { damaged => 0, @@ -1881,6 +1907,7 @@ sub test_renew_desensitize { restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode, + itype => $itemtype_obj->itemtype, } ); my $itemtype = $item_object->effective_itemtype;