Bug 34478: Manual fix - add ops - hold-table.inc opac-user.tt

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nick Clemens 2024-02-01 08:53:28 -05:00 committed by Jonathan Druart
parent 0143ed45bb
commit adbc2ae27e
Signed by: jonathan.druart
GPG key ID: A085E712BEF0E0F0
4 changed files with 16 additions and 7 deletions

View file

@ -92,6 +92,7 @@
<div class="modal-dialog">
<form id="change_branch_form[% HOLD.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-change_branch">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="changePickup[% HOLD.reserve_id | html %]Label">Change pickup location for <em>[% INCLUDE 'biblio-title.inc' biblio=HOLD.biblio %]</em></h5>
@ -168,6 +169,7 @@
[% IF HOLD.suspend %]
<form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-unsuspend" />
<input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
<button class="btn btn-link" type="submit" name="submit"><i class="fa fa-play" aria-hidden="true"></i> Resume</button>
</form>
@ -177,6 +179,7 @@
[% ELSE %]
<form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-suspend" />
<input type="hidden" name="reserve_id" value="[% HOLD.reserve_id | html %]" />
<button class="btn btn-link" type="submit" name="submit"><i class="fa fa-pause" aria-hidden="true"></i> Suspend</button>
</form>
@ -190,6 +193,7 @@
[% IF ( HOLD.is_cancelable_from_opac ) %]
<form id="delete_hold_[% HOLD.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-cancel" />
<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-times" aria-hidden="true"></i> [% tp('Cancel hold button', 'Cancel') | html %]</button>
@ -197,9 +201,9 @@
[% ELSIF HOLD.is_waiting && HOLD.cancellation_requestable_from_opac %]
<form id="req_cancel_hold_[% HOLD.reserve_id | html %]" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-request_cancellation" />
<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-times" aria-hidden="true"></i> [% tp('Request to cancel hold button', 'Request to cancel') | html %]</button>
</form>
[% END %]
@ -216,6 +220,7 @@
<div>
<form class="form-inline" id="suspend_all_holds" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-suspend_all" />
<button type="submit" id="suspend_all_submit" class="btn btn-primary"><i class="fa fa-pause" aria-hidden="true"></i> Suspend all holds</button>
<input type="hidden" name="suspend" value="1" />
@ -230,6 +235,7 @@
<div>
<form id="resume_all_holds" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-unsuspend_all" />
<button type="submit" id="resume_all_submit" class="btn btn-primary"><i class="fa fa-play" aria-hidden="true"></i> Resume all suspended holds</button>
<input type="hidden" name="suspend" value="0" />
</form>

View file

@ -1042,8 +1042,10 @@
<div class="modal-header">
[% IF HOLD.suspend %]
<h5 class="modal-title" id="suspendModalLabel">Resume hold</h5>
<input type="hidden" name="op" value="cud-unsuspend" />
[% ELSE %]
<h5 class="modal-title" id="suspendModalLabel">Suspend hold</h5>
<input type="hidden" name="op" value="cud-suspend" />
[% END %]
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">x</span>

View file

@ -30,14 +30,15 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
}
);
my $op = $query->param('op') || q{};
my $suspend = $query->param('suspend');
my $suspend_until = $query->param('suspend_until') || undef;
my $reserve_id = $query->param('reserve_id');
if ($reserve_id) {
if ( ( $op eq 'cud-suspend' || $op eq 'cud-unsuspend' ) && $reserve_id ) {
ToggleSuspend( $reserve_id, $suspend_until ) if CanReserveBeCanceledFromOpac($reserve_id, $borrowernumber);
}
else {
elsif( $op eq 'cud-suspend_all' || $op eq 'cud-unsuspend_all' ) {
SuspendAll(
borrowernumber => $borrowernumber,
suspend => $suspend,

View file

@ -39,8 +39,8 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
}
);
my $op = $query->param('op');
my $reserve_id = $query->param('reserve_id');
my $cancellation_request = $query->param('cancellation_request');
my $new_pickup_location = $query->param('new_pickup_location');
if ( $reserve_id && $borrowernumber ) {
@ -54,11 +54,11 @@ if ( $reserve_id && $borrowernumber ) {
exit;
}
if ( $cancellation_request ) {
if ( $op eq 'cud-request_cancellation' ) {
$hold->add_cancellation_request
if $hold->cancellation_requestable_from_opac;
}
elsif ( $new_pickup_location ) {
elsif ( $op eq 'cud-change_branch' && $new_pickup_location ) {
if ($hold->can_update_pickup_location_opac) {
$hold->set_pickup_location({ library_id => $new_pickup_location });
@ -69,7 +69,7 @@ if ( $reserve_id && $borrowernumber ) {
exit;
}
}
elsif ( $hold->is_cancelable_from_opac ) {
elsif ( $op eq 'cud-cancel' && $hold->is_cancelable_from_opac ) {
$hold->cancel;
}
}