From a500f90d7533465c2d978a5a518426a5686bb6c0 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 4 Oct 2021 17:22:38 +1300 Subject: [PATCH] Bug 31391: Request recalls and convert reserves on staff interface This enhancement adds the ability to place recalls via the staff interface by introducing a system preference, RecallsInterface, to configure where recalls can be placed. Recalls can either be placed via the OPAC, or the staff interface, or both. This is set to OPAC by default to be consistent with current behaviour. This enhancement also adds the ability to convert existing reserves to recalls easily via the staff interface. The reserve will be cancelled and a recall placed using the reserve's information. To test: 1) Update database and restart services 2) Enable UseRecalls and set the relevant recalls circulation rules 3) View the new RecallsInterface system preference. Confirm it is set to OPAC only by default 4) Check out Item A to Patron B. 5) Log into the OPAC as Patron A. Confirm you can place, view and cancel recalls as normal. 6) In the staff interface, set RecallsInterface to Staff interface only. 7) In the OPAC, confirm you can still view and cancel recalls, but can no longer place recalls. 8) In the staff interface, search for Item A and go to the Reserves tab. Place a reserve for Patron C. 9) Under the Priority column, select the dropdown and choose the recall option next to your reserve. 10) Click Update holds. Confirm when the page refreshes that your reserve has disappeared. 11) Go to the recalls tab. Confirm your reserve has been converted to a recall, and details like the patron, expiration, and pickup location have carried across to the recall. 12) On this recalls page, use the patron search to find Patron D. Test placing a record-level recall by keeping the 'recall next available item' checkbox. 13) When the page refreshes, confirm the recall was successfully placed with the correct details stored. 14) Repeat steps 12 and 13 with Patron E, this time place an item-level recall by choosing an item in the 'place a recall on a specific item' table. When selecting one of these items, the 'recall next available item' checkbox should de-select. 15) Set RecallsInterface back to OPAC only. Go back to the record and view the Recalls tab. 16) Confirm you cannot search for a patron to place a recall, but can still view and cancel recalls. Confirm you also cannot convert reserves to recalls. 17) Set RecallsInterface to both staff interface and OPAC. Confirm you can place recalls on both interfaces. 18) On the staff interface, test placing recalls that your circulation rules do not allow. For example, if 'recalls per record' is 1, ensure you're blocked from placing a second recall on a record for a patron. 19) Place a reserve for one of the patron's that already has a recall. Once complete, try to convert this reserve into a recall. Confirm you are blocked and shown a message that the hold cannot be converted to a recall. 20) Ensure tests pass t/db_dependent/Holds.t Sponsored-by: Auckland University of Technology --- C4/Reserves.pm | 34 +++ Koha/Biblio.pm | 4 +- Koha/Item.pm | 6 +- .../intranet-tmpl/prog/en/includes/holds_table.inc | 6 + .../prog/en/modules/recalls/request.tt | 264 +++++++++++++++++++-- .../prog/en/modules/reserve/request.tt | 8 + .../intranet-tmpl/prog/js/patron-autocomplete.js | 4 +- recalls/request.pl | 98 +++++++- reserve/modrequest.pl | 14 +- reserve/request.pl | 5 + t/db_dependent/Holds.t | 83 ++++++- 11 files changed, 498 insertions(+), 28 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index a03072d8df..4a6ff75135 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1115,6 +1115,40 @@ sub ModReserve { if ( $rank eq "del" ) { $hold->cancel({ cancellation_reason => $cancellation_reason }); } + elsif ( $rank eq "recall" ) { + if ( !$biblionumber ) { + $biblionumber = $hold->biblionumber; + } + my $biblio = Koha::Biblios->find( $biblionumber ); + if ( !$borrowernumber ) { + $borrowernumber = $hold->borrowernumber; + } + my $patron = Koha::Patrons->find( $borrowernumber ); + if ( $hold->item_level_hold ) { + if ( $hold->item->can_be_recalled({ patron => $patron, hold_convert => 1 }) ) { + my ( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({ + patron => $patron, + biblio => $biblio, + branchcode => $branchcode, + expirationdate => $date, + interface => 'intranet', + item => $hold->item, + }); + $hold->cancel({ cancellation_reason => 'RECALLED' }); + } + } else { + if ( $biblio->can_be_recalled({ patron => $patron, hold_convert => 1 }) ) { + my ( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({ + patron => $patron, + biblio => $biblio, + branchcode => $branchcode, + expirationdate => $date, + interface => 'intranet', + }); + $hold->cancel({ cancellation_reason => 'RECALLED' }); + } + } + } elsif ($hold->found && $hold->priority eq '0' && $date) { logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold ) if C4::Context->preference('HoldsLog'); diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 3c8e5cb4b2..289376a9b0 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -1283,6 +1283,8 @@ sub recalls { Does biblio-level checks and returns the items attached to this biblio that are available for recall +if hold_convert $param is included, this is to say that this a check to convert a hold to a recall, so we should not check for an existing hold. + =cut sub can_be_recalled { @@ -1308,7 +1310,7 @@ sub can_be_recalled { my @all_itemnumbers; foreach my $item ( @all_items ) { push( @all_itemnumbers, $item->itemnumber ); - if ( $item->can_be_recalled({ patron => $patron }) ) { + if ( $item->can_be_recalled({ patron => $patron, hold_convert => $params->{hold_convert} }) ) { push( @itemtypes, $item->effective_itemtype ); push( @itemnumbers, $item->itemnumber ); push( @items, $item ); diff --git a/Koha/Item.pm b/Koha/Item.pm index f25ae42c57..212f291358 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -1732,6 +1732,8 @@ sub recall { Does item-level checks and returns if items can be recalled by this borrower +if hold_convert $param is included, this is to say that this a check to convert a hold to a recall, so we should not check for an existing hold. + =cut sub can_be_recalled { @@ -1783,7 +1785,9 @@ sub can_be_recalled { return 0 if ( Koha::Checkouts->search({ itemnumber => $self->itemnumber, borrowernumber => $patron->borrowernumber })->count > 0 ); # check if this patron has already reserved this item - return 0 if ( Koha::Holds->search({ itemnumber => $self->itemnumber, borrowernumber => $patron->borrowernumber })->count > 0 ); + unless ( $params->{hold_convert} ) { + return 0 if ( Koha::Holds->search({ itemnumber => $self->itemnumber, borrowernumber => $patron->borrowernumber })->count > 0 ); + } } # check item availability diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc index 536bd16484..cd41bebe60 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -64,6 +64,9 @@ [% END %] + [% IF Koha.Preference('UseRecalls') AND Koha.Preference('RecallsInterface') != 'opac' %] + + [% END %] [% ELSE %] @@ -79,6 +82,9 @@ [% ELSE %] [% END %] + [% IF Koha.Preference('UseRecalls') AND Koha.Preference('RecallsInterface') != 'opac' %] + + [% END %] [% END %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt index 2f4a573cf8..043baa9d12 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt @@ -2,8 +2,17 @@ [% USE Asset %] [% USE Koha %] [% USE KohaDates %] +[% USE TablesSettings %] +[% USE Branches %] +[% USE Categories %] +[% USE AuthorisedValues %] +[% USE ItemTypes %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] +[% SET libraries = Branches.all %] +[% SET categories = Categories.all.unblessed %] +[% SET columns = ['name', 'cardnumber', 'dateofbirth', 'category', 'branch', 'address', 'phone'] %] +[% PROCESS "patron-search.inc" %] Confirm recalls › Recalls › Koha [% INCLUDE 'doc-head-close.inc' %] @@ -11,35 +20,217 @@ [% INCLUDE 'header.inc' %] [% INCLUDE 'circ-search.inc' %] - +
-

