From e6312bd57dc66869ce8bfec82a5b1368eb94ce1d Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 2 Mar 2023 00:42:28 +0000 Subject: [PATCH] Bug 31391: Interface and wording fixes This patch includes the following fixes: - Making the atomic updates executable - Preventing warns when running tests - Updating db updates - Fixing terminology - Make 'cancel selected recalls' button yellow - Fix HTML makeup of recalls request page - Show a warning when placing a recall if there is already a record-level hold by this patron - Show a link to mark a hold for conversion which selects the recall option on holds page - Include changes to patron search dropdown - add 'mark hold for conversion to recall' column to columns settings Signed-off-by: David Nind Signed-off-by: Pedro Amorim --- admin/columns_settings.yml | 4 +- ..._CANCELLATION-RECALLED_authorised_value.pl | 4 +- ...ug_31391_-_add_RecallsInterface_syspref.pl | 4 +- .../prog/en/includes/holds_table.inc | 6 ++ .../admin/preferences/circulation.pref | 20 +++---- .../prog/en/modules/recalls/request.tt | 55 +++++++++++-------- .../prog/en/modules/reserve/request.tt | 6 +- recalls/request.pl | 5 +- t/db_dependent/Holds.t | 14 +++++ 9 files changed, 80 insertions(+), 38 deletions(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 2a632acc25b..956aa3a99e9 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -1955,6 +1955,8 @@ modules: columnname: suspend - columnname: print_slip + - + columnname: convert_to_recall holdsratios: holds-ratios: @@ -2545,4 +2547,4 @@ modules: - columnname: actions cannot_be_toggled: 1 - cannot_be_modified: 1 + cannot_be_modified: 1 \ No newline at end of file diff --git a/installer/data/mysql/atomicupdate/bug_31391_-_add_HOLD_CANCELLATION-RECALLED_authorised_value.pl b/installer/data/mysql/atomicupdate/bug_31391_-_add_HOLD_CANCELLATION-RECALLED_authorised_value.pl index ad7aae45309..c00dcadefb4 100644 --- a/installer/data/mysql/atomicupdate/bug_31391_-_add_HOLD_CANCELLATION-RECALLED_authorised_value.pl +++ b/installer/data/mysql/atomicupdate/bug_31391_-_add_HOLD_CANCELLATION-RECALLED_authorised_value.pl @@ -2,7 +2,7 @@ use Modern::Perl; return { bug_number => "31391", - description => "Add new RECALLED value to HOLD_CANCELLATION authorised value category", + description => "Staff-side recalls", up => sub { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; @@ -10,5 +10,7 @@ return { $dbh->do( q{ INSERT IGNORE INTO authorised_values (category, authorised_value, lib) VALUES ('HOLD_CANCELLATION','RECALLED','Hold was converted to a recall') } ); + + say $out "Added RECALLED value to HOLD_CANCELLATION authorised value category"; }, }; diff --git a/installer/data/mysql/atomicupdate/bug_31391_-_add_RecallsInterface_syspref.pl b/installer/data/mysql/atomicupdate/bug_31391_-_add_RecallsInterface_syspref.pl index abb370c8642..17c0896d332 100644 --- a/installer/data/mysql/atomicupdate/bug_31391_-_add_RecallsInterface_syspref.pl +++ b/installer/data/mysql/atomicupdate/bug_31391_-_add_RecallsInterface_syspref.pl @@ -2,7 +2,7 @@ use Modern::Perl; return { bug_number => "31391", - description => "Add new system preference RecallsInterface", + description => "Staff-side recalls", up => sub { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; @@ -10,5 +10,7 @@ return { $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/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc index 2fc06748685..8a1e64f8879 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -25,6 +25,7 @@ Delete Suspend Print hold/transfer slip + Convert hold to recall [%- SET first_priority = 0 -%] @@ -365,6 +366,11 @@ [% ELSE %] [% END %] + + [% IF Koha.Preference('UseRecalls') AND Koha.Preference('RecallsInterface') != 'opac' %] + Mark for conversion to recall + [% END %] + [% END %] 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 9060b53cc1d..ec4aa228002 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 @@ -1474,6 +1474,15 @@ Circulation: 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.) SIP2: - @@ -1515,13 +1524,4 @@ Circulation: choices: 1: Enable 0: Disable - - "the curbside pickup module." - - - - 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.) \ No newline at end of file + - "the curbside pickup module." \ No newline at end of file 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 cc1144c78e4..00a25cb1b91 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt @@ -52,6 +52,10 @@
Unable to place a recall. 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 %] +
Recall details
@@ -103,7 +107,7 @@ Barcode [% UNLESS ( single_branch_mode ) %] Home library - Last location + Holding library [% END %] Collection Call number @@ -144,7 +148,7 @@ > [% END %] [% IF ( item.itemlost || item.withdrawn ) %] - Unavailable (lost or missing) + Unavailable (lost or withdrawn) [% END %] [% IF ( item.notforloan ) %] Not for loan ([% item.notforloan | html %]) @@ -161,7 +165,7 @@ [% 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. + Patron has already placed a hold on this item. [% END # / IF ( item.recall or hold ) %] @@ -204,29 +208,31 @@
[% END %] -

Existing recalls

+
+

Existing recalls

- [% IF Koha.Preference('UseRecalls') %] - [% IF recalls.count %] -
- - [% INCLUDE 'csrf-token.inc' %] - - - Select all - [% INCLUDE 'recalls.inc' %] -
- -
- -
- + [% IF Koha.Preference('UseRecalls') %] + [% IF recalls.count %] +
+
+ [% INCLUDE 'csrf-token.inc' %] + + + Select all + [% INCLUDE 'recalls.inc' %] +
+ +
+
+
+ + [% ELSE %] +
No recalls have been made.
+ [% END %] [% ELSE %] -
No recalls have been made.
+
Recalls have not been enabled. Enable the UseRecalls system preference to use recalls.
[% END %] - [% ELSE %] -
Recalls have not been enabled. Enable the UseRecalls system preference to use recalls.
- [% END %] +
[% END %] [% END %] @@ -235,10 +241,13 @@ [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] [% INCLUDE 'calendar.inc' %] + [% INCLUDE 'select2.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 %] diff --git a/recalls/request.pl b/recalls/request.pl index 29a8b9941a6..22c509082fd 100755 --- a/recalls/request.pl +++ b/recalls/request.pl @@ -138,9 +138,12 @@ if ($borrowernumber) { if ( !$biblio->can_be_recalled( { patron => $patron } ) ) { $error = 1; } + my $patron_holds_count = Koha::Holds->search( + { borrowernumber => $borrowernumber, biblionumber => $biblio->biblionumber, item_level_hold => 0 } )->count; $template->param( - patron => $patron, + patron => $patron, + patron_holds_count => $patron_holds_count, ); } } diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t index 9627786db09..2445ce88cc6 100755 --- a/t/db_dependent/Holds.t +++ b/t/db_dependent/Holds.t @@ -2125,6 +2125,7 @@ subtest 'ModReserve to convert a hold to a recall' => sub { surname => 'whatever surname', categorycode => $category->{categorycode}, branchcode => $branch, + email => 'name@email.com', } )->store; my $borrowernumber = $patron->borrowernumber; @@ -2135,6 +2136,7 @@ subtest 'ModReserve to convert a hold to a recall' => sub { surname => 'whatever surname', categorycode => $category->{categorycode}, branchcode => $branch, + email => 'name2@email.com', } )->store; @@ -2156,6 +2158,18 @@ subtest 'ModReserve to convert a hold to a recall' => sub { } ); + my $notice = Koha::Notice::Template->new( + { + name => 'Hold cancellation', + module => 'reserves', + code => 'HOLD_CANCELLATION', + title => 'Hold cancelled', + content => 'Your hold was cancelled.', + message_transport_type => 'email', + branchcode => q{}, + } + )->store(); + my $reserve_id = AddReserve( { branchcode => $branch, -- 2.34.1