Bug 28018: Replace obsolete title-string sorting: OPAC templates
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / sco / sco-main.tt
1     [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE AudioAlerts %]
6 [% USE To %]
7 [% USE Price %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Self checkout &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha [% END %]</title>
10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11 <meta name="generator" content="Koha [% Version | html %]" /> <!-- leave this for stats -->
12 [% IF ( Koha.Preference('OpacFavicon') ) %]
13 <link rel="shortcut icon" href="[% Koha.Preference('OpacFavicon') | url %]" type="image/x-icon" />
14 [% ELSE %]
15 <link rel="shortcut icon" href="[% interface | html %]/[% theme | html %]/images/favicon.ico" type="image/x-icon" />
16 [% END %]
17 [% Asset.css("lib/font-awesome/css/font-awesome.min.css") | $raw %]
18 [% IF ( bidi ) %]
19     [% Asset.css("lib/jquery/jquery-ui-rtl-1.12.1.min.css") | $raw %]
20     [% Asset.css("css/sco-rtl.css") | $raw %]
21 [% ELSE %]
22     [% Asset.css("lib/jquery/jquery-ui-1.12.1.css") | $raw %]
23     [% Asset.css("css/sco.css") | $raw %]
24 [% END %]
25 [% IF ( Koha.Preference('OPACUserCSS') ) %]<style>[% Koha.Preference('OPACUserCSS') | $raw %]</style>[% END %]
26 [% IF ( Koha.Preference('SCOUserCSS') ) %]<style>[% Koha.Preference('SCOUserCSS') | $raw %]</style>[% END %]
27 <script>
28     function _(s) { return s } // dummy function for gettext
29 </script>
30 [% Asset.js("lib/modernizr.min.js") | $raw %]
31 </head>
32 <body id="sco_main" class="sco" onload="dofocus();" onunload="mungeHistory();">
33     [% INCLUDE 'masthead-sco.inc' %]
34
35     <div class="main">
36         <div class="container-fluid">
37             <div class="row">
38                 [% IF ( display_patron_image ) %]
39                     <div class="col-10 order-first order-md-first order-lg-2">
40                 [% ELSE %]
41                     <div class="col order-first order-md-first order-lg-2">
42                 [% END %]
43
44                     <div id="masthead"><h1>[% LibraryName | html %] Self checkout system</h1></div>
45
46                     [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
47                         <div class="alert alert-warning">
48                             <span class="sco-alert-warning noissue"></span>
49                             <h3>Item cannot be checked out.</h3>
50                             <p>Sorry, this item cannot be checked out at this station.</p>
51                             [% IF ( title ) %]
52                                 <p>Title: <em>[% title | html %]</em> </p>
53                             [% END %]
54
55                             <p>
56                                 [% IF ( circ_error_UNKNOWN_BARCODE ) %]
57                                     The system does not recognize this barcode.
58                                 [% ELSIF ( circ_error_max_loans_allowed ) %]
59                                     You have checked out too many items and can't check out any more.
60                                 [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
61                                     This item is checked out to someone else.
62                                 [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
63                                     You cannot renew this item again.
64                                 [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
65                                     This item is not for loan.
66                                 [% ELSIF ( circ_error_DEBT ) %]
67                                     You owe the library [% DEBT | $Price %] and cannot check out.
68                                 [% ELSIF ( circ_error_WTHDRAWN ) %]
69                                     This item has been withdrawn from the collection.
70                                 [% ELSIF ( circ_error_RESTRICTED ) %]
71                                     This item is restricted.
72                                 [% ELSIF ( circ_error_RESERVED ) %]
73                                     This item is on hold for another patron.
74                                 [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
75                                     This item belongs to another branch.
76                                 [% ELSIF ( circ_error_EXPIRED ) %]
77                                     Your account has expired.
78                                 [% ELSIF ( circ_error_DEBARRED ) %]
79                                     Your account has been suspended.
80                                 [% ELSIF ( circ_error_CARD_LOST ) %]
81                                     This card has been declared lost.
82                                 [% ELSIF ( circ_error_GNA ) %]
83                                     Your contact information seems to be incomplete.
84                                 [% ELSIF ( circ_error_INVALID_DATE ) %]
85                                     Due date is not valid.
86                                 [% ELSIF ( circ_error_ADDITIONAL_MATERIALS ) %]
87                                     Item must be checked out at a circulation desk.
88                                 [% END %]
89                                 Please see a member of the library staff.
90                             </p>
91
92                             [% IF ( returnitem && Koha.Preference('SCOAllowCheckin') ) %]
93                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
94                                     <input type="hidden" name="op" value="returnbook" />
95                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
96                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
97                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
98                                     <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
99                                 </form>
100                             [% END %]
101
102                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" class="inline" method="post">
103                                 <input type="hidden" name="op" value="" />
104                                 <input type="hidden" name="patronid" value="[% patronid | html %]" />
105                                 <input type="hidden" name="barcode" value="[% barcode | html %]" />
106                                 <input type="hidden" name="newissues" value="[% newissues | html %]" />
107                                 <input type="submit" name= "confirm" value="Return to account summary" class="btn btn-info back focus" />
108                             </form>
109                         </div> <!-- / .alert -->
110                     [% END # / IF ( impossible %]
111
112                     [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
113                         <div class="alert alert-warning"><h3>Please confirm the checkout:</h3>
114                             <span class="sco-alert-warning confirm"></span>
115                             [% IF ( confirm_renew_issue ) %]
116                                 <p>This item is already checked out to you.</p>
117                             [% END %]
118
119                             [% IF ( renew && Koha.Preference('SCOAllowCheckin') ) %]
120                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
121                                     <input type="hidden" name="op" value="returnbook" />
122                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
123                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
124                                     <input type="hidden" name="confirmed" value="" />
125                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
126                                     <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
127                                 </form>
128                             [% END %]
129
130                             [% UNLESS ( renew ) %]
131                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
132                                     <input type="hidden" name="op" value="renew" />
133                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
134                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
135                                     <input type="hidden" name="confirmed" value="1" />
136                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
137                                     <button type="submit" name="confirm" class="btn btn-primary"><i class="fa fa-refresh" aria-hidden="true"></i> Renew item</button>
138                                   </form>
139                             [% ELSE %]
140                                 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
141                                     <input type="hidden" name="op" value="renew" />
142                                     <input type="hidden" name="patronid" value="[% patronid | html %]" />
143                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
144                                     <input type="hidden" name="confirmed" value="1" />
145                                     <input type="hidden" name="newissues" value="[% newissues | html %]" />
146                                     <button type="submit" class="btn btn-primary"><i class="fa fa-refresh" aria-hidden="true"></i> Renew item</button>
147                                 </form>
148                             [% END %]
149
150                             <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" class="inline" method="post">
151                                 <input type="hidden" name="op" value="" />
152                                 <input type="hidden" name="patronid" value="[% patronid | html %]" />
153                                 <input type="hidden" name="newissues" value="[% newissues | html %]" />
154                                 <button type="submit" class="btn btn-primary"><i class="fa fa-cancel" aria-hidden="true"></i> Cancel</button>
155                             </form>
156                         </div>
157                     [% END # / IF confirm %]
158
159                     [% IF ( nopermission ) %]
160                         <!-- This is what is displayed if user doesn't have permission -->
161                         <div class="alert alert-warning">
162                             <span class="sco-alert-warning nopermission"></span>
163                             <h3>Access denied</h3>
164                             <p>Sorry, this self-checkout station has lost authentication.  Please contact the administrator to resolve this problem.</p>
165                         </div>
166                     [% END %]
167
168                     [% IF ( different_ip ) %]
169                         <!-- This is what is displayed if user doesn't have permission -->
170                         <div class="alert alert-warning">
171                             <span class="sco-alert-warning sessionlost"></span>
172                             <h3>Session lost</h3>
173                             <p>You are accessing self-checkout from a different IP address! please log in again.</p>
174                         </div>
175                     [% END %]
176
177                     [% IF ( invalid_username_or_password ) %]
178                         <!-- This is what is displayed if user doesn't have permission -->
179                         <div class="alert alert-warning">
180                             <span class="sco-alert-warning notfound"></span>
181                             <h3>Record not found</h3>
182                             <p>Your userid was not found in the database.  Please try again.</p>
183                         </div>
184                     [% END %]
185
186                     [% IF ( issued ) %]
187                         <span class="sco-alert-success issue"></span>
188                         <div class="alert alert-info">
189                             <p>Item checked out</p>
190                         </div>
191                     [% ELSIF ( renewed ) %]
192                         <span class="sco-alert-success renew"></span>
193                         <div class="alert alert-info">
194                             <p>Item renewed</p>
195                         </div>
196                     [% ELSIF ( returned == 0 ) %]
197                         <span class="sco-alert-warning return"></span>
198                         <div class="alert alert-info">
199                             <p>Item not checked in: please see circulation staff for assistance</p>
200                         </div>
201                     [% ELSIF ( returned == 1 ) %]
202                         <span class="sco-alert-success return"></span>
203                         <div class="alert alert-info">
204                             <p>Item checked in</p>
205                         </div>
206                     [% END %]
207
208
209                     [% UNLESS ( hide_main ) %]
210
211                         [% IF ( patronid ) %]
212                             [% IF ( validuser ) %]
213                                 <div class="alert alert-info">You are logged in as [% borrowername | html %].</div>
214                                 [% INCLUDE 'opac-note.inc' %]
215                                 [% IF patron_has_hold_fee %]
216                                     <div class="alert alert-warning">A hold fee was charged to your account for collecting this item.</div>
217                                 [% END %]
218                             [% END %]
219
220                             [% IF ( nouser ) %]
221                                 <div class="alert alert-warning">
222                                     <h4>Sorry</h4>
223                                     <p>The userid <strong>[% patronid | html %]</strong> was not found in the database.  Please try again.</p>
224                                 </div>
225                             [% END %]
226                         [% END # / IF patronid %]
227
228                         [% IF ( validuser ) %]
229                             <div id="newcheckout" class="sco_entry">
230                                 <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid | html %]');">
231                                     <h2>
232                                         [% IF ( Koha.Preference('SCOAllowCheckin') ) %]
233                                             Check out, return, or renew an item:
234                                         [% ELSE %]
235                                             Check out or renew an item:
236                                         [% END %]
237                                     </h2>
238                                     <div class="row">
239                                         <div class="col">
240                                             <label for="barcode">Scan a new item or enter its barcode:</label>
241                                         </div>
242                                         <div class="col-3">
243                                             <input id="barcode" name="barcode" size="20" type="text" class="focus form-control" autocomplete="off" />
244                                         </div>
245                                         <div class="col-auto">
246                                             <button type="submit" class="btn btn-primary">Submit</button>
247                                         </div>
248                                         <div class="col ml-auto">
249                                             <button type="button" id="logout_form" class="btn btn-info"><i class="fa fa-check" aria-hidden="true"></i> Finish</button>
250                                             <input type="hidden" name="op" value="checkout" />
251                                             <input type="hidden" name="patronid" value="[% patronid | html %]" />
252                                             <input type="hidden" name="newissues" value="[% newissues | html %]" />
253                                         </div>
254                                     </div> <!-- /.row -->
255                                 </form> <!-- /#scan_form -->
256                             </div> <!-- / #newcheckout -->
257                 </div> <!-- / .span12/12 -->
258                 [% IF ( display_patron_image ) %]
259                     <div class="col-lg-2">
260                         <img src="/cgi-bin/koha/sco/sco-patron-image.pl?borrowernumber=[% borrowernumber | uri %]&csrf_token=[% csrf_token | uri %]" alt="" />
261                     </div>
262                 [% END %]
263             </div> <!-- / .row -->
264         </div> <!-- / .container-fluid -->
265
266         <div class="container-fluid">
267             <div class="row">
268                 <div class="col order-first order-md-first order-lg-2">
269                     <ul class="nav nav-tabs" role="tablist">
270                         <li class="nav-item" role="presentation">
271                             <a class="nav-link active" href="#checkouts-tab" id="checkouts" aria-controls="home" aria-selected="true" data-toggle="tab">Checkouts ([% issues_count | html %])</a>
272                         </li>
273                         <li class="nav-item" role="presentation">
274                             <a class="nav-link" href="#holds-tab" id="holds" aria-controls="home" aria-selected="false" data-toggle="tab">
275                                 [% IF waiting_holds_count %]
276                                     <i class="fa fa-exclamation" aria-hidden="true"></i>
277                                 [% END %]
278                                 Holds ([% HOLDS.count | html %])
279                             </a>
280                         </li>
281                         <li class="nav-item" role="presentation">
282                             <a class="nav-link" href="#account-tab" id="account" aria-controls="home" aria-selected="false" data-toggle="tab">Charges ([% total | $Price %])</a>
283                         </li>
284                     </ul>
285                     <div class="tab-content">
286                         <div id="checkouts-tab" class="tab-pane show active" aria-labelledby="checkouts">
287                             <div id="borrowerdetails">
288                                 [% IF ( issues_count ) %]
289                                     <table id="loanTable" class="table table-bordered table-striped">
290                                         <caption>Checkouts for [% borrowername | html %] <span class="count">([% issues_count | html %] total)</span></caption>
291                                         <!-- ISSUES TABLE ROWS -->
292                                         <thead>
293                                             <tr>
294                                                 <th class="noshow">Checked out on</th>
295                                                 <th class="anti-the">Title</th>
296                                                 <th>Call no.</th>
297                                                 <th>Due</th>
298                                                 <th class="nosort">Renew</th>
299                                                 [% UNLESS ( nofines ) %]
300                                                     <th>Fines</th>
301                                                 [% END %]
302                                             </tr>
303                                         </thead>
304                                         <tbody>
305                                             [% FOREACH ISSUE IN ISSUES %]
306                                                 <tr>
307                                                     <td>[% ISSUE.issuedate | html %]</td>
308                                                     <td>
309                                                         [% UNLESS ( noitemlinks ) %]
310                                                             <a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.  biblionumber | uri %]">[% ISSUE.title | html %]</a>
311                                                         [% ELSE %]
312                                                             <strong>[% ISSUE.title | html %]</strong>
313                                                         [% END %]
314                                                         [% IF ( newissues.match(ISSUE.barcode)) %]
315                                                             <span class="label label-info">NEW</span>
316                                                         [% END %]
317                                                         <span class="item-details">[% ISSUE.author | html %]</span>
318                                                         ([% ISSUE.barcode | html %])
319                                                     </td>
320                                                     <td>[% ISSUE.itemcallnumber | html %]</td>
321                                                     [% IF ( ISSUE.overdue ) %]
322                                                         <td class="overdue" data-order="[% ISSUE.date_due | html %]">
323                                                             [% ISSUE.date_due | $KohaDates  as_due_date => 1 %]
324                                                         </td>
325                                                     [% ELSE   %]
326                                                         <td data-order="[% ISSUE.date_due | html %]">
327                                                             [% ISSUE.date_due | $KohaDates  as_due_date => 1 %]
328                                                         </td>
329                                                     [% END %]
330                                                     <td>
331                                                         <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
332                                                             <input type="hidden" name="patronid" value="[% patronid | html %]" />
333                                                             <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" />
334                                                             <input type="hidden" name="newissues" value="[% newissues | html %]" />
335                                                             [% IF ISSUE.can_be_renewed %]
336                                                                 <input type="hidden" name="op" value="renew" />
337                                                                 <input type="hidden" name="confirmed" value="1" />
338                                                                 [% UNLESS ( ISSUE.renew ) %]
339                                                                     <input type="submit" value="Renew item"  name="confirm  " class="btn btn-primary btn-sm renew" />
340                                                                 [% ELSE %]
341                                                                     <input type="submit" value="Renew item" class="btn btn-primary btn-sm renew" />
342                                                                 [% END %]
343                                                             [% ELSE %]
344                                                                 [% IF ISSUE.renew_error == 'auto_renew' OR ISSUE.renew_error == 'auto_too_soon' %]
345                                                                     <span>This item has been scheduled for automatic renewal and cannot be renewed</span>
346                                                                 [% ELSIF ISSUE.renew_error == 'onsite_checkout' %]
347                                                                     <span>This is a on-site checkout, it cannot be renewed.</span>
348                                                                 [% ELSIF ISSUE.renew_error == 'too_unseen' %]
349                                                                     <span>You have renewed this item the maximum number of consecutive times without it being seen by the library.</span>
350                                                                 [% ELSE %]
351                                                                     <span>No renewals allowed</span>
352                                                                 [% END %]
353                                                                 [% IF Koha.Preference('SCOAllowCheckin') %]
354                                                                     <input type="submit" value="Check in item" name="confirm" class="btn btn-info btn-sm return" />
355                                                                     <input type="hidden" name="op" value="returnbook" />
356                                                                     <input type="hidden" name="confirmed" value=""  />
357                                                                 [% END %]
358                                                             [% END %]
359                                                         </form>
360                                                     </td>
361                                                     [% UNLESS ( nofines ) %]
362                                                         <td>
363                                                             [% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]
364                                                         </td>
365                                                     [% END %]
366                                                 </tr>
367                                             [% END # / FOREACH ISSUE %]
368                                         </tbody>
369                                     </table>
370                                 [% ELSE %]
371                                     <h3>You currently have nothing checked out.</h3>
372                                 [% END # / IF issues_count %]
373                             </div> <!-- / #borrowerdetails -->
374                         </div>
375                         <div id="holds-tab" class="tab-pane" role="tabpanel" aria-labelledby="holds">
376                             [% IF HOLDS.count > 0 %]
377                                 [% PROCESS 'holds-table.inc' HOLDS = HOLDS, SuspendHoldsOpac = SuspendHoldsOpac, showpriority = showpriority, AutoResumeSuspendedHolds = AutoResumeSuspendedHolds, onlyinfo = 'true' %]
378                             [% ELSE %]
379                                 <h3>You currently have no pending holds.</h3>
380                             [% END %]
381                         </div>
382                         <div id="account-tab" class="tab-pane" role="tabpanel" aria-labelledby="account">
383                             [% PROCESS 'account-table.inc' %]
384                         </div>
385                     </div>
386                         [% ELSE # IF validuser %]
387                             <div class="sco_entry" >
388                                 <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
389                                     <fieldset>
390                                         [% IF ( Koha.Preference('SelfCheckoutByLogin') ) %]
391                                             <legend>Log in to your account</legend>
392                                             <label for="patronlogin">Login:</label>
393                                             <input type="text" id="patronlogin" class="focus noEnterSubmit" size="20" name="patronlogin" />
394                                             <label for="patronpw">Password:</label>
395                                             <input type="password" id="patronpw" size="20" name="patronpw" />
396                                             <fieldset class="action">
397                                                 <button type="submit" class="btn btn-primary">Log in</button>
398                                             </fieldset>
399                                         [% ELSE %]
400                                             <div class="form-row">
401                                                 <div class="col-auto">
402                                                     <label for="patronid">Please enter your card number:</label>
403                                                 </div>
404                                                 <div class="col-3">
405                                                     <input type="text" id="patronid" class="form-control focus" size="20" name="patronid" autocomplete="off" />
406                                                 </div>
407                                                 <div class="col-auto">
408                                                     <button type="submit" class="btn btn-primary">Submit</button>
409                                                 </div>
410                                             </div> <!-- /.form-row -->
411                                         [% END %]
412
413                                         [% FOREACH INPUT IN INPUTS %]
414                                             <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]">
415                                         [% END %]
416                                         <input type="hidden" name="op" value="login" />
417                                     </fieldset>
418                                 </form>
419                             </div> <!-- / .sco_entry -->
420                         [% END # / IF validuser %]
421                     [% END # / UNLESS ( hide_main %]
422                     [% IF ( Koha.Preference('SCOMainUserBlock' ) ) %]<div id="scomainuserblock">[% Koha.Preference('SCOMainUserBlock' ) | $raw %]</div>[% END %]
423                 </div> <!-- / .span12 -->
424             </div> <!-- / .row -->
425         </div> <!-- / .container-fluid -->
426     </div> <!-- / .main -->
427     <span id="audio-alert"></span>
428
429 [% INCLUDE 'opac-bottom.inc' %]
430 [% BLOCK jsinclude %]
431     [% INCLUDE 'datatables.inc' %]
432     <script>
433         function mungeHistory() {
434             // prevent back button from allowing form resubmission
435             if (history && history.pushState) {
436                 history.replaceState(null, document.title, window.location.href);
437             }
438         }
439         var mainTimeout;
440         function sco_init() {
441             mainTimeout = setTimeout(function() {
442                 location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
443             }, [% SelfCheckTimeout | html %]);
444         }
445         function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
446             // alert("dofocus called");
447             $(".focus:last").select();
448         }
449         var slip_re = /slip/;
450         function printx_window(print_type) {
451           var handler = print_type.match(slip_re) ? "printslip" : "moremember";
452
453           return false;
454         }
455         function checkout_confirm(patronid) {
456             var   barcode = $("#barcode").val();
457             // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
458             if (! barcode) { dofocus(); return false; }    // no barcode
459             if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode
460                 window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
461                 return false;
462             }
463             return true;
464         }
465         [% IF Koha.Preference('AudioAlerts') %]
466             var AUDIO_ALERTS = JSON.parse( "[% To.json(AudioAlerts.AudioAlerts) | $raw %]" );
467             $( document ).ready(function() {
468                 if ( AUDIO_ALERTS ) {
469                     for ( var k in AUDIO_ALERTS ) {
470                         var alert = AUDIO_ALERTS[k];
471                         if ( $( alert.selector ).length ) {
472                             playSound( alert.sound );
473                             break;
474                         }
475                     }
476                 }
477             });
478             function playSound( sound ) {
479                 if (  ( sound.indexOf('http://') == 0 || sound.indexOf('https://') == 0 )  ) {
480                     document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
481                 }
482             }
483         [% END %]
484
485
486         $(document).ready(function() {
487             dofocus();
488             [% IF ( patronid ) %]sco_init();[% END %]
489             $("#loanTable").dataTable($.extend(true, {}, dataTablesDefaults, {
490                 "dom": "t",
491                 "order": [ 0 ],
492                 "columnDefs": [
493                     { "targets": [ "nosort" ], "sortable": false, "searchable": false },
494                     { "targets": [ "noshow" ], "visible": false, "searchable": false },
495                     { "type": "anti-the", "targets" : [ "anti-the" ] }
496                 ]
497             }));
498
499             $("#logout_form").on("click", function(e){
500                 e.preventDefault(e);
501                 clearTimeout(mainTimeout);
502                 [% IF Koha.Preference('SelfCheckReceiptPrompt') %]
503                     var confirmStart = Date.now();
504                     confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function(result) {
505                         if ( result && (Date.now() - confirmStart) < [% SelfCheckTimeout | html %] ) {
506                             var win = window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber | html %]&amp;print=qslip");
507                             location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
508                         } else {
509                             location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
510                         }
511                     })
512                 [% ELSE %]
513                     location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
514                 [% END %]
515
516                 return true;
517             });
518     });
519
520     </script>
521
522     [% IF ( Koha.Preference('SCOUserJS') ) %]<script>[% Koha.Preference('SCOUserJS') | $raw %]</script>[% END %]
523 [% END %]