Bug 11360 - Disable barcode field and submit button when a hold is found

At the moment when scanning in returns, it can be easy to miss a hold
trap due to the fact that the barcode and submit are still active and
the barcode field is focused on. A librarian who is focused on scanning
can easily scan another item and pass over the form, which is equivalent
to clicking the "ignore" button.

Test Plan:
1) Apply this patch
2) Trap a hold, note the new modal
3) Check the hold in a second time
4) Note the new modal
5) For each modal, test each button

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Kyle M Hall 2015-11-18 18:53:03 +00:00
parent aef77798a9
commit 872892b03c
1 changed files with 194 additions and 46 deletions

View File

@ -38,6 +38,11 @@ function Dopop(link) {
$("#barcode").focus();
}
$(document).ready(function () {
$(".modal").modal({ backdrop: 'static' }).on('shown', function() {
$("#barcode").prop("disabled", true);
}).on('hidden', function() {
$("#barcode").prop("disabled", false).focus();
});
[% IF print_slip %]
Dopop('hold-transfer-slip.pl?borrowernumber=[% borrowernumber %]&amp;biblionumber=[% biblionumber %]');
@ -241,57 +246,95 @@ $(document).ready(function () {
[% END %]
[% IF ( found ) %]
<!-- found -->
<!-- case of a reservation found, and display info -->
[% IF ( waiting ) %]
<!-- waiting -->
<div id="hold-found1" class="modal fade audio-alert-action">
<form method="post" action="returns.pl" class="confirm">
<div class="modal-header">
<h3>
Hold found (item is already waiting):
<a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">
[% itembarcode |html %]: [% title |html %]
</a>
</h3>
</div>
<div id="hold-found1" class="dialog message audio-alert-action">
<h3>Hold found (item is already waiting)</h3>
<p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% itembarcode |html %]: [% title |html %]</a></p>
[% IF ( reservenotes ) %]<h4>Notes: [% reservenotes %]</h4>[% END %]
<h4>Hold for:</h4>
<ul>
<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borsurname %], [% borfirstname %]</a> ([% borcnum %])</li>
<li>[% borstnum %] [% boraddress %]<br />
[% IF ( boraddress2 ) %][% boraddress2 %]<br />[% END %]
[% borcity %] [% borzip %]</li>
[% IF ( borphone ) %]<li> [% borphone %]</li>[% END %]
[% IF ( boremail ) %]<li><a id="boremail" href="mailto:[% boremail %]">[% boremail %]</a></li>[% END %]
[% INCLUDE display_bormessagepref %]
[% IF ( debarred ) %]<li class="error">Patron is RESTRICTED</li>[% END %]
[% IF ( gonenoaddress ) %]<li class="error">Patron's address is in doubt</li>[% END %]</ul>
[% IF ( transfertodo ) %]
<h4><strong>Transfer to:</strong> [% destbranchname %]</h4>
[% ELSE %]
<h4><strong>Hold at</strong> [% destbranchname %]</h4>
[% END %]
<form method="post" action="returns.pl" class="confirm">
<button type="submit" class="approve"><i class="fa fa-check"></i> Confirm</button>
<div class="modal-body">
[% IF ( reservenotes ) %]
<h4>Notes: [% reservenotes %]</h4>
[% END %]
<input type="hidden" name="cancel_reserve" value="0" />
<button type="submit" class="deny" onclick="this.form.cancel_reserve.value = 1; this.form.submit();"><i class="fa fa-times"></i> Cancel</button>
<h4>Hold for:</h4>
<input type="hidden" name="print_slip" value="0" />
<button type="submit" class="print" onclick="this.form.print_slip.value = 1; this.form.submit();"><i class="fa fa-print"></i> Print and confirm</button>
[% FOREACH inputloo IN inputloop %]
<input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
<input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
<input type="hidden" name="bn-[% inputloo.counter %]" value="[% inputloo.borrowernumber %]" />
[% END %]
<input type="hidden" name="itemnumber" value="[% itemnumber %]" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
<input type="hidden" name="biblionumber" value="[% itembiblionumber %]" />
<input type="hidden" name="resbarcode" value="[% barcode | html %]" />
<input type="hidden" name="diffBranch" value="[% destbranch %]" />
<input type="hidden" name="exemptfine" value="[% exemptfine %]" />
<input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
<input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire %]" />
<li>
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borsurname %], [% borfirstname %]</a> ([% borcnum %])
</li>
<input type="hidden" name="return_date_override" value="[% return_date_override %]" />
<input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember %]" />
</form>
</div>
<li>
[% borstnum %] [% boraddress %]<br />
[% IF ( boraddress2 ) %]
[% boraddress2 %]<br />
[% END %]
[% borcity %] [% borzip %]
</li>
[% IF ( borphone ) %]
<li> [% borphone %]</li>
[% END %]
[% IF ( boremail ) %]
<li><a id="boremail" href="mailto:[% boremail %]">[% boremail %]</a></li>
[% END %]
[% IF ( debarred ) %]
<li class="error">Patron is RESTRICTED</li>
[% END %]
[% IF ( gonenoaddress ) %]
<li class="error">Patron's address is in doubt</li>
[% END %]
[% IF ( transfertodo ) %]
<h4><strong>Transfer to:</strong> [% destbranchname %]</h4>
[% ELSE %]
<h4><strong>Hold at</strong> [% destbranchname %]</h4>
[% END %]
[% FOREACH inputloo IN inputloop %]
<input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
<input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
<input type="hidden" name="bn-[% inputloo.counter %]" value="[% inputloo.borrowernumber %]" />
[% END %]
<input type="hidden" name="itemnumber" value="[% itemnumber %]" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
<input type="hidden" name="biblionumber" value="[% itembiblionumber %]" />
<input type="hidden" name="resbarcode" value="[% barcode | html %]" />
<input type="hidden" name="diffBranch" value="[% destbranch %]" />
<input type="hidden" name="exemptfine" value="[% exemptfine %]" />
<input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
<input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire %]" />
<input type="hidden" name="return_date_override" value="[% return_date_override %]" />
<input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember %]" />
</div>
<div class="modal-footer">
<input type="hidden" name="cancel_reserve" value="0" />
<button type="submit" class="btn btn-danger deny" onclick="this.form.cancel_reserve.value = 1; this.form.submit();">
<i class="fa fa-times"></i> Cancel hold
</button>
<button type="submit" class="btn approve">
<i class="fa fa-check"></i> Confirm
</button>
<input type="hidden" name="print_slip" value="0" />
<button type="submit" class="btn btn-primary print" onclick="this.form.print_slip.value = 1; this.form.submit();">
<i class="fa fa-print"></i> Print and confirm
</button>
</div>
</form>
</div>
[% END %]
[% IF ( diffbranch ) %]
@ -404,7 +447,38 @@ $(document).ready(function () {
<!-- case of simple return no issue or transfer but with a reservation -->
[% IF ( reserved ) %]
<!-- reserved -->
<div id="hold-found2" class="modal fade audio-alert-action">
<form method="post" action="returns.pl" class="confirm">
<div class="modal-header">
<h3>
Hold found:
<a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">
[% itembarcode |html %]: [% title |html %]
</a>
</div>
<div class="modal-body">
[% IF ( reservenotes ) %]
<h4>Notes: [% reservenotes %]</h4>
[% END %]
<h5>Hold for:</h5>
<li>
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">
[% borsurname %], [% borfirstname %]
</a>
([% borcnum %])
</li>
<li>
[% borstnum %] [% boraddress %]<br />
[% IF ( boraddress2 ) %]
[% boraddress2 %]<br />
[% END %]
[% borcity %] [% borzip %]
</li>
<<<<<<< HEAD
<div id="hold-found2" class="dialog message audio-alert-action">
<h3>Hold found</h3>
<p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% itembarcode |html %]: [% title |html %]</a></p>
@ -456,6 +530,80 @@ $(document).ready(function () {
<input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember %]" />
</form>
</div>
=======
[% IF ( borphone ) %]
<li>[% borphone %]</li>
[% END %]
[% IF ( boremail ) %]
<li>
[% IF ( transfertodo ) %]
[% boremail %]
[% ELSE %]
<a id="boremail" href="mailto:[% boremail %]">[% boremail %]</a>
[% END %]
</li>
[% END %]
[% IF ( debarred ) %]
<li class="error">Patron is RESTRICTED</li>
[% END %]
[% IF ( gonenoaddress ) %]
<li class="error">Patron's address is in doubt</li>
[% END %]
[% IF ( transfertodo ) %]
<h4><strong>Transfer to:</strong> [% destbranchname %]</h4>
[% ELSE %]
<h4><strong>Hold at</strong> [% destbranchname %]</h4>
[% END %]
<input type="hidden" name="print_slip" value="0" />
[% FOREACH inputloo IN inputloop %]
<input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
<input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
<input type="hidden" name="bn-[% inputloo.counter %]" value="[% inputloo.borrowernumber %]" />
[% END %]
<input type="hidden" name="itemnumber" value="[% itemnumber %]" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
<input type="hidden" name="biblionumber" value="[% itembiblionumber %]" />
<input type="hidden" name="resbarcode" value="[% barcode %]" />
<input type="hidden" name="diffBranch" value="[% destbranch %]" />
<input type="hidden" name="exemptfine" value="[% exemptfine %]" />
<input type="hidden" name="dropboxmode" value="[% dropboxmode %]" />
<input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire %]" />
<input type="hidden" name="return_date_override" value="[% return_date_override %]" />
<input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember %]" />
</div>
<div class="modal-footer">
[% IF ( transfertodo ) %]
<button type="submit" class="btn approve">
<i class="fa fa-check"></i> Confirm hold and transfer
</button>
<button type="submit" class="btn btn-primary print" onclick="this.form.print_slip.value = 1; this.form.submit()">
<i class="fa fa-print"></i> Print slip, transfer, and confirm
</button>
[% ELSE %]
<button type="submit" class="btn approve">
<i class="fa fa-check"></i> Confirm hold
</button>
<button type="submit" class="btn btn-primary print" onclick="this.form.print_slip.value = 1; this.form.submit();">
<i class="fa fa-print"></i> Print slip and confirm
</button>
[% END %]
<button data-dismiss="modal" aria-hidden="true" type="submit" class="btn btn-danger deny" onclick="$('#barcode').focus(); return false;">
<i class="fa fa-times"></i> Ignore
</button>
</div>
</form>
</div>
>>>>>>> Bug 11360 - Disable barcode field and submit button when a hold is found
[% END %]
[% END %]