From 4e6d9d13bf879593303eed8188bcfc615111519c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 22 Jul 2024 16:14:08 +0100 Subject: [PATCH] Bug 28762: Replace is_notforloan with not_for_loan This patch replaces the use of is_notforloan with not_for_loan and removes the older is_notforloan method and tests Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- C4/ILSDI/Services.pm | 2 +- Koha/Item.pm | 14 -------------- t/db_dependent/Koha/Item.t | 19 ------------------- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 7d40c6b4d1..5a214562b3 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -970,7 +970,7 @@ sub _availability { my $location = $library ? $library->branchname : ''; my $itemcallnumber = $item->itemcallnumber; - if ( $item->is_notforloan ) { + if ( $item->effective_notforloan ) { return ( $biblionumber, __('not available'), __('Not for loan'), $location, $itemcallnumber ); } elsif ( $item->onloan ) { return ( $biblionumber, __('not available'), __('Checked out'), $location, $itemcallnumber ); diff --git a/Koha/Item.pm b/Koha/Item.pm index 33ee8e0226..ed573d1b6a 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -2398,20 +2398,6 @@ sub check_recalls { return $recall; } -=head3 is_notforloan - - my $is_notforloan = $item->is_notforloan; - -Determine whether or not this item is "notforloan" based on -the item's notforloan status or its item type - -=cut - -sub is_notforloan { - my ( $self ) = @_; - return $self->not_for_loan; -} - =head3 is_denied_renewal my $is_denied_renewal = $item->is_denied_renewal; diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index cd90a6ce7b..c6ec27b880 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -2242,25 +2242,6 @@ subtest 'Recalls tests' => sub { $schema->storage->txn_rollback; }; -subtest 'Notforloan tests' => sub { - - plan tests => 3; - - $schema->storage->txn_begin; - - my $item1 = $builder->build_sample_item; - $item1->update({ notforloan => 0 }); - $item1->itemtype->notforloan(0); - ok( !$item1->is_notforloan, 'Notforloan is correctly false by item status and item type'); - $item1->update({ notforloan => 1 }); - ok( $item1->is_notforloan, 'Notforloan is correctly true by item status'); - $item1->update({ notforloan => 0 }); - $item1->itemtype->update({ notforloan => 1 }); - ok( $item1->is_notforloan, 'Notforloan is correctly true by item type'); - - $schema->storage->txn_rollback; -}; - subtest 'item_group() tests' => sub { plan tests => 4; -- 2.39.5