Bug 28762: Confirm return of not_for_loan in boolean context matches is_notforloan

This patch is simply here to prove that is_notforloan is just
not_for_loan but in a boolean context.. we'll remove it in the next
patch.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 0d5c224cc3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2024-07-22 16:09:30 +01:00 committed by Lucas Gass
parent a38bac4814
commit 656d39208b
2 changed files with 4 additions and 18 deletions

View File

@ -2409,21 +2409,7 @@ the item's notforloan status or its item type
sub is_notforloan {
my ( $self ) = @_;
my $is_notforloan = 0;
if ( $self->notforloan ){
$is_notforloan = 1;
}
else {
my $itemtype = $self->itemtype;
if ($itemtype){
if ( $itemtype->notforloan ){
$is_notforloan = 1;
}
}
}
return $is_notforloan;
return $self->not_for_loan;
}
=head3 is_denied_renewal

View File

@ -2251,12 +2251,12 @@ subtest 'Notforloan tests' => sub {
my $item1 = $builder->build_sample_item;
$item1->update({ notforloan => 0 });
$item1->itemtype->notforloan(0);
is ( $item1->is_notforloan, 0, 'Notforloan is correctly false by item status and item type');
ok( !$item1->is_notforloan, 'Notforloan is correctly false by item status and item type');
$item1->update({ notforloan => 1 });
is ( $item1->is_notforloan, 1, 'Notforloan is correctly true by item status');
ok( $item1->is_notforloan, 'Notforloan is correctly true by item status');
$item1->update({ notforloan => 0 });
$item1->itemtype->update({ notforloan => 1 });
is ( $item1->is_notforloan, 1, 'Notforloan is correctly true by item type');
ok( $item1->is_notforloan, 'Notforloan is correctly true by item type');
$schema->storage->txn_rollback;
};