Bugzilla – Attachment 57996 Details for
Bug 17449
Let users choose action in self checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17449 - Let users choose action in self checkout
Bug-17449---Let-users-choose-action-in-self-checko.patch (text/plain), 12.90 KB, created by
Magnus Enger
on 2016-12-06 10:21:12 UTC
(
hide
)
Description:
Bug 17449 - Let users choose action in self checkout
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2016-12-06 10:21:12 UTC
Size:
12.90 KB
patch
obsolete
>From d0c0f12f2f95d5ecf77bc27cfebc2198755ba510 Mon Sep 17 00:00:00 2001 >From: Magnus Enger <magnus@libriotech.no> >Date: Mon, 17 Oct 2016 08:00:32 +0000 >Subject: [PATCH] Bug 17449 - Let users choose action in self checkout > >Currently if you have a stack of 15 books that you want to renew >through the self checkout, you need to read the barcode of each >item and then click "renew" for each of them. Same for returning >books. One of my customers wants to change the SCO screen so that >users can choose the action they want to take up front, then >let them do the 15 renewals by just scanning the barcodes. > >This patch uses "Bootstrap tabs". I tried using "jQuery tabs", in >a similar way to how it is done in e.g. record detail display in the >OPAC. This resulted in weird conflicts between jQuery and Bootstrap, >hence the the use of Bootstrap for the final patch. > >To test: >- Apply this patch >- Make sure self check is enabled >- Log in to self check >- Process some barcodes, first by borrowing, then renewing, then > returning. Verify that the selected tab is still active and has > focus after each barcode has been processed. >- Now try "illegal" actions and check that you get appropriate > responses: > - Try to borrow a barcode you have already borrowed. > - Try to return a barcode that you have not already borrowed. > - Etc. >- Try this with and without AllowSelfCheckReturns > >Sponsored-by: Hylte Public Library >--- > koha-tmpl/opac-tmpl/bootstrap/css/sco.css | 5 +- > .../opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 114 +++++++++++++++++---- > opac/sco/sco-main.pl | 18 +++- > 3 files changed, 114 insertions(+), 23 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/sco.css b/koha-tmpl/opac-tmpl/bootstrap/css/sco.css >index ad50406..79ed68c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/css/sco.css >+++ b/koha-tmpl/opac-tmpl/bootstrap/css/sco.css >@@ -170,6 +170,9 @@ i.cancel { > i.finish { > background : transparent url("../lib/famfamfam/silk/stop.png") no-repeat 0 0; > } >+.finish-button { >+ padding-top: 20px; >+} > > i.help { > background : transparent url("../lib/famfamfam/silk/help.png") no-repeat 0 0; >@@ -193,4 +196,4 @@ i.help { > .table .nosort.sorting { > padding-right: 19px; > background: #EEEEEE none; >-} >\ No newline at end of file >+} >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >index 3e5d7f4..0a9402e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >@@ -178,26 +178,94 @@ > [% END # / IF patronid %] > > [% IF ( validuser ) %] >- <div id="newcheckout" class="sco_entry"> >- <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid %]');"> >+ >+ <!-- Nav tabs --> >+ <ul class="nav nav-tabs" role="tablist"> >+ [% IF ( op_sanitized == 'checkout' ) %] >+ <li role="presentation" class="active"><a href="#checkout" aria-controls="checkout" role="tab" data-toggle="tab">Checkout</a></li> >+ [% ELSE %] >+ <li role="presentation"><a href="#checkout" aria-controls="checkout" role="tab" data-toggle="tab">Checkout</a></li> >+ [% END %] >+ [% IF ( op_sanitized == 'renew' ) %] >+ <li role="presentation" class="active"><a href="#renew" aria-controls="renew" role="tab" data-toggle="tab">Renew</a></li> >+ [% ELSE %] >+ <li role="presentation"><a href="#renew" aria-controls="renew" role="tab" data-toggle="tab">Renew</a></li> >+ [% END %] >+ [% IF ( AllowSelfCheckReturns ) %] >+ [% IF ( op_sanitized == 'return' ) %] >+ <li role="presentation" class="active"><a href="#return" aria-controls="return" role="tab" data-toggle="tab">Return</a></li> >+ [% ELSE %] >+ <li role="presentation"><a href="#return" aria-controls="return" role="tab" data-toggle="tab">Return</a></li> >+ [% END %] >+ [% END %] >+ </ul> >+ >+ <!-- Tab panes --> >+ <div class="tab-content"> >+ [% IF ( op_sanitized == 'checkout' ) %] >+ <div role="tabpanel" class="tab-pane active" id="checkout"> >+ [% ELSE %] >+ <div role="tabpanel" class="tab-pane" id="checkout"> >+ [% END %] >+ <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('checkout', '[% patronid %]');"> > <fieldset> >- <legend>Check out[% IF ( AllowSelfCheckReturns ) %], return[% END %] or renew an item: </legend> >- <div class="input-append"> >- <label for="barcode">Scan a new item or enter its barcode:</label> >- <input id="barcode" name="barcode" size="20" type="text" class="focus" autocomplete="off" /> >- <button type="submit" class="btn">Submit</button> >- </div> >- <input type="hidden" name="op" value="checkout" /> >- <input type="hidden" name="patronid" value="[% patronid %]" /> >- </fieldset> >+ <div class="input-append"> >+ <label for="checkout-barcode">Scan a new item or enter its barcode to checkout:</label> >+ <input id="checkout-barcode" name="barcode" size="20" type="text" class="form-control focus" autocomplete="off" /> >+ <span class="input-group-btn"> >+ <button type="submit" class="btn btn-default" type="button">Submit</button> >+ </span> >+ </div> >+ <input type="hidden" name="op" value="checkout" /> >+ <input type="hidden" name="patronid" value="[% patronid %]" /> >+ </fieldset> > </form> >+ </div> <!-- / #checkout --> > >- <div> >- <form method="post" action="#" id="logout_form"> >- <button type="submit" class="btn"><i class="icon finish"></i> Finish</button> >- </form> >- </div> >- </div> <!-- / #newcheckout --> >+ [% IF ( op_sanitized == 'renew' ) %] >+ <div role="tabpanel" class="tab-pane active" id="renew"> >+ [% ELSE %] >+ <div role="tabpanel" class="tab-pane" id="renew"> >+ [% END %] >+ <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('renew', '[% patronid %]');"> >+ <fieldset> >+ <div class="input-append"> >+ <label for="renew-barcode">Scan a new item or enter its barcode to renew it:</label> >+ <input id="renew-barcode" name="barcode" size="20" type="text" class="form-control focus" autocomplete="off" /> >+ <button type="submit" class="btn">Submit</button> >+ </div> >+ <input type="hidden" name="op" value="renew" /> >+ <input type="hidden" name="patronid" value="[% patronid %]" /> >+ </fieldset> >+ </form> >+ </div> <!-- / #renew --> >+ >+ [% IF ( AllowSelfCheckReturns ) %] >+ [% IF ( op_sanitized == 'return' ) %] >+ <div role="tabpanel" class="tab-pane active" id="return"> >+ [% ELSE %] >+ <div role="tabpanel" class="tab-pane" id="return"> >+ [% END %] >+ <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('return', '[% patronid %]');"> >+ <fieldset> >+ <div class="input-append"> >+ <label for="return-barcode">Scan a new item or enter its barcode to return it:</label> >+ <input id="return-barcode" name="barcode" size="20" type="text" class="form-control focus" autocomplete="off" /> >+ <button type="submit" class="btn">Submit</button> >+ </div> >+ <input type="hidden" name="op" value="returnbook" /> >+ <input type="hidden" name="patronid" value="[% patronid %]" /> >+ </fieldset> >+ </form> >+ </div> <!-- / #return --> >+ [% END %] >+ </div> <!-- / #tab-content--> >+ >+ <div class="finish-button"> >+ <form method="post" action="#" id="logout_form"> >+ <button type="submit" class="btn"><i class="icon finish"></i> Finish</button> >+ </form> >+ </div> > </div> <!-- / .span12/12 --> > [% IF ( display_patron_image ) %] > <div class="span2"> >@@ -318,7 +386,6 @@ > </div> <!-- / .container-fluid --> > </div> <!-- / .main --> > <span id="audio-alert"></span> >-</body> > > [% INCLUDE 'opac-bottom.inc' %] > [% BLOCK jsinclude %] >@@ -347,8 +414,8 @@ > > return false; > } >- function checkout_confirm(patronid) { >- var barcode = $("#barcode").val(); >+ function checkout_confirm(target, patronid) { >+ var barcode = $("#" + target + "-barcode").val(); > // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'"); > if (! barcode) { dofocus(); return false; } // no barcode > if (barcode == "__KOHA_NEW_CIRC__") { // magic barcode >@@ -406,6 +473,13 @@ > > return true; > }); >+ >+ // Make sure the barcode box on the selected tab is given focus >+ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { >+ var target = $(e.target).attr("href"); >+ $(target + '-barcode').focus(); >+ }); >+ > }); > //]]> > </script> >diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl >index 0a59d3b..a055504 100755 >--- a/opac/sco/sco-main.pl >+++ b/opac/sco/sco-main.pl >@@ -134,6 +134,9 @@ elsif ( $op eq "returnbook" && $allowselfcheckreturns ) { > #warn "returnbook: " . $doreturn; > $borrower = GetMemberDetails(undef,$patronid); > } >+elsif ( $op eq "renew" ) { >+ AddRenewal( $borrower, $item->{itemnumber} ); >+} > elsif ( $op eq "checkout" ) { > my $impossible = {}; > my $needconfirm = {}; >@@ -283,9 +286,20 @@ if ($borrower->{cardnumber}) { > ); > } > >+# Send a sanitized value for op to the template, to determine active tab >+my $op_sanitized; >+if ( $op eq 'returnbook' ) { >+ $op_sanitized = 'return'; >+} elsif ( $op eq 'renew' ) { >+ $op_sanitized = 'renew'; >+} else { >+ $op_sanitized = 'checkout'; >+} >+ > $template->param( >- SCOUserJS => C4::Context->preference('SCOUserJS'), >- SCOUserCSS => C4::Context->preference('SCOUserCSS'), >+ SCOUserJS => C4::Context->preference('SCOUserJS'), >+ SCOUserCSS => C4::Context->preference('SCOUserCSS'), >+ op_sanitized => $op_sanitized, > ); > > output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >-- >2.7.4
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 17449
:
57996
|
74796