Merge remote-tracking branch 'origin/new/bug_6875'
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / sco / sco-main.tt
1 [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] &rsaquo; Self Checkout </title>
2 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3 <meta name="generator" content="Koha [% Version %]" /> <!-- leave this for stats -->
4 <link rel="shortcut icon" href="[% themelang %]/includes/favicon.ico" type="image/x-icon" />
5 <script type="text/javascript" src="[% themelang %]/lib/jquery/jquery.js"></script>
6 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
7 <script type="text/javascript">//<![CDATA[
8 function sco_init(valid_session) {
9     if (valid_session == 1) {
10         setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",[% SelfCheckTimeout %]); 
11     }
12 }
13 function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
14     // alert("dofocus called");
15     $(".focus:last").select();
16 }
17
18 function checkout_confirm(patronid) {
19     var   barcode = $("#barcode").val();
20     // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
21     if (! barcode) { dofocus(); return false; }    // no barcode
22     if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode 
23         window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
24         return false;
25     }
26     if (this.valid_session == 0) {
27         // probably should force logout like above ? --atz 6/09
28         if (confirm('Session has expired.  Click \'OK\' to continue processing this item.  Click Cancel if you are not ' + patronid)){
29             this.op.value='logout';
30             this.patronid.value='';
31         }
32     }
33     return true;
34 }
35
36 $.tablesorter.addParser({
37     id: 'articles',
38     is: function(s) {return false;  },
39     format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
40     type: 'text'
41 });
42
43 $(document).ready(function() {
44     [% IF ( patronid ) %] sco_init(1);
45     [% ELSIF ( timedout ) %] sco_init(1);
46     [% END %]
47     $("#loanTable").tablesorter({
48         [% IF ( dateformat_metric ) %]
49             dateFormat: 'uk',
50         [% END %]
51         widgets:   ['zebra'],
52         sortList:  [[2, 1], [0, 0]],
53         headers: {
54             0: { sorter: 'articles' },
55             3: { sorter: false }
56             [% UNLESS ( nofines ) %], 4: { sorter: false }[% END %]
57         }
58     });
59 });
60 //]]>
61 </script>
62 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/sco.css" />
63 </head>
64 <body onload="dofocus();">
65
66 <div id="doc" class="yui-t7">
67
68 <div id="masthead"><h1>[% LibraryName %] Self Checkout System</h1></div>
69 <div id="bd">
70
71 [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
72 <div class="dialog alert"><h3>Item cannot be checked out.</h3><p>Sorry, This item cannot be checked out at this station.  </p>
73 [% IF ( title ) %]<p>Title: <em>[% title |html %]</em> </p>[% END %]
74 <p>
75    [% IF ( circ_error_UNKNOWN_BARCODE ) %]
76     <em>MESSAGE 1:</em> The system does not recognize this barcode.
77    [% ELSIF ( circ_error_TOO_MANY ) %]
78     <em>MESSAGE 2:</em> You have borrowed too many items and can't check out any more.
79    [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
80     <em>MESSAGE 3:</em> This item is checked out to someone else.
81    [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
82     <em>MESSAGE 4:</em> You cannot renew this item again.
83    [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
84     <em>MESSAGE 5:</em> This item is not for loan.
85    [% ELSIF ( circ_error_DEBT ) %]
86     <em>MESSAGE 6:</em> You owe the library [% amount %] and cannot borrow.
87    [% ELSIF ( circ_error_WTHDRAWN ) %]
88     <em>MESSAGE 7:</em> This item has been withdrawn from the collection.
89    [% ELSIF ( circ_error_RESTRICTED ) %]
90     <em>MESSAGE 8:</em>
91    [% ELSIF ( circ_error_RESERVED ) %]
92     <em>MESSAGE 9:</em> This item is reserved for another patron.
93    [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
94     <em>MESSAGE 10:</em>
95    [% ELSIF ( circ_error_EXPIRED ) %]
96     <em>MESSAGE 11:</em> Your account has expired.
97    [% ELSIF ( circ_error_DEBARRED ) %]
98     <em>MESSAGE 12:</em> Your account has been suspended.
99    [% ELSIF ( circ_error_CARD_LOST ) %]
100     <em>MESSAGE 13:</em> This card has been declared lost.
101    [% ELSIF ( circ_error_GNA ) %]
102     <em>MESSAGE 14:</em>
103    [% ELSIF ( circ_error_INVALID_DATE ) %]
104     <em>MESSAGE 15:</em>
105    [% END %]
106    Please see a member of the library staff.
107 </p>
108 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" method="post">
109 <input type="hidden" name="op" value="login" />
110 <input type="hidden" name="patronid" value="[% patronid %]" />
111 [% IF ( returnitem ) %]
112 [% IF ( AllowSelfCheckReturns ) %]
113 <input type="hidden" name="barcode" value="[% barcode %]" />
114 <input type="button" name="returnbook" value="Return this item" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
115 [% END %]
116 [% END %]
117 <input type="submit" name= "confirm" value="Return to Account Summary" class="back focus" />
118 </form>
119 [% END %]
120 [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
121 <div class="dialog alert"><h3>Please confirm the checkout:</h3>
122 <p>[% IF ( confirm_renew_issue ) %]This item is already checked out to you.[% END %]</p>
123
124 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" method="post">
125 <input type="hidden" name="op" value="checkout" />
126 <input type="hidden" name="patronid" value="[% patronid %]" />
127 <input type="hidden" name="barcode" value="[% barcode %]" />
128 <input type="hidden" name="confirmed" value="" />
129 [% IF ( renew ) %]
130 [% IF ( AllowSelfCheckReturns ) %]
131 <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
132 [% END %]
133 [% END %]
134 [% UNLESS ( renew ) %]<input type="button" value="Renew Item" name="confirm" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
135 [% ELSE %]<input type="button" value="Renew Item" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />[% END %]
136 <input type="button" value="Cancel" class="cancel" onclick="this.form.op.value='';this.form.submit();return true;"  />
137 </form>
138 </div>
139 [% END %]
140
141 [% IF ( nopermission ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Access Denied</h3>
142 Sorry, This Self-Checkout Station has lost authentication.  Please contact the administrator to resolve this problem. </div>
143 [% END %]
144 [% IF ( timed_out ) %]<!-- This is what is displayed if login has timed out -->
145 <div class="dialog alert"><h3>Session timed out</h3>Sorry, your session has timed out, please log in again.</div>[% END %]
146 [% 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 %]
147 [% IF ( invalid_username_or_password ) %]
148 <!-- 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 %]
149
150
151 [% UNLESS ( hide_main ) %]
152         <div class="sco_head">
153         [% UNLESS ( validuser ) %] 
154         <h3>Self Checkout</h3>
155         [% END %]
156
157         <div id="checkouthelp">
158                 <a href="/cgi-bin/koha/sco/help.pl">HELP</a> with the self checkout system
159         </div>
160
161         [% IF ( patronid ) %]
162         [% IF ( validuser ) %]
163     <h3 class="warning">You are logged in as [% borrowername %].</h3>
164         [% END %]
165         </div>
166         [% IF ( nouser ) %]
167         <div class="dialog alert"><h4>Sorry</h4><p>The userid <strong>[% patronid %]</strong> was not found in the database.  Please try again.</p></div>
168         <br />
169         [% END %]
170         [% END %]
171
172         [% IF ( timedout ) %]
173         <div class="dialog message"><h4>Sorry</h4><p>Your session has timed out due to inactivity.  Please sign in.</p></div>
174         <br />
175         [% END %]
176         [% IF ( validuser ) %]
177   [% IF ( display_patron_image ) %]<div class="yui-ge"><div class="yui-u first">[% END %]
178         <div id="newcheckout" class="sco_entry">
179         <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid %]');">
180         <fieldset><legend> Check out[% IF ( AllowSelfCheckReturns ) %], return[% END %] or renew an item: </legend>
181         <label for="barcode">Scan a new item or enter its barcode:</label>
182         <input id="barcode" name="barcode" size="20" class="focus" />
183         <input type="hidden" name="op" value="checkout" />
184         <input type="hidden" name="patronid" value="[% patronid %]" />
185         <input type="hidden" name="valid_session" value="1" />
186         <input type="submit" value="Submit" class="submit" /></fieldset>
187         </form>
188         <div><form method="post" action="/cgi-bin/koha/sco/sco-main.pl?op=logout" ><input type="submit" value="Finish" class="finish" /></form></div>
189         </div> <!-- sco_entry --> <!-- newcheckout -->
190   [% IF ( display_patron_image ) %]</div> <!-- /yui-u first -->[% END %]
191   [% IF ( display_patron_image ) %]
192   <div class="yui-u">
193         <img src="/cgi-bin/koha/sco/sco-patron-image.pl?cardnumber=[% cardnumber %]" alt="" />
194   </div>
195   [% END %]
196   </div> <!-- /yui-ge -->
197   <div class="yui-g">
198         <div id="borrowerdetails">
199         [% IF ( issues_count ) %]
200         <table id="loanTable"><caption>Checkouts for [% borrowername %] <span class="count">([% issues_count %] total)</span></caption>
201         <!-- ISSUES TABLE ROWS -->
202     <thead>
203         <tr><th>Title</th><th>Call No.</th><th>Due</th><th>Renew</th>[% UNLESS ( nofines ) %]<th>Fines</th>[% END %]</tr>
204     </thead>
205
206     <tbody>
207         [% FOREACH ISSUE IN ISSUES %]
208         [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
209     <!-- FIXME: yet another jacket image breakpoint -->
210         <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">
211         [% ISSUE.author %]</span> ([% ISSUE.barcode %])</td>
212         <td>[% ISSUE.itemcallnumber %]</td>
213         [% IF ( ISSUE.overdue ) %]<td class="overdue">[% ISSUE.date_due_display %]</td>[% ELSE %]<td>[% ISSUE.date_due_display %]</td>[% END %]
214         <td>
215     <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
216     <input type="hidden" name="op" value="checkout" />
217     <input type="hidden" name="patronid" value="[% patronid %]" />
218     <input type="hidden" name="barcode" value="[% ISSUE.barcode %]" />
219     <input type="hidden" name="confirmed" value=""  />
220         [% IF ( ISSUE.norenew ) %]
221           [% IF ( ISSUE.AllowSelfCheckReturns ) %]
222           <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
223           [% ELSE %]
224           <span>No renewals allowed</span>
225           [% END %]
226         [% ELSE %]
227             [% UNLESS ( ISSUE.renew ) %]<input type="button" value="Renew Item"  name="confirm" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
228             [% ELSE %]<input type="button" value="Renew Item" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />[% END %]
229         [% END %]
230     </form>
231         </td>
232         [% UNLESS ( nofines ) %]<td>[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>[% END %]</tr>
233         [% END %]
234     </tbody>
235
236         </table>
237         [% ELSE %]
238         <h3>You currently have nothing checked out.</h3>
239         [% END %]
240 </div> <!-- /yui-g -->
241         [% ELSE %]<!-- not validuser -->
242         <div class="sco_entry" >
243         <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
244        [% IF ( authbylogin ) %]
245         <fieldset class="checkout">
246        <legend>Please login with your username and password</legend>
247        <label for="patronlogin">Username:</label>
248         <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" />
249        <label for="patronpw">Password:</label>
250         <input type="password" id="patronpw" size="20" name="patronpw" />
251        [% ELSE %]
252         <fieldset class="checkout"><label for="patronid">Please enter your card number:</label> 
253         <input type="text" id="patronid" class="focus" size="20" name="patronid" />
254         [% END %]
255
256         [% FOREACH INPUT IN INPUTS %]<input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]">[% END %]
257         <input type="hidden" name="op" value="login" />
258         <input type="submit" value="Submit" class="submit" /></fieldset></form>
259         </div>
260         [% END %]
261 [% END %] <!-- ( / hide main) -->       
262         
263         </div>
264 </div>
265 [% INCLUDE 'opac-bottom.inc' %]