Bugzilla – Attachment 74796 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), 13.07 KB, created by
Magnus Enger
on 2018-04-24 09:58:17 UTC
(
hide
)
Description:
Bug 17449 - Let users choose action in self checkout
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2018-04-24 09:58:17 UTC
Size:
13.07 KB
patch
obsolete
>From 736cb171f9f24e7fd2210a2db235fccb6578e56f 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 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 > >2018-04-24: Fixed conflicts and problems with renew and return. > >Sponsored-by: Hylte Public Library >--- > koha-tmpl/opac-tmpl/bootstrap/css/sco.css | 8 +- > .../opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 114 +++++++++++++++++---- > opac/sco/sco-main.pl | 19 ++++ > 3 files changed, 117 insertions(+), 24 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/sco.css b/koha-tmpl/opac-tmpl/bootstrap/css/sco.css >index 38fe877..3045e24 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; >@@ -194,15 +197,12 @@ i.help { > padding-right: 19px; > background: #EEEEEE none; > } >- > #sci_logout { > color: #E8583C; > } >- > #sci_checkin_button, #sci_refresh_button, #sci_append_button { > margin-bottom: 10px; > } >- > #sci_refresh_button { > color: rgb(51, 51, 51); >-} >\ 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 8cadb17..6a56b24 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 >@@ -182,26 +182,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 ( Koha.Preference('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 ( Koha.Preference('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 ( Koha.Preference('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"> >@@ -327,7 +395,6 @@ > </div> <!-- / .container-fluid --> > </div> <!-- / .main --> > <span id="audio-alert"></span> >-</body> > > [% INCLUDE 'opac-bottom.inc' %] > [% BLOCK jsinclude %] >@@ -356,8 +423,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 >@@ -415,6 +482,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 9fcf729..621f59a 100755 >--- a/opac/sco/sco-main.pl >+++ b/opac/sco/sco-main.pl >@@ -128,6 +128,9 @@ if ($op eq "logout") { > elsif ( $op eq "returnbook" && $allowselfcheckreturns ) { > my ($doreturn) = AddReturn( $barcode, $branch ); > } >+elsif ( $op eq "renew" ) { >+ AddRenewal( $borrower->{borrowernumber}, $item->{itemnumber} ); >+} > elsif ( $patron and $op eq "checkout" ) { > my $impossible = {}; > my $needconfirm = {}; >@@ -306,4 +309,20 @@ if ($borrower) { > ); > } > >+# 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'), >+ 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