Existing recalls

+

Recalls

+ +

Place a recall on [% INCLUDE 'biblio-title.inc' link = 1 %]

+ + [% IF patron %] + + [% IF error %] +
+ Unable to place a recall. Check your circulation rules. +
+ [% END %] + +
+ Recall details +
+ + +
    +
  1. + [% INCLUDE 'patron-title.inc' %] + +
  2. + + [% UNLESS ( single_branch_mode ) %]
  3. + + +
  4. [% END %] + +
  5. + +
  6. +
  7. + +
  8. +
+ +
+ + + [% IF error %] + + [% ELSE %] + + [% END %] + Cancel +
+ + + + + + + + + [% UNLESS ( single_branch_mode ) %] + + + [% END %] + + + + + + + + + [% FOREACH item IN items %] + + + + [% UNLESS ( single_branch_mode ) %] + + + [% END %] + + + + + + [% END %] + +
Place a recall on a specific item
 Item typeBarcodeHome libraryLast locationCollectionCall numberCopy numberVol no.Information
+ [% IF item.can_be_recalled( patron => patron ) %] + + [% ELSE %] + + + + [% END %] + [% ItemTypes.GetDescription( item.effective_itemtype ) | html %][% item.barcode | html %][% Branches.GetName( item.homebranch ) | html %][% Branches.GetName( item.holdingbranch) | html %][% AuthorisedValues.GetByCode( 'CCODE', item.ccode, 1 ) | html %][% item.itemcallnumber | html %][% item.copynumber | html %][% item.enumchron | html %] + [% IF ( item.checkout ) %] + Due [% item.checkout.date_due | $KohaDates %] + [% ELSIF ( item.get_transfer ) %] + In transit from [% Branches.GetName( item.get_transfer.frombranch ) | html %] to [% Branches.GetName( item.get_transfer.tobranch ) | html %] since [% item.get_transfer.datesent | $KohaDates %] + [% END %] + [% IF ( item.itemlost || item.withdrawn ) %] + Unavailable (lost or missing) + [% END %] + [% IF ( item.notforloan ) %] + Not for loan ([% item.notforloan | html %]) + [% END %] + [% hold = item.current_holds.next %] + [% IF ( item.recall ) %] + + [% IF ( item.recall.waiting_date ) %] + Waiting for patron at [% Branches.GetName( item.recall.pickup_library_id ) | html %] since [% item.recall.waiting_date | $KohaDates %]. + [% ELSIF ( item.recall.item_id == item.itemnumber ) %] + Recalled by patron expected at [% Branches.GetName( item.recall.pickup_library_id ) | html %] since [% item.recall.created_date | $KohaDates %]. + [% END %] + + [% ELSIF ( hold.waitingdate ) %] + + Waiting for patron at [% Branches.GetName( hold.branchcode ) | html %] since [% hold.waitingdate | $KohaDates %]. + + [% ELSIF ( hold.borrowernumber == logged_in_user.borrowernumber ) %] + + Patron has already placed a reserve on this item. + + [% END # / IF ( item.recall or hold ) %] +
- [% IF Koha.Preference('UseRecalls') %] - [% IF recalls.count %] - - - Select all - [% INCLUDE 'recalls.inc' %]
- + + + [% IF error %] + + [% ELSE %] + + [% END %] + Cancel
+ +
+ + [% ELSE %] + + [% IF Koha.Preference('RecallsInterface') == 'opac' %] +
+ Due to the RecallsInterface system preference, recalls cannot be placed through the staff client. +
[% ELSE %] -
No recalls have been made.
+ +
+

Search patrons

+
+ +
+
+ [% PROCESS patron_search_filters_simple %] + [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %] +
+
+
+
+ [% END %] - [% ELSE %] -
Recalls have not been enabled. Enable the UseRecalls system preference to use recalls.
+ +

Existing recalls

+ + [% IF Koha.Preference('UseRecalls') %] + [% IF recalls.count %] +
+ + Select all + [% INCLUDE 'recalls.inc' %] +
+ +
+
+ [% ELSE %] +
No recalls have been made.
+ [% END %] + [% ELSE %] +
Recalls have not been enabled. Enable the UseRecalls system preference to use recalls.
+ [% END %] + [% END %]
@@ -58,6 +249,45 @@ [% Asset.js("js/recalls.js") | $raw %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] + [% INCLUDE 'calendar.inc' %] + [% SET url_biblio_params = "biblionumber=" _ biblio.biblionumber %] + [% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/recalls/request.pl?' _ url_biblio_params, redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/recalls/request.pl?' _ url_biblio_params, redirect_if_attribute_equal => 'cardnumber' %] + [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index eb37dbc00e..5c98b3198f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -216,6 +216,14 @@

No club with this name, please, try another

[% END %] + + [% IF ( recallerror ) %] +
+

Hold cannot be converted to a recall

+

A recall cannot be placed on one or more holds. Check your circulation and fine rules.

+
+ [% END %] +
[% UNLESS multi_hold %] [% IF clubcount %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js index 6057cb8473..a1733e83f3 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js +++ b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js @@ -67,7 +67,9 @@ function patron_autocomplete(node, options) { ? "/cgi-bin/koha/circ/circulation.pl" : link_to == 'reserve' ? "/cgi-bin/koha/reserve/request.pl" - : "/cgi-bin/koha/members/moremember.pl"; + : link_to == 'recall' + ? "/cgi-bin/koha/recalls/request.pl" + : "/cgi-bin/koha/members/moremember.pl"; item.link += ( url_params ? '?' + url_params + '&' : "?" ) + 'borrowernumber=' + item.patron_id; } else { item.link = null; diff --git a/recalls/request.pl b/recalls/request.pl index 222f7ab38b..2d24133e57 100755 --- a/recalls/request.pl +++ b/recalls/request.pl @@ -38,27 +38,115 @@ my ($template, $loggedinuser, $cookie)= get_template_and_user( my $op = $input->param('op') || 'list'; my @recall_ids = $input->multi_param('recall_ids'); my $biblionumber = $input->param('biblionumber'); -my $recalls = Koha::Recalls->search({ biblio_id => $biblionumber, completed => 0 }); my $biblio = Koha::Biblios->find( $biblionumber ); +my $borrowernumber = $input->param('borrowernumber'); +my $error = $input->param('error'); if ( $op eq 'cancel_multiple_recalls' ) { foreach my $id ( @recall_ids ) { Koha::Recalls->find( $id )->set_cancelled; } - $op = 'list' } +elsif ( $op eq 'request' ) { + + if ( C4::Context->preference('UseRecalls') and C4::Context->preference('RecallsInterface') ne 'opac' and $borrowernumber ) { + my $patron = Koha::Patrons->find( $borrowernumber ); + + unless ( $biblio->can_be_recalled({ patron => $patron }) ) { $error = 'unavailable'; } + my $items = Koha::Items->search({ biblionumber => $biblionumber })->as_list; + + # check if already recalled + my $recalled = $biblio->recalls->filter_by_current->search({ patron_id => $borrowernumber })->count; + if ( defined $recalled and $recalled > 0 ) { + my $recalls_per_record = Koha::CirculationRules->get_effective_rule({ + categorycode => $patron->categorycode, + branchcode => undef, + itemtype => undef, + rule_name => 'recalls_per_record' + }); + if ( defined $recalls_per_record and $recalls_per_record->rule_value and $recalled >= $recalls_per_record->rule_value ){ + $error = 'duplicate'; + } + } + + if ( !defined $error ){ + my $pickuploc = $input->param('pickup'); + my $expdate = $input->param('expirationdate'); + my $level = $input->param('type'); + my $itemnumber = $input->param('itemnumber'); + + my ( $recall, $due_interval, $due_date ); + + if ( !defined $level and defined $itemnumber ) { + my $item = Koha::Items->find( $itemnumber ); + if ( $item->can_be_recalled({ patron => $patron }) ) { + ( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({ + patron => $patron, + biblio => $biblio, + branchcode => $pickuploc, + item => $item, + expirationdate => $expdate, + interface => 'staff', + }); + } else { + $error = 'cannot'; + } + } else { + if ( $biblio->can_be_recalled({ patron => $patron }) ) { + ( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({ + patron => $patron, + biblio => $biblio, + branchcode => $pickuploc, + expirationdate => $expdate, + interface => 'staff', + }); + } else { + $error = 'cannot'; + } + } + if ( !defined $recall ) { + $error = 'failed'; + } else { + # successful recall, go back to Recalls tab + print $input->redirect("/cgi-bin/koha/recalls/request.pl?biblionumber=$biblionumber"); + } + } + } +} + +if ( $borrowernumber ) { + my $patron = Koha::Patrons->find( $borrowernumber ); + + if ( C4::Context->preference('UseRecalls') and C4::Context->preference('RecallsInterface') ne 'opac' and $patron and $patron->borrowernumber ) { + if ( !$biblio->can_be_recalled({ patron => $patron }) ) { + $error = 1; + } -if ( $op eq 'list' ) { - $recalls = Koha::Recalls->search({ biblio_id => $biblionumber, completed => 0 }); - $biblio = Koha::Biblios->find( $biblionumber ); + $template->param( + patron => $patron, + ); + } } +my $recalls = Koha::Recalls->search({ biblio_id => $biblionumber, completed => 0 }); +my $branches = Koha::Libraries->search; +my $single_branch_mode = $branches->count == 1; +my $items = Koha::Items->search({ biblionumber => $biblionumber }); + $template->param( recalls => $recalls, recallsview => 1, biblio => $biblio, checkboxes => 1, + branches => $branches, + items => $items, + error => $error, + single_branch_mode => $single_branch_mode, C4::Search::enabled_staff_search_views, + attribute_type_codes => ( C4::Context->preference('ExtendedPatronAttributes') + ? [ Koha::Patron::Attribute::Types->search( { staff_searchable => 1 } )->get_column('code') ] + : [] + ), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/reserve/modrequest.pl b/reserve/modrequest.pl index ec78f683be..c0b44af64e 100755 --- a/reserve/modrequest.pl +++ b/reserve/modrequest.pl @@ -52,6 +52,7 @@ my @branch = $query->multi_param('pickup'); my @itemnumber = $query->multi_param('itemnumber'); my @biblionumber = $query->multi_param('biblionumber'); my $count=@rank; +my $recallerror; @biblionumber = uniq @biblionumber; @@ -86,6 +87,13 @@ else { $params->{reservedate} = $reservedates[$i] || undef; } + if ( $rank[$i] eq 'recall' and !$recallerror ) { + my $hold = Koha::Holds->find( $reserve_id[$i] ); + if ( !$hold->biblio->can_be_recalled({ patron => $hold->patron }) ) { + $recallerror = 1; + } + } + try { ModReserve($params); } catch { @@ -112,6 +120,10 @@ if ( $from eq 'borrower'){ print $query->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrower[0]"); } else { my $url = URI->new("/cgi-bin/koha/reserve/request.pl"); - $url->query_form( biblionumber => [@biblionumber]); + if ( $recallerror ) { + $url->query_form( biblionumber => [@biblionumber], recallerror => 1 ); + } else { + $url->query_form( biblionumber => [@biblionumber] ); + } print $query->redirect($url); } diff --git a/reserve/request.pl b/reserve/request.pl index 8c64f43160..cb2786355c 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -725,6 +725,11 @@ $template->param( borrowernumber => $borrowernumber_hold, ); +my $recallerror = $input->param('recallerror'); +if ( $recallerror ) { + $template->param( recallerror => 1 ); +} + # printout the page output_html_with_http_headers $input, $cookie, $template->output; diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t index 6f87d43533..887f76cc95 100755 --- a/t/db_dependent/Holds.t +++ b/t/db_dependent/Holds.t @@ -7,7 +7,7 @@ use t::lib::TestBuilder; use C4::Context; -use Test::More tests => 75; +use Test::More tests => 76; use Test::Exception; use MARC::Record; @@ -1795,4 +1795,83 @@ subtest 'Koha::Holds->get_items_that_can_fill returns items with datecancelled o is($items_that_can_fill3->count, 1, "Koha::Holds->get_items_that_can_fill returns 1 item with correct parameters"); is($items_that_can_fill4->next, undef, "Koha::Holds->get_items_that_can_fill doesn't return item with undefined datearrived and undefined datecancelled"); is($items_that_can_fill4->count, 0, "Koha::Holds->get_items_that_can_fill returns 0 item"); -} +}; + +subtest 'ModReserve to convert a hold to a recall' => sub { + plan tests => 2; + + $schema->storage->txn_begin; + + my $category = $builder->build({ source => 'Category' }); + my $branch = $builder->build({ source => 'Branch' })->{ branchcode }; + my $biblio = $builder->build_sample_biblio( { itemtype => 'DUMMY' } ); + my $item = $builder->build_sample_item( + { library => $branch, biblionumber => $biblio->biblionumber } ); + + my $patron = Koha::Patron->new( + { + firstname => 'my firstname', + surname => 'whatever surname', + categorycode => $category->{categorycode}, + branchcode => $branch, + } + )->store; + my $borrowernumber = $patron->borrowernumber; + + my $patron2 = Koha::Patron->new( + { + firstname => 'my firstname', + surname => 'whatever surname', + categorycode => $category->{categorycode}, + branchcode => $branch, + } + )->store; + + t::lib::Mocks::mock_preference("UseRecalls", 1); + t::lib::Mocks::mock_userenv( { branchcode => $branch } ); + + C4::Circulation::AddIssue( $patron2->unblessed, $item->barcode ); + + Koha::CirculationRules->set_rules({ + branchcode => undef, + categorycode => undef, + itemtype => undef, + rules => { + recalls_allowed => 5, + recalls_per_record => 1, + on_shelf_recalls => 'any', + }, + }); + + my $reserve_id = AddReserve( + { + branchcode => $branch, + borrowernumber => $borrowernumber, + biblionumber => $biblio->biblionumber, + priority => + C4::Reserves::CalculatePriority( $biblio->biblionumber ), + itemnumber => $item->id, + } + ); + + my $hold = Koha::Holds->find($reserve_id); + my $before_recalls = Koha::Recalls->search->filter_by_current->count; + + ModReserve( + { + reserve_id => $hold->id, + expirationdate => '1981-06-10', + priority => 99, + rank => "recall", + itemnumber => $item->id, + } + ); + + $hold = Koha::Holds->find($reserve_id); + my $after_recalls = Koha::Recalls->search->filter_by_current->count; + + ok( !defined $hold, 'Hold was cancelled' ); + is( $after_recalls, $before_recalls + 1, 'Recall count increased by 1 as hold was converted to a recall' ); + + $schema->storage->txn_rollback; +}; -- 2.11.0