From a0a72c9653e546155bca210605ac9cabb74de09c Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Mon, 14 Mar 2022 22:04:47 -1000 Subject: [PATCH] Bug 19532: (RM follow-up) More use of system preference When system preference is off, call no code related to Koha::Recalls. Also add some missing module import. Signed-off-by: Fridolin Somers --- C4/Circulation.pm | 79 ++++++++++++++++++++++--------------- C4/Search.pm | 7 +++- C4/XSLT.pm | 8 +++- Koha/Biblio.pm | 1 + Koha/Patron.pm | 1 + catalogue/detail.pl | 11 ++++-- circ/circulation.pl | 21 +++++++--- circ/returns.pl | 37 ++++++++++------- circ/transferstoreceive.pl | 8 ++-- members/moremember.pl | 9 ++++- opac/opac-course-details.pl | 10 +++-- opac/opac-detail.pl | 18 +++++++-- opac/opac-reserve.pl | 2 +- opac/opac-user.pl | 20 ++++++---- svc/checkouts | 29 ++++++++------ t/db_dependent/Koha/Item.t | 3 ++ t/db_dependent/XSLT.t | 2 + tools/viewlog.pl | 1 + 18 files changed, 175 insertions(+), 92 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index dea25b6915..5537531db2 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -62,6 +62,7 @@ use Koha::Checkouts::ReturnClaims; use Koha::SearchEngine::Indexer; use Koha::Exceptions::Checkout; use Koha::Plugins; +use Koha::Recalls; use Carp qw( carp ); use List::MoreUtils qw( any ); use Scalar::Util qw( looks_like_number ); @@ -381,15 +382,17 @@ sub transferbook { } # find recall - my $recall = Koha::Recalls->find({ itemnumber => $itemnumber, status => 'in_transit' }); - if ( defined $recall and C4::Context->preference('UseRecalls') ) { - # do a transfer if the recall branch is different to the item holding branch - if ( $recall->branchcode eq $fbr ) { - $dotransfer = 0; - $messages->{'RecallPlacedAtHoldingBranch'} = 1; - } else { - $dotransfer = 1; - $messages->{'RecallFound'} = $recall; + if ( C4::Context->preference('UseRecalls') ) { + my $recall = Koha::Recalls->find({ itemnumber => $itemnumber, status => 'in_transit' }); + if ( defined $recall ) { + # do a transfer if the recall branch is different to the item holding branch + if ( $recall->branchcode eq $fbr ) { + $dotransfer = 0; + $messages->{'RecallPlacedAtHoldingBranch'} = 1; + } else { + $dotransfer = 1; + $messages->{'RecallFound'} = $recall; + } } } @@ -1570,7 +1573,16 @@ sub AddIssue { $item_object->discard_changes; } - Koha::Recalls->move_recall({ action => $cancel_recall, recall_id => $recall_id, item => $item_object, borrowernumber => $borrower->{borrowernumber} }) if C4::Context->preference('UseRecalls'); + if ( C4::Context->preference('UseRecalls') ) { + Koha::Recalls->move_recall( + { + action => $cancel_recall, + recall_id => $recall_id, + item => $item_object, + borrowernumber => $borrower->{borrowernumber}, + } + ); + } C4::Reserves::MoveReserve( $item_object->itemnumber, $borrower->{'borrowernumber'}, $cancelreserve ); @@ -2285,13 +2297,15 @@ sub AddReturn { } # find recalls... - # check if this item is recallable first, which includes checking if UseRecalls syspref is enabled - my $recall = undef; - $recall = $item->check_recalls if $item->can_be_waiting_recall; - if ( defined $recall ) { - $messages->{RecallFound} = $recall; - if ( $recall->branchcode ne $branch ) { - $messages->{RecallNeedsTransfer} = $branch; + if ( C4::Context->preference('UseRecalls') ) { + # check if this item is recallable first, which includes checking if UseRecalls syspref is enabled + my $recall = undef; + $recall = $item->check_recalls if $item->can_be_waiting_recall; + if ( defined $recall ) { + $messages->{RecallFound} = $recall; + if ( $recall->branchcode ne $branch ) { + $messages->{RecallNeedsTransfer} = $branch; + } } } @@ -2354,11 +2368,12 @@ sub AddReturn { $request->status('RET') if $request; } - my $transfer_recall = Koha::Recalls->find({ itemnumber => $item->itemnumber, status => 'in_transit' }); # all recalls that have triggered a transfer will have an allocated itemnumber - if ( $transfer_recall and - $transfer_recall->branchcode eq $branch and - C4::Context->preference('UseRecalls') ) { - $messages->{TransferredRecall} = $transfer_recall; + if ( C4::Context->preference('UseRecalls') ) { + # all recalls that have triggered a transfer will have an allocated itemnumber + my $transfer_recall = Koha::Recalls->find({ itemnumber => $item->itemnumber, status => 'in_transit' }); + if ( $transfer_recall and $transfer_recall->branchcode eq $branch ) { + $messages->{TransferredRecall} = $transfer_recall; + } } # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer @@ -2879,15 +2894,17 @@ sub CanBookBeRenewed { return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_much_oweing'; } - my $recall = undef; - $recall = $item->check_recalls if $item->can_be_waiting_recall; - if ( defined $recall ) { - if ( $recall->item_level_recall ) { - # item-level recall. check if this item is the recalled item, otherwise renewal will be allowed - return ( 0, 'recalled' ) if ( $recall->itemnumber == $item->itemnumber ); - } else { - # biblio-level recall, so only disallow renewal if the biblio-level recall has been fulfilled by a different item - return ( 0, 'recalled' ) unless ( $recall->waiting ); + if ( C4::Context->preference('UseRecalls') ) { + my $recall = undef; + $recall = $item->check_recalls if $item->can_be_waiting_recall; + if ( defined $recall ) { + if ( $recall->item_level_recall ) { + # item-level recall. check if this item is the recalled item, otherwise renewal will be allowed + return ( 0, 'recalled' ) if ( $recall->itemnumber == $item->itemnumber ); + } else { + # biblio-level recall, so only disallow renewal if the biblio-level recall has been fulfilled by a different item + return ( 0, 'recalled' ) unless ( $recall->waiting ); + } } } diff --git a/C4/Search.pm b/C4/Search.pm index 0d88d24ec3..9dfca44df3 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -31,6 +31,7 @@ use Koha::ItemTypes; use Koha::Libraries; use Koha::Logger; use Koha::Patrons; +use Koha::Recalls; use Koha::RecordProcessor; use URI::Escape; use Business::ISBN; @@ -1901,7 +1902,11 @@ sub searchResults { # ($transfertwhen, $transfertfrom, $transfertto) = C4::Circulation::GetTransfers($item->{itemnumber}); $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} ); - $recallstatus = 'Waiting' if Koha::Recalls->search({ itemnumber => $item->{itemnumber}, status => 'W' })->count; + if ( C4::Context->preference('UseRecalls') ) { + if ( Koha::Recalls->search({ itemnumber => $item->{itemnumber}, status => 'waiting' })->count ) { + $recallstatus = 'Waiting'; + } + } } # item is withdrawn, lost, damaged, not for loan, reserved or in transit diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 747416ea7b..ca25d0db30 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -30,6 +30,7 @@ use Koha::AuthorisedValues; use Koha::ItemTypes; use Koha::XSLT::Base; use Koha::Libraries; +use Koha::Recalls; my $engine; #XSLT Handler object my %authval_per_framework; @@ -353,10 +354,13 @@ sub buildKohaItemsNamespace { while ( my $item = $items->next ) { my $status; my $substatus = ''; + my $recalls_count; - my $recalls = Koha::Recalls->search({ itemnumber => $item->itemnumber, status => 'waiting' }); + if ( C4::Context->preference('UseRecalls') ) { + $recalls_count = Koha::Recalls->search({ itemnumber => $item->itemnumber, status => 'waiting' })->count; + } - if ( $recalls->count ) { + if ($recalls_count) { # recalls take priority over holds $status = 'other'; $substatus = 'Recall waiting'; diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 0e8e477f13..4022819e9c 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -41,6 +41,7 @@ use Koha::Item::Transfer::Limits; use Koha::Items; use Koha::Libraries; use Koha::Old::Checkouts; +use Koha::Recalls; use Koha::Suggestions; use Koha::Subscriptions; use Koha::SearchEngine; diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 82760f200f..6414abf9cb 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -49,6 +49,7 @@ use Koha::Patron::Modifications; use Koha::Patron::Relationships; use Koha::Patrons; use Koha::Plugins; +use Koha::Recalls; use Koha::Result::Boolean; use Koha::Subscription::Routinglists; use Koha::Token; diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 32a3528765..40e54b5394 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -54,6 +54,7 @@ use Koha::ItemTypes; use Koha::Patrons; use Koha::Virtualshelves; use Koha::Plugins; +use Koha::Recalls; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; @@ -401,10 +402,12 @@ foreach my $item (@items) { $item->{cover_images} = $item_object->cover_images; } - my $recall = Koha::Recalls->find({ itemnumber => $item->{itemnumber}, old => undef }); - if ( defined $recall ) { - $item->{recalled} = 1; - $item->{recall} = $recall; + if ( C4::Context->preference('UseRecalls') ) { + my $recall = Koha::Recalls->find({ itemnumber => $item->{itemnumber}, old => undef }); + if ( defined $recall ) { + $item->{recalled} = 1; + $item->{recall} = $recall; + } } if ($currentbranch and C4::Context->preference('SeparateHoldings')) { diff --git a/circ/circulation.pl b/circ/circulation.pl index 4d8d827747..358a34cb18 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -394,9 +394,16 @@ if (@$barcodes) { } unless($confirm_required) { my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}; - if ( !$recall_id ) { - my $item = Koha::Items->find({ barcode => $barcode }); - my $recall = Koha::Recalls->find({ biblionumber => $item->biblionumber, itemnumber => [ undef, $item->itemnumber ], status => [ 'R','W' ], old => undef, borrowernumber => $patron->borrowernumber }); + if ( C4::Context->preference('UseRecalls') && !$recall_id ) { + my $recall = Koha::Recalls->find( + { + biblionumber => $item->biblionumber, + itemnumber => [ undef, $item->itemnumber ], + status => [ 'requested', 'waiting' ], + old => undef, + borrowernumber => $patron->borrowernumber, + } + ); $recall_id = ( $recall and $recall->recall_id ) ? $recall->recall_id : undef; } my $issue = AddIssue( $patron->unblessed, $barcode, $datedue, $cancelreserve, undef, undef, { onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew'), switch_onsite_checkout => $switch_onsite_checkout, cancel_recall => $cancel_recall, recall_id => $recall_id, } ); @@ -446,9 +453,13 @@ if ($patron) { $template->param( holds_count => $holds->count(), WaitingHolds => $waiting_holds, - recalls => $patron->recalls->filter_by_current->search({},{ order_by => { -asc => 'recalldate' } }), - specific_patron => 1, ); + if ( C4::Context->preference('UseRecalls') ) { + $template->param( + recalls => $patron->recalls->filter_by_current->search({},{ order_by => { -asc => 'recalldate' } }), + specific_patron => 1, + ); + } } if ( $patron ) { diff --git a/circ/returns.pl b/circ/returns.pl index 8d93da4525..f98907187a 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -52,6 +52,7 @@ use Koha::Holds; use Koha::Items; use Koha::Item::Transfers; use Koha::Patrons; +use Koha::Recalls; my $query = CGI->new; @@ -178,16 +179,18 @@ if ( $query->param('recall_id') ) { my $itemnumber = $query->param('itemnumber'); my $return_branch = $query->param('returnbranch'); - my $item; - if ( !$recall->item_level_recall ) { - $item = Koha::Items->find( $itemnumber ); - } + if ($recall) { + my $item; + if ( !$recall->item_level_recall ) { + $item = Koha::Items->find( $itemnumber ); + } - if ( $recall->branchcode ne $return_branch ) { - $recall->start_transfer({ item => $item }) if !$recall->in_transit; - } else { - my $expirationdate = $recall->calc_expirationdate; - $recall->set_waiting({ item => $item, expirationdate => $expirationdate }) if !$recall->waiting; + if ( $recall->branchcode ne $return_branch ) { + $recall->start_transfer({ item => $item }) if !$recall->in_transit; + } else { + my $expirationdate = $recall->calc_expirationdate; + $recall->set_waiting({ item => $item, expirationdate => $expirationdate }) if !$recall->waiting; + } } } @@ -250,9 +253,11 @@ if ($transit) { my $transfer = Koha::Item::Transfers->find($transit); if ( $canceltransfer ) { $transfer->cancel({ reason => 'Manual', force => 1}); - my $recall_transfer_deleted = Koha::Recalls->find({ itemnumber => $itemnumber, status => 'T' }); - if ( defined $recall_transfer_deleted ) { - $recall_transfer_deleted->revert_transfer; + if ( C4::Context->preference('UseRecalls') ) { + my $recall_transfer_deleted = Koha::Recalls->find({ itemnumber => $itemnumber, status => 'in_transit' }); + if ( defined $recall_transfer_deleted ) { + $recall_transfer_deleted->revert_transfer; + } } $template->param( transfercancelled => 1); } else { @@ -262,9 +267,11 @@ if ($transit) { my $item = Koha::Items->find($itemnumber); my $transfer = $item->get_transfer; $transfer->cancel({ reason => 'Manual', force => 1}); - my $recall_transfer_deleted = Koha::Recalls->find({ itemnumber => $itemnumber, status => 'T' }); - if ( defined $recall_transfer_deleted ) { - $recall_transfer_deleted->revert_transfer; + if ( C4::Context->preference('UseRecalls') ) { + my $recall_transfer_deleted = Koha::Recalls->find({ itemnumber => $itemnumber, status => 'in_transit' }); + if ( defined $recall_transfer_deleted ) { + $recall_transfer_deleted->revert_transfer; + } } if($dest eq "ttr"){ print $query->redirect("/cgi-bin/koha/circ/transferstoreceive.pl"); diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl index d398ac733d..939891211d 100755 --- a/circ/transferstoreceive.pl +++ b/circ/transferstoreceive.pl @@ -111,9 +111,11 @@ while ( my $library = $libraries->next ) { } # check for a recall for this transfer - my $recall = $item->recall; - if ( defined $recall ) { - $getransf{recall} = $recall; + if ( C4::Context->preference('UseRecalls') ) { + my $recall = $item->recall; + if ( defined $recall ) { + $getransf{recall} = $recall; + } } push( @transferloop, \%getransf ); diff --git a/members/moremember.pl b/members/moremember.pl index af76827091..89ec5d9af5 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -273,8 +273,13 @@ $template->param( files => Koha::Patron::Files->new( borrowernumber => $borrowernumber ) ->GetFilesInfo(), #debarments => scalar GetDebarments({ borrowernumber => $borrowernumber }), has_modifications => $has_modifications, - recalls => $patron->recalls({},{ order_by => { -asc => 'recalldate' } })->filter_by_current, - specific_patron => 1, ); +if ( C4::Context->preference('UseRecalls') ) { + $template->param( + recalls => $patron->recalls({},{ order_by => { -asc => 'recalldate' } })->filter_by_current, + specific_patron => 1, + ); +} + output_html_with_http_headers $input, $cookie, $template->output; diff --git a/opac/opac-course-details.pl b/opac/opac-course-details.pl index bf9abdfb88..48b5b9f746 100755 --- a/opac/opac-course-details.pl +++ b/opac/opac-course-details.pl @@ -44,10 +44,12 @@ die("No course_id given") unless ($course_id); my $course = GetCourse($course_id); my $course_reserves = GetCourseReserves( course_id => $course_id, include_items => 1, include_count => 1 ); -foreach my $cr ( @$course_reserves ) { - if ( $cr->{issue}->{date_due} and $cr->{issue}->{borrowernumber} and $borrowernumber != $cr->{issue}->{borrowernumber} and C4::Context->preference('UseRecalls') ) { - $cr->{course_item}->{avail_for_recall} = 1; - $cr->{course_item}->{biblionumber} = Koha::Items->find( $cr->{itemnumber} )->biblionumber; +if ( C4::Context->preference('UseRecalls') ) { + foreach my $cr ( @$course_reserves ) { + if ( $cr->{issue}->{date_due} and $cr->{issue}->{borrowernumber} and $borrowernumber != $cr->{issue}->{borrowernumber} ) { + $cr->{course_item}->{avail_for_recall} = 1; + $cr->{course_item}->{biblionumber} = Koha::Items->find( $cr->{itemnumber} )->biblionumber; + } } } diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index ab2f7b900d..00c52eb5aa 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -81,6 +81,7 @@ use Koha::Virtualshelves; use Koha::Patrons; use Koha::Plugins; use Koha::Ratings; +use Koha::Recalls; use Koha::Reviews; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; @@ -729,10 +730,19 @@ if ( not $viewallitems and @items > $max_items_to_display ) { $itemfields{$_} = 1 if ($itm->{$_}); } - my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber}); - my $recall_status = Koha::Recalls->search({ itemnumber => $itm->{itemnumber}, status => 'W', old => undef }); - if( $reserve_status eq "Waiting" or $recall_status->count ){ $itm->{'waiting'} = 1; } - if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; } + my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber}); + my $recall_status; + if ( C4::Context->preference('UseRecalls') ) { + my $recall_status = Koha::Recalls->search( + { + itemnumber => $itm->{itemnumber}, + status => 'waiting', + old => undef, + } + )->count; + } + if ( $reserve_status eq "Waiting" or $recall_status ) { $itm->{'waiting'} = 1; } + if ( $reserve_status eq "Reserved" ) { $itm->{'onhold'} = 1; } my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber}); if ( defined( $transfertwhen ) && $transfertwhen ne '' ) { diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 568a3c73de..b8ffca4e44 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -633,7 +633,7 @@ foreach my $biblioNum (@biblionumbers) { $biblioLoopIter{holdable} &&= $status eq 'OK'; $biblioLoopIter{already_patron_possession} = $status eq 'alreadypossession'; - if ( CanBookBeReserved( $borrowernumber, $biblioNum )->{status} eq 'recall' ){ + if ( $status eq 'recall' ) { $biblioLoopIter{recall} = 1; } diff --git a/opac/opac-user.pl b/opac/opac-user.pl index dc440dced5..ec18afabc9 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -46,6 +46,7 @@ use Koha::Patron::Messages; use Koha::Patron::Discharge; use Koha::Patrons; use Koha::Ratings; +use Koha::Recalls; use Koha::Token; use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; @@ -307,11 +308,13 @@ if ( $pending_checkouts->count ) { # Useless test $issue->{MySummaryHTML} = $my_summary_html; } - my $maybe_recalls = Koha::Recalls->search({ biblionumber => $issue->{biblionumber}, itemnumber => [ undef, $issue->{itemnumber} ], old => undef }); - while( my $recall = $maybe_recalls->next ) { - if ( $recall->checkout and $recall->checkout->issue_id == $issue->{issue_id} ) { - $issue->{recall} = 1; - last; + if ( C4::Context->preference('UseRecalls') ) { + my $maybe_recalls = Koha::Recalls->search({ biblionumber => $issue->{biblionumber}, itemnumber => [ undef, $issue->{itemnumber} ], old => undef }); + while( my $recall = $maybe_recalls->next ) { + if ( $recall->checkout and $recall->checkout->issue_id == $issue->{issue_id} ) { + $issue->{recall} = 1; + last; + } } } } @@ -335,14 +338,17 @@ $template->param( show_barcode => 1 ) if $show_barcode; # now the reserved items.... my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } ); -my $recalls = Koha::Recalls->search({ borrowernumber => $borrowernumber, old => undef }); $template->param( RESERVES => $reserves, showpriority => $show_priority, - RECALLS => $recalls, ); +if ( C4::Context->preference('UseRecalls') ) { + my $recalls = Koha::Recalls->search( { borrowernumber => $borrowernumber, old => undef } ); + $template->param( RECALLS => $recalls ); +} + if (C4::Context->preference('BakerTaylorEnabled')) { $template->param( BakerTaylorEnabled => 1, diff --git a/svc/checkouts b/svc/checkouts index 852827e0d0..98959d1edf 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -29,6 +29,7 @@ use C4::Context; use Koha::AuthorisedValues; use Koha::DateUtils qw( dt_from_string output_pref ); +use Koha::Items; use Koha::ItemTypes; my $input = CGI->new; @@ -212,20 +213,22 @@ while ( my $c = $sth->fetchrow_hashref() ) { my $item = Koha::Items->find( $c->{itemnumber} ); my $recalled = 0; - my $recall = undef; - $recall = $item->check_recalls if $item->can_be_waiting_recall; - if ( defined $recall ) { - if ( $recall->item_level_recall ) { - if ( $recall->itemnumber == $c->{itemnumber} ) { - # item-level recall on this item - $recalled = 1; + if ( C4::Context->preference('UseRecalls') ) { + my $recall = undef; + $recall = $item->check_recalls if $item->can_be_waiting_recall; + if ( defined $recall ) { + if ( $recall->item_level_recall ) { + if ( $recall->itemnumber == $c->{itemnumber} ) { + # item-level recall on this item + $recalled = 1; + } else { + $recalled = 0; + } } else { - $recalled = 0; - } - } else { - # biblio-level recall, but don't want to mark recalled if the recall has been allocated a different item - if ( !$recall->waiting ) { - $recalled = 1; + # biblio-level recall, but don't want to mark recalled if the recall has been allocated a different item + if ( !$recall->waiting ) { + $recalled = 1; + } } } } diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index 9db7de79e0..244ce5b50a 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -1186,6 +1186,7 @@ subtest 'Recalls tests' => sub { ); t::lib::Mocks::mock_userenv( { patron => $patron1 } ); + t::lib::Mocks::mock_preference('UseRecalls', 1); my $recall1 = Koha::Recall->new( { borrowernumber => $patron1->borrowernumber, @@ -1357,6 +1358,8 @@ subtest 'Recalls tests' => sub { is( $check_recall->borrowernumber, $patron1->borrowernumber, "Only remaining recall is returned" ); $recall2->set_cancelled; + + $schema->storage->txn_rollback; }; subtest 'store() tests' => sub { diff --git a/t/db_dependent/XSLT.t b/t/db_dependent/XSLT.t index 5de621f7f7..4c9be6bb4f 100755 --- a/t/db_dependent/XSLT.t +++ b/t/db_dependent/XSLT.t @@ -143,6 +143,7 @@ subtest 'buildKohaItemsNamespace status tests' => sub { my $library_name = $holdinglibrary->branchname; like($xml,qr{${library_name}}, "Found resultbranch / holding branch" ); + t::lib::Mocks::mock_preference('UseRecalls', 1); my $recall = $builder->build_object({ class => 'Koha::Recalls', value => { biblionumber => $item->biblionumber, itemnumber => $item->itemnumber, @@ -151,6 +152,7 @@ subtest 'buildKohaItemsNamespace status tests' => sub { $recall->set_waiting; $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); like($xml,qr{Recall waiting},"Waiting status takes precedence over In transit (recalls)"); + t::lib::Mocks::mock_preference('UseRecalls', 0); }; diff --git a/tools/viewlog.pl b/tools/viewlog.pl index 9f32a9ef76..c7f4273565 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -33,6 +33,7 @@ use Koha::Database; use Koha::DateUtils qw( dt_from_string ); use Koha::Items; use Koha::Patrons; +use Koha::Recalls; =head1 viewlog.pl -- 2.39.5