Bug 29737: Fix suspend from hold list

From holds list of a bibliographic record, the "unsuspend" button does not work as expected.
The form is submitted but the suspension is still there.

There are 3 requests, 2 GET and 1 POST.
One of the GET is rejected by Firefox (NS_BINDING_ABORTED)

Test plan:
Place some items on hold, play with suspend/unsuspend from the hold list
/cgi-bin/koha/reserve/request.pl?biblionumber=XX

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2021-12-20 13:45:04 +01:00 committed by Fridolin Somers
parent e4f4a7ea98
commit fd1b110fd5
2 changed files with 12 additions and 1 deletions

View File

@ -201,7 +201,7 @@
<td>
[% IF Koha.Preference('SuspendHoldsIntranet') %]
[% UNLESS ( hold.found ) %]
<button class="btn btn-default btn-xs" onclick="window.location.href='request.pl?action=toggleSuspend&amp;reserve_id=[% hold.reserve_id | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;date=[% hold.date | html %]&amp;suspend_until=' + $('#suspend_until_[% hold.reserve_id | html %]').val()">
<button class="btn btn-default btn-xs toggle-suspend" data-reserve-id="[% hold.reserve_id | html %]" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-date="[% hold.date | html %]">
[% IF ( hold.suspend ) %]
<i class="fa fa-play" aria-hidden="true"></i> Unsuspend
[% ELSE %]

View File

@ -427,4 +427,15 @@ $(document).ready(function() {
$('#suspend-modal').modal('hide');
});
});
$(".toggle-suspend").on('click', function(e) {
e.preventDefault();
let reserve_id = $(this).data('reserve-id');
let borrowernumber = $(this).data('borrowernumber');
let biblionumber = $(this).data('biblionumber');
let date = $(this).data('date');
let suspend_until = $('#suspend_until_' + reserve_id).val();
window.location.href='request.pl?action=toggleSuspend&amp;reserve_id=' + reserve_id + '&amp;borrowernumber=' + borrowernumber + '&amp;biblionumber=' + biblionumber + '&amp;date=' + date + '&amp;suspend_until=' + suspend_until;
return false;
});
});