Bug 22456: Staff interface handling

This patch introduces a new tab to the 'Holds awaiting pickup' screen
for holds that have cancellation requests. This can be accepted (by
cancelling the hold) or rejected.

To test:
1. Set circulation rules for cancellation requests, allowing them for
   certain item type.
2. Have some waiting holds for a patron on an item type that allows
   requesting cancellation.
3. Visit 'Holds awaiting pickup'
=> SUCCESS: No holds have cancellation requests
4. In the OPAC, on the user details, notice some holds have the ability
   to be requested cancellation.
5. Choose to request cancellation
=> SUCCESS: Request is placed, the button is disabled
6. In 'Holds awaiting pickup' you can see them
7. Play with rejecting/accepting
=> SUCCESS: It works!
8. Things are reflected in the OPAC side

Sponsored-by: Montgomery County Public Libraries

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomas Cohen Arazi 2022-05-18 17:38:37 -03:00
parent f717314385
commit b3cdbb557d
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
4 changed files with 75 additions and 2 deletions

View File

@ -1439,6 +1439,37 @@ modules:
-
columnname: action
holdscr:
columns:
-
columnname: checkbox
cannot_be_toggled: 1
cannot_be_modified: 1
-
columnname: waiting_since
-
columnname: date_hold_placed
-
columnname: expiration_date
-
columnname: title
-
columnname: patron
-
columnname: home_library
-
columnname: current_location
-
columnname: shelving_location
-
columnname: call_number
-
columnname: copy_number
-
columnname: enumeration
-
columnname: action
overdues:
circ-overdues:
default_display_length: 20

View File

@ -116,6 +116,8 @@ while ( my $hold = $holds->next ) {
}
my $holds_with_cancellation_requests = Koha::Holds->waiting->filter_by_has_cancellation_requests;
$template->param(cancel_result => \@cancel_result) if @cancel_result;
$template->param(
@ -123,6 +125,8 @@ $template->param(
reservecount => scalar @reserve_loop,
overloop => \@over_loop,
overcount => scalar @over_loop,
cancel_reqs_count => $holds_with_cancellation_requests->count,
cancel_reqs => $holds_with_cancellation_requests,
show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
tab => $tab,
);

View File

@ -1,3 +1,4 @@
[% USE KohaDates %]
[% USE ItemTypes %]
[% USE AuthorisedValues %]
<table class="holds_table" id="[% table_name | html %]">
@ -6,6 +7,9 @@
<th class="NoSort"><input type="checkbox" class="select_hold_all"/></th>
<th>Waiting since</th>
<th>Date hold placed</th>
[% IF table_name == 'holdscr' %]
<th>Date cancellation requested</th>
[% END %]
<th>Expiration date</th>
<th class="anti-the">Title</th>
<th>Patron</th>
@ -24,6 +28,13 @@
<th><input type="checkbox" class="select_hold" data-id="[% reserveloo.reserve_id | html %]"/></th>
<td><span data-order="[% reserveloo.waitingdate | html %]">[% reserveloo.waitingdate | $KohaDates %]</span></td>
<td><span data-order="[% reserveloo.reservedate | html %]">[% reserveloo.reservedate | $KohaDates %]</span></td>
[% IF table_name == 'holdscr' %]
<td>
[% FOREACH cancellation_request IN reserveloo.cancellation_requests %]
<span>[% cancellation_request.creation_date | $KohaDates %]</span>
[% END %]
</td>
[% END %]
<td><span data-order="[% reserveloo.expirationdate | html %]">[% reserveloo.expirationdate | $KohaDates %]</span></td>
<td>
[% INCLUDE 'biblio-title.inc' biblio=reserveloo.biblio link = 1 %]

View File

@ -48,6 +48,15 @@
View all libraries</a></span>
[% END %]
</h2>
[% IF reject_result_error %]
<div class="error message">
[% IF reject_result_error.invalid_status %]
<p>There was a problem rejecting the cancellation request. Cannot reject an already completed cancellation request.</p>
[% ELSE %]
<p>Some error occurred while rejecting the cancellation request. Please check the logs</p>
[% END %]
</div>
[% END %]
[% IF ( cancel_result ) %]
[% FOREACH cancel_result %]
[% IF ( messagetransfert ) %]
@ -88,6 +97,11 @@
Holds waiting over [% Koha.Preference('ReservesMaxPickUpDelay') | html %] days: [% overcount | html %]
</a>
</li>
<li role="presentation">
<a href="#holdscr" aria-controls="holdscr" role="tab" data-toggle="tab">
Holds with cancellation requests: [% cancel_reqs_count | html %]
</a>
</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="holdswaiting">
@ -125,6 +139,13 @@
<div class="dialog message">No holds found.</div>
[% END %]
</div>
<div role="tabpanel" class="tab-pane" id="holdscr">
[% IF cancel_reqs_count %]
[% INCLUDE waiting_holds.inc select_column='1' table_name='holdscr' reserveloop=cancel_reqs tab='holdscr' %]
[% ELSE %]
<div class="dialog message">No holds found.</div>
[% END %]
</div>
</div>
[% END %]
@ -180,8 +201,9 @@
[% INCLUDE 'columns_settings.inc' %]
<script>
var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
var holdst_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdst', 'json' ) | $raw %];
var holdso_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdso', 'json' ) | $raw %];
var holdst_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdst', 'json' ) | $raw %];
var holdso_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdso', 'json' ) | $raw %];
var holdscr_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds_awaiting_pickup', 'holdscr', 'json' ) | $raw %];
$(document).ready(function() {
@ -195,6 +217,11 @@
"order": [[1, 'asc']]
}, holdso_table_settings);
KohaTable("holdscr", {
"sPaginationType": "full",
"order": [[1, 'asc']]
}, holdscr_table_settings);
let cancel_link;
$("#cancelModalConfirmBtn").on("click",function(e) {