Bugzilla – Attachment 135324 Details for
Bug 22456
Allow patrons to cancel their waiting holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22456: Allow requesting cancellation from the OPAC
Bug-22456-Allow-requesting-cancellation-from-the-O.patch (text/plain), 6.69 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-05-24 17:18:07 UTC
(
hide
)
Description:
Bug 22456: Allow requesting cancellation from the OPAC
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-05-24 17:18:07 UTC
Size:
6.69 KB
patch
obsolete
>From c432020b79a94fff23445f29895de37f84ba34ce Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 18 May 2022 16:16:58 -0300 >Subject: [PATCH] Bug 22456: Allow requesting cancellation from the OPAC > >--- > .../bootstrap/en/includes/holds-table.inc | 22 +++++++++++++--- > .../bootstrap/en/modules/opac-user.tt | 13 ++++++++++ > opac/opac-modrequest.pl | 25 +++++++++++++++---- > 3 files changed, 51 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >index 2263737ec8..c033d76a98 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >@@ -151,12 +151,26 @@ > [% END # / IF SuspendHoldsOpac %] > [% IF ! onlyinfo %] > <td class="modify"> >+ [% SET owner_cancellation_request = HOLD.owner_cancellation_request %] > [% IF ( HOLD.is_cancelable_from_opac ) %] > <form id="delete_hold_[% HOLD.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post"> >- <input type="hidden" name="biblionumber" value="[% HOLD.biblionumber | html %]" /> >- <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" /> >- <button data-title="[% INCLUDE 'biblio-title-head.inc' biblio=HOLD.biblio %]" data-reserve_id="[% HOLD.reserve_id | html %]" type="submit" class="btn btn-sm btn-danger btn-delete-hold"><i class="fa fa-remove" aria-hidden="true"></i> [% tp('Cancel hold button', 'Cancel') | html %]</button> >- </form> >+ <input type="hidden" name="biblionumber" value="[% HOLD.biblionumber | html %]" /> >+ <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" /> >+ <button data-title="[% INCLUDE 'biblio-title-head.inc' biblio=HOLD.biblio %]" data-reserve_id="[% HOLD.reserve_id | html %]" type="submit" class="btn btn-sm btn-danger btn-delete-hold"><i class="fa fa-remove" aria-hidden="true"></i> [% tp('Cancel hold button', 'Cancel') | html %]</button> >+ </form> >+ [% ELSIF HOLD.owner_cancellation_request %] >+ [% IF owner_cancellation_request.status == 'rejected' %] >+ <button type="submit" class="btn btn-sm btn-danger disabled"><i class="fa fa-remove" aria-hidden="true"></i> [% t('Cancellation rejected') | html %]</button> >+ [% ELSE %] >+ <button type="submit" class="btn btn-sm btn-danger disabled"><i class="fa fa-remove" aria-hidden="true"></i> [% t('Cancellation requested') | html %]</button> >+ [% END %] >+ [% ELSIF HOLD.cancellation_requestable_from_opac %] >+ <form id="req_cancel_hold_[% HOLD.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post"> >+ <input type="hidden" name="biblionumber" value="[% HOLD.biblionumber | html %]" /> >+ <input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" /> >+ <input type="hidden" name="cancellation_request" value="1" /> >+ <button data-title="[% INCLUDE 'biblio-title-head.inc' biblio=HOLD.biblio %]" data-reserve_id="[% HOLD.reserve_id | html %]" type="submit" class="btn btn-sm btn-danger btn-req-delete-hold"><i class="fa fa-remove" aria-hidden="true"></i> [% tp('Cancellation request hold button', 'Request cancellation') | html %]</button> >+ </form> > [% END %] > </td> > [% END # / IF onlyinfo %] >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 a8dcd2a5f8..0d55ee4143 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -1016,6 +1016,19 @@ > ); > }); > >+ $(".btn-req-delete-hold").on("click", function(e){ >+ e.preventDefault(); >+ var hold_title = $(this).data("title"); >+ var reserve_id = $(this).data("reserve_id"); >+ confirmModal( hold_title, _("Are you sure you want to request cancelling this hold?"), _("Yes"), _("No"), function( result ){ >+ $("#bootstrap-confirm-box-modal").remove() >+ if( result ){ >+ $("#req_cancel_hold_" + reserve_id ).submit(); >+ } >+ } >+ ); >+ }); >+ > $(".btn-delete-article-request").on("click", function(e){ > e.preventDefault(); > var article_request = $(this).data("title"); >diff --git a/opac/opac-modrequest.pl b/opac/opac-modrequest.pl >index 05b01a836a..13283d82d8 100755 >--- a/opac/opac-modrequest.pl >+++ b/opac/opac-modrequest.pl >@@ -26,9 +26,9 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > use C4::Output; >-use C4::Reserves qw( CanReserveBeCanceledFromOpac ); > use C4::Auth qw( get_template_and_user ); > use Koha::Holds; >+ > my $query = CGI->new; > > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >@@ -40,11 +40,26 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > ); > > my $reserve_id = $query->param('reserve_id'); >+my $cancellation_request = $query->param('cancellation_request'); >+ >+if ( $reserve_id && $borrowernumber ) { >+ >+ my $hold = Koha::Holds->find($reserve_id); >+ >+ unless ( $hold->borrowernumber == $borrowernumber ) { > >-if ($reserve_id && $borrowernumber) { >- if ( CanReserveBeCanceledFromOpac($reserve_id, $borrowernumber) ) { >- my $hold = Koha::Holds->find( $reserve_id ); >- $hold->cancel if $hold; >+ # whatcha tryin to do? >+ print $query->redirect('/cgi-bin/koha/errors/403.pl'); >+ exit; >+ } >+ >+ if ($cancellation_request) { >+ $hold->add_cancellation_request( { requester_id => $borrowernumber } ) >+ if $hold->cancellation_requestable_from_opac; >+ } >+ else { >+ $hold->cancel >+ if $hold->is_cancelable_from_opac; > } > } > >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22456
:
135165
|
135166
|
135167
|
135168
|
135169
|
135170
|
135171
|
135319
|
135320
|
135321
|
135322
|
135323
|
135324
|
135325
|
135326
|
135349
|
135350
|
135351
|
135352
|
135396
|
135397
|
135398
|
135399
|
135400
|
135401
|
135402
|
135403
|
135404
|
135405
|
135406
|
135407
|
135408
|
135409
|
135410
|
135411
|
135430
|
135830
|
135831
|
135832
|
135838
|
135839
|
135840
|
135841
|
135842
|
135843
|
135844
|
135845
|
135846
|
137580
|
137581
|
137582
|
137583
|
137584
|
137585
|
137586
|
137587
|
137588
|
137589
|
137591
|
138209
|
138210
|
138211
|
138212
|
138213
|
138214
|
138215
|
138216
|
138217
|
138218