Bug 14060: Add OnClose event on missing datepicker
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / circulation.tt
1 [% USE Koha %]
2 [% USE Branches %]
3 [% USE KohaDates %]
4 [% USE Categories %]
5 [% USE ColumnsSettings %]
6 [% USE ItemTypes %]
7 [% USE Price %]
8 [% IF Koha.Preference('ExportRemoveFields') OR Koha.Preference('ExportWithCsvProfile') %]
9    [% SET exports_enabled = 1 %]
10 [% END %]
11 [% USE AuthorisedValues %]
12 [% INCLUDE 'doc-head-open.inc' %]
13 [% SET destination = "circ" %]
14 <title>Koha &rsaquo; Circulation
15 [% IF borrowernumber and borrower%]
16   &rsaquo; Checking out to [% INCLUDE 'patron-title.inc' invert_name = 1 %]
17 [% END %]
18 </title>
19 [% INCLUDE 'doc-head-close.inc' %]
20 [% INCLUDE 'calendar.inc' %]
21
22 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
23 [% INCLUDE 'strings.inc' %]
24 [% INCLUDE 'datatables.inc' %]
25 [% INCLUDE 'columns_settings.inc' %]
26 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
27 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery-ui-timepicker-addon.min.js"></script>
28 [% INCLUDE 'timepicker.inc' %]
29 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.rowGrouping.js"></script>
30 <script type="text/javascript" src="[% interface %]/[% theme %]/js/pages/circulation.js"></script>
31 <script type="text/javascript" src="[% interface %]/[% theme %]/js/checkouts.js"></script>
32 <script type="text/javascript" src="[% interface %]/[% theme %]/js/holds.js"></script>
33 <script type="text/javascript">
34 //<![CDATA[
35 /* Set some variable needed in circulation.js */
36 var MSG_DT_LOADING_RECORDS = _("Loading... you may continue scanning.");
37 var interface = "[% interface %]";
38 var theme = "[% theme %]";
39 var borrowernumber = "[% borrowernumber %]";
40 var branchcode = "[% branch %]";
41 var exports_enabled = "[% exports_enabled %]";
42 var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 %];
43 var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 %];
44 var script = "circulation";
45 var relatives_borrowernumbers = new Array();
46 [% FOREACH b IN relatives_borrowernumbers %]
47     relatives_borrowernumbers.push("[% b %]");
48 [% END %]
49
50 var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
51 var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone.");
52
53 columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'issues-table', 'json' ) %]
54
55 [% IF borrowernumber and borrower %]
56     if($.cookie("holdfor") != [% borrowernumber %]){
57         $.removeCookie("holdfor", { path: '/' });
58     }
59 [% ELSE %]
60     $.removeCookie("holdfor", { path: '/' });
61 [% END %]
62
63 [% UNLESS ( borrowernumber ) %][% UNLESS ( borrowers ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
64
65 // On-site checkout
66 function toggle_onsite_checkout(){
67     if ( $("#onsite_checkout").prop('checked') ) {
68         $("#duedatespec").val("[% todaysdate | $KohaDates with_hours => 1%]")
69         [% IF !Koha.Preference('SpecifyDueDate') %]
70             $("#duedatespec").datetimepicker('destroy');
71         [% END %]
72     } else {
73         $("#duedatespec").datetimepicker({
74             onClose: function(dateText, inst) {
75                 if (validate_date(dateText, inst) ) {
76                     $("#barcode").focus();
77                 }
78             },
79             hour: 23,
80             minute: 59
81         });
82     }
83 }
84
85 function Dopop(link) {
86     var newin = window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
87 }
88 $(document).ready(function() {
89     $('#mainform').on('submit',function() {
90         if ($("#barcode") && $("#barcode").val()) {
91             $('#barcode').on('keypress',function(event) {
92                 $('#barcodeSubmittedModal').modal();
93                 event.preventDefault(); }
94             );
95         }
96     });
97
98     [% IF !( CircAutoPrintQuickSlip == 'clear' ) %]
99         // listen submit to trigger qslip on empty checkout
100         $('#mainform').bind('submit',function() {
101             if ($('#barcode').val() == '') {
102                 return printx_window( '[% CircAutoPrintQuickSlip %]' );
103             }
104         });
105     [% END %]
106     toggle_onsite_checkout();
107     $("#onsite_checkout").click(function(){
108         toggle_onsite_checkout();
109     });
110
111     $("#suspend_until").datepicker({
112         onClose: function(dateText, inst) {
113             validate_date(dateText, inst);
114         },
115         minDate: 1, // require that hold suspended until date is after today
116     });
117
118 });
119
120 //]]>
121 </script>
122 </head>
123 <body id="circ_circulation" class="circ">
124
125 [% INCLUDE 'header.inc' %]
126 [% INCLUDE 'circ-search.inc' %]
127
128 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo;
129 [% IF borrowernumber and borrower %]
130     <a href="/cgi-bin/koha/circ/circulation.pl">Checkouts</a> &rsaquo; [% INCLUDE 'patron-title.inc' %]
131 [% ELSE %]
132     <strong>Checkouts</strong>
133 [% END %]
134 </div>
135 [% IF ( $borrowers ) %]
136 <div id="doc" class="yui-t7">
137
138    <div id="bd">
139         <div id="yui-main">
140         <div class="yui-g">
141 [% ELSE %]
142 <div id="doc3" class="yui-t2">
143
144    <div id="bd">
145         <div id="yui-main">
146         <div class="yui-b">
147 [% END %]
148
149 [% IF borrowernumber and borrower %]
150 [% INCLUDE 'members-toolbar.inc' %]
151 [% END %]
152
153 <!--  INITIAL BLOC : PARAMETERS & BORROWER INFO -->
154 [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% expiry | $KohaDates %]</div>[% END %]
155
156 [% IF additional_materials %]
157     <div id="materials" class="dialog message">Note about the accompanying materials: <br />
158     [% additional_materials %]
159     </div>
160 [% END %]
161
162 [% IF ( alert.ITEM_LOST ) %]
163     <div class="dialog message">This item has been lost with a status of "[% alert.ITEM_LOST %]".</div>
164 [% END %]
165
166 [% IF ( alert.OTHER_CHARGES ) %]
167     <div class="dialog message">The patron has unpaid charges for holds, rentals etc of [% alert.OTHER_CHARGES %]</div>
168 [% END %]
169
170 [% IF alert.HIGHHOLDS %]
171     <div class="dialog message">High demand item. <b>Loan period was not shortened due to override.</b> Shortened due date would have been [% alert.HIGHHOLDS.returndate %] ([% alert.HIGHHOLDS.duration %] days).</div>
172 [% END %]
173
174 [% IF ( nopermission ) %]
175     <div class="dialog alert">Staff members are not allowed to discharge borrowers, nor borrowers to request a discharge.</div>
176 [% END %]
177
178 [% IF ( NEEDSCONFIRMATION ) %]
179 <div class="yui-g">
180
181 <div id="circ_needsconfirmation" class="dialog alert audio-alert-action">
182 [% IF CAN_user_circulate_force_checkout %]
183   <h3>Please confirm checkout</h3>
184 [% ELSE %]
185   <h3>Cannot check out</h3>
186 [% END %]
187
188 <ul>
189 [%IF ( AGE_RESTRICTION ) %]
190     <li>Age restriction [% AGE_RESTRICTION %].
191       [% IF CAN_user_circulate_force_checkout %]
192         Check out anyway?
193       [% END %]
194     </li>
195 [% END %]
196
197 [% IF ( DEBT ) %]
198     <li>The patron has a debt of [% DEBT %].</li>
199 [% END %]
200
201 [% IF ( DEBT_GUARANTEES ) %]
202     <li>The patron's guarantees collectively have a debt of [% DEBT_GUARANTEES | $Price %].</li>
203 [% END %]
204
205 [% IF ( RENTALCHARGE && RENTALCHARGE > 0 ) %]
206     <li>Rental charge for this item: [% RENTALCHARGE %]</li>
207 [% END %]
208
209 [% IF ( RENEW_ISSUE ) %]
210     <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) is currently checked out to this patron.  Renew?</li>
211 [% END %]
212
213 [% IF ( RESERVE_WAITING ) %]
214     <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) has been waiting for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber %]">[% resfirstname %] [% ressurname %]</a> ([% rescardnumber %]) at [% resbranchname %] since [% reswaitingdate | $KohaDates %]</li>
215 [% END %]
216
217 [% IF ( RESERVED ) %]
218     <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) has been on hold for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber %]">[% resfirstname %] [% ressurname %]</a> ([% rescardnumber %]) at [% resbranchname %] since [% resreservedate | $KohaDates %]</li>
219 [% END %]
220
221 [% IF ( ISSUED_TO_ANOTHER ) %]
222     <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) is checked out to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% issued_borrowernumber %]">[% issued_firstname %] [% issued_surname %]</a> ([% issued_cardnumber %]).
223       [% IF CAN_user_circulate_force_checkout %]
224         Check in and check out?
225       [% END %]
226     </li>
227 [% END %]
228
229 [% IF TOO_MANY and TOO_MANY == 'TOO_MANY_CHECKOUTS' %]
230     <li>Too many checked out. [% current_loan_count %] checked out, only [% max_loans_allowed %] are allowed.</li>
231 [% END %]
232
233 [% IF TOO_MANY and TOO_MANY == 'TOO_MANY_ONSITE_CHECKOUTS' %]
234     <li>Too many on-site checked out. [% current_loan_count %] on-site checked out, only [% max_loans_allowed %] are allowed.</li>
235 [% END %]
236
237 [% IF ( BORRNOTSAMEBRANCH ) %]
238     <li>This patron is from a different library ([% BORRNOTSAMEBRANCH %])</li>
239 [% END %]
240
241 [% IF ( PATRON_CANT ) %]
242     <li>This patron can't check out this item per library circulation policy</li>
243 [% END %]
244
245 [% IF ( NOT_FOR_LOAN_FORCING ) %]
246     <li>
247     [% IF ( itemtype_notforloan ) %]
248         Item type is normally not for loan.
249     [% ELSIF ( item_notforloan ) %]
250         [% item_notforloan_lib = AuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
251         Item is normally not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib %])[% END %].
252     [% END %]
253       [% IF CAN_user_circulate_force_checkout %]
254         Check out anyway?
255       [% END %]
256     </li>
257 [% END %]
258
259 [% IF ( USERBLOCKEDOVERDUE ) %]
260     <li>Patron has [% USERBLOCKEDOVERDUE %] overdue item(s).
261       [% IF CAN_user_circulate_force_checkout %]
262        Check out anyway?
263       [% END %]
264     </li>
265 [% END %]
266
267 [% IF ( ITEM_LOST ) %]
268     <li>This item has been lost with a status of "[% ITEM_LOST %]".
269       [% IF CAN_user_circulate_force_checkout %]
270         Check out anyway?
271       [% END %]
272     </li>
273 [% END %]
274
275 [% IF HIGHHOLDS %]
276     <li>High demand item. Loan period shortened to [% HIGHHOLDS.duration %] days (due [% HIGHHOLDS.returndate %]). Check out anyway?</li>
277 [% END %]
278
279 [% IF PREVISSUE %]
280     <li>This item has previously been checked out to this patron.  Check out anyway?</li>
281 [% END %]
282
283 [% IF BIBLIO_ALREADY_ISSUED %]
284   <li>
285     Patron has already checked out another item from this record.
286     [% IF CAN_user_circulate_force_checkout %]
287       Check out anyway?
288     [% END %]
289   </li>
290 [% END %]
291 </ul>
292
293 [% IF HIGHHOLDS %]
294 <script language="JavaScript" type="text/javascript">
295 $(document).ready(function() {
296     [% IF !override_high_holds %]
297         $("input[name=duedatespec]:hidden").val('[% HIGHHOLDS.returndate %]');
298         if ('[% duedatespec %]' === '') {
299             $("input[name=restoreduedatespec]:hidden").val('highholds_empty');
300         } else {
301             $("input[name=restoreduedatespec]:hidden").val('[% duedatespec %]');
302         }
303     [% END %]
304
305     $("#override_high_holds_tmp").on( 'change', function() {
306         if ( this.checked ) {
307             $("input[name=duedatespec]:hidden").val('');
308         }
309     });
310 });
311 </script>
312 [% END %]
313
314 [% IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
315 <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
316     <input type="hidden" name="restoreduedatespec" />
317
318 [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
319
320 [% IF HIGHHOLDS %]
321     <p class="circ-override-high-holds">
322     <input type="checkbox" name="override_high_holds_tmp" id="override_high_holds_tmp" value="1" />
323     <label for="override_high_holds_tmp">Don't decrease loan length based on holds</label>
324     </p>
325 [% END %]
326
327 [% IF ( RESERVED ) %]
328     <p>
329     <input type="checkbox" id="cancelreserve" name="cancelreserve" value="cancel" />
330     <label for="cancelreserve">Cancel hold</label>
331     </p>
332 [% END %]
333
334 [% IF ( RESERVE_WAITING ) %]
335 <p>
336     <label for="cancelreserve">Cancel hold</label>
337     <input type="radio" value="cancel" name="cancelreserve" id="cancelreserve" /><br />
338     <label for="revertreserve">Revert waiting status</label>
339     <input type="radio" value="revert" name="cancelreserve" id="revertreserve" checked="checked"/>
340 </p>
341 [% END %]
342
343     <input type="hidden" name="barcode" value="[% barcode |html %]" />
344     <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
345     <input type="hidden" name="issueconfirmed" value="1" />
346     <input type="hidden" name="override_high_holds" value="[% override_high_holds %]"/>
347     [% IF ( DEBT ) %]<input type="hidden" name="debt_confirmed" value="1" />[% END %]
348     [% IF ( INVALID_DATE ) %]
349     <p>
350     <input type="text" size="13" id="duedatespec" name="duedatespec" value="[% duedatespec %]" />
351     <label for="duedatespec">Due date</label>
352     </p>
353     [% ELSE %]
354     <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
355     [% END %]
356     <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
357     <input type="hidden" name="branch" value="[% branch %]" />
358     [% IF ( RENEW_ISSUE ) %]
359     <button type="submit" class="approve" accesskey="y"><i class="fa fa-check"></i> Yes, renew (Y)</button>
360     [% ELSE %]
361     <button type="submit" class="approve" accesskey="y"><i class="fa fa-check"></i> Yes, check out (Y)</button>
362     [% END %]
363     <input type="hidden" name="onsite_checkout" value="[% onsite_checkout %]" />
364 </form>
365 [% END %]
366
367 [% IF ( RESERVED ) %]
368 <form method="get" action="/cgi-bin/koha/circ/circulation.pl">
369     <input type="hidden" name="restoreduedatespec" />
370     <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
371     <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
372     <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
373     <button class="print" type="submit" onclick="Dopop('hold-transfer-slip.pl?borrowernumber=[% reserveborrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip');this.form.submit();"><i class="fa fa-print"></i> Don't check out and print slip (P)</button>
374 </form>
375 [% END %]
376
377 [% IF ( RESERVE_WAITING ) %]
378 <form method="get" action="/cgi-bin/koha/circ/circulation.pl">
379     <input type="hidden" name="restoreduedatespec" />
380     <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
381     <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
382     <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
383     <button class="print" type="submit" onclick="Dopop('hold-transfer-slip.pl?borrowernumber=[% reserveborrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip');this.form.submit();"><i class="fa fa-print"></i> Don't check out and print slip (P)</button>
384 </form>
385 [% END %]
386
387 <form method="get" action="/cgi-bin/koha/circ/circulation.pl">
388     [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
389     <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
390     <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
391     <input type="hidden" name="restoreduedatespec" />
392     <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
393     [% IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
394         [% IF ( RENEW_ISSUE ) %]
395         <button type="submit" class="deny" accesskey="n"><i class="fa fa-times"></i> No, don't renew (N)</button>
396         [% ELSE %]
397         <button type="submit" class="deny" accesskey="n"><i class="fa fa-times"></i> No, don't check out (N)</button>
398         [% END %]
399     [% ELSE %]
400         <button type="submit" class="deny"><i class="fa fa-times"></i> Continue</button>
401     [% END %]
402 </form>
403
404 [% IF ( RESERVED || ISSUED_TO_ANOTHER ) && (CAN_user_reserveforothers_place_holds ) %]
405     [% UNLESS noissues %]
406         <button type="submit" onclick="window.location.href='/cgi-bin/koha/reserve/request.pl?biblionumber=[% itembiblionumber %]&borrowernumber=[% borrowernumber %]'"><i class="fa fa-sticky-note-o"></i> Cancel checkout and place a hold for [% INCLUDE 'patron-title.inc' %]</button>
407     [% END %]
408 [% END %]
409 </div></div>
410 [% END %] <!-- NEEDSCONFIRMATION -->
411
412         [% IF ( IMPOSSIBLE ) %]
413
414 <div class="yui-g">
415 <div id="circ_impossible" class="dialog alert audio-alert-warning">
416     [% IF ( UNKNOWN_BARCODE ) %]
417         <h3>Barcode not found</h3>
418     [% END %]
419 <!-- RESULT OF ISSUING REQUEST -->
420         <ul>
421         [% IF ( STATS ) %]
422             <li>Local use recorded</li>
423         [% END %]
424
425         [% IF ( INVALID_DATE ) %]
426             <li>The due date &quot;[% INVALID_DATE %]&quot; is invalid</li>
427         [% END %]
428
429         [% IF ( UNKNOWN_BARCODE ) %]
430             <li>The barcode was not found: <span class="ex">[% barcode |html %]</span>
431             [% IF ( fast_cataloging ) %]
432                 [% IF ( CAN_user_editcatalogue_fast_cataloging ) %]
433             <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=FA&amp;barcode=[% barcode |uri %]&amp;circborrowernumber=[% borrowernumber %]&amp;branch=[% branch %]&amp;duedatespec=[% duedatespec %]&amp;stickyduedate=[% stickyduedate %]">Fast cataloging</a>
434                 [% END %]
435             [% END %]
436
437         [% IF ( FALLBACK ) %]
438             [% IF options %]
439                 <br />The following items were found by searching:
440                 [% FOREACH book IN options %]
441                     <br />
442                     <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
443                     [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
444                         <input type="hidden" name="restoreduedatespec" />
445                         <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
446                         <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
447                         <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
448                         <input type="hidden" name="branch" value="[% branch %]" />
449                         <input type="hidden" name="barcode" value="[% book.barcode %]" />
450                         <button type="submit" name="x"><i class="fa fa-check"></i> Check out [% book.barcode %]: [% book.title %]</button>
451                     </form>
452                 [% END %]
453             [% ELSE %]
454                 <br />No items were found by searching.
455             [% END %]
456         [% END %]
457
458      </li>
459         [% END %]
460
461         [% IF ( NOT_FOR_LOAN ) %]
462             <li>
463             [% IF ( itemtype_notforloan ) %]
464                 Item type not for loan.
465             [% ELSIF ( item_notforloan ) %]
466                 [% item_notforloan_lib = AuthorisedValues.GetByCode( authvalcode_notforloan, item_notforloan, 0 ) %]
467                 Item not for loan [% IF (item_notforloan_lib) %]([% item_notforloan_lib %])[% END %].
468             [% END %]
469             </li>
470         [% END %]
471
472         [% IF ( WTHDRAWN ) %]
473             <li>Item has been withdrawn</li>
474         [% END %]
475
476         [% IF ( RESTRICTED ) %]
477             <li>Item is restricted</li>
478         [% END %]
479
480         [% IF ( GNA ) %]
481             <li>Patron's address is in doubt</li>
482         [% END %]
483
484         [% IF ( CARD_LOST ) %]
485             <li>Patron's card is lost</li>
486         [% END %]
487
488         [% IF ( DEBARRED ) %]
489             <li>Patron is restricted</li>
490         [% END %]
491
492         [% IF ( NO_MORE_RENEWALS ) %]
493             <li>No more renewals possible</li>
494         [% END %]
495
496         [% IF NO_RENEWAL_FOR_ONSITE_CHECKOUTS %]
497             <li>This item can not be renewed, it's an on-site checkout</li>
498         [% END %]
499
500         [%IF ( AGE_RESTRICTION ) %]
501             <li>Age restriction [% AGE_RESTRICTION %].</li>
502         [% END %]
503
504         [% IF ( EXPIRED ) %]
505             <li>Patron's card is expired</li>
506         [% END %]
507
508         [% IF ( TOO_MANY ) %]
509             <li>Too many checked out. [% current_loan_count %] checked out, only [% max_loans_allowed %] are allowed.</li>
510         [% END %]
511
512         [% IF ( ITEMNOTSAMEBRANCH ) %]
513             <li>This item belongs to [% Branches.GetName( itemhomebranch ) %] and cannot be checked out from this location.</li>
514         [% END %]
515
516         [% IF RETURN_IMPOSSIBLE %]
517             <li>This item must be returned to [% Branches.GetName( branch_to_return ) %].</li>
518         [% END %]
519
520         [% IF ( USERBLOCKEDWITHENDDATE ) %]
521             <li>Patron has a restriction until [% USERBLOCKEDWITHENDDATE | $KohaDates %].</li>
522         [% END %]
523
524         [% IF ( USERBLOCKEDNOENDDATE ) %]
525             <li>Patron has an indefinite restriction.</li>
526         [% END %]
527
528         [% IF ( USERBLOCKEDOVERDUE ) %]
529             <li>Checkouts are BLOCKED because patron has overdue items.</li>
530         [% END %]
531         </ul>
532
533         [% IF (forceallow) %]
534             <li>Restriction overridden temporarily.</li>
535         [% END %]
536
537 </div></div>
538 [% ELSE %]
539   [% IF (forceallow) %]
540       <div id="overridden_debarment" class="dialog alert">Restriction overridden temporarily</div>
541   [% END %]
542 [% END %] <!-- /impossible -->
543
544 <span class="audio-alert-success"></span>
545
546 [% IF ( issued ) %]
547 <p>Item checked out</p>
548 [% END %]
549
550 [% IF ( message ) %]
551 [% INCLUDE 'patron-toolbar.inc' %]
552 <h4>
553 No patron matched <span class="ex">[% message | html %]</span>
554 </h4>
555 [% END %]
556
557 [% IF ( borrowers ) %]
558 [% INCLUDE 'patron-toolbar.inc' %]
559
560 <fieldset id="circ_circulation_selectborrower">
561     [% INCLUDE 'circ-patron-search-results.inc' destination = "circ" %]
562 </fieldset>
563 [% ELSE %]
564
565 <!-- BARCODE ENTRY -->
566
567 [% IF borrowernumber and borrower %]
568 <div class="yui-g">
569
570 [% IF privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %]
571     <div class="dialog alert"><strong>Error:</strong> This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect.</div>
572 [% END %]
573
574 [% IF ( !noissues ) || ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') )%]
575 <div class="yui-u first">
576
577 <form method="post" action="/cgi-bin/koha/circ/circulation.pl" id="mainform" name="mainform" autocomplete="off">
578     <input type="hidden" name="restoreduedatespec" />
579 [% IF ( issue ) %]
580     <fieldset id="circ_circulation_issue" class="lastchecked">
581 [% ELSE %]
582     <fieldset id="circ_circulation_issue">
583 [% END %]
584     [% IF ( DisplayClearScreenButton ) %]
585         <span id="clearscreen"><a href="/cgi-bin/koha/circ/circulation.pl" title="Clear screen">x</a></span>
586     [% END %]
587
588     [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
589
590     <label class="circ_barcode" for="barcode">Checking out to [% INCLUDE 'patron-title.inc' %]</label>
591
592         <div class="hint">Enter item barcode:</div>
593
594     [% IF NEEDSCONFIRMATION %]
595         <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" disabled="disabled" />
596     [% ELSE %]
597         <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" />
598     [% END %]
599     <button type="submit" class="btn">Check out</button>
600
601     <div id="show-checkout-settings">
602         <a href="#"><i class="fa fa-caret-right checkout-settings-icon"></i> Checkout settings</a>
603     </div>
604
605     <div class="checkout-settings">
606
607         [% UNLESS ( noissues && Koha.Preference('OnSiteCheckoutsForce') ) %]
608             [% IF ( SpecifyDueDate ) %]
609                 <div id="specify-due-date" class="checkout-setting">
610                     <div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div>
611                     [% IF ( duedatespec ) %]
612                         <input type="text" size="13" id="duedatespec" name="duedatespec" value="[% duedatespec %]" />
613                     [% ELSE %]
614                         <input type="text" size="13" id="duedatespec" name="duedatespec" value="" />
615                     [% END %]
616                     <label for="stickyduedate"> Remember for session:</label>
617                     [% IF ( stickyduedate ) %]
618                         <input type="checkbox" id="stickyduedate" onclick="this.form.barcode.focus();" name="stickyduedate" checked="checked" />
619                     [% ELSE %]
620                         <input type="checkbox" id="stickyduedate" onclick="this.form.barcode.focus();" name="stickyduedate" />
621                     [% END %]
622                     <button class="btn btn-small action" id="cleardate" name="cleardate" onclick="this.checked = false; this.form.duedatespec.value = ''; this.form.stickyduedate.checked = false; this.form.barcode.focus(); return false;" >Clear</button>
623                 </div>
624             [% END %]
625         [% END %]
626
627         [% UNLESS ( noissues ) %]
628             <div id="set-automatic-renewal" class="checkout-setting">
629                 [% IF NEEDSCONFIRMATION %]
630                     <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" disabled="disabled" />
631                 [% ELSE %]
632                     <input type="checkbox" name="auto_renew" id="auto_renew" value="auto_renew" />
633                 [% END %]
634
635                 <label for="auto_renew">Automatic renewal</label>
636             </div>
637             [% IF Koha.Preference('decreaseLoanHighHolds') %]
638                 <div id="set_high_holds_overrride" class="checkout-setting">
639                     [% IF NEEDSCONFIRMATION %]
640                         [% IF override_high_holds %]
641                             <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" disabled="disabled" checked="checked"/>
642                         [% ELSE %]
643                             <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" disabled="disabled"/>
644                         [% END %]
645                     [% ELSE %]
646                         [% IF override_high_holds %]
647                             <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" checked="checked" />
648                         [% ELSE %]
649                             <input type="checkbox" name="override_high_holds" id="override_high_holds" value="1" />
650                         [% END %]
651                     [% END %]
652                     <label for="override_high_holds">Don't decrease checkout length based on holds</label>
653                 </div>
654             [% END %]
655         [% END %]
656
657         [% IF Koha.Preference('OnSiteCheckouts') %]
658             <div id="onsite_checkout-select" class="checkout-setting">
659                 [% IF noissues %]
660                     <div class="onsite-checkout-only">
661                         <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>
662                         <input type="text" name="duedatespec" id="duedatespec" />
663                         <input type="hidden" name="onsite_checkout" checked="checked" value="1" />
664                     </div>
665                 [% ELSE %]
666                     <input type="checkbox" id="onsite_checkout" name="onsite_checkout" /> <label for="onsite_checkout">On-site checkout</label>
667                 [% END %]
668             </div>
669         [% END %]
670
671     </div> <!-- /.checkout-settings -->
672
673           <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
674           <input type="hidden" name="branch" value="[% branch %]" />
675           <input type="hidden" name="print" value="maybe" />
676           <input type="hidden" name="debt_confirmed" value="[% debt_confirmed %]" />
677                 [% IF ( CHARGES ) %]
678                         <input type="hidden" name="charges" value="yes" />
679                         <input type="hidden" name="oldamount" value="[% amountold %]" />
680                 [% END %]
681 </fieldset>
682 [% IF ( issue ) %]
683     <div class="lastchecked">
684         <p><strong>Checked out: </strong>[% issue.item.biblioitemnumber.biblionumber.title %] ([% issue.item.barcode %]). Due on [% issue.date_due | $KohaDates %]</p>
685     </div>
686 [% END %]
687 </form></div>
688
689 [% END %]<!-- /unless noissues -->
690
691 [% IF ( noissues ) %]
692     [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
693         <div class="yui-u">
694     [% ELSE %]
695         <div>
696     [% END %]
697 [% ELSE %]
698     <div class="yui-u">
699 [% END %]
700
701         [% IF ( noissues ) %]
702             [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
703                 <div id="circmessages" class="circmessage attention">
704             [% ELSE %]
705                 <h4>Checking out to [% INCLUDE 'patron-title.inc' %]</h4>
706                 <div id="circmessages" class="circmessage warning">
707             [% END %]
708             <h3>
709                 Cannot check out!
710                 [% IF ( Koha.Preference('OnSiteCheckouts') && Koha.Preference('OnSiteCheckoutsForce') ) %]
711                     <span class="circ-hlt">Only on-site checkouts are allowed</span>
712                 [% END %]
713             </h3>
714         [% ELSE %]
715             <div id="circmessages" class="circmessage attention">
716                 <h3>Attention:</h3>
717         [% END %]
718
719                 <ul>
720
721                    [% IF ( has_modifications ) %]
722                     <li><span class="circ-hlt">Pending modifications:</span> Patron has pending modifications.
723                             [% IF CAN_user_borrowers && ( !Koha.Preference('IndependentBranchesPatronModifications') || borrower.branch == branch ) %]
724                                     <a href="/cgi-bin/koha/members/members-update.pl">View all pending patron modifications</a>
725                             [% END %]
726                    </li>
727                   [% END %]
728
729                         [% IF ( warndeparture ) %]
730                         <li><span class="circ-hlt">Expiration:</span> Patron's card will expire soon.
731             Patron's card expires on [% expiry | $KohaDates %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]">Edit Details</a>
732
733                         </li>
734                         [% END %]
735
736                         [% IF ( returnbeforeexpiry ) %]
737                          <li><span class="circ-hlt">Set due date to expiry:</span> You have the ReturnBeforeExpiry system preference enabled this means if the
738                          expiry date is before the date due, the date due will be set to the expiry date
739                          </li>
740                         [% END %]
741
742                         [% IF ( expired ) %]
743                         <li><span class="circ-hlt">Expiration:</span> Patron's card has expired.
744             [% IF ( expiry ) %]Patron's card expired on [% expiry | $KohaDates %][% END %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]">Edit Details</a>
745
746                         </li>
747                         [% END %]
748
749             [% IF ( gna ) %]
750                         <li class="blocker"><span class="circ-hlt">Address:</span> Patron's address in doubt</li>
751                         [% END %]
752
753             [% IF ( lost ) %]
754                         <li class="blocker"><span class="circ-hlt">Lost: </span>Patron's card is lost</li>
755                         [% END %]
756
757             [% IF ( userdebarred ) %]
758                <li class="blocker">
759                    <span class="circ-hlt"> Restricted:</span> Patron's account is restricted
760
761                    [% IF ( userdebarreddate ) %]
762                        until [% userdebarreddate | $KohaDates %]
763                    [% END %]
764
765                    [% IF ( debarredcomment ) %]
766                        with the explanation: <br/><i>
767                            [% IF debarredcomment.search('OVERDUES_PROCESS') %]
768                                Restriction added by overdues process [% debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %]
769                            [% ELSE %]
770                                [% debarredcomment | html_line_break %]
771                            [% END %]
772                     </i>
773                    [% END %]
774                    <br/>
775                    <a class="btn btn-small" href="#reldebarments" onclick="$('#debarments-tab-link').click()"><i class="fa fa-ban"></i> View restrictions</a>
776                     [% IF (noissues && borrowernumber && CAN_user_circulate_force_checkout) %]
777                         <span class="override_debarment">
778                             <a href="/cgi-bin/koha/circ/circulation.pl?forceallow=1&amp;borrowernumber=[% borrowernumber %]" class="btn btn-small">Override restriction temporarily</a>
779                         </span>
780                     [% END %]
781                </li>
782             [% END %]
783
784                 [% IF ( odues ) %]<li>[% IF ( nonreturns ) %]<span class="circ-hlt">Overdues: Patron has ITEMS OVERDUE.</span> <a href="#checkouts">See highlighted items below</a>[% END %]</li>
785             [% END %]
786
787             [% IF ( charges ) %]
788                 [% INCLUDE 'blocked-fines.inc'
789                     fines = chargesamount
790                 %]
791             [% END %]
792
793             [% IF ( charges_guarantees ) %]
794                 <li>
795                     <span class="circ-hlt">Fees &amp; Charges:</span> Patron's guarantees collectively owe [% chargesamount_guarantees %].
796                         [% IF ( charges_guarantees_is_blocker ) %]
797                             <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
798                         [% END %]
799                 </li>
800             [% END %]
801
802
803             [% IF ( credits ) %]
804                 <li>
805                     <span class="circ-hlt">Credits:</span> Patron has a credit[% IF ( creditsamount ) %] of [% creditsamount %][% END %]
806                 </li>
807             [% END %]
808
809                         </ul>
810         </div>
811
812             [% IF WaitingHolds.count %]
813                 <div id="holdswaiting" class="circmessage">
814                     <h4>Holds waiting:</h4>
815                     [% FOREACH w IN WaitingHolds %]
816                         <ul>
817                             <li>
818                                 <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% w.biblio.biblionumber %]">[% w.biblio.title | html %]</a>
819                                 ([% ItemTypes.GetDescription( w.item.effective_itemtype ) %]),
820                                 [% IF ( w.biblio.author ) %] by [% w.biblio.author | html %] [% END %]
821                                 [% IF ( w.item.itemcallnumber ) %] [[% w.item.itemcallnumber %]] [% END %]
822                                 Hold placed on [% w.reservedate | $KohaDates %].
823
824                                 <br/>
825                                 [% IF ( w.branch.branchcode == Branches.GetLoggedInBranchcode()  ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]
826                                     [% SET waiting_expires_on = w.waiting_expires_on %]
827                                     Waiting at [% w.branch.branchname | html %] [% IF waiting_expires_on %] until [% waiting_expires_on | $KohaDates %] [% END %]
828                                 </strong>
829                             </li>
830                         </ul>
831                     [% END %]
832                 </div>
833             [% END %]
834
835         [% IF ( notes ) %]
836                         <div id="circnotes" class="circmessage">
837                         <h4>Notes:</h4>
838             <p><span class="circ-hlt">[% notesmsg %]</span></p>
839                         </div>
840
841
842     <!-- /If notes -->[% END %]
843
844     <div id="messages" class="circmessage">
845         <h4>Messages:</h4>
846         <ul>
847             [% FOREACH message IN librarian_messages %]
848                 <li>
849                     <span class="circ-hlt">
850                         [% message.message_date | $KohaDates %]
851                         [% Branches.GetName( message.branchcode ) %]
852                         <i>"[% message.message %]"</i>
853                     </span>
854                     [% IF message.branchcode == branch OR Koha.Preference('AllowAllMessageDeletion') %]
855                         [<a href="/cgi-bin/koha/circ/del_message.pl?message_id=[% message.message_id %]&amp;borrowernumber=[% message.borrowernumber %]" onclick="return confirm(MSG_CONFIRM_DELETE_MESSAGE);"><i class="fa fa-trash"></i> Delete</a>]
856                     [% END %]
857                 </li>
858             [% END %]
859             [% FOREACH message IN patron_messages %]
860                 <li><span class="">[% message.message_date | $KohaDates %] [% Branches.GetName( message.branchcode )%] <i>"[% message.message %]"</i></span>
861                 [% IF message.branchcode == branch OR Koha.Preference('AllowAllMessageDeletion') %]
862                     [<a href="/cgi-bin/koha/circ/del_message.pl?message_id=[% message.message_id %]&amp;borrowernumber=[% message.borrowernumber %]"><i class="fa fa-trash"></i> Delete</a>]
863                 [% END %]</li>
864             [% END %]
865         </ul>
866         <a id="addnewmessageLabel" href="#add_message_form" data-toggle="modal"><i class="fa fa-plus"></i> Add a new message</a>
867     </div>
868
869 </div>
870 </div>
871
872 <div class="yui-g"><div id="patronlists" class="toptabs">
873
874 <ul>
875     <li>
876         [% IF ( issuecount ) %]
877             <a href="#checkouts">[% issuecount %] Checkout(s)</a>
878         [% ELSE %]
879             <a href="#checkouts">0 Checkouts</a>
880         [% END %]
881     </li>
882
883     [% IF relatives_issues_count %]
884         <li><a id="relatives-issues-tab" href="#relatives-issues">Relatives' checkouts</a></li>
885     [% END %]
886
887     <li>
888         [% IF ( holds_count ) %]
889             <a href="#reserves" id="holds-tab">[% holds_count %] Hold(s)</a>
890         [% ELSE %]
891             <a href="#reserves" id="holds-tab">0 Holds</a>
892         [% END %]
893
894     <li><a id="debarments-tab-link" href="#reldebarments">[% debarments.size %] Restrictions</a></li>
895 </ul>
896
897 <!-- SUMMARY : TODAY & PREVIOUS ISSUES -->
898
899 [% INCLUDE "checkouts-table.inc" %]
900
901 [% IF ( relatives_issues_count ) %]
902     <div id="relatives-issues">
903         <table id="relatives-issues-table">
904             <thead>
905                 <tr>
906                     <th scope="col">Due date (unformatted, hidden)</th>
907                     <th scope="col">Due date</th>
908                     <th scope="col">Title</th>
909                     <th scope="col">Item type</th>
910                     <th scope="col">Location</th>
911                     <th scope="col">Checked out on</th>
912                     <th scope="col">Checked out from</th>
913                     <th scope="col">Call no</th>
914                     <th scope="col">Charge</th>
915                     <th scope="col">Fine</th>
916                     <th scope="col">Price</th>
917                     <th scope="col">Patron</th>
918                 </tr>
919             </thead>
920         </table>
921     </div>
922 [% END %]
923
924 [% INCLUDE borrower_debarments.inc %]
925
926 <div id="reserves">
927 [% IF ( holds_count ) %]
928     <form action="/cgi-bin/koha/reserve/modrequest.pl" method="post">
929         <input type="hidden" name="from" value="circ" />
930         <table id="holds-table" style="width: 100% !Important;">
931             <thead>
932                 <tr>
933                     <th>Hold date</th>
934                     <th>Title</th>
935                     <th>Call number</th>
936                     <th>Barcode</th>
937                     <th>Pickup at</th>
938                     <th>Expiration</th>
939                     <th>Priority</th>
940                     <th>Delete?</th>
941                     <th>Suspend?</th>
942                 </tr>
943             </thead>
944         </table>
945
946         <fieldset class="action">
947             <input type="submit" class="cancel" name="submit" value="Cancel marked holds" />
948         </fieldset>
949     </form>
950
951     [% IF SuspendHoldsIntranet %]
952     <fieldset class="action">
953         <form action="/cgi-bin/koha/reserve/modrequest_suspendall.pl" method="post">
954             <input type="hidden" name="from" value="circ" />
955             <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
956             <input type="submit" value="Suspend all holds" />
957
958             [% IF AutoResumeSuspendedHolds %]
959             <label for="suspend_until">until</label>
960             <input type="text" size="10" id="suspend_until" name="suspend_until datepicker" />
961             <span class="hint">Specify date on which to resume [% INCLUDE 'date-format.inc' %]: </span>
962              [% END %]
963         </form>
964     </fieldset>
965
966     <fieldset class="action">
967         <form action="/cgi-bin/koha/reserve/modrequest_suspendall.pl" method="post">
968             <input type="hidden" name="from" value="circ" />
969             <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
970             <input type="hidden" name="suspend" value="0" />
971             <input type="submit" value="Resume all suspended holds" />
972         </form>
973     </fieldset>
974     [% END # IF SuspendHoldsIntranet %]
975
976 [% ELSE %]
977         <p>Patron has nothing on hold.</p>
978 [% END %]
979 </div> <!-- reservesloop -->
980
981 [% ELSIF borrowernumber %]
982     <div class="dialog message">This patron does not exist. <a href="/cgi-bin/koha/members/members-home.pl">Find another patron?</a></div>
983 [% END %] <!-- borrowernumber and borrower-->
984 </div></div>
985 [% END %]
986
987 </div>
988 </div>
989 [% UNLESS ( borrowers ) %][% IF borrowernumber and borrower %]<div class="yui-b">
990 [% INCLUDE 'circ-menu.inc' %]
991 </div>[% END %][% END %]
992 </div>
993 <!-- Modal -->
994 <div id="barcodeSubmittedModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="barcodeSubmittedModalLabel" aria-hidden="true">
995     <div class="modal-header">
996         <h3 id="barcodeSubmittedModalLabel">Barcode submitted</h3>
997     </div>
998
999     <div class="modal-body">
1000         <p>You have already submitted a barcode, please wait for the checkout to process...</p>
1001     </div>
1002 </div>
1003 [% INCLUDE 'intranet-bottom.inc' %]