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