Bug 18349: Remove useless info in alert message
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / sco / sco-main.tt
blob0ec7679fb29652df069965b99aa60d13d429603b
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% USE AudioAlerts %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] &rsaquo; Self checkout </title>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7 <meta name="generator" content="Koha [% Version %]" /> <!-- leave this for stats -->
8 <link rel="shortcut icon" href="[% IF ( OpacFavicon  ) %][% OpacFavicon  %][% ELSE %][% interface %]/[% theme %]/images/favicon.ico[% END %]" type="image/x-icon" />
9 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/lib/bootstrap/css/bootstrap.min.css" />
10 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/lib/jquery/jquery-ui.css" />
11 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/sco.css" />
12 [% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
13 [% IF ( SCOUserCSS ) %]<style type="text/css">[% SCOUserCSS %]</style>[% END %]
14 <!--[if lt IE 9]>
15     <script src="[% interface %]/[% theme %]/lib/respond.min.js"></script>
16 <![endif]-->
17 <script type="text/javascript">
18     function _(s) { return s } // dummy function for gettext
19 </script>
20 <script type="text/javascript" src="[% interface %]/[% theme %]/lib/modernizr.min.js"></script>
21 </head>
22 <body id="sco_main" class="sco" onload="dofocus();" onunload="mungeHistory();">
23 [% INCLUDE 'masthead-sco.inc' %]
25     <div class="main">
26         <div class="container-fluid">
27             <div class="row-fluid">
28                 [% IF ( display_patron_image ) %]
29                     <div class="span10">
30                 [% ELSE %]
31                     <div class="span12">
32                 [% END %]
34                     <div id="masthead"><h1>[% LibraryName %] Self checkout system</h1></div>
36                     [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
37                         <div class="alert">
38                             <h3>Item cannot be checked out.</h3>
39                             <p>Sorry, this item cannot be checked out at this station.</p>
40                             [% IF ( title ) %]
41                                 <p>Title: <em>[% title |html %]</em> </p>
42                             [% END %]
44                             <p>
45                                 [% IF ( circ_error_UNKNOWN_BARCODE ) %]
46                                     The system does not recognize this barcode.
47                                 [% ELSIF ( circ_error_max_loans_allowed ) %]
48                                     You have checked out too many items and can't check out any more.
49                                 [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
50                                     This item is checked out to someone else.
51                                 [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
52                                     You cannot renew this item again.
53                                 [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
54                                     This item is not for loan.
55                                 [% ELSIF ( circ_error_DEBT ) %]
56                                     You owe the library [% amount %] and cannot check out.
57                                 [% ELSIF ( circ_error_WTHDRAWN ) %]
58                                     This item has been withdrawn from the collection.
59                                 [% ELSIF ( circ_error_RESTRICTED ) %]
60                                 [% ELSIF ( circ_error_RESERVED ) %]
61                                     This item is on hold for another patron.
62                                 [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
63                                 [% ELSIF ( circ_error_EXPIRED ) %]
64                                     Your account has expired.
65                                 [% ELSIF ( circ_error_DEBARRED ) %]
66                                     Your account has been suspended.
67                                 [% ELSIF ( circ_error_CARD_LOST ) %]
68                                     This card has been declared lost.
69                                 [% ELSIF ( circ_error_GNA ) %]
70                                 [% ELSIF ( circ_error_INVALID_DATE ) %]
71                                 [% END %]
72                                 Please see a member of the library staff.
73                             </p>
75                             [% IF ( returnitem && AllowSelfCheckReturns ) %]
76                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
77                                     <input type="hidden" name="op" value="returnbook" />
78                                     <input type="hidden" name="patronid" value="[% patronid %]" />
79                                     <input type="hidden" name="barcode" value="[% barcode %]" />
80                                     <button type="submit" name="returnbook" class="btn"><i class="return"></i> Return this item</button>
81                                 </form>
82                             [% END %]
84                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
85                                 <input type="hidden" name="op" value="" />
86                                 <input type="hidden" name="patronid" value="[% patronid %]" />
87                                 <input type="hidden" name="barcode" value="[% barcode %]" />
88                                 <input type="submit" name= "confirm" value="Return to account summary" class="btn back focus" />
89                             </form>
90                         </div> <!-- / .alert -->
91                     [% END # / IF ( impossible %]
93                     [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
94                         <div class="alert"><h3>Please confirm the checkout:</h3>
95                             [% IF ( confirm_renew_issue ) %]
96                                 <p>This item is already checked out to you.</p>
97                             [% END %]
99                             [% IF ( renew && AllowSelfCheckReturns ) %]
100                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
101                                     <input type="hidden" name="op" value="returnbook" />
102                                     <input type="hidden" name="patronid" value="[% patronid %]" />
103                                     <input type="hidden" name="barcode" value="[% barcode %]" />
104                                     <input type="hidden" name="confirmed" value="" />
105                                     <button type="submit" name="returnbook" class="btn"><i class="icon return"></i> Return this item</button>
106                                 </form>
107                             [% END %]
109                             [% UNLESS ( renew ) %]
110                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
111                                     <input type="hidden" name="op" value="checkout" />
112                                     <input type="hidden" name="patronid" value="[% patronid %]" />
113                                     <input type="hidden" name="barcode" value="[% barcode %]" />
114                                     <input type="hidden" name="confirmed" value="1" />
115                                     <button type="submit" name="confirm" class="btn"><i class="icon renew"></i> Renew item</button>
116                                   </form>
117                             [% ELSE %]
118                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
119                                     <input type="hidden" name="op" value="checkout" />
120                                     <input type="hidden" name="patronid" value="[% patronid %]" />
121                                     <input type="hidden" name="barcode" value="[% barcode %]" />
122                                     <input type="hidden" name="confirmed" value="1" />
123                                     <button type="submit" class="btn"><i class="icon renew"></i> Renew item</button>
124                                 </form>
125                             [% END %]
127                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
128                                 <input type="hidden" name="op" value="" />
129                                 <input type="hidden" name="patronid" value="[% patronid %]" />
130                                 <button type="submit" class="btn"><i class="icon cancel"></i> Cancel</button>
131                             </form>
132                         </div>
133                     [% END # / IF confirm %]
135                     [% IF ( nopermission ) %]
136                         <!-- This is what is displayed if user doesnt have permission -->
137                         <div class="alert">
138                             <h3>Access denied</h3>
139                             <p>Sorry, this self-checkout station has lost authentication.  Please contact the administrator to resolve this problem.</p>
140                         </div>
141                     [% END %]
143                     [% IF ( different_ip ) %]
144                         <!-- This is what is displayed if user doesnt have permission -->
145                         <div class="alert">
146                             <h3>Session lost</h3>
147                             <p>You are accessing self-checkout from a different IP address! please log in again.</p>
148                         </div>
149                     [% END %]
151                     [% IF ( invalid_username_or_password ) %]
152                         <!-- This is what is displayed if user doesnt have permission -->
153                         <div class="alert">
154                             <h3>Record not found</h3>
155                             <p>Your userid was not found in the database.  Please try again.</p>
156                         </div>
157                     [% END %]
160                     [% UNLESS ( hide_main ) %]
162                         [% IF ( patronid ) %]
163                             [% IF ( validuser ) %]
164                                 <div class="alert alert-info">You are logged in as [% borrowername %].</div>
165                                 [% INCLUDE 'opac-note.inc' %]
166                                 [% IF patron_has_hold_fee %]
167                                     <div class="alert">A hold fee was charged to your account for collecting this item.</div>
168                                 [% END %]
169                             [% END %]
171                             [% IF ( nouser ) %]
172                                 <div class="alert">
173                                     <h4>Sorry</h4>
174                                     <p>The userid <strong>[% patronid %]</strong> was not found in the database.  Please try again.</p>
175                                 </div>
176                             [% END %]
177                         [% END # / IF patronid %]
179                         [% IF ( validuser ) %]
180                             <div id="newcheckout" class="sco_entry">
181                                 <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid %]');">
182                                     <fieldset>
183                                         <legend>Check out[% IF ( AllowSelfCheckReturns ) %], return[% END %] or renew an item: </legend>
184                                         <div class="input-append">
185                                             <label for="barcode">Scan a new item or enter its barcode:</label>
186                                             <input id="barcode" name="barcode" size="20" type="text" class="focus" autocomplete="off" />
187                                             <button type="submit" class="btn">Submit</button>
188                                         </div>
189                                         <input type="hidden" name="op" value="checkout" />
190                                         <input type="hidden" name="patronid" value="[% patronid %]" />
191                                     </fieldset>
192                                 </form>
194                                 <div>
195                                     <form method="post" action="#" id="logout_form">
196                                         <button type="submit" class="btn"><i class="icon finish"></i> Finish</button>
197                                     </form>
198                                 </div>
199                             </div> <!-- / #newcheckout -->
200                 </div> <!-- / .span12/12 -->
201                 [% IF ( display_patron_image ) %]
202                     <div class="span2">
203                         <img src="/cgi-bin/koha/sco/sco-patron-image.pl?borrowernumber=[% borrowernumber %]" alt="" />
204                     </div>
205                 [% END %]
206             </div> <!-- / .row-fluid -->
207         </div> <!-- / .container-fluid -->
209         <div class="container-fluid">
210             <div class="row-fluid">
211                     <div class="span12">
212                         <div id="borrowerdetails">
213                             [% IF ( issues_count ) %]
214                                 <table id="loanTable" class="table table-bordered table-striped">
215                                     <caption>Checkouts for [% borrowername %] <span class="count">([%   issues_count %] total)</span></caption>
216                                     <!-- ISSUES TABLE ROWS -->
217                                     <thead>
218                                         <tr>
219                                             <th class="noshow">Checked out on</th>
220                                             <th class="anti-the">Title</th>
221                                             <th>Call no.</th>
222                                             <th class="title-string">Due</th>
223                                             <th class="nosort">Renew</th>
224                                             [% UNLESS ( nofines ) %]
225                                                 <th>Fines</th>
226                                             [% END %]
227                                         </tr>
228                                     </thead>
229                                     <tbody>
230                                         [% FOREACH ISSUE IN ISSUES %]
231                                             <tr>
232                                                 <td>[% ISSUE.issuedate %]</td>
233                                                 <td>
234                                                     [% UNLESS ( noitemlinks ) %]
235                                                         <a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.  biblionumber %]">[% ISSUE.title |html %]</a>
236                                                     [% ELSE %]
237                                                         <strong>[% ISSUE.title |html %]</strong>
238                                                     [% END %]
239                                                     <span class="item-details">[% ISSUE.author %]</span>
240                                                     ([% ISSUE.barcode %])
241                                                 </td>
242                                                 <td>[% ISSUE.itemcallnumber %]</td>
243                                                 [% IF ( ISSUE.overdue ) %]
244                                                     <td class="overdue"><span title="[% ISSUE.date_due %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td>
245                                                 [% ELSE   %]
246                                                     <td><span title="[% ISSUE.date_due %]">[% ISSUE.date_due | $KohaDates as_due_date => 1 %]</span></td>
247                                                 [% END %]
248                                                 <td>
249                                                     <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
250                                                         <input type="hidden" name="patronid" value="[% patronid %]" />
251                                                         <input type="hidden" name="barcode" value="[% ISSUE.barcode %]" />
252                                                         [% IF ISSUE.can_be_renewed %]
253                                                             <input type="hidden" name="op" value="checkout" />
254                                                             <input type="hidden" name="confirmed" value="1" />
255                                                             [% UNLESS ( ISSUE.renew ) %]
256                                                                 <input type="submit" value="Renew item"  name="confirm  " class="btn renew" />
257                                                             [% ELSE %]
258                                                                 <input type="submit" value="Renew item" class="btn renew" />
259                                                             [% END %]
260                                                         [% ELSE %]
261                                                             [% IF ISSUE.renew_error == 'auto_renew' OR ISSUE.renew_error == 'auto_too_soon' %]
262                                                                 <span>This item has been scheduled for automatic renewal and cannot be renewed</span>
263                                                             [% ELSIF ISSUE.renew_error == 'onsite_checkout' %]
264                                                                 <span>This is a on-site checkout, it cannot be renewed.</span>
265                                                             [% ELSE %]
266                                                                 <span>No renewals allowed</span>
267                                                             [% END %]
268                                                             [% IF AllowSelfCheckReturns %]
269                                                                 <input type="submit" value="Check in item" name="confirm" class="btn return" />
270                                                                 <input type="hidden" name="op" value="returnbook" />
271                                                                 <input type="hidden" name="confirmed" value=""  />
272                                                             [% END %]
273                                                         [% END %]
274                                                     </form>
275                                                 </td>
276                                                 [% UNLESS ( nofines ) %]
277                                                     <td>
278                                                         [% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]
279                                                     </td>
280                                                 [% END %]
281                                             </tr>
282                                         [% END # / FOREACH ISSUE %]
283                                     </tbody>
284                                 </table>
285                             [% ELSE %]
286                                 <h3>You currently have nothing checked out.</h3>
287                             [% END # / IF issues_count %]
288                         </div> <!-- / #borrowerdetails -->
289                         [% ELSE # IF validuser %]
290                             <div class="sco_entry" >
291                                 <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
292                                     <fieldset class="checkout brief">
293                                         [% IF ( authbylogin ) %]
294                                             <legend>Log in to your account</legend>
295                                             <label for="patronlogin">Login:</label>
296                                             <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" />
297                                             <label for="patronpw">Password:</label>
298                                             <input type="password" id="patronpw" size="20" name="patronpw" />
299                                             <fieldset class="action">
300                                                 <button type="submit" class="btn">Log in</button>
301                                             </fieldset>
302                                         [% ELSE %]
303                                             <div class="input-append">
304                                                 <label for="patronid">Please enter your card number:</label>
305                                                 <input type="text" id="patronid" class="focus" size="20" name="patronid" autocomplete="off" />
306                                                 <button type="submit" class="btn">Submit</button>
307                                             </div>
308                                         [% END # / IF authbylogin %]
310                                         [% FOREACH INPUT IN INPUTS %]
311                                             <input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]">
312                                         [% END %]
313                                         <input type="hidden" name="op" value="login" />
314                                     </fieldset>
315                                 </form>
316                             </div> <!-- / .sco_entry -->
317                         [% END # / IF validuser %]
318                     [% END # / UNLESS ( hide_main %]
320                 </div> <!-- / .span12 -->
321             </div> <!-- / .row-fluid -->
322         </div> <!-- / .container-fluid -->
323     </div> <!-- / .main -->
324     <span id="audio-alert"></span>
325 </body>
327 [% INCLUDE 'opac-bottom.inc' %]
328 [% BLOCK jsinclude %]
329     [% INCLUDE 'datatables.inc' %]
330     <script type="text/javascript">
331         //<![CDATA[
332         function mungeHistory() {
333             // prevent back button from allowing form resubmission
334             if (history && history.pushState) {
335                 history.replaceState(null, document.title, window.location.href);
336             }
337         }
338         var mainTimeout;
339         function sco_init() {
340             mainTimeout = setTimeout(function() {
341                 location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
342             }, [% SelfCheckTimeout %]);
343         }
344         function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
345             // alert("dofocus called");
346             $(".focus:last").select();
347         }
348         var slip_re = /slip/;
349         function printx_window(print_type) {
350           var handler = print_type.match(slip_re) ? "printslip" : "moremember";
352           return false;
353         }
354         function checkout_confirm(patronid) {
355             var   barcode = $("#barcode").val();
356             // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
357             if (! barcode) { dofocus(); return false; }    // no barcode
358             if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode
359                 window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
360                 return false;
361             }
362             return true;
363         }
364         [% IF Koha.Preference('AudioAlerts') %]
365             var AUDIO_ALERTS = JSON.parse( '[% AudioAlerts.AudioAlerts | replace( "'", "\\'" ) | replace( '"', '\\"' ) %]' );
366             $( document ).ready(function() {
367                 if ( AUDIO_ALERTS ) {
368                     for ( var k in AUDIO_ALERTS ) {
369                         var alert = AUDIO_ALERTS[k];
370                         if ( $( alert.selector ).length ) {
371                             playSound( alert.sound );
372                             break;
373                         }
374                     }
375                 }
376             });
377             function playSound( sound ) {
378                 if (  ( sound.indexOf('http://') == 0 || sound.indexOf('https://') == 0 )  ) {
379                     document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
380                 }
381             }
382         [% END %]
385         $(document).ready(function() {
386             dofocus();
387             [% IF ( patronid ) %]sco_init();[% END %]
388             $("#loanTable").dataTable($.extend(true, {}, dataTablesDefaults, {
389                 "aaSorting": [ 0 ],
390                 "aoColumnDefs": [
391                     { "aTargets": [ "nosort" ], "bSortable": false, "bSearchable": false },
392                     { "aTargets": [ "noshow" ], "bVisible": false, "bSearchable": false },
393                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
394                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
395                 ]
396             }));
398             $("#logout_form").submit(function(){
399                 clearTimeout(mainTimeout);
400                 [% IF Koha.Preference('SelfCheckReceiptPrompt') %]
401                     var confirmStart = Date.now();
402                     if(confirm(_("Would you like to print a receipt?"))){
403                         if ( (Date.now() - confirmStart) < [% SelfCheckTimeout %] ) {
404                             window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber %]&amp;print=qslip");
405                         } else {
406                             alert(_("Timeout while waiting for print confirmation"));
407                         }
408                     }
409                 [% END %]
411                 return true;
412             });
413     });
414     //]]>
415     </script>
417     [% IF ( SCOUserJS ) %]<script type="text/javascript">[% SCOUserJS %]</script>[% END %]
418 [% END %]