From 1a3d44db001adcd34fffd3e4a7bc80d23ec4d077 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Fri, 27 Sep 2024 18:07:17 +0000 Subject: [PATCH] Bug 31391: Update the UseRecalls system preference to have choices Options are: * off * opac * staff * opac_and_staff This patch implements this all over the place. All recalls things should still work including the above test plan. Tests should pass: * t/db_dependent/Circulation.t * t/db_dependent/Circulation/transferbook.t * t/db_dependent/Holds.t * t/db_dependent/Koha/Biblio.t * t/db_dependent/Koha/Item.t * t/db_dependent/SIP/Transaction.t * t/db_dependent/Search.t * t/db_dependent/XSLT.t Sponsored-by: Auckland University of Technology Sponsored-by: Catalyst IT Signed-off-by: Pedro Amorim --- C4/Circulation.pm | 12 +++++------ C4/Search.pm | 2 +- C4/XSLT.pm | 2 +- Koha/Biblio.pm | 2 +- Koha/Item.pm | 4 ++-- circ/circulation.pl | 4 ++-- circ/returns.pl | 4 ++-- circ/transferstoreceive.pl | 2 +- ...ug_31391_-_add_RecallsInterface_syspref.pl | 16 --------------- .../bug_31391_-_update_UseRecalls_syspref.pl | 19 ++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 3 +-- .../prog/en/includes/biblio-view-menu.inc | 2 +- .../prog/en/includes/circ-menu.inc | 2 +- .../prog/en/includes/circ-nav.inc | 2 +- .../prog/en/includes/holds_table.inc | 6 +++--- .../tables/items/catalogue_detail.inc | 4 ++-- .../en/includes/messaging-preference-form.inc | 2 +- .../prog/en/includes/patron-detail-tabs.inc | 4 ++-- .../admin/preferences/circulation.pref | 20 +++++++------------ .../prog/en/modules/admin/smart-rules.tt | 8 ++++---- .../prog/en/modules/catalogue/results.tt | 2 +- .../prog/en/modules/circ/circulation-home.tt | 2 +- .../prog/en/modules/members/recallshistory.tt | 2 +- .../en/modules/recalls/recalls_old_queue.tt | 2 +- .../en/modules/recalls/recalls_overdue.tt | 2 +- .../prog/en/modules/recalls/recalls_queue.tt | 2 +- .../en/modules/recalls/recalls_to_pull.tt | 2 +- .../en/modules/recalls/recalls_waiting.tt | 2 +- .../prog/en/modules/recalls/request.tt | 12 +++++------ .../bootstrap/en/includes/item-status.inc | 4 ++-- .../en/includes/opac-detail-sidebar.inc | 2 +- .../bootstrap/en/includes/usermenu.inc | 2 +- .../bootstrap/en/modules/opac-messaging.tt | 2 +- .../bootstrap/en/modules/opac-recalls.tt | 2 +- .../bootstrap/en/modules/opac-results.tt | 2 +- .../bootstrap/en/modules/opac-shelves.tt | 2 +- .../bootstrap/en/modules/opac-tags.tt | 2 +- .../bootstrap/en/modules/opac-user.tt | 4 ++-- members/moremember.pl | 4 ++-- opac/opac-recall.pl | 2 +- opac/opac-user.pl | 4 ++-- recalls/request.pl | 7 ++----- svc/checkouts | 2 +- t/db_dependent/Circulation.t | 8 ++++---- t/db_dependent/Circulation/transferbook.t | 2 +- t/db_dependent/Holds.t | 2 +- t/db_dependent/Koha/Biblio.t | 4 ++-- t/db_dependent/Koha/Item.t | 8 ++++---- t/db_dependent/SIP/Transaction.t | 2 +- t/db_dependent/Search.t | 2 +- t/db_dependent/XSLT.t | 4 ++-- 51 files changed, 107 insertions(+), 114 deletions(-) delete mode 100755 installer/data/mysql/atomicupdate/bug_31391_-_add_RecallsInterface_syspref.pl create mode 100755 installer/data/mysql/atomicupdate/bug_31391_-_update_UseRecalls_syspref.pl diff --git a/C4/Circulation.pm b/C4/Circulation.pm index b9b66974be..a838b2c5d2 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -385,7 +385,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 ) { # do a transfer if the recall branch is different to the item holding branch @@ -1142,7 +1142,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 ) { @@ -1647,7 +1647,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, @@ -2427,7 +2427,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; $recall = $item->check_recalls if $item->can_be_waiting_recall; @@ -2504,7 +2504,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' }); if ( $transfer_recall and $transfer_recall->pickup_library_id eq $branch ) { @@ -3067,7 +3067,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 ) { diff --git a/C4/Search.pm b/C4/Search.pm index ca8e79ab0f..89534c12db 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1936,7 +1936,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'; } diff --git a/C4/XSLT.pm b/C4/XSLT.pm index a2134225d8..2292b136a3 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -299,7 +299,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; } diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 53419cf5c8..b6db47d09e 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -2081,7 +2081,7 @@ if hold_convert $param is included, this is to say that this a check to convert 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}; diff --git a/Koha/Item.pm b/Koha/Item.pm index 58c96f75fa..08dfa20d9c 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -2331,7 +2331,7 @@ if hold_convert $param is included, this is to say that this a check to convert 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 ); @@ -2416,7 +2416,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 ); diff --git a/circ/circulation.pl b/circ/circulation.pl index 968470e6f1..29bcf3b50b 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -519,7 +519,7 @@ if ( @$barcodes && $op eq 'cud-checkout' ) { } unless ($confirm_required) { my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}; - if ( C4::Context->preference('UseRecalls') && !$recall_id ) { + if ( C4::Context->preference('UseRecalls') ne "off" && !$recall_id ) { my $recall = Koha::Recalls->find( { biblio_id => $item->biblionumber, @@ -598,7 +598,7 @@ if ($patron) { WaitingHolds => $waiting_holds, ); - if ( C4::Context->preference('UseRecalls') ) { + if ( C4::Context->preference('UseRecalls') ne "off" ) { my $waiting_recalls = $patron->recalls->search( { status => 'waiting' } ); $template->param( recalls => $patron->recalls->filter_by_current->search( {}, { order_by => { -asc => 'created_date' } } ), diff --git a/circ/returns.pl b/circ/returns.pl index b064b189eb..f631f1b4e6 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -269,7 +269,7 @@ if ($transit && $op eq 'cud-transfer') { my $transfer = Koha::Item::Transfers->find($transit); if ( $canceltransfer ) { $transfer->cancel({ reason => 'Manual', force => 1}); - if ( C4::Context->preference('UseRecalls') ) { + if ( C4::Context->preference('UseRecalls') ne "off" ) { my $recall_transfer_deleted = Koha::Recalls->find({ item_id => $itemnumber, status => 'in_transit' }); if ( defined $recall_transfer_deleted ) { $recall_transfer_deleted->revert_transfer; @@ -283,7 +283,7 @@ if ($transit && $op eq 'cud-transfer') { my $item = Koha::Items->find($itemnumber); my $transfer = $item->get_transfer; $transfer->cancel({ reason => 'Manual', force => 1}); - if ( C4::Context->preference('UseRecalls') ) { + if ( C4::Context->preference('UseRecalls') ne "off" ) { my $recall_transfer_deleted = Koha::Recalls->find({ item_id => $itemnumber, status => 'in_transit' }); if ( defined $recall_transfer_deleted ) { $recall_transfer_deleted->revert_transfer; diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl index 0116278145..113e54f145 100755 --- a/circ/transferstoreceive.pl +++ b/circ/transferstoreceive.pl @@ -111,7 +111,7 @@ while ( my $library = $libraries->next ) { } # check for a recall for this transfer - if ( C4::Context->preference('UseRecalls') ) { + if ( C4::Context->preference('UseRecalls') ne "off" ) { my $recall = $item->recall; if ( defined $recall ) { $getransf{recall} = $recall; diff --git a/installer/data/mysql/atomicupdate/bug_31391_-_add_RecallsInterface_syspref.pl b/installer/data/mysql/atomicupdate/bug_31391_-_add_RecallsInterface_syspref.pl deleted file mode 100755 index 17c0896d33..0000000000 --- a/installer/data/mysql/atomicupdate/bug_31391_-_add_RecallsInterface_syspref.pl +++ /dev/null @@ -1,16 +0,0 @@ -use Modern::Perl; - -return { - bug_number => "31391", - description => "Staff-side recalls", - up => sub { - my ($args) = @_; - my ( $dbh, $out ) = @$args{qw(dbh out)}; - - $dbh->do( - q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('RecallsInterface','opac','opac|staff|both','The interface that recalls can be placed through','Choice') } - ); - - say $out "Added system preference 'RecallsInterface'"; - }, -}; diff --git a/installer/data/mysql/atomicupdate/bug_31391_-_update_UseRecalls_syspref.pl b/installer/data/mysql/atomicupdate/bug_31391_-_update_UseRecalls_syspref.pl new file mode 100755 index 0000000000..9af3394519 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_31391_-_update_UseRecalls_syspref.pl @@ -0,0 +1,19 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); + +return { + bug_number => "31391", + description => "Staff-side recalls", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + try { + $dbh->do(q{UPDATE systempreferences SET value = "off", options = "off|opac|staff|opac_and_staff", type="Choice" WHERE variable = "UseRecalls" AND value = "0"}); + $dbh->do(q{UPDATE systempreferences SET value = "opac", options = "off|opac|staff|opac_and_staff", type="Choice" WHERE variable = "UseRecalls" AND value = "1"}); + say_success( $out, "Updated system preference 'UseRecalls' to include interface choices" ); + } + catch { + say_failure( $out, "Database modification failed with errors: $_" ); + }; + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 686a1d48d2..bb19214528 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -649,7 +649,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('QuoteOfTheDay','','intranet,opac','Enable or disable display of Quote of the Day on the OPAC and staff interface home page','multiple'), ('RandomizeHoldsQueueWeight','0',NULL,'if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight','YesNo'), ('RealTimeHoldsQueue', '0', NULL, 'Enable updating the holds queue in real time', 'YesNo'), -('RecallsInterface','opac','opac|staff|both','The interface that recalls can be placed through','Choice'), ('RecallsLog','1',NULL,'If ON, log create/cancel/expire/fulfill actions on recalls','YesNo'), ('RecallsMaxPickUpDelay','7',NULL,'Define the maximum time a recall can be awaiting pickup','Integer'), ('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'), @@ -857,7 +856,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('UseICUStyleQuotes','0','1','Tell Koha whether to use ICU style quotes ({) or default (") when tracing subjects .','YesNo'), ('UseLocationAsAQInSIP', '0', '', 'Use permanent_location instead of homebranch for AQ in SIP response', 'YesNo'), ('UseOCLCEncodingLevels','0',NULL,'If enabled, include OCLC encoding levels in leader value builder dropdown for position 17.','YesNo'), -('UseRecalls','0',NULL,'Enable or disable recalls','YesNo'), +('UseRecalls','off','off|opac|staff|opac_and_staff','Enable or disable recalls','Choice'), ('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'), ('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'), ('viewISBD','1','','Allow display of ISBD view of bibiographic records','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc index 3e5625eff0..407f35de3c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc @@ -124,7 +124,7 @@ [%- END -%] - [%- IF ( Koha.Preference('UseRecalls') && CAN_user_recalls ) -%] + [%- IF ( Koha.Preference('UseRecalls') != "off" && CAN_user_recalls ) -%] [%- IF ( recallsview ) -%]
  • [%- ELSE -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 56d4e923af..bb7b7852af 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -243,7 +243,7 @@ ILL requests history
  • [% END %] - [% IF Koha.Preference('UseRecalls') && CAN_user_recalls %] + [% IF Koha.Preference('UseRecalls') != "off" && CAN_user_recalls %] [% IF recallsview %]
  • [% ELSE %]
  • [% END %] Recalls history
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc index 86ca5d18ce..60e532cc82 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc @@ -70,7 +70,7 @@
    - [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %] + [% IF Koha.Preference('UseRecalls') != "off" and CAN_user_recalls %]
    Recalls
    • 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 51e7b9e3a3..dc9ecb68ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -73,7 +73,7 @@ [% END %] - [% IF Koha.Preference('UseRecalls') AND Koha.Preference('RecallsInterface') != 'opac' %] + [% IF ( Koha.Preference('UseRecalls').match('staff') ) %] [% END %] @@ -91,7 +91,7 @@ [% ELSE %] [% END %] - [% IF Koha.Preference('UseRecalls') AND Koha.Preference('RecallsInterface') != 'opac' %] + [% IF ( Koha.Preference('UseRecalls').match('staff') ) %] [% END %] @@ -279,7 +279,7 @@ [% END %] - [% IF Koha.Preference('UseRecalls') AND Koha.Preference('RecallsInterface') != 'opac' %] + [% IF ( Koha.Preference('UseRecalls').match('staff') ) %] Mark for conversion to recall [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index 047f095fd5..034d4ec568 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -237,7 +237,7 @@ [% IF biblio.serial %] embed.push('serial_item.serial'); [% END %] - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] embed.push('recall', 'recall+strings', 'recall.patron') [% END %] [% IF bundlesEnabled %] @@ -540,7 +540,7 @@ } } - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] if ( row.recall ) { if ( row.recall.waiting_date ) { nodes += '%s'.format(_("Waiting at %s since %s").format(escape_str(row.recall.pickup_library_id.str), $date(row.recall.waiting_date))); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc index ecf35310f3..f9c6b70f57 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc @@ -18,7 +18,7 @@ [% FOREACH messaging_preference IN messaging_preferences %] [% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %] [% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %] - [% NEXT IF !Koha.Preference('UseRecalls') && messaging_preference.message_name.match('^Recall_') %] + [% NEXT IF Koha.Preference('UseRecalls') != "off" && messaging_preference.message_name.match('^Recall_') %] [% IF ( messaging_preference.Item_Due ) %]Item due [% ELSIF ( messaging_preference.Advance_Notice ) %]Advance notice diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc index 68f5e54630..c90d740d70 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc @@ -30,7 +30,7 @@ [% END %] [% END %] - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% WRAPPER tab_item tabname= "recalls" %] Recalls ([% recalls.count || 0 | html %]) [% END %] @@ -232,7 +232,7 @@ [% END %] [% END %] - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% WRAPPER tab_panel tabname="recalls" %] [% INCLUDE 'recalls.inc' %] [% END # /tab_panel# %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index c7f2bc6647..12a9a11fd8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -1463,21 +1463,15 @@ Circulation: - class: integer - days. - + - Recalls - pref: UseRecalls - type: boolean + default: off choices: - 1: Use - 0: "Don't use" - - recalls. Make sure you configure circulation and fine rules for recalls once enabled. - - - - Recalls can be placed through - - pref: RecallsInterface - default: opac - choices: - opac: the OPAC only - staff: the staff interface only - both: both the OPAC and the staff interface - - . (Requires UseRecalls.) + off: are disabled + opac: can be placed through the OPAC only + staff: can be placed through the staff interface only + opac_and_staff: can be placed through both the OPAC and staff interface + - . Make sure you configure circulation and fine rules for recalls when enabled. SIP2: - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index 4ec21fb454..18640587cd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -147,7 +147,7 @@ Article requests [% END %] Rental discount (%) - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] Recalls allowed (total) Recalls per record (count) On shelf recalls allowed @@ -392,7 +392,7 @@ [% END %] [% rentaldiscount | html %] - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% recalls_allowed | html %] [% recalls_per_record | html %] @@ -539,7 +539,7 @@ [% END %] - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] @@ -603,7 +603,7 @@ Article requests [% END %] Rental discount (%) - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] Recalls allowed (total) Recalls per record (count) On shelf recalls allowed diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 4c8deeb929..919000556b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -568,7 +568,7 @@ Holds ([% SEARCH_RESULT.biblio_object.holds.count | html %]) [% END %] [% END # /IF SEARCH_RESULT.norequests %] - [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %] + [% IF Koha.Preference('UseRecalls') != "off" and CAN_user_recalls %] | Recalls ([% SEARCH_RESULT.biblio_object.recalls.search( completed => 0 ).count | html %]) [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt index 656dfd4d1f..225f5305ee 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt @@ -103,7 +103,7 @@
    - [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %] + [% IF Koha.Preference('UseRecalls') != "off" and CAN_user_recalls %]

    Recalls

      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt index 9e30b0fec2..1c02c5d3f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt @@ -30,7 +30,7 @@ [% INCLUDE 'messages.inc' %] [% INCLUDE 'members-toolbar.inc' %]

      Recalls history

      - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% INCLUDE 'recalls.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_old_queue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_old_queue.tt index 9488a6580b..7aab33f70f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_old_queue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_old_queue.tt @@ -39,7 +39,7 @@ [% INCLUDE 'messages.inc' %]

      Old recalls

      - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %]
      [% INCLUDE 'recalls.inc' %]
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_overdue.tt index 61bbb246e8..4c8e163623 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_overdue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_overdue.tt @@ -39,7 +39,7 @@ [% INCLUDE 'messages.inc' %]

      Overdue recalls

      - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% IF recalls.count %]
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_queue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_queue.tt index 112bdaa7fb..378d9a6f2c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_queue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_queue.tt @@ -39,7 +39,7 @@ [% INCLUDE 'messages.inc' %]

      Recalls queue

      - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% IF recalls.count %]
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt index b2af89c052..9d88f7fa09 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt @@ -44,7 +44,7 @@

      Recalls to pull

      The following recalls could be fulfilled by available items. - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% IF recalls %]
      diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_waiting.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_waiting.tt index a2adf81e9b..0705b8d212 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_waiting.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_waiting.tt @@ -39,7 +39,7 @@ [% INCLUDE 'messages.inc' %]

      Recalls awaiting pickup

      - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% WRAPPER tabs id= "results" %] [% WRAPPER tabs_nav %] 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 44758f5a83..7bbd2b2603 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt @@ -53,13 +53,13 @@ [% IF patron %] [% IF error %] -
      - Unable to place a recall. Check your circulation rules. +
      + Cannot place recalls: check your circulation rules.
      [% END %] [% IF patron_holds_count %] -
      +
      Patron has placed one or more record-level holds. Convert a hold to a recall.
      [% END %] @@ -199,9 +199,9 @@ [% ELSE %] - [% IF Koha.Preference('RecallsInterface') == 'opac' %] + [% IF Koha.Preference('UseRecalls') == 'opac' %]
      - Due to the RecallsInterface system preference, recalls cannot be placed through the staff interface. + Due to the UseRecalls system preference, recalls cannot be placed through the staff interface.
      [% ELSE %] @@ -226,7 +226,7 @@

      Existing recalls

      - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% IF recalls.count %]
      diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc index 2d19d918ce..3e214b82a1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -62,7 +62,7 @@ Checked out [% END %] [% END %] - [% IF show_recall_link %] + [% IF show_recall_link != "off" %] [% IF logged_in_user.borrowernumber != issue.borrowernumber %] Recall [% END %] @@ -129,7 +129,7 @@ Pending hold [% END %] -[% IF Koha.Preference('UseRecalls') && item.has_pending_recall %] +[% IF Koha.Preference('UseRecalls') != "off" && item.has_pending_recall %] [% SET itemavailable = 0 %] Pending recall [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc index 45d7365b54..d4c348a8fd 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc @@ -11,7 +11,7 @@ [% END %] [% END %] - [% IF Koha.Preference('UseRecalls') AND Koha.Preference('RecallsInterface') != 'staff' %] + [% IF Koha.Preference('UseRecalls').match('opac') %]
    • Place recall
    • [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc index d088f48ab7..44ba662f07 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc @@ -84,7 +84,7 @@ Holds history [% END %] - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% IF ( recallsview ) %]
    • [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt index c25147453d..06387fb3f3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -60,7 +60,7 @@ [% FOREACH messaging_preference IN messaging_preferences %] [% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %] [% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %] - [% NEXT IF !Koha.Preference('UseRecalls') && messaging_preference.message_name.match('^Recall_') %] + [% NEXT IF Koha.Preference('UseRecalls') == "off" && messaging_preference.message_name.match('^Recall_') %]
    • [% IF ( messaging_preference.Item_Due ) %]Item due [% ELSIF ( messaging_preference.Advance_Notice ) %]Advance notice diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt index 0fc9c1413e..3f48d5118c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt @@ -28,7 +28,7 @@

      Recalls history

      - [% IF Koha.Preference('UseRecalls') %] + [% IF Koha.Preference('UseRecalls') != "off" %] [% IF RECALLS.count %]
      diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index a010d674bc..7d25dc3905 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -11,7 +11,7 @@ [% SET CartEnabled = ( Koha.Preference('opacbookbag') == 1 ) %] [% SET ListsEnabled = ( Koha.Preference('virtualshelves') == 1 ) && LoginEnabled %] [% SET HoldsEnabled = ( Koha.Preference('OPACHoldRequests') == 1 ) && LoginEnabled %] -[% SET RecallsEnabled = ( Koha.Preference('UseRecalls') == 1 ) && LoginEnabled && ( Koha.Preference('RecallsInterface') != 'staff' ) %] +[% SET RecallsEnabled = ( Koha.Preference('UseRecalls').match('opac') ) && LoginEnabled %] [% SET ArticleRequestsEnabled = ( Koha.Preference('ArticleRequests') == 1 ) && LoginEnabled %] [% SET MultiHolds = ( Koha.Preference('DisplayMultiPlaceHold') == 1 ) && HoldsEnabled %] [% SET CoverImagePlugins = KohaPlugins.get_plugins_opac_cover_images %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt index 376682d684..306a78e63f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt @@ -13,7 +13,7 @@ [% SET CartEnabled = ( Koha.Preference('opacbookbag') == 1 ) %] [% SET ListsEnabled = ( Koha.Preference('virtualshelves') == 1 ) && LoginEnabled %] [% SET HoldsEnabled = ( Koha.Preference('OPACHoldRequests') == 1 ) && LoginEnabled %] -[% SET RecallsEnabled = ( Koha.Preference('UseRecalls') == 1 ) && LoginEnabled && ( Koha.Preference('RecallsInterface') != 'staff' ) %] +[% SET RecallsEnabled = ( Koha.Preference('UseRecalls').match('opac') ) && LoginEnabled %] [% SET ArticleRequestsEnabled = ( Koha.Preference('ArticleRequests') == 1 ) && LoginEnabled %] [% SET MultiHolds = ( Koha.Preference('DisplayMultiPlaceHold') == 1 ) && HoldsEnabled %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt index 5025249464..78767f162a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt @@ -12,7 +12,7 @@ [% SET CartEnabled = ( Koha.Preference('opacbookbag') == 1 ) %] [% SET ListsEnabled = ( Koha.Preference('virtualshelves') == 1 ) && LoginEnabled %] [% SET HoldsEnabled = ( Koha.Preference('OPACHoldRequests') == 1 ) && LoginEnabled %] -[% SET RecallsEnabled = ( Koha.Preference('UseRecalls') == 1 ) && LoginEnabled && ( Koha.Preference('RecallsInterface') != 'staff' ) %] +[% SET RecallsEnabled = ( Koha.Preference('UseRecalls').match('opac') ) && LoginEnabled %] [% SET ArticleRequestsEnabled = ( Koha.Preference('ArticleRequests') == 1 ) && LoginEnabled %] [% SET MultiHolds = ( Koha.Preference('DisplayMultiPlaceHold') == 1 ) && HoldsEnabled %] [% INCLUDE 'doc-head-open.inc' %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 12163f0e4f..248039f2d6 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -299,7 +299,7 @@ Holds ([% RESERVES.count | html %]) [% END %] [% END %] - [% IF Koha.Preference('UseRecalls') && RECALLS.count %] + [% IF Koha.Preference('UseRecalls') != "off" && RECALLS.count %] [% WRAPPER tab_item tabname= "opac-user-recalls" %] Recalls ([% RECALLS.count | html %]) [% END %] @@ -844,7 +844,7 @@ [% END # /tab_panel#opac-user-holds %] [% END # / #RESERVES.count %] - [% IF Koha.Preference('UseRecalls') && RECALLS.count %] + [% IF Koha.Preference('UseRecalls') != "off" && RECALLS.count %] [% WRAPPER tab_panel tabname="opac-user-recalls" %]
      diff --git a/members/moremember.pl b/members/moremember.pl index 773bc4190d..f9eaaceb55 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -213,7 +213,7 @@ $template->param( WaitingHolds => $waiting_holds, ); -if ( C4::Context->preference('UseRecalls') ) { +if ( C4::Context->preference('UseRecalls') ne "off" ) { my $waiting_recalls = $patron->recalls->search({ status => 'waiting' }); $template->param( waiting_recalls => $waiting_recalls ); } @@ -305,7 +305,7 @@ $template->param( patron_lists_count => $patron_lists_count, ); -if ( C4::Context->preference('UseRecalls') ) { +if ( C4::Context->preference('UseRecalls') ne "off" ) { $template->param( recalls => $patron->recalls({},{ order_by => { -asc => 'recalldate' } })->filter_by_current, specific_patron => 1, diff --git a/opac/opac-recall.pl b/opac/opac-recall.pl index 66cf3dad00..3e7e2f1609 100755 --- a/opac/opac-recall.pl +++ b/opac/opac-recall.pl @@ -42,7 +42,7 @@ if ($op eq 'cud-cancel'){ print $query->redirect('/cgi-bin/koha/opac-user.pl'); } -if ( C4::Context->preference('UseRecalls') and C4::Context->preference('RecallsInterface') ne 'staff' ) { +if ( C4::Context->preference('UseRecalls') =~ m/opac/ ) { my $patron = Koha::Patrons->find( $borrowernumber ); my $error; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 3f1ca4ad59..a1fb17e3aa 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -304,7 +304,7 @@ if ( $pending_checkouts->count ) { # Useless test $issue->{normalized_oclc} = GetNormalizedOCLCNumber( $marcrecord, C4::Context->preference('marcflavour') ); } - if ( C4::Context->preference('UseRecalls') ) { + if ( C4::Context->preference('UseRecalls') ne "off" ) { my $maybe_recalls = Koha::Recalls->search({ biblio_id => $issue->{biblionumber}, item_id => [ undef, $issue->{itemnumber} ], completed => 0 }); while( my $recall = $maybe_recalls->next ) { if ( $recall->checkout and $recall->checkout->issue_id == $issue->{issue_id} ) { @@ -340,7 +340,7 @@ $template->param( showpriority => $show_priority, ); -if ( C4::Context->preference('UseRecalls') ) { +if ( C4::Context->preference('UseRecalls') ne "off" ) { my $recalls = Koha::Recalls->search( { patron_id => $borrowernumber, completed => 0 } ); $template->param( RECALLS => $recalls ); } diff --git a/recalls/request.pl b/recalls/request.pl index 35b0e3e80f..efe57dcdce 100755 --- a/recalls/request.pl +++ b/recalls/request.pl @@ -49,9 +49,7 @@ if ( $op eq 'cud-cancel_multiple_recalls' ) { print $input->redirect( '/cgi-bin/koha/recalls/request.pl?biblionumber=' . $biblionumber ); } elsif ( $op eq 'cud-request' ) { - if ( C4::Context->preference('UseRecalls') - and C4::Context->preference('RecallsInterface') ne 'opac' - and $borrowernumber ) + if ( C4::Context->preference('UseRecalls') =~ m/staff/ and $borrowernumber ) { my $patron = Koha::Patrons->find($borrowernumber); @@ -130,8 +128,7 @@ if ( $op eq 'cud-cancel_multiple_recalls' ) { if ($borrowernumber) { my $patron = Koha::Patrons->find($borrowernumber); - if ( C4::Context->preference('UseRecalls') - and C4::Context->preference('RecallsInterface') ne 'opac' + if ( C4::Context->preference('UseRecalls') =~ m/staff/ and $patron and $patron->borrowernumber ) { diff --git a/svc/checkouts b/svc/checkouts index dd8d1d0f82..382034a665 100755 --- a/svc/checkouts +++ b/svc/checkouts @@ -219,7 +219,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { my @subtitles = split(/ \| /, $c->{'subtitle'} // '' ); my $recalled = 0; - if ( C4::Context->preference('UseRecalls') ) { + if ( C4::Context->preference('UseRecalls') ne "off" ) { my $item = Koha::Items->find( $c->{itemnumber} ); my $recall = undef; $recall = $item->check_recalls if $item->can_be_waiting_recall; diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index f26069e939..9ae976fd8b 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -1728,7 +1728,7 @@ subtest "CanBookBeRenewed tests" => sub { ); # Recalls - t::lib::Mocks::mock_preference('UseRecalls', 1); + t::lib::Mocks::mock_preference('UseRecalls', 'opac'); Koha::CirculationRules->set_rules({ categorycode => undef, branchcode => undef, @@ -2441,7 +2441,7 @@ subtest 'AddIssue & AllowReturnToBranch' => sub { subtest 'AddIssue | recalls' => sub { plan tests => 3; - t::lib::Mocks::mock_preference("UseRecalls", 1); + t::lib::Mocks::mock_preference("UseRecalls", 'opac'); t::lib::Mocks::mock_preference("item-level_itypes", 1); my $patron1 = $builder->build_object({ class => 'Koha::Patrons' }); my $patron2 = $builder->build_object({ class => 'Koha::Patrons' }); @@ -4800,7 +4800,7 @@ subtest 'CanBookBeIssued | notforloan' => sub { subtest 'CanBookBeIssued | recalls' => sub { plan tests => 3; - t::lib::Mocks::mock_preference("UseRecalls", 1); + t::lib::Mocks::mock_preference("UseRecalls", 'opac'); t::lib::Mocks::mock_preference("item-level_itypes", 1); my $patron1 = $builder->build_object({ class => 'Koha::Patrons' }); my $patron2 = $builder->build_object({ class => 'Koha::Patrons' }); @@ -4952,7 +4952,7 @@ subtest 'AddReturn should clear items.onloan for unissued items' => sub { subtest 'AddReturn | recalls' => sub { plan tests => 3; - t::lib::Mocks::mock_preference("UseRecalls", 1); + t::lib::Mocks::mock_preference("UseRecalls", 'opac'); t::lib::Mocks::mock_preference("item-level_itypes", 1); my $patron1 = $builder->build_object({ class => 'Koha::Patrons' }); my $patron2 = $builder->build_object({ class => 'Koha::Patrons' }); diff --git a/t/db_dependent/Circulation/transferbook.t b/t/db_dependent/Circulation/transferbook.t index 78ca0b34c8..d8ec03fc26 100755 --- a/t/db_dependent/Circulation/transferbook.t +++ b/t/db_dependent/Circulation/transferbook.t @@ -158,7 +158,7 @@ subtest 'transfer already at destination' => sub { is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info"); # recalls - t::lib::Mocks::mock_preference('UseRecalls', 1); + t::lib::Mocks::mock_preference('UseRecalls', 'opac'); my $recall = Koha::Recall->new( { biblio_id => $item->biblionumber, item_id => $item->itemnumber, diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t index aed474b22e..cf47c1b790 100755 --- a/t/db_dependent/Holds.t +++ b/t/db_dependent/Holds.t @@ -1914,7 +1914,7 @@ subtest 'ModReserve to convert a hold to a recall' => sub { } )->store; - t::lib::Mocks::mock_preference( "UseRecalls", 1 ); + t::lib::Mocks::mock_preference( "UseRecalls", 'opac' ); t::lib::Mocks::mock_userenv( { branchcode => $branch } ); C4::Circulation::AddIssue( $patron2, $item->barcode ); diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 0576acca56..4ad4ff239a 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -1581,10 +1581,10 @@ subtest 'Recalls tests' => sub { is( $recalls->count, 3, 'Correctly get number of recalls for biblio' ); is( $recalls->filter_by_current->count, 1, 'Correctly get number of active recalls for biblio' ); - t::lib::Mocks::mock_preference('UseRecalls', 0); + t::lib::Mocks::mock_preference('UseRecalls', 'off'); is( $biblio->can_be_recalled({ patron => $patron1 }), 0, "Can't recall with UseRecalls disabled" ); - t::lib::Mocks::mock_preference("UseRecalls", 1); + t::lib::Mocks::mock_preference("UseRecalls", 'opac'); $item1->update({ notforloan => 1 }); is( $biblio->can_be_recalled({ patron => $patron1 }), 0, "Can't recall with no available items" ); diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index 7d115cdb3a..6f6a7f56f8 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -2459,7 +2459,7 @@ subtest 'Recalls tests' => sub { ); t::lib::Mocks::mock_userenv( { patron => $patron1 } ); - t::lib::Mocks::mock_preference('UseRecalls', 1); + t::lib::Mocks::mock_preference('UseRecalls', 'opac'); my $recall1 = Koha::Recall->new( { patron_id => $patron1->borrowernumber, @@ -2487,10 +2487,10 @@ subtest 'Recalls tests' => sub { $recall2->set_cancelled; - t::lib::Mocks::mock_preference('UseRecalls', 0); + t::lib::Mocks::mock_preference('UseRecalls', 'off'); is( $item1->can_be_recalled({ patron => $patron1 }), 0, "Can't recall with UseRecalls disabled" ); - t::lib::Mocks::mock_preference("UseRecalls", 1); + t::lib::Mocks::mock_preference("UseRecalls", 'opac'); $item1->update({ notforloan => 1 }); is( $item1->can_be_recalled({ patron => $patron1 }), 0, "Can't recall that is not for loan" ); @@ -2675,7 +2675,7 @@ subtest 'has_pending_recall() tests' => sub { my $patron = $builder->build_object({ class => 'Koha::Patrons' }); t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); - t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'opac' ); C4::Circulation::AddIssue( $patron, $item->barcode ); diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t index b259e4f9bf..e6d147a671 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -1280,7 +1280,7 @@ subtest do_checkout_with_recalls => sub { } ); - t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'opac' ); Koha::CirculationRules->set_rule( { branchcode => undef, diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t index 00ce65abda..b01fe00dee 100755 --- a/t/db_dependent/Search.t +++ b/t/db_dependent/Search.t @@ -155,7 +155,7 @@ $contextmodule->mock('preference', sub { } elsif ($pref eq 'SearchLimitLibrary') { return 'both'; } elsif ($pref eq 'UseRecalls') { - return '0'; + return 'off'; } elsif ( $pref eq 'ContentWarningField' ) { return q{}; } elsif ( $pref eq 'AuthorLinkSortBy' ) { diff --git a/t/db_dependent/XSLT.t b/t/db_dependent/XSLT.t index 4f7ef3c84b..d9d7524cfd 100755 --- a/t/db_dependent/XSLT.t +++ b/t/db_dependent/XSLT.t @@ -193,7 +193,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); + t::lib::Mocks::mock_preference('UseRecalls', 'opac'); my $recall = $builder->build_object( { class => 'Koha::Recalls', @@ -208,7 +208,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); + t::lib::Mocks::mock_preference('UseRecalls', 'off'); $schema->storage->txn_rollback; }; -- 2.39.5
      Recalls ([% RECALLS.count | html %])