Bug 27249: Catch NoOpenDays exception while checking out an item
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / circulation.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Context %]
4 [% USE Koha %]
5 [% USE Branches %]
6 [% USE KohaDates %]
7 [% USE Categories %]
8 [% USE TablesSettings %]
9 [% USE ItemTypes %]
10 [% USE Price %]
11 [% USE AuthorisedValues %]
12 [% PROCESS 'i18n.inc' %]
13 [% SET footerjs = 1 %]
14 [% INCLUDE 'doc-head-open.inc' %]
15 [% Asset.css("lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css") | $raw %]
16 [% SET destination = "circ" %]
17 <title>[% FILTER collapse %]
18     [% IF patron %]
19         [% patron_in_title = INCLUDE 'patron-title.inc' invert_name = 1 no_html = 1 %]
20         [% tx("Checking out to {patron}", { patron = patron_in_title }) | html %]  &rsaquo;
21     [% END %]
22     [% t("Circulation") | html %] &rsaquo;
23     [% t("Koha") | html %]
24 [% END %]</title>
25 [% INCLUDE 'doc-head-close.inc' %]
26 </head>
27
28 <body id="circ_circulation" class="circ">
29
30     [% WRAPPER 'header.inc' %]
31     [% INCLUDE 'circ-search.inc' %]
32 [% END %]
33
34     [% WRAPPER 'sub-header.inc' %]
35         [% WRAPPER breadcrumbs %]
36             [% WRAPPER breadcrumb_item %]
37                 <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
38             [% END %]
39             [% IF patron %]
40                 [% WRAPPER breadcrumb_item %]
41                     <a href="/cgi-bin/koha/circ/circulation.pl">Checkouts</a>
42                 [% END %]
43                 [% WRAPPER breadcrumb_item bc_active= 1 %]
44                     [% INCLUDE 'patron-title.inc' %]
45                 [% END %]
46             [% ELSE %]
47                 [% WRAPPER breadcrumb_item bc_active= 1 %]
48                     <span>Checkouts</span>
49                 [% END %]
50             [% END %]
51         [% END #/ WRAPPER breadcrumbs %]
52     [% END #/ WRAPPER sub-header.inc %]
53
54     <div class="main container-fluid">
55         <main>
56             <div class="row">
57                 <div class="col-sm-10 col-sm-push-2">
58
59                     [% IF patron %]
60                         [% INCLUDE 'members-toolbar.inc' %]
61                     [% END %]
62
63                     <h1>Checkouts</h1>
64
65                     <!--  INITIAL BLOC : PARAMETERS & BORROWER INFO -->
66                     [% IF ( was_renewed ) %]
67                         <div class="dialog message">Patron's account has been renewed until [% expiry | $KohaDates %]</div>
68                     [% END %]
69
70                     [% IF autoswitched %]
71                         <div id="autoswitched" class="dialog message">Patron was automatically switched by reading the patron card during checking out. Ensure you are working with the right patron.</div>
72                     [% END %]
73
74                     [% IF ADDITIONAL_MATERIALS && !NEEDSCONFIRMATION %]
75                         <div id="materials" class="dialog message">Note about the accompanying materials: [% ADDITIONAL_MATERIALS | html %]
76                         </div>
77                     [% END %]
78
79                     [% IF ( alert.ITEM_LOST ) %]
80                         <div class="dialog message">This item has been lost with a status of "[% alert.ITEM_LOST | html %]".</div>
81                     [% END %]
82
83                     [% IF ( alert.OTHER_CHARGES ) %]
84                         <div class="dialog message">The patron has unpaid charges for holds, rentals etc of [% alert.OTHER_CHARGES | $Price %]</div>
85                     [% END %]
86
87                     [% IF alert.HIGHHOLDS %]
88                         <div class="dialog message">High demand item. <strong>Loan period was not shortened due to override.</strong> Shortened due date would have been [% alert.HIGHHOLDS.returndate | $KohaDates %] ([% alert.HIGHHOLDS.duration  | html %] days).</div>
89                     [% END %]
90
91                     [% IF alert.RETURNED_FROM_ANOTHER %]
92                         <div class="dialog alert">Item was checked out to [% INCLUDE 'patron-title.inc' patron = alert.RETURNED_FROM_ANOTHER.patron %] and was returned automatically.</div>
93                     [% END %]
94
95                     [% IF ( nopermission ) %]
96                         <div class="dialog alert">Staff members are not allowed to discharge borrowers, nor borrowers to request a discharge.</div>
97                     [% END %]
98
99                     [% IF ( NEEDSCONFIRMATION ) %]
100                         <div id="circ_needsconfirmation" class="dialog alert audio-alert-action focus" tabindex="-1">
101                             [% IF CAN_user_circulate_force_checkout or ADDITIONAL_MATERIALS %]
102                                 <h3>Please confirm checkout</h3>
103                             [% ELSE %]
104                               <h3>Cannot check out</h3>
105                             [% END %]
106
107                             <ul>
108                                 [%IF ( AGE_RESTRICTION ) %]
109                                     <li>
110                                         Age restriction [% AGE_RESTRICTION | html %].
111                                         [% IF CAN_user_circulate_force_checkout %]
112                                             Check out anyway?
113                                         [% END %]
114                                     </li>
115                                 [% END %]
116
117
118                                 [% IF ( DEBT ) %]
119                                     <li>The patron has a debt of [% DEBT | $Price %].</li>
120                                 [% END %]
121
122                                 [% IF ( DEBT_GUARANTEES ) %]
123                                     <li>The patron's guarantees collectively have a debt of [% DEBT_GUARANTEES | $Price %].</li>
124                                 [% END %]
125
126                                 [% IF ( DEBT_GUARANTORS ) %]
127                                     <li>The patron's guarantors and their other guarantees collectively have a debt of [% DEBT_GUARANTORS | $Price %].</li>
128                                 [% END %]
129
130                                 [% IF ( RENTALCHARGE && RENTALCHARGE > 0 ) %]
131                                     <li>Rental charge for this item: [% RENTALCHARGE | $Price %]</li>
132                                 [% END %]
133
134                                 [% IF ( RENEW_ISSUE ) %]
135                                     <li>Item <em>[% getTitleMessageIteminfo | html %]</em> ([% getBarcodeMessageIteminfo | html %]) is currently checked out to this patron.  Renew?</li>
136                                 [% END %]
137
138                                 [% IF ( RESERVE_WAITING ) %]
139                                     <li>Item <em>[% getTitleMessageIteminfo | html %]</em> ([% getBarcodeMessageIteminfo | html %]) has been waiting for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber | uri %]">[% resfirstname | html %] [% ressurname | html %]</a> ([% rescardnumber | html %]) at [% Branches.GetName( resbranchcode ) | html %] since [% reswaitingdate | $KohaDates %]</li>
140                                 [% END %]
141
142                                 [% IF ( TRANSFERRED ) %]
143                                     <li>Item <em>[% getTitleMessageIteminfo | html %]</em> ([% getBarcodeMessageIteminfo | html %]) is on hold for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber | uri %]">[% resfirstname | html %] [% ressurname | html %]</a> ([% rescardnumber | html %]) and being transferred to [% Branches.GetName( resbranchcode ) | html %]</li>
144                                 [% END %]
145
146                                 [% IF ( PROCESSING ) %]
147                                     <li>Item <em>[% getTitleMessageIteminfo | html %]</em> ([% getBarcodeMessageIteminfo | html %]) is being processed for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber | uri %]">[% resfirstname | html %] [% ressurname | html %]</a> ([% rescardnumber | html %]) at [% Branches.GetName( resbranchcode ) | html %]</li>
148                                 [% END %]
149
150                                 [% IF ( RESERVED ) %]
151                                     <li>Item <em>[% getTitleMessageIteminfo | html %]</em> ([% getBarcodeMessageIteminfo | html %]) has been on hold for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber | uri %]">[% resfirstname | html %] [% ressurname | html %]</a> ([% rescardnumber | html %]) at [% Branches.GetName( resbranchcode ) | html %] since [% resreservedate | $KohaDates %]</li>
152                                 [% END %]
153
154                                 [% IF ( ISSUED_TO_ANOTHER ) %]
155                                     <li>Item <em>[% getTitleMessageIteminfo | html %]</em> ([% getBarcodeMessageIteminfo | html %]) is checked out to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% issued_borrowernumber | uri %]">[% issued_firstname | html %] [% issued_surname | html %]</a> ([% issued_cardnumber | html %]).
156                                         [% IF CAN_user_circulate_force_checkout %]
157                                             Check in and check out?
158                                         [% END %]
159                                     </li>
160                                 [% END %]
161
162                                 [% IF TOO_MANY and TOO_MANY == 'TOO_MANY_CHECKOUTS' %]
163                                     <li>Too many checked out. [% current_loan_count | html %] checked out, only [% max_loans_allowed | html %] are allowed.</li>
164                                 [% END %]
165
166                                 [% IF TOO_MANY and TOO_MANY == 'TOO_MANY_ONSITE_CHECKOUTS' %]
167                                     <li>Too many on-site checked out. [% current_loan_count | html %] on-site checked out, only [% max_loans_allowed | html %] are allowed.</li>
168                                 [% END %]
169
170                                 [% IF ( BORRNOTSAMEBRANCH ) %]
171                                     <li>This patron is from a different library ([% Branches.GetName( BORRNOTSAMEBRANCH ) | html %])</li>
172                                 [% END %]
173
174                                 [% IF ( PATRON_CANT ) %]
175                                     <li>This patron can't check out this item per library circulation policy.</li>
176                                 [% END %]
177
178                                 [% IF ( TOO_MANY and TOO_MANY == 'NO_RULE_DEFINED' ) %]
179                                     <li>No circulation rule is defined for this patron and itemtype combination.</li>
180                                 [% END %]
181
182                                 [% IF ( NOT_FOR_LOAN_FORCING ) %]
183                                     <li>
184                                     [% IF ( itemtype_notforloan ) %]
185                                         <span>Item type is normally not for loan.</span>
186                                     [% ELSIF ( item_notforloan ) %]
187                                         [% item_notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %]
188                                         <span>Item is normally not for loan</span>[% IF (item_notforloan_lib) %] ([% item_notforloan_lib | html %])[% END %].
189                                     [% END %]
190                                         [% IF CAN_user_circulate_force_checkout %]
191                                             <span>Check out anyway?</span>
192                                         [% END %]
193                                     </li>
194                                 [% END %]
195
196                                 [% IF ( USERBLOCKEDOVERDUE ) %]
197                                     <li>Patron has [% USERBLOCKEDOVERDUE %] overdue item(s).
198                                         [% IF CAN_user_circulate_force_checkout %]
199                                             Check out anyway?
200                                         [% END %]
201                                     </li>
202                                 [% END %]
203
204                                 [% IF ( ITEM_LOST ) %]
205                                     <li>This item has been lost with a status of "[% ITEM_LOST | html %]".
206                                         [% IF CAN_user_circulate_force_checkout %]
207                                             Check out anyway?
208                                         [% END %]
209                                     </li>
210                                 [% END %]
211
212                                 [% IF HIGHHOLDS %]
213                                     <li>High demand item. Loan period shortened to [% HIGHHOLDS.duration | html %] days (due [% HIGHHOLDS.returndate | $KohaDates %]). Check out anyway?</li>
214                                 [% END %]
215
216                                 [% IF PREVISSUE %]
217                                     <li>Patron has previously checked out this title: <strong>[% biblio.title | html %] [% IF biblio.author %] by [% biblio.author | html %][% END %]</strong>. Check out anyway?</li>
218                                 [% END %]
219
220                                 [% IF BIBLIO_ALREADY_ISSUED %]
221                                     <li>
222                                         Patron has already checked out another item from this record.
223                                         [% IF CAN_user_circulate_force_checkout %]
224                                             Check out anyway?
225                                         [% END %]
226                                     </li>
227                                 [% END %]
228
229                                 [% IF ADDITIONAL_MATERIALS %]
230                                     <li>
231                                         Please confirm that the accompanying materials are present: [% ADDITIONAL_MATERIALS | html %]
232                                     </li>
233                                 [% END %]
234
235                                 [% IF RECALLED %]
236                                     [% IF RECALLED.waiting %]
237                                         <li>Item <i>[% RECALLED.biblio.title | html %]</i> ([% RECALLED.item.barcode | html %]) has been waiting for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% RECALLED.patron_id | uri %]">[% RECALLED.patron.firstname | html %] [% RECALLED.patron.surname | html %]</a> ([% RECALLED.patron.cardnumber | html %]) at [% Branches.GetName( RECALLED.pickup_library_id ) | html %] since [% RECALLED.waiting_date | $KohaDates %]</li>
238                                     [% ELSIF RECALLED.requested or RECALLED.overdue %]
239                                         <li>Item <i>[% RECALLED.biblio.title | html %]</i> [% IF RECALLED.item %]([% RECALLED.item.barcode | html %])[% END %] has been recalled by <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% RECALLED.patron_id | uri %]">[% RECALLED.patron.firstname | html %] [% RECALLED.patron.surname | html %]</a> ([% RECALLED.patron.cardnumber | html %]) at [% Branches.GetName( RECALLED.pickup_library_id ) | html %] since [% RECALLED.created_date | $KohaDates %]</li>
240                                     [% END %]
241                                 [% END %]
242
243                             </ul>
244
245                             [% IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
246                                 <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
247                                     <input type="hidden" name="restoreduedatespec" />
248
249                                     [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
250
251                                     [% IF HIGHHOLDS %]
252                                         <p class="circ-override-high-holds">
253                                             <input type="checkbox" name="override_high_holds_tmp" id="override_high_holds_tmp" value="1" />
254                                             <label for="override_high_holds_tmp">Don't decrease loan length based on holds</label>
255                                         </p>
256                                     [% END %]
257
258                                     [% IF ( RESERVED ) %]
259                                         <p>
260                                             <input type="checkbox" id="cancelreserve" name="cancelreserve" value="cancel" />
261                                             <label for="cancelreserve">Cancel hold</label>
262                                         </p>
263                                     [% END %]
264
265                                     [% IF ( RESERVE_WAITING ) %]
266                                         <p>
267                                             <label for="cancelreserve">Cancel hold</label>
268                                             <input type="radio" value="cancel" name="cancelreserve" id="cancelreserve" /><br />
269                                             <label for="revertreserve">Revert waiting status</label>
270                                             <input type="radio" value="revert" name="cancelreserve" id="revertreserve" checked="checked"/>
271                                         </p>
272                                     [% END %]
273
274                                     [% IF ( TRANSFERRED ) %]
275                                         <p>
276                                             <label for="cancelreserve">Cancel hold</label>
277                                             <input type="radio" value="cancel" name="cancelreserve" id="cancelreserve" /><br />
278                                             <label for="revertreserve">Revert hold transfer status</label>
279                                             <input type="radio" value="revert" name="cancelreserve" id="revertreserve" checked="checked"/>
280                                         </p>
281                                     [% END %]
282
283                                     [% IF ( PROCESSING ) %]
284                                         <p>
285                                             <label for="cancelreserve">Cancel hold</label>
286                                             <input type="radio" value="cancel" name="cancelreserve" id="cancelreserve" /><br />
287                                             <label for="revertreserve">Revert In Processing status</label>
288                                             <input type="radio" value="revert" name="cancelreserve" id="revertreserve" checked="checked"/>
289                                         </p>
290                                     [% END %]
291
292                                     [% IF ( RECALLED ) %]
293                                         <p>
294                                             <label for="cancelrecall">Cancel recall</label>
295                                             <input type="radio" value="cancel" name="cancel_recall" id="cancelrecall" />
296                                             <input type="hidden" value="[% RECALLED.id | html %]" name="recall_id" />
297                                         </p>
298                                         [% IF RECALLED.waiting %]
299                                             <p>
300                                                 <label for="revertrecall">Revert waiting status</label>
301                                                 <input type="radio" value="revert" name="cancel_recall" id="revertrecall" checked="checked"/>
302                                                 <input type="hidden" value="[% RECALLED.id | html %]" name="recall_id" />
303                                             </p>
304                                         [% END %]
305                                     [% END %]
306
307                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
308                                     <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
309                                     <input type="hidden" name="issueconfirmed" value="1" />
310                                     <input type="hidden" name="override_high_holds" value="[% override_high_holds | html %]"/>
311
312                                     [% IF ( DEBT ) %]<input type="hidden" name="debt_confirmed" value="1" />[% END %]
313
314                                     [% IF ( INVALID_DATE ) %]
315                                         <p>
316                                           <input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" class="flatpickr" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#barcode" />
317                                             <label for="duedatespec">Due date</label>
318                                         </p>
319                                     [% ELSE %]
320                                         <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
321                                     [% END %]
322
323                                     <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
324                                     <input type="hidden" name="branch" value="[% branch | html %]" />
325
326                                     [% IF ( RENEW_ISSUE ) %]
327                                         <button type="submit" class="approve" accesskey="y"><i class="fa fa-check"></i> Yes, renew (Y)</button>
328                                     [% ELSE %]
329                                         <button type="submit" class="approve" accesskey="y"><i class="fa fa-check"></i> Yes, check out (Y)</button>
330                                     [% END %]
331
332                                     <input type="hidden" name="onsite_checkout" value="[% onsite_checkout | html %]" />
333                                     <input type="hidden" name="auto_renew" value="[% auto_renew | html %]" />
334                                 </form>
335                             [% END # /IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
336
337                             [% IF ADDITIONAL_MATERIALS && !CAN_user_circulate_force_checkout %]
338                                 <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
339                                     <input type="hidden" name="restoreduedatespec" />
340
341                                     [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
342
343                                     <input type="hidden" name="barcode" value="[% barcode | html %]" />
344                                     <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
345                                     <input type="hidden" name="issueconfirmed" value="1" />
346                                     <input type="hidden" name="override_high_holds" value="[% override_high_holds | html %]"/>
347                                     <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
348                                     <input type="hidden" name="branch" value="[% branch | html %]" />
349
350                                     [% IF ( RENEW_ISSUE ) %]
351                                         <button type="submit" class="approve" accesskey="y"><i class="fa fa-check"></i> Yes, renew (Y)</button>
352                                     [% ELSE %]
353                                         <button type="submit" class="approve" accesskey="y"><i class="fa fa-check"></i> Yes, check out (Y)</button>
354                                     [% END %]
355
356                                     <input type="hidden" name="onsite_checkout" value="[% onsite_checkout | html %]" />
357                                     <input type="hidden" name="auto_renew" value="[% auto_renew | html %]" />
358                                 </form>
359                             [% END # /IF ADDITIONAL_MATERIALS %]
360
361                             [% IF ( RESERVED or RESERVE_WAITING or TRANSFERRED or PROCESSING ) %]
362                                 <form method="get" action="/cgi-bin/koha/circ/circulation.pl">
363                                     <input type="hidden" name="restoreduedatespec" />
364                                     <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
365                                     <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
366                                     <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
367                                     <button class="print" type="submit" onclick="Dopop('hold-transfer-slip.pl?reserve_id=[% reserve_id | uri %]');this.form.submit();"><i class="fa fa-print"></i> Don't check out and print slip (P)</button>
368                                 </form>
369                             [% END %]
370
371                             [% IF ( RECALLED ) %]
372                                 <form method="get" action="/cgi-bin/koha/circ/circulation.pl">
373                                     <button class="print" type="submit" onclick="Dopop('/cgi-bin/koha/recalls/recall_pickup_slip.pl?recall_id=[% RECALLED.id | html %]');this.form.submit();"><i class="fa fa-print"></i> Don't check out and print slip (P)</button>
374                                 </form>
375                             [% END %]
376
377                             <form method="get" action="/cgi-bin/koha/circ/circulation.pl">
378                                 [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
379                                 <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
380                                 <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
381                                 <input type="hidden" name="restoreduedatespec" />
382                                 <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
383                                 [% IF CAN_user_circulate_force_checkout or HIGHHOLDS or ADDITIONAL_MATERIALS %]
384                                     [% IF ( RENEW_ISSUE ) %]
385                                         <button type="submit" class="deny" accesskey="n"><i class="fa fa-times"></i> No, don't renew (N)</button>
386                                     [% ELSE %]
387                                         <button type="submit" class="deny" accesskey="n"><i class="fa fa-times"></i> No, don't check out (N)</button>
388                                     [% END %]
389                                 [% ELSE %]
390                                     <button type="submit" class="deny"><i class="fa fa-times"></i> Continue</button>
391                                 [% END %]
392                             </form>
393
394                             [% IF ( RESERVED || ISSUED_TO_ANOTHER || RECALLED ) && (CAN_user_reserveforothers_place_holds ) %]
395                                 [% UNLESS noissues %]
396                                     <button type="submit" onclick="window.location.href='/cgi-bin/koha/reserve/request.pl?biblionumber=[% itembiblionumber | html %]&borrowernumber=[% patron.borrowernumber | html %]'"><i class="fa-solid fa-note-sticky"></i> Cancel checkout and place a hold for [% INCLUDE 'patron-title.inc' %]</button>
397                                 [% END %]
398                             [% END %]
399                         </div> <!-- /#circ_needsconfirmation -->
400                     [% END # /NEEDSCONFIRMATION %]
401
402                     [% IF ( IMPOSSIBLE ) %]
403                         <div id="circ_impossible" class="dialog alert audio-alert-warning focus" tabindex="-1">
404                             [% IF ( UNKNOWN_BARCODE ) %]
405                                 <h3>Barcode not found</h3>
406                             [% END %]
407
408                             <!-- RESULT OF ISSUING REQUEST -->
409                             <ul>
410                                 [% IF ( DEBT_GUARANTORS ) %]
411                                     <li>The patron's guarantors and their other guarantees collectively have a debt of [% DEBT_GUARANTORS | $Price %].</li>
412                                 [% END %]
413
414                                 [% IF ( STATS ) %]
415                                     <li>Local use recorded</li>
416                                 [% END %]
417
418                                 [% IF ( INVALID_DATE ) %]
419                                     <li>The due date &quot;[% INVALID_DATE | $KohaDates %]&quot; is invalid</li>
420                                 [% END %]
421
422                                 [% IF ( UNKNOWN_BARCODE ) %]
423                                     <li>The barcode was not found: <span class="ex">[% barcode | html %]</span>
424                                         <div>
425                                             [% IF ( FALLBACK ) %]
426                                                 [% IF options %]
427                                                     <button type="button" class="approve" data-toggle="modal" data-target="#itemSearchFallback"><i class="fa fa-search"></i> Show matching titles</button>
428                                                 [% ELSE %]
429                                                     <div>No items were found by searching.</div>
430                                                 [% END %]
431                                             [% END %]
432
433                                             [% IF ( fast_cataloging ) %]
434                                                 [% IF ( CAN_user_editcatalogue_fast_cataloging ) %]
435                                                     <a class="approve" href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA&amp;barcode=[% barcode |uri %]&amp;circborrowernumber=[% patron.borrowernumber | html %]&amp;branch=[% branch | html %]&amp;duedatespec=[% duedatespec | html %]&amp;stickyduedate=[% stickyduedate | html %]"><i class="fa fa-plus"></i> Add record using fast cataloging</a>
436                                                 [% END %]
437                                             [% END %]
438                                         </div>
439                                     </li>
440                                 [% END %]
441
442                                 [% IF ( NOT_FOR_LOAN ) %]
443                                     <li>
444                                     [% IF ( itemtype_notforloan ) %]
445                                         Item type not for loan.
446                                     [% ELSIF ( item_notforloan ) %]
447                                         [% item_notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %]
448                                         Item not for loan[% IF (item_notforloan_lib) %] ([% item_notforloan_lib | html %])[% END %].
449                                     [% END %]
450                                     </li>
451                                 [% END %]
452
453                                 [% IF ( WTHDRAWN ) %]
454                                     <li>
455                                         <span>Item has been withdrawn</span>
456                                         [% item_withdrawn_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %]
457                                         [% IF (item_withdrawn_lib) %]<span class="co-withdrawn">([% item_withdrawn_lib | html %])</span>[% END %]
458                                     </li>
459                                 [% END %]
460
461                                 [% IF ( RESTRICTED ) %]
462                                     <li>Item is restricted</li>
463                                 [% END %]
464
465                                 [% IF ( GNA ) %]
466                                     <li>Patron's address is in doubt</li>
467                                 [% END %]
468
469                                 [% IF ( CARD_LOST ) %]
470                                     <li>Patron's card is lost</li>
471                                 [% END %]
472
473                                 [% IF ( DEBARRED ) %]
474                                     <li>Patron is restricted</li>
475                                 [% END %]
476
477                                 [% IF ( NO_MORE_RENEWALS ) %]
478                                     <li>No more renewals possible</li>
479                                 [% END %]
480
481                                 [% IF NO_RENEWAL_FOR_ONSITE_CHECKOUTS %]
482                                     <li>This item can not be renewed, it's an on-site checkout</li>
483                                 [% END %]
484
485                                 [%IF ( AGE_RESTRICTION ) %]
486                                     <li>Age restriction [% AGE_RESTRICTION | html %].</li>
487                                 [% END %]
488
489                                 [% IF ( EXPIRED ) %]
490                                     <li>Patron's card is expired</li>
491                                 [% END %]
492
493                                 [% IF ( TOO_MANY ) %]
494                                     <li>Too many checked out. [% current_loan_count | html %] checked out, only [% max_loans_allowed | html %] are allowed.</li>
495                                 [% END %]
496
497                                 [% IF ( ITEMNOTSAMEBRANCH ) %]
498                                     <li>This item belongs to [% Branches.GetName( itemhomebranch ) | html %] and cannot be checked out from this location.</li>
499                                 [% END %]
500
501                                 [% IF RETURN_IMPOSSIBLE %]
502                                     <li>This item must be returned to [% Branches.GetName( branch_to_return ) | html %].</li>
503                                 [% END %]
504
505                                 [% IF ( USERBLOCKEDWITHENDDATE ) %]
506                                     <li>Patron has a restriction until [% USERBLOCKEDWITHENDDATE | $KohaDates %].</li>
507                                 [% END %]
508
509                                 [% IF ( USERBLOCKEDNOENDDATE ) %]
510                                     <li>Patron has an indefinite restriction.</li>
511                                 [% END %]
512
513                                 [% IF ( USERBLOCKEDOVERDUE ) %]
514                                     <li>Checkouts are BLOCKED because patron has overdue items.</li>
515                                 [% END %]
516
517                                 [% IF ( RECALLED_INTRANSIT ) %]
518                                     <li>Item has been recalled and is in transit for pickup at [% Branches.GetName( RECALLED_INTRANSIT ) | html %].</li>
519                                 [% END %]
520
521                                 [% IF NO_OPEN_DAYS %]
522                                     <li>No open days found while calculating the due date. Check the library calendar.</li>
523                                 [% END %]
524                                 </ul>
525
526                                 [% IF (forceallow) %]
527                                     <li>Restriction overridden temporarily.</li>
528                                 [% END %]
529                             </ul>
530                         </div> <!-- /#circ_impossible -->
531
532                         [% IF ( FALLBACK ) %]
533                             [% IF options %]
534                                 <!-- Modal -->
535                                 <div class="modal" id="itemSearchFallback" tabindex="-1" role="dialog" aria-labelledby="itemSearchFallbackLabel">
536                                     <div class="modal-dialog modal-wide" role="document">
537                                         <div class="modal-content">
538                                             <div class="modal-header">
539                                                 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
540                                                 <h3 id="itemSearchFallbackLabel"><h3>Barcode not found. The following items were found by searching:</h3>
541                                             </div>
542                                             <div class="modal-body">
543                                                 <table class="table_borrowers">
544                                                     <thead>
545                                                         <tr>
546                                                             <th>Title</th>
547                                                             <th>Barcode</th>
548                                                             <th>Call number</th>
549                                                             <th>Copy number</th>
550                                                             <th>Inventory number</th>
551                                                             <th>Serial enumeration</th>
552                                                             <th>Collection</th>
553                                                             [% IF ( item_level_itypes ) %]<th>Item type</th>[% END %]
554                                                             <th>&nbsp;</th>
555                                                         </tr>
556                                                     </thead>
557                                                     <tbody>
558                                                     [% FOREACH item IN options %]
559                                                         <tr>
560                                                             <td>
561                                                                 <a target="_blank" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber | html %]">[% item.biblio.title | html %] <i class="fa-solid fa-window-restore"></i></a>
562                                                                 [% IF item.onloan %]<span style="float: right; color: red; margin-left:5px;">Checked out</span>[% END %]
563                                                             </td>
564                                                             <td>
565                                                                 [% item.barcode | html %]
566                                                             </td>
567                                                             <td>[% item.itemcallnumber | html %]</th>
568                                                             <td>[% item.copynumber | html %]</th>
569                                                             <td>[% item.stocknumber| html %]</th>
570                                                             <td>[% item.enumchron| html %]</th>
571                                                             <td>
572                                                                 [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]
573                                                             </td>
574                                                             [% IF ( item_level_itypes ) %]
575                                                                 <td>
576                                                                     [% ItemTypes.GetDescription( item.itype ) | html %]
577                                                                 </td>
578                                                             [% END %]
579                                                             <td>
580                                                                 <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
581                                                                     [% IF (forceallow) %]
582                                                                         <input type="hidden" name="forceallow" value="1">
583                                                                     [% END %]
584                                                                     <input type="hidden" name="restoreduedatespec" />
585                                                                     <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
586                                                                     <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
587                                                                     <input type="hidden" name="stickyduedate" value="[% stickyduedate | html %]" />
588                                                                     <input type="hidden" name="branch" value="[% branch | html %]" />
589                                                                     <input type="hidden" name="barcode" value="[% item.barcode | html %]" />
590                                                                     <input type="hidden" name="onsite_checkout" value="[% onsite_checkout | html %]" />
591                                                                     <input type="hidden" name="auto_renew" value="[% auto_renew | html %]" />
592                                                                     <button class="btn btn-default btn-xs" type="submit" name="x"><i class="fa fa-check"></i> Check out</button>
593                                                                 </form>
594                                                             </td>
595                                                         </tr>
596                                                     [% END %]
597                                                     </tbody>
598                                                 </table>
599                                             </div> <!-- /.modal-body -->
600                                             <div class="modal-footer">
601                                                 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
602                                             </div>
603                                         </div> <!-- /.modal-content -->
604                                     </div> <!-- /.modal-dialog.modal-wide -->
605                                 </div> <!-- /#itemSearchFallback -->
606                             [% END # /IF options %]
607                         [% END # /IF FALLBACK %]
608
609                     [% ELSE # IF IMPOSSIBLE %]
610                         [% IF (forceallow) %]
611                             <div id="overridden_debarment" class="dialog alert">Restriction overridden temporarily</div>
612                         [% END %]
613                     [% END # /IF IMPOSSIBLE %]
614
615                     <span class="audio-alert-success"></span>
616
617                     [% IF ( issued ) %]
618                         <p>Item checked out</p>
619                     [% END %]
620
621                     [% IF ( message ) %]
622                         [% INCLUDE 'patron-toolbar.inc' %]
623                         <h4>No patron matched <span class="ex">[% message | html %]</span></h4>
624                     [% END %]
625
626                     <!-- BARCODE ENTRY -->
627
628                     [% IF patron %]
629
630                         [% IF patron.privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %]
631                             <div class="dialog alert">
632                                 <strong>Error:</strong> This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect.
633                             </div>
634                         [% END %]
635
636                         <div class="row">
637                             [% IF ( !noissues ) || ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') )%]
638                                 <div class="col-sm-6">
639                                     <form method="post" action="/cgi-bin/koha/circ/circulation.pl" id="mainform" name="mainform" autocomplete="off">
640                                         <input type="hidden" name="restoreduedatespec" />
641                                         [% IF ( issue ) %]
642                                             <fieldset id="circ_circulation_issue" class="lastchecked">
643                                         [% ELSE %]
644                                             <fieldset id="circ_circulation_issue">
645                                         [% END %]
646
647                                         [% IF Koha.Preference('DisplayClearScreenButton') == 'issueslip' %]
648                                             <span id="clearscreen"><a href="/cgi-bin/koha/circ/circulation.pl" title="Clear screen">x</a></span>
649                                             <span id="printclearscreen"><a href="#" title="Print slip and clear screen"><i class="fa fa-print"></i></a></span>
650                                         [% ELSIF Koha.Preference('DisplayClearScreenButton') == 'issueqslip' %]
651                                             <span id="clearscreen"><a href="/cgi-bin/koha/circ/circulation.pl" title="Clear screen">x</a></span>
652                                             <span id="printclearscreenq"><a href="#" title="Print quick slip and clear screen"><i class="fa fa-print"></i></a></span>
653                                         [% END %]
654
655                                         [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
656
657                                         <label class="circ_barcode" for="barcode">Checking out to [% INCLUDE 'patron-title.inc' %]</label>
658
659                                         [% IF NEEDSCONFIRMATION %]
660                                             <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" disabled="disabled" />
661                                         [% ELSE %]
662                                             [% IF Koha.Preference('itemBarcodeFallbackSearch') %]
663                                                 <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" placeholder="Enter item barcode or keyword" />
664                                             [% ELSE %]
665                                                 <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" placeholder="Enter item barcode" />
666                                             [% END %]
667                                         [% END %]
668
669                                         <div id="show-circ-settings">
670                                             <a href="#" title="Checkout settings"><i class="fa-solid fa-sliders"></i></a>
671                                         </div>
672
673                                         <button type="submit" class="btn btn-primary">Check out</button>
674
675                                         <div class="circ-settings">
676
677                                                 [% UNLESS ( noissues && Koha.Preference('OnSiteCheckoutsForce') ) %]
678                                                     [% IF ( SpecifyDueDate ) %]
679                                                         <div id="specify-due-date" class="circ-setting">
680                                                             <div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div>
681                                                             [% IF ( duedatespec ) %]
682                                                                 <input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" class="flatpickr" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#barcode" />
683                                                             [% ELSE %]
684                                                                 <input type="text" size="20" id="duedatespec" name="duedatespec" value="" class="flatpickr" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#barcode" />
685                                                             [% END %]
686                                                             <label for="stickyduedate"> Remember for session:</label>
687                                                             [% IF ( stickyduedate ) %]
688                                                                 <input type="checkbox" id="stickyduedate" onclick="this.form.barcode.focus();" name="stickyduedate" checked="checked" />
689                                                             [% ELSE %]
690                                                                 <input type="checkbox" id="stickyduedate" onclick="this.form.barcode.focus();" name="stickyduedate" />
691                                                             [% END %]
692                                                         </div>
693                                                     [% END %]
694                                                 [% END %]
695
696                                                 [% UNLESS ( noissues ) %]
697                                                     [% IF Koha.Preference('AllowSetAutomaticRenewal') %]
698                                                         <div id="set-automatic-renewal" class="circ-setting">
699                                                             [% IF NEEDSCONFIRMATION %]
700                                                                 [% IF auto_renew %]
701                                                                     [% IF patron.autorenew_checkouts %]
702                                                                         <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled"
703                                                                         title="Patron has opted out of auto-renewal"/>
704                                                                     [% ELSE %]
705                                                                         <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" checked="checked" />
706                                                                     [% END %]
707                                                                 [% ELSE %]
708                                                                     <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" />
709                                                                 [% END %]
710                                                             [% ELSE %]
711                                                                 [% IF ( auto_renew && patron.autorenew_checkouts ) %]
712                                                                     <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" checked="checked" />
713                                                                 [% ELSIF patron.autorenew_checkouts %]
714                                                                     <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" class="circ_setting" />
715                                                                 [% ELSE %]
716                                                                     <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled"
717                                                                     title="Patron has opted out of auto-renewal"/>
718                                                                 [% END %]
719                                                             [% END %]
720
721                                                             <label for="auto_renew">Automatic renewal</label>
722                                                         </div>
723                                                     [% END %]
724                                                     [% IF Koha.Preference('decreaseLoanHighHolds') %]
725                                                         <div id="set_high_holds_overrride" class="circ-setting">
726                                                             [% IF NEEDSCONFIRMATION %]
727                                                                 [% IF override_high_holds %]
728                                                                     <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" disabled="disabled" checked="checked"/>
729                                                                 [% ELSE %]
730                                                                     <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" disabled="disabled"/>
731                                                                 [% END %]
732                                                             [% ELSE %]
733                                                                 [% IF override_high_holds %]
734                                                                     <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" class="circ_setting" checked="checked" />
735                                                                 [% ELSE %]
736                                                                     <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" class="circ_setting" />
737                                                                 [% END %]
738                                                             [% END %]
739                                                             <label for="override_high_holds">Don't decrease checkout length based on holds</label>
740                                                         </div>
741                                                     [% END %]
742                                                 [% END %]
743
744                                                 [% IF Koha.Preference('OnSiteCheckouts') %]
745                                                     <div id="onsite_checkout-select" class="circ-setting">
746                                                         [% IF noissues %]
747                                                             <div class="onsite-checkout-only">
748                                                                 <input type="checkbox" id="onsite_checkout" name="onsite_checkout_forced" checked="checked" disabled="disabled" /> <label for="onsite_checkout">On-site checkouts only. Automatic due date: </label>
749                                                                 <input type="text" name="duedatespec" id="duedatespec" class="flatpickr" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#barcode" />
750                                                                 <input type="hidden" name="onsite_checkout" checked="checked" value="1" />
751                                                             </div>
752                                                         [% ELSE %]
753                                                             [% IF Koha.Preference('OnSiteCheckoutAutoCheck') && onsite_checkout == "on" %]
754                                                             <input type="checkbox" id="onsite_checkout" name="onsite_checkout" class="circ_setting" checked="checked" /> <label for="onsite_checkout">On-site checkout</label>
755                                                             [% ELSE %]
756                                                             <input type="checkbox" id="onsite_checkout" name="onsite_checkout" class="circ_setting" /> <label for="onsite_checkout">On-site checkout</label>
757                                                             [% END %]
758                                                         [% END %]
759                                                     </div>
760                                                 [% END %]
761
762                                             </div> <!-- /.circ-settings -->
763
764                                             <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
765                                             <input type="hidden" name="branch" value="[% branch | html %]" />
766                                             <input type="hidden" name="debt_confirmed" value="[% debt_confirmed | html %]" />
767                                             [% IF ( CHARGES ) %]
768                                                     <input type="hidden" name="charges" value="yes" />
769                                             [% END %]
770                                         </fieldset> <!-- /#circ_circulation_issue -->
771
772                                         [% IF ( issue ) %]
773                                             <div class="lastchecked">
774                                                 <p>
775                                                     <strong>Checked out: </strong>
776                                                     [% issue.item.biblio.title | html %] ([% issue.item.barcode | html %]).
777
778                                                     [% IF issue.item.is_bundle %]
779                                                         [% SET bundle_items_count = issue.item.bundle_items.count %]
780                                                         [% tnx('Bundle of {count} item', 'Bundle of {count} items', bundle_items_count, { count = bundle_items_count }) | html %].
781                                                     [% END %]
782
783                                                     Due on [% issue.date_due | $KohaDates as_due_date => 1 %]
784                                                 </p>
785                                             </div>
786                                         [% END %]
787                                     </form> <!-- /#mainform -->
788                                 </div> <!-- /.col-sm-6 -->
789
790                             [% END #/IF !noissues %]
791
792                             [% IF ( noissues ) %]
793                                 [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
794                                     <div class="col-sm-6">
795                                 [% ELSE %]
796                                     <div>
797                                 [% END %]
798                             [% ELSE %]
799                                 <div class="col-sm-6">
800                             [% END %]
801
802                             [% IF ( noissues ) %]
803                                 [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
804                                     <div id="circmessages" class="circmessage attention">
805                                 [% ELSE %]
806                                     <h4>Checking out to [% INCLUDE 'patron-title.inc' %]</h4>
807                                     <div id="circmessages" class="circmessage warning">
808                                 [% END %]
809                                 <h3>
810                                     Cannot check out!
811                                     [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
812                                         <span class="circ-hlt">Only on-site checkouts are allowed</span>
813                                     [% END %]
814                                 </h3>
815                             [% ELSE %]
816                                 <div id="circmessages" class="circmessage attention">
817                             [% END %]
818
819                             [% INCLUDE 'patron_messages.inc' %]
820
821                         </div> <!-- /#circmessages -->
822                     </div> <!-- /div or div.col-sm-6 -->
823                 </div> <!-- /.row -->
824
825                     [% INCLUDE 'patron-detail-tabs.inc' patronpage = "circ" %]
826
827                 [% ELSIF borrowernumber # IF patron %]
828                     <div class="dialog message">Patron not found. <a href="/cgi-bin/koha/members/members-home.pl">Return to search</a></div>
829                 [% END # /IF patron %]
830
831                 </div> <!-- /.col-sm-10.col-sm-push-2 -->
832
833                 [% IF Koha.Preference('CircSidebar') %]
834                     [% IF not( borrowernumber and patron ) %]
835                         <div class="col-sm-2 col-sm-pull-10">
836                             <aside>
837                                 [% INCLUDE 'circ-nav.inc' %]
838                             </aside>
839                         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
840                     [% END %]
841                 [% END %]
842
843                 [% IF borrowernumber and patron %]
844                         <div class="col-sm-2 col-sm-pull-10">
845                             <aside>
846                         [% INCLUDE 'circ-menu.inc' %]
847                             </aside>
848                         </div> <!-- /.col-sm-2 col-sm-pull-10 -->
849                 [% END %]
850
851             </div> <!-- /.row -->
852         </main>
853
854         [% IF Koha.Preference('ClaimReturnedLostValue') || Koha.Preference('BundleLostValue') %]
855             [% INCLUDE 'modals/resolve_return_claim.inc' %]
856         [% END %]
857
858 <!-- Modal -->
859 <div id="barcodeSubmittedModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="barcodeSubmittedModalLabel" aria-hidden="true">
860     <div class="modal-dialog">
861         <div class="modal-content">
862             <div class="modal-header">
863                 <h3 id="barcodeSubmittedModalLabel">Barcode submitted</h3>
864             </div>
865             <div class="modal-body">
866                 <p>You have already submitted a barcode, please wait for the checkout to process...</p>
867             </div>
868         </div> <!-- /.modal-content -->
869     </div> <!-- /.modal-dialog -->
870 </div> <!-- /#barcodeSubmittedModal -->
871
872 [% MACRO jsinclude BLOCK %]
873     [% INCLUDE 'datatables.inc' %]
874     [% INCLUDE 'columns_settings.inc' %]
875     [% INCLUDE 'select2.inc' %]
876     [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
877     [% PROCESS 'modal-claims.inc' %]
878     [% PROCESS 'modal-claims-js' %]
879     [% INCLUDE 'js-date-format.inc' %]
880
881     <script>
882         /* Set some variable needed in circulation.js */
883         const LoadCheckoutsTableDelay = [% Koha.Preference('LoadCheckoutsTableDelay') || 0 | html %];
884         var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
885         var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
886         var ClaimReturnedChargeFee = "[% Koha.Preference('ClaimReturnedChargeFee') | html %]";
887         var UnseenRenewals = "[% Koha.Preference('UnseenRenewals') | html %]";
888         var ClaimReturnedWarningThreshold = "[% Koha.Preference('ClaimReturnedWarningThreshold') | html %]";
889         var interface = "[% interface | html %]";
890         var theme = "[% theme | html %]";
891         var borrowernumber = "[% patron.borrowernumber | html %]";
892         var branchcode = "[% branch | html %]";
893         var exports_enabled = "[% Koha.Preference('ExportCircHistory') | html %]";
894         var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 | html %];
895         var AllowRenewalOnHoldOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalOnHoldOverride') )? 1: 0 | html %];
896         var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 | html %];
897         var script = "circulation";
898         var relatives_borrowernumbers = new Array();
899         [% FOREACH b IN relatives_borrowernumbers %]
900             relatives_borrowernumbers.push("[% b | html %]");
901         [% END %]
902         var SuspendHoldsIntranet = [% ( Koha.Preference('SuspendHoldsIntranet') ) ? 1 : 0 | html %];
903     </script>
904     [% Asset.js("js/pages/circulation.js") | $raw %]
905     [% Asset.js("js/checkouts.js") | $raw %]
906     [% IF Koha.Preference('ClaimReturnedLostValue') || Koha.Preference('BundleLostValue') %]
907         [% Asset.js("js/resolve_claim_modal.js") | $raw %]
908     [% END %]
909     [% Asset.js("js/holds.js") | $raw %]
910     [% INCLUDE 'calendar.inc' %]
911     <script>
912         table_settings_issues_table = [% TablesSettings.GetTableSettings( 'circ', 'circulation', 'issues-table', 'json' ) | $raw %]
913         table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'circ', 'circulation', 'relatives-issues-table', 'json' ) | $raw %]
914         table_settings_borrowers_table = [% TablesSettings.GetTableSettings( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
915
916         [% IF borrowernumber and patron %]
917             if( Cookies.get("holdfor") != [% patron.borrowernumber | html %]){
918                 Cookies.remove("holdfor", { path: '/', SameSite: 'Lax' });
919             }
920         [% ELSE %]
921             Cookies.remove("holdfor", { path: '/', SameSite: 'Lax' });
922         [% END %]
923
924         [% UNLESS ( patron.borrowernumber ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %]
925
926         // On-site checkout
927         function toggle_onsite_checkout(){
928             if ( $("#onsite_checkout").prop('checked') ) {
929                 const duedatespec_fp = document.querySelector("#duedatespec")._flatpickr;
930                 duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]");
931             }
932         }
933
934         function Dopop(link) {
935             var newin = window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
936         }
937         $(document).ready(function() {
938             $('#mainform').on('submit',function() {
939                 if ($("#barcode") && $("#barcode").val()) {
940                     $('#barcode').on('keypress',function(event) {
941                         $('#barcodeSubmittedModal').modal();
942                         event.preventDefault(); }
943                     );
944                 }
945             });
946
947             // listen submit to trigger qslip on empty checkout
948             $('#mainform').bind('submit',function() {
949                 if ($('#barcode').val() == '') {
950                     [% IF ( CircAutoPrintQuickSlip == 'clear' ) %]
951                         window.location='/cgi-bin/koha/circ/circulation.pl';
952                         return false;
953                     [% ELSE %]
954                         return printx_window( '[% CircAutoPrintQuickSlip | html %]' );
955                     [% END %]
956                 }
957             });
958             toggle_onsite_checkout();
959             $("#onsite_checkout").click(function(){
960                 toggle_onsite_checkout();
961             });
962
963             [% IF HIGHHOLDS %]
964                 [% IF !override_high_holds %]
965                     $("input[name=duedatespec]:hidden").val('[% HIGHHOLDS.returndate | html %]');
966                     if ('[% duedatespec | html %]' === '') {
967                         $("input[name=restoreduedatespec]:hidden").val('highholds_empty');
968                     } else {
969                         $("input[name=restoreduedatespec]:hidden").val('[% duedatespec | html %]');
970                     }
971                 [% END %]
972
973                 $("#override_high_holds_tmp").on( 'change', function() {
974                     if ( this.checked ) {
975                         $("input[name=duedatespec]:hidden").val('');
976                     }
977                 });
978             [% END %]
979         });
980     </script>
981     [% INCLUDE 'str/members-menu.inc' %]
982     [% Asset.js("js/members-menu.js") | $raw %]
983     [% Asset.js("js/recalls.js") | $raw %]
984 [% END %]
985
986 [% INCLUDE 'intranet-bottom.inc' %]