Bug 31391: Implement UseRecalls choices in modules

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Aleisha Amohia 2026-06-16 00:04:28 +00:00 committed by Pedro Amorim
parent f9c159e0a3
commit 0f35039974
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
5 changed files with 12 additions and 12 deletions

View File

@ -394,7 +394,7 @@ sub transferbook {
}
# find recall
if ( C4::Context->preference('UseRecalls') ) {
if ( C4::Context->preference('UseRecalls') ne "off" ) {
my $recall = Koha::Recalls->find( { item_id => $itemnumber, status => 'in_transit' } );
if ( defined $recall ) {
@ -1236,7 +1236,7 @@ sub CanBookBeIssued {
# CHECK IF ITEM HAS BEEN RECALLED BY ANOTHER PATRON
# Only bother doing this if UseRecalls is enabled and the item is recallable
# Don't look at recalls that are in transit
if ( C4::Context->preference('UseRecalls') and $item_object->can_be_waiting_recall ) {
if ( C4::Context->preference('UseRecalls') ne "off" and $item_object->can_be_waiting_recall ) {
my @recalls = $biblio->recalls( {}, { order_by => { -asc => 'created_date' } } )->filter_by_current->as_list;
foreach my $r (@recalls) {
@ -1802,7 +1802,7 @@ sub AddIssue {
$item_object->discard_changes;
}
if ( C4::Context->preference('UseRecalls') ) {
if ( C4::Context->preference('UseRecalls') ne "off" ) {
Koha::Recalls->move_recall(
{
action => $cancel_recall,
@ -2768,7 +2768,7 @@ sub AddReturn {
}
# find recalls...
if ( C4::Context->preference('UseRecalls') ) {
if ( C4::Context->preference('UseRecalls') ne "off" ) {
# check if this item is recallable first, which includes checking if UseRecalls syspref is enabled
my $recall = undef;
@ -2859,7 +2859,7 @@ sub AddReturn {
$request->status('RET') if $request;
}
if ( C4::Context->preference('UseRecalls') ) {
if ( C4::Context->preference('UseRecalls') ne "off" ) {
# all recalls that have triggered a transfer will have an allocated itemnumber
my $transfer_recall = Koha::Recalls->find( { item_id => $item->itemnumber, status => 'in_transit' } );
@ -3493,7 +3493,7 @@ sub CanBookBeRenewed {
}
if ( C4::Context->preference('UseRecalls') ) {
if ( C4::Context->preference('UseRecalls') ne "off" ) {
my $recall = undef;
$recall = $item->check_recalls if $item->can_be_waiting_recall;
if ( defined $recall ) {

View File

@ -1980,7 +1980,7 @@ sub searchResults {
)
: ( '', '', '' );
$reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} );
if ( C4::Context->preference('UseRecalls') ) {
if ( C4::Context->preference('UseRecalls') ne "off" ) {
if ( Koha::Recalls->search( { item_id => $item->{itemnumber}, status => 'waiting' } )->count ) {
$recallstatus = 'Waiting';
}

View File

@ -385,7 +385,7 @@ sub buildKohaItemsNamespace {
my $substatus = '';
my $recalls_count;
if ( C4::Context->preference('UseRecalls') ) {
if ( C4::Context->preference('UseRecalls') ne "off" ) {
$recalls_count = Koha::Recalls->search( { item_id => $item->itemnumber, status => 'waiting' } )->count;
}

View File

@ -2244,7 +2244,7 @@ Does biblio-level checks and returns the items attached to this biblio that are
sub can_be_recalled {
my ( $self, $params ) = @_;
return 0 if !( C4::Context->preference('UseRecalls') );
return 0 if ( C4::Context->preference('UseRecalls') eq "off" );
my $patron = $params->{patron};

View File

@ -1777,7 +1777,7 @@ sub _status {
if ( $self->first_hold ) {
push @statuses, 'on_hold';
}
if ( C4::Context->preference('UseRecalls') && $self->recall ) {
if ( C4::Context->preference('UseRecalls') ne "off" && $self->recall ) {
push @statuses, 'recalled';
}
@ -2648,7 +2648,7 @@ Does item-level checks and returns if items can be recalled by this borrower
sub can_be_recalled {
my ( $self, $params ) = @_;
return 0 if !( C4::Context->preference('UseRecalls') );
return 0 if ( C4::Context->preference('UseRecalls') eq "off" );
# check if this item is not for loan, withdrawn or lost
return 0 if ( $self->notforloan != 0 );
@ -2745,7 +2745,7 @@ At this point the item has already been recalled. We are now at the checkin and
sub can_be_waiting_recall {
my ($self) = @_;
return 0 if !( C4::Context->preference('UseRecalls') );
return 0 if ( C4::Context->preference('UseRecalls') eq "off" );
# check if this item is not for loan, withdrawn or lost
return 0 if ( $self->notforloan != 0 );