Bug 35535: Allow for cancellation of holds with or without a reason

TO TEST:
1. Have a waiting hold on a particular barcode
2. Have at least 1 HOLD_CANCELLATION auth value
3. Check in the barcode and try to cancel the hold on the modal while
   selecting a reason.
=> SUCCESS: You can cancel a hold when selecting a reason.
4. Repeat 1-3 but not selecting any reason.
=> SUCCESS: Hold cancelled correctly.
5. Delete all HOLD_CANCELLATION auth values.
6. Repeat Try 1-3
=> SUCCESS: No reason displayed
=> FAIL: Cancelling does nothing. There's an error in the browser
   inspector
7. Apply this patch
8. Repeat 1-3
=> SUCCESS: No reason displayed
=> SUCCESS: Cancelling works
9. Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: amended the test plan to make it clearer
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c1bf46d1e7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Lucas Gass 2024-01-17 15:45:53 +00:00 committed by Fridolin Somers
parent d1e3956eff
commit cca2fa2396

View file

@ -705,7 +705,7 @@
[% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
[% IF hold_cancellation.count %]
<select name="cancellation-reason" id="cancellation-reason">
<option value="NULL">No reason given</option>
<option value="">No reason given</option>
[% FOREACH reason IN hold_cancellation %]
<option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
[% END %]
@ -1562,7 +1562,11 @@
this.form.submit();
});
$('.cancel-hold').on("click",function(e){
let cancel_reason = document.getElementById('cancellation-reason').value;
let cancel_form = document.getElementById('cancellation-reason');
let cancel_reason = '';
if ( cancel_form ) {
cancel_reason = cancel_form.value;
}
this.form.cancel_reserve.value = 1;
this.form.cancel_reason.value = cancel_reason;
this.form.submit();