Merge branch 'bug_9052' 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="[% themelang %]/css/sco.css" />
104 [% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
105 [% IF ( SCOUserCSS ) %]<style type="text/css">[% SCOUserCSS %]</style>[% END %]
106
107 </head>
108 <body onload="dofocus();">
109
110 <div id="doc" class="yui-t7">
111
112 <div id="masthead"><h1>[% LibraryName %] Self checkout system</h1></div>
113 <div id="bd">
114
115 [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
116 <div class="dialog alert"><h3>Item cannot be checked out.</h3><p>Sorry, this item cannot be checked out at this station.  </p>
117 [% IF ( title ) %]<p>Title: <em>[% title |html %]</em> </p>[% END %]
118 <p>
119    [% IF ( circ_error_UNKNOWN_BARCODE ) %]
120     <em>MESSAGE 1:</em> The system does not recognize this barcode.
121    [% ELSIF ( circ_error_max_loans_allowed ) %]
122     <em>MESSAGE 2:</em> You have checked out too many items and can't check out any more.
123    [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
124     <em>MESSAGE 3:</em> This item is checked out to someone else.
125    [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
126     <em>MESSAGE 4:</em> You cannot renew this item again.
127    [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
128     <em>MESSAGE 5:</em> This item is not for loan.
129    [% ELSIF ( circ_error_DEBT ) %]
130     <em>MESSAGE 6:</em> You owe the library [% amount %] and cannot check out.
131    [% ELSIF ( circ_error_WTHDRAWN ) %]
132     <em>MESSAGE 7:</em> This item has been withdrawn from the collection.
133    [% ELSIF ( circ_error_RESTRICTED ) %]
134     <em>MESSAGE 8:</em>
135    [% ELSIF ( circ_error_RESERVED ) %]
136     <em>MESSAGE 9:</em> This item is on hold for another patron.
137    [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
138     <em>MESSAGE 10:</em>
139    [% ELSIF ( circ_error_EXPIRED ) %]
140     <em>MESSAGE 11:</em> Your account has expired.
141    [% ELSIF ( circ_error_DEBARRED ) %]
142     <em>MESSAGE 12:</em> Your account has been suspended.
143    [% ELSIF ( circ_error_CARD_LOST ) %]
144     <em>MESSAGE 13:</em> This card has been declared lost.
145    [% ELSIF ( circ_error_GNA ) %]
146     <em>MESSAGE 14:</em>
147    [% ELSIF ( circ_error_INVALID_DATE ) %]
148     <em>MESSAGE 15:</em>
149    [% END %]
150    Please see a member of the library staff.
151 </p>
152 [% IF ( returnitem ) %]
153 [% IF ( AllowSelfCheckReturns ) %]
154 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
155     <input type="hidden" name="op" value="returnbook" />
156     <input type="hidden" name="patronid" value="[% patronid %]" />
157     <input type="hidden" name="barcode" value="[% barcode %]" />
158     <input type="submit" name="returnbook" value="Return this item" class="return" />
159 </form>
160 [% END %]
161 [% END %]
162 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
163     <input type="hidden" name="op" value="" />
164     <input type="hidden" name="patronid" value="[% patronid %]" />
165     <input type="hidden" name="barcode" value="[% barcode %]" />
166     <input type="submit" name= "confirm" value="Return to account summary" class="back focus" />
167 </form>
168 [% END %]
169 [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
170 <div class="dialog alert"><h3>Please confirm the checkout:</h3>
171 <p>[% IF ( confirm_renew_issue ) %]This item is already checked out to you.[% END %]</p>
172
173 [% IF ( renew ) %]
174 [% IF ( AllowSelfCheckReturns ) %]
175     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
176         <input type="hidden" name="op" value="returnbook" />
177         <input type="hidden" name="patronid" value="[% patronid %]" />
178         <input type="hidden" name="barcode" value="[% barcode %]" />
179         <input type="hidden" name="confirmed" value="" />
180         <input type="submit" value="Return item" name="confirm" class="return" />
181     </form>
182 [% END %]
183 [% END %]
184
185 [% UNLESS ( renew ) %]
186     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
187         <input type="hidden" name="op" value="checkout" />
188         <input type="hidden" name="patronid" value="[% patronid %]" />
189         <input type="hidden" name="barcode" value="[% barcode %]" />
190         <input type="hidden" name="confirmed" value="1" />
191         <input type="submit" value="Renew item" name="confirm" class="renew" />
192       </form>
193 [% ELSE %]
194     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
195         <input type="hidden" name="op" value="checkout" />
196         <input type="hidden" name="patronid" value="[% patronid %]" />
197         <input type="hidden" name="barcode" value="[% barcode %]" />
198         <input type="hidden" name="confirmed" value="1" />
199         <input type="submit" value="Renew item" class="renew" />
200     </form>
201 [% END %]
202     <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
203       <input type="hidden" name="op" value="" />
204       <input type="hidden" name="patronid" value="[% patronid %]" />
205       <input type="submit" value="Cancel" class="cancel" />
206     </form>
207 </div>
208 [% END %]
209
210 [% IF ( nopermission ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Access denied</h3>
211 Sorry, this self-checkout station has lost authentication.  Please contact the administrator to resolve this problem. </div>
212 [% END %]
213 [% 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 %]
214 [% IF ( invalid_username_or_password ) %]
215 <!-- 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 %]
216
217
218 [% UNLESS ( hide_main ) %]
219         <div class="sco_head">
220         [% UNLESS ( validuser ) %] 
221     <h3>Self checkout</h3>
222         [% END %]
223
224         <div id="checkouthelp">
225                 <a href="/cgi-bin/koha/sco/help.pl">HELP</a> with the self checkout system
226         </div>
227
228         [% IF ( patronid ) %]
229         [% IF ( validuser ) %]
230     <h3 class="warning">You are logged in as [% borrowername %].</h3>
231         [% END %]
232         </div>
233         [% IF ( nouser ) %]
234         <div class="dialog alert"><h4>Sorry</h4><p>The userid <strong>[% patronid %]</strong> was not found in the database.  Please try again.</p></div>
235         <br />
236         [% END %]
237         [% END %]
238
239         [% IF ( validuser ) %]
240   [% IF ( display_patron_image ) %]<div class="yui-ge"><div class="yui-u first">[% END %]
241         <div id="newcheckout" class="sco_entry">
242         <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid %]');">
243         <fieldset><legend> Check out[% IF ( AllowSelfCheckReturns ) %], return[% END %] or renew an item: </legend>
244         <label for="barcode">Scan a new item or enter its barcode:</label>
245     <input id="barcode" name="barcode" size="20" class="focus" autocomplete="off" />
246         <input type="hidden" name="op" value="checkout" />
247         <input type="hidden" name="patronid" value="[% patronid %]" />
248         <input type="submit" value="Submit" class="submit" /></fieldset>
249         </form>
250     <div><form method="post" action="#" id="logout_form"><input type="submit" value="Finish" class="finish" /></form></div>
251         </div> <!-- sco_entry --> <!-- newcheckout -->
252   [% IF ( display_patron_image ) %]</div> <!-- /yui-u first -->[% END %]
253   [% IF ( display_patron_image ) %]
254   <div class="yui-u">
255         <img src="/cgi-bin/koha/sco/sco-patron-image.pl?cardnumber=[% cardnumber %]" alt="" />
256   </div>
257   [% END %]
258   </div> <!-- /yui-ge -->
259   <div class="yui-g">
260         <div id="borrowerdetails">
261         [% IF ( issues_count ) %]
262         <table id="loanTable"><caption>Checkouts for [% borrowername %] <span class="count">([% issues_count %] total)</span></caption>
263         <!-- ISSUES TABLE ROWS -->
264     <thead>
265         <tr><th>Title</th><th>Call no.</th><th>Due</th><th>Renew</th>[% UNLESS ( nofines ) %]<th>Fines</th>[% END %]</tr>
266     </thead>
267
268     <tbody>
269         [% FOREACH ISSUE IN ISSUES %]
270         [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
271     <!-- FIXME: yet another jacket image breakpoint -->
272         <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">
273         [% ISSUE.author %]</span> ([% ISSUE.barcode %])</td>
274         <td>[% ISSUE.itemcallnumber %]</td>
275         [% IF ( ISSUE.overdue ) %]<td class="overdue">[% ISSUE.date_due | $KohaDates %]</td>[% ELSE %]<td>[% ISSUE.date_due | $KohaDates %]</td>[% END %]
276         <td>
277     <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
278     <input type="hidden" name="patronid" value="[% patronid %]" />
279     <input type="hidden" name="barcode" value="[% ISSUE.barcode %]" />
280         [% IF ( ISSUE.norenew ) %]
281           [% IF ( AllowSelfCheckReturns ) %]
282             <input type="submit" value="Check in item" name="confirm" class="return" />
283             <input type="hidden" name="op" value="returnbook" />
284             <input type="hidden" name="confirmed" value=""  />
285           [% ELSE %]
286             <span>No renewals allowed</span>
287           [% END %]
288         [% ELSE %]
289             <input type="hidden" name="op" value="checkout" />
290             <input type="hidden" name="confirmed" value="1" />
291             [% UNLESS ( ISSUE.renew ) %]<input type="submit" value="Renew item"  name="confirm" class="renew" />
292             [% ELSE %]<input type="submit" value="Renew item" class="renew" />[% END %]
293         [% END %]
294     </form>
295         </td>
296         [% UNLESS ( nofines ) %]<td>[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>[% END %]</tr>
297         [% END %]
298     </tbody>
299
300         </table>
301         [% ELSE %]
302         <h3>You currently have nothing checked out.</h3>
303         [% END %]
304 </div> <!-- /yui-g -->
305         [% ELSE %]<!-- not validuser -->
306         <div class="sco_entry" >
307         <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
308        [% IF ( authbylogin ) %]
309         <fieldset class="checkout">
310        <legend>Please login with your username and password</legend>
311        <label for="patronlogin">Username:</label>
312         <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" />
313        <label for="patronpw">Password:</label>
314         <input type="password" id="patronpw" size="20" name="patronpw" />
315        [% ELSE %]
316         <fieldset class="checkout"><label for="patronid">Please enter your card number:</label> 
317     <input type="text" id="patronid" class="focus" size="20" name="patronid" autocomplete="off" />
318         [% END %]
319
320         [% FOREACH INPUT IN INPUTS %]<input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]">[% END %]
321         <input type="hidden" name="op" value="login" />
322         <input type="submit" value="Submit" class="submit" /></fieldset></form>
323         </div>
324         [% END %]
325 [% END %] <!-- ( / hide main) -->       
326         
327         </div>
328 </div>
329 [% INCLUDE 'opac-bottom.inc' %]