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