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