Merge branch 'bug_8877' into 3.12-master
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / sco / sco-main.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] &rsaquo; Self checkout </title>
3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <meta name="generator" content="Koha [% Version %]" /> <!-- leave this for stats -->
5 <link rel="shortcut icon" href="[% themelang %]/includes/favicon.ico" type="image/x-icon" />
6 <!-- yui js -->
7 <script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script>
8 <script type="text/javascript" src="[% yuipath %]/container/container-min.js"></script>
9 <script type="text/javascript" src="[% yuipath %]/menu/menu-min.js"></script>
10 <script type="text/javascript" src="[% themelang %]/lib/jquery/jquery.js"></script>
11 <script type="text/javascript" src="[% themelang %]/lib/jquery/jquery-ui.js"></script>
12 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
13 <script type="text/javascript">//<![CDATA[
14 function sco_init() {
15     setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",[% SelfCheckTimeout %]);
16 }
17 function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
18     // alert("dofocus called");
19     $(".focus:last").select();
20 }
21 var slip_re = /slip/;
22 function printx_window(print_type) {
23   var handler = print_type.match(slip_re) ? "printslip" : "moremember";
24
25   return false;
26 }
27 function checkout_confirm(patronid) {
28     var   barcode = $("#barcode").val();
29     // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
30     if (! barcode) { dofocus(); return false; }    // no barcode
31     if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode 
32         window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
33         return false;
34     }
35     return true;
36 }
37
38 // build Change Language menus
39 YAHOO.util.Event.onContentReady("changelanguage", function () {
40   $(".sublangs").each(function(){
41     var menuid = $(this).attr("id");
42     var menuid = menuid.replace("show","");
43
44     var oMenu = new YAHOO.widget.Menu("sub"+menuid, { zindex: 2 });
45     function positionoMenu() {
46       oMenu.align("bl", "tl");
47     }
48     oMenu.subscribe("beforeShow", function () {
49     if (this.getRoot() == this) {
50       positionoMenu();
51     }
52     });
53     oMenu.render();
54     oMenu.cfg.setProperty("context", ["show"+menuid, "bl", "tl"]);
55     function onYahooClick(p_oEvent) {
56       // Position and display the menu
57       positionoMenu();
58       oMenu.show();
59       // Stop propagation and prevent the default "click" behavior
60       YAHOO.util.Event.stopEvent(p_oEvent);
61     }
62     YAHOO.util.Event.addListener("show"+menuid, "click", onYahooClick);
63     YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu);
64   });
65 });
66
67 $.tablesorter.addParser({
68     id: 'articles',
69     is: function(s) {return false;  },
70     format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
71     type: 'text'
72 });
73
74 $(document).ready(function() {
75     dofocus();
76     [% IF ( patronid ) %]sco_init();[% END %]
77     $("#loanTable").tablesorter({
78         [% IF ( dateformat_metric ) %]
79             dateFormat: 'uk',
80         [% END %]
81         widgets:   ['zebra'],
82         sortList:  [[2, 1], [0, 0]],
83         headers: {
84             0: { sorter: 'articles' },
85             3: { sorter: false }
86             [% UNLESS ( nofines ) %], 4: { sorter: false }[% END %]
87         }
88     });
89 });
90 //]]>
91 $(document).ready(function(){
92     $("#logout_form").submit(function(){
93         if(confirm("Would you like to print a receipt?")){
94             window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber %]&amp;print=qslip");
95         }
96         return true;
97     });
98 });
99 </script>
100 [% IF ( opacuserjs ) %]<script type="text/javascript">[% opacuserjs %]</script>[% END %]
101 [% IF ( SCOUserJS ) %]<script type="text/javascript">[% SCOUserJS %]</script>[% END %]
102
103 <link rel="stylesheet" type="text/css" href="[% yuipath %]/reset-fonts-grids.css" />
104 <link rel="stylesheet" type="text/css" href="[% yuipath %]/skin.css" />
105 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/sco.css" />
106 [% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
107 [% IF ( SCOUserCSS ) %]<style type="text/css">[% SCOUserCSS %]</style>[% END %]
108
109 </head>
110 <body onload="dofocus();">
111
112 <div id="doc" class="yui-t7">
113
114 <div id="masthead"><h1>[% LibraryName %] Self checkout system</h1></div>
115 <div id="bd">
116
117 [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
118 <div class="dialog alert"><h3>Item cannot be checked out.</h3><p>Sorry, this item cannot be checked out at this station.  </p>
119 [% IF ( title ) %]<p>Title: <em>[% title |html %]</em> </p>[% END %]
120 <p>
121    [% IF ( circ_error_UNKNOWN_BARCODE ) %]
122     <em>MESSAGE 1:</em> The system does not recognize this barcode.
123    [% ELSIF ( circ_error_max_loans_allowed ) %]
124     <em>MESSAGE 2:</em> You have checked out too many items and can't check out any more.
125    [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
126     <em>MESSAGE 3:</em> This item is checked out to someone else.
127    [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
128     <em>MESSAGE 4:</em> You cannot renew this item again.
129    [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
130     <em>MESSAGE 5:</em> This item is not for loan.
131    [% ELSIF ( circ_error_DEBT ) %]
132     <em>MESSAGE 6:</em> You owe the library [% amount %] and cannot check out.
133    [% ELSIF ( circ_error_WTHDRAWN ) %]
134     <em>MESSAGE 7:</em> This item has been withdrawn from the collection.
135    [% ELSIF ( circ_error_RESTRICTED ) %]
136     <em>MESSAGE 8:</em>
137    [% ELSIF ( circ_error_RESERVED ) %]
138     <em>MESSAGE 9:</em> This item is on hold for another patron.
139    [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
140     <em>MESSAGE 10:</em>
141    [% ELSIF ( circ_error_EXPIRED ) %]
142     <em>MESSAGE 11:</em> Your account has expired.
143    [% ELSIF ( circ_error_DEBARRED ) %]
144     <em>MESSAGE 12:</em> Your account has been suspended.
145    [% ELSIF ( circ_error_CARD_LOST ) %]
146     <em>MESSAGE 13:</em> This card has been declared lost.
147    [% ELSIF ( circ_error_GNA ) %]
148     <em>MESSAGE 14:</em>
149    [% ELSIF ( circ_error_INVALID_DATE ) %]
150     <em>MESSAGE 15:</em>
151    [% END %]
152    Please see a member of the library staff.
153 </p>
154 [% IF ( returnitem ) %]
155 [% IF ( AllowSelfCheckReturns ) %]
156 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
157     <input type="hidden" name="op" value="returnbook" />
158     <input type="hidden" name="patronid" value="[% patronid %]" />
159     <input type="hidden" name="barcode" value="[% barcode %]" />
160     <input type="submit" name="returnbook" value="Return this item" class="return" />
161 </form>
162 [% END %]
163 [% END %]
164 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
165     <input type="hidden" name="op" value="" />
166     <input type="hidden" name="patronid" value="[% patronid %]" />
167     <input type="hidden" name="barcode" value="[% barcode %]" />
168     <input type="submit" name= "confirm" value="Return to account summary" class="back focus" />
169 </form>
170 [% END %]
171 [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
172 <div class="dialog alert"><h3>Please confirm the checkout:</h3>
173 <p>[% IF ( confirm_renew_issue ) %]This item is already checked out to you.[% END %]</p>
174
175 [% IF ( renew ) %]
176 [% IF ( AllowSelfCheckReturns ) %]
177     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
178         <input type="hidden" name="op" value="returnbook" />
179         <input type="hidden" name="patronid" value="[% patronid %]" />
180         <input type="hidden" name="barcode" value="[% barcode %]" />
181         <input type="hidden" name="confirmed" value="" />
182         <input type="submit" value="Return item" name="confirm" class="return" />
183     </form>
184 [% END %]
185 [% END %]
186
187 [% UNLESS ( renew ) %]
188     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
189         <input type="hidden" name="op" value="checkout" />
190         <input type="hidden" name="patronid" value="[% patronid %]" />
191         <input type="hidden" name="barcode" value="[% barcode %]" />
192         <input type="hidden" name="confirmed" value="1" />
193         <input type="submit" value="Renew item" name="confirm" class="renew" />
194       </form>
195 [% ELSE %]
196     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
197         <input type="hidden" name="op" value="checkout" />
198         <input type="hidden" name="patronid" value="[% patronid %]" />
199         <input type="hidden" name="barcode" value="[% barcode %]" />
200         <input type="hidden" name="confirmed" value="1" />
201         <input type="submit" value="Renew item" class="renew" />
202     </form>
203 [% END %]
204     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
205       <input type="hidden" name="op" value="" />
206       <input type="hidden" name="patronid" value="[% patronid %]" />
207       <input type="submit" value="Cancel" class="cancel" />
208     </form>
209 </div>
210 [% END %]
211
212 [% IF ( nopermission ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Access denied</h3>
213 Sorry, this self-checkout station has lost authentication.  Please contact the administrator to resolve this problem. </div>
214 [% END %]
215 [% IF ( different_ip ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Session lost</h3>You are accessing self-checkout from a different IP address! please log in again.</div>[% END %]
216 [% IF ( invalid_username_or_password ) %]
217 <!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Record not found</h3><p>Your userid was not found in the database.  Please try again.</p></div>[% END %]
218
219
220 [% UNLESS ( hide_main ) %]
221         <div class="sco_head">
222         [% UNLESS ( validuser ) %] 
223     <h3>Self checkout</h3>
224         [% END %]
225
226         <div id="checkouthelp">
227                 <a href="/cgi-bin/koha/sco/help.pl">HELP</a> with the self checkout system
228         </div>
229
230         [% IF ( patronid ) %]
231         [% IF ( validuser ) %]
232     <h3 class="warning">You are logged in as [% borrowername %].</h3>
233         [% END %]
234         </div>
235         [% IF ( nouser ) %]
236         <div class="dialog alert"><h4>Sorry</h4><p>The userid <strong>[% patronid %]</strong> was not found in the database.  Please try again.</p></div>
237         <br />
238         [% END %]
239         [% END %]
240
241         [% IF ( validuser ) %]
242   [% IF ( display_patron_image ) %]<div class="yui-ge"><div class="yui-u first">[% END %]
243         <div id="newcheckout" class="sco_entry">
244         <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid %]');">
245         <fieldset><legend> Check out[% IF ( AllowSelfCheckReturns ) %], return[% END %] or renew an item: </legend>
246         <label for="barcode">Scan a new item or enter its barcode:</label>
247     <input id="barcode" name="barcode" size="20" class="focus" autocomplete="off" />
248         <input type="hidden" name="op" value="checkout" />
249         <input type="hidden" name="patronid" value="[% patronid %]" />
250         <input type="submit" value="Submit" class="submit" /></fieldset>
251         </form>
252     <div><form method="post" action="#" id="logout_form"><input type="submit" value="Finish" class="finish" /></form></div>
253         </div> <!-- sco_entry --> <!-- newcheckout -->
254   [% IF ( display_patron_image ) %]</div> <!-- /yui-u first -->[% END %]
255   [% IF ( display_patron_image ) %]
256   <div class="yui-u">
257         <img src="/cgi-bin/koha/sco/sco-patron-image.pl?cardnumber=[% cardnumber %]" alt="" />
258   </div>
259   [% END %]
260   </div> <!-- /yui-ge -->
261   <div class="yui-g">
262         <div id="borrowerdetails">
263         [% IF ( issues_count ) %]
264         <table id="loanTable"><caption>Checkouts for [% borrowername %] <span class="count">([% issues_count %] total)</span></caption>
265         <!-- ISSUES TABLE ROWS -->
266     <thead>
267         <tr><th>Title</th><th>Call no.</th><th>Due</th><th>Renew</th>[% UNLESS ( nofines ) %]<th>Fines</th>[% END %]</tr>
268     </thead>
269
270     <tbody>
271         [% FOREACH ISSUE IN ISSUES %]
272         [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
273     <!-- FIXME: yet another jacket image breakpoint -->
274         <td>[% UNLESS ( ISSUE.noitemlinks ) %]<a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.biblionumber %]">[% ISSUE.title |html %]</a>[% ELSE %]<strong>[% ISSUE.title |html %]</strong>[% END %]<span class="item-details">
275         [% ISSUE.author %]</span> ([% ISSUE.barcode %])</td>
276         <td>[% ISSUE.itemcallnumber %]</td>
277         [% IF ( ISSUE.overdue ) %]<td class="overdue">[% ISSUE.date_due | $KohaDates %]</td>[% ELSE %]<td>[% ISSUE.date_due | $KohaDates %]</td>[% END %]
278         <td>
279     <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
280     <input type="hidden" name="patronid" value="[% patronid %]" />
281     <input type="hidden" name="barcode" value="[% ISSUE.barcode %]" />
282         [% IF ( ISSUE.norenew ) %]
283           [% IF ( AllowSelfCheckReturns ) %]
284             <input type="submit" value="Check in item" name="confirm" class="return" />
285             <input type="hidden" name="op" value="returnbook" />
286             <input type="hidden" name="confirmed" value=""  />
287           [% ELSE %]
288             <span>No renewals allowed</span>
289           [% END %]
290         [% ELSE %]
291             <input type="hidden" name="op" value="checkout" />
292             <input type="hidden" name="confirmed" value="1" />
293             [% UNLESS ( ISSUE.renew ) %]<input type="submit" value="Renew item"  name="confirm" class="renew" />
294             [% ELSE %]<input type="submit" value="Renew item" class="renew" />[% END %]
295         [% END %]
296     </form>
297         </td>
298         [% UNLESS ( nofines ) %]<td>[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>[% END %]</tr>
299         [% END %]
300     </tbody>
301
302         </table>
303         [% ELSE %]
304         <h3>You currently have nothing checked out.</h3>
305         [% END %]
306 </div> <!-- /yui-g -->
307         [% ELSE %]<!-- not validuser -->
308         <div class="sco_entry" >
309         <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
310        [% IF ( authbylogin ) %]
311         <fieldset class="checkout">
312        <legend>Please login with your username and password</legend>
313        <label for="patronlogin">Username:</label>
314         <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" />
315        <label for="patronpw">Password:</label>
316         <input type="password" id="patronpw" size="20" name="patronpw" />
317        [% ELSE %]
318         <fieldset class="checkout"><label for="patronid">Please enter your card number:</label> 
319     <input type="text" id="patronid" class="focus" size="20" name="patronid" autocomplete="off" />
320         [% END %]
321
322         [% FOREACH INPUT IN INPUTS %]<input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]">[% END %]
323         <input type="hidden" name="op" value="login" />
324         <input type="submit" value="Submit" class="submit" /></fieldset></form>
325         </div>
326         [% END %]
327 [% END %] <!-- ( / hide main) -->       
328         
329         </div>
330 </div>
331 [% INCLUDE 'opac-bottom.inc' %]