Bug 23039: Hold found modal on checkin screen ( circulation.pl ) obscures Check in...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / returns.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE Koha %]
6 [% USE Borrowers %]
7 [% USE ItemTypes %]
8 [% USE AuthorisedValues %]
9 [% USE ColumnsSettings %]
10 [% SET footerjs = 1 %]
11 [% BLOCK display_bormessagepref %]
12     [% IF ( bormessagepref ) %]
13         <li class="notification_method">Patron notification:
14             [% FOREACH mtt IN bormessagepref.keys %]
15                 [%~ IF ( mtt == 'email' ) %] Email[% END ~%]
16                 [%~ IF ( mtt == 'phone' ) %] Phone[% END ~%]
17                 [%~ IF ( mtt == 'sms' ) %] SMS[% END ~%]
18                 [%~ UNLESS loop.last %], [% ELSE %].[% END ~%]
19             [% END %]
20         </li>
21            [% ELSE %]
22         <li class="notification_method none">Patron is not notified.</li>
23     [% END %]
24 [% END %]
25
26 [% BLOCK display_holdpatron_address %]
27     [% IF Koha.Preference( 'AddressFormat' ) %]
28         [% INCLUDE "member-display-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
29     [% ELSE %]
30         [% INCLUDE 'member-display-address-style-us.inc' %]
31     [% END %]
32 [% END %]
33
34 [% INCLUDE 'doc-head-open.inc' %]
35 <title>Koha &rsaquo; Circulation &rsaquo; Check in [% title | html %]</title>
36 [% INCLUDE 'doc-head-close.inc' %]
37 </head>
38
39 <body id="circ_returns" class="circ">
40     <span class="audio-alert-success"></span>
41
42     [% INCLUDE 'header.inc' %]
43     [% INCLUDE 'checkin-search.inc' %]
44
45     <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; Check in</div>
46
47     <div class="main container-fluid">
48         <div class="row">
49             <div class="col-sm-12">
50                 <main>
51                     <div class="row">
52
53                         [% IF Koha.Preference('CircSidebar') %]
54                             <div class="col-sm-10 col-sm-push-2">
55                         [% ELSE %]
56                             <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
57                         [% END %]
58
59                         [% BLOCK all_checkin_messages %]
60                             [% IF hold_auto_filled %]
61                                 <div class="dialog alert hold-auto-filled">
62                                     [% IF ( reservenotes ) %]
63                                         <h4>Notes: [% reservenotes | html %]</h4>
64                                     [% END %]
65                                     <h3>Hold filled for:</h3>
66                                     <ul>
67                                         <li>
68                                             [% INCLUDE 'patron-title.inc' patron=patron %]
69                                             <span class="patron-category"> - [% patron.category.description | html %]</span>
70                                         </li>
71
72                                         [% INCLUDE display_holdpatron_address %]
73
74                                         [% IF ( patron.phone ) %]
75                                             <li>[% patron.phone | html %]</li>
76                                         [% END %]
77
78                                         [% IF ( patron.email ) %]
79                                             <li>
80                                                 [% IF ( transfertodo ) %]
81                                                     [% patron.email | html %]
82                                                 [% ELSE %]
83                                                     <a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a>
84                                                 [% END %]
85                                             </li>
86                                         [% END %]
87
88                                         [% UNLESS ( transfertodo) %]
89                                             [% INCLUDE display_bormessagepref %]
90                                         [% END %]
91
92                                         [% IF ( patron.debarred ) %]
93                                             <li class="error">Patron is RESTRICTED</li>
94                                         [% END %]
95
96                                         [% IF ( patron.gonenoaddress ) %]
97                                             <li class="error">Patron's address is in doubt</li>
98                                         [% END %]
99                                     </ul>
100
101                                     [% IF ( transfertodo ) %]
102                                         <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
103                                     [% ELSE %]
104                                         <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
105                                     [% END %]
106
107                                     <a href="#" class="btn btn-default print print-slip">
108                                         <i class="fa fa-print"></i> Print
109                                     </a>
110                                 </div> <!-- /.hold-auto-filled -->
111                             [% END # /IF hold_auto_filled %]
112
113                             [% IF privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %]
114                                 <div class="dialog alert">
115                                     <strong>Error:</strong>
116                                     This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect.
117                                 </div>
118                             [% ELSIF NOT Koha.Preference('AnonymousPatron') AND Koha.Preference('OPACPrivacy') %]
119                                 <div class="dialog alert">
120                                     <strong>Error:</strong>
121                                     The system preference OPACPrivacy is set but AnonymousPatron is not! Please correct this before continuing circulation.
122                                 </div>
123                             [% END %]
124
125                             [% IF additional_materials %]
126                                 <div class="dialog message" id="materials">
127                                     Note about the accompanying materials: <br />
128                                     [% additional_materials | html %]
129                                 </div>
130                             [% END %]
131
132                             [% IF ( collectionItemNeedsTransferred ) %]
133                                  <div id="rotating-collection" class="dialog message">
134                                     <h3>Please transfer item to: [% Branches.GetName( collectionBranch ) | html %]</h3>
135                                     <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% itembarcode | html %]: [% title | html %]</a></p>
136                                     <p>This item is part of a rotating collection.</p>
137                                     <p><button type="button" class="openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;branchcode=[% collectionBranch | html %]&amp;op=slip"><i class="fa fa-print"></i> Print slip</button></p>
138                                 </div>
139                             [% END %]
140
141                             <!-- Patron has added an issue note -->
142                             [% IF ( issue.note) %]
143                                 <div class="dialog message">
144                                     <h1>Patron note</h1>
145                                     <p>[% issue.notedate | $KohaDates %]</p>
146                                     <p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% itembiblionumber | uri %]"> [% title | html %]</a> [% author | html %]</p>
147                                     <p>[% issue.note | html %]</p>
148                                 </div>
149                             [% END %]
150
151                             <!-- Patron has fines -->
152                             [% IF ( fines ) %]
153                                 <div class="dialog alert">
154                                     <h3>Patron has outstanding fines of [% fines | html %].</h3>
155                                     <p><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% fineborrowernumber | uri %]">Make payment</a>.</p>
156                                 </div>
157                             [% END %]
158
159                             <!-- Patron has waiting holds -->
160                             [% IF ( waiting_holds ) %]
161                                 <div id="awaiting-pickup" class="dialog message">
162                                     <h3>[% holdsfirstname | html %] [% holdssurname | html %] has [% waiting_holds | html %] hold(s) waiting for pickup.</h3>
163                                     <p><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% holdsborrowernumber | uri %]">Check out to this patron</a>.</p>
164                                 </div>
165                             [% END %]
166
167                             <!-- Patron is restricted and checkin was backdated -->
168                             [% IF return_date_was_overriden && Borrowers.IsDebarred( borrower ) %]
169                                 <div id="restricted_backdated" class="dialog message">
170                                     <h3>
171                                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">
172                                             [% patron.firstname | html %] [% patron.surname | html %]
173                                         </a>
174                                         is restricted. Please verify this patron should still be restricted.
175                                     </h3>
176                                 </div>
177                             [% END %]
178
179
180                             [% IF ( errmsgloop ) %]
181                                 <div class="dialog alert audio-alert-warning">
182                                     <h3>Check in message</h3>
183                                     [% IF itembiblionumber %]
184                                         <p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% itembarcode | html %]: [% title | html %]</a></p>
185                                     [% END %]
186                                     [% FOREACH errmsgloo IN errmsgloop %]
187                                         [% IF ( errmsgloo.NotForLoanStatusUpdated ) %]
188                                             <p class="problem">
189                                                 Not for loan status updated.
190                                                 <br />Old value:
191                                                 [% IF errmsgloo.NotForLoanStatusUpdated.from %]
192                                                     [% AuthorisedValues.GetByCode( 'NOT_LOAN', errmsgloo.NotForLoanStatusUpdated.from ) | html %].
193                                                 [% ELSE %]
194                                                     Available for loan.
195                                                 [% END %]
196                                                 <br />New value:
197                                                 [% IF errmsgloo.NotForLoanStatusUpdated.to %]
198                                                     [% AuthorisedValues.GetByCode( 'NOT_LOAN', errmsgloo.NotForLoanStatusUpdated.to ) | html %].
199                                                 [% ELSE %]
200                                                     Available for loan.
201                                                 [% END %]
202                                             </p>
203                                         [% END %]
204                                         [% IF ( errmsgloo.ItemLocationUpdated ) %]
205                                              <p class="problem">
206                                                  Item shelving location updated.
207                                                 <br />Old value:
208                                                 [% IF errmsgloo.ItemLocationUpdated.from %]
209                                                     [% IF errmsgloo.ItemLocationUpdated.from == '' %]
210                                                         empty
211                                                     [% ELSIF AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.from ) == '' %]
212                                                         [% errmsgloo.ItemLocationUpdated.from | html %] (No description available)
213                                                     [% ELSE %]
214                                                         [% AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.from ) | html %]
215                                                     [% END %]
216                                                 [% ELSE %]
217                                                     "Blank"
218                                                 [% END %]
219                                                 <br />New value:
220                                                 [% IF errmsgloo.ItemLocationUpdated.to %]
221                                                     [% IF errmsgloo.ItemLocationUpdated.to == '' %]
222                                                         empty
223                                                     [% ELSIF AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.to ) == '' %]
224                                                         [% errmsgloo.ItemLocationUpdated.to | html %] (Not an authorized value)
225                                                     [% ELSE %]
226                                                         [% AuthorisedValues.GetByCode( 'LOC', errmsgloo.ItemLocationUpdated.to ) | html %]
227                                                     [% END %]
228                                                 [% ELSE %]
229                                                     "Blank"
230                                                 [% END %]
231                                              </p>
232                                         [% END %]
233                                         [% IF ( errmsgloo.badbarcode ) %]
234                                             <p class="problem">No item with barcode: [% errmsgloo.msg | html %]</p>
235                                         [% END %]
236                                         [% IF ( errmsgloo.ispermanent ) %]
237                                             <p class="problem">Please return item to: [% Branches.GetName( errmsgloo.msg ) | html %]</p>
238                                         [% END %]
239                                         [% IF ( errmsgloo.notissued ) %]
240                                             <p class="problem">Not checked out.</p>
241                                         [% END %]
242                                         [% IF ( errmsgloo.localuse) %]
243                                             <p class="problem">Local use recorded</p>
244                                         [% END %]
245                                         [% IF ( errmsgloo.waslost ) %]
246                                             [% IF Koha.Preference('BlockReturnOfLostItems') %]
247                                                 <p class="problem">Item is lost, cannot be checked in.</p>
248                                             [% ELSE %]
249                                                 <p class="problem">Item was lost, now found.</p>
250                                             [% END %]
251                                             [% IF LostItemFeeRefunded and not Koha.Preference('BlockReturnOfLostItems') %]
252                                                 <p class="problem">A refund has been applied to the borrowing patron's account.</p>
253                                             [% ELSIF Koha.Preference('BlockReturnOfLostItems') %]
254                                                <h5>Cannot check in</h5>
255                                                <p><strong>NOT CHECKED IN</strong></p>
256                                             [% ELSE %]
257                                                 <p class="problem">Any lost item fees for this item will remain on the patron's account.</p>
258                                             [% END %]
259                                         [% END %]
260                                         [% IF ( errmsgloo.withdrawn ) %]
261                                             [% IF Koha.Preference('BlockReturnOfWithdrawnItems') %]
262                                                <h5>Cannot check in</h5>
263                                                <p><strong>NOT CHECKED IN</strong></p>
264                                             [% END %]
265                                            <p class="problem">Item is withdrawn.</p>
266                                         [% END %]
267                                         [% IF ( errmsgloo.debarred ) %]
268                                             <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber | uri %]">[% errmsgloo.debarname | html %]([% errmsgloo.debarcardnumber | html %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %].</p>
269                                         [% END %]
270                                         [% IF ( errmsgloo.prevdebarred ) %]
271                                             <p class="problem"><b>Reminder: </b>Patron was earlier restricted until [% errmsgloo.prevdebarred | $KohaDates %].</p>
272                                         [% END %]
273                                         [% IF ( errmsgloo.foreverdebarred ) %]
274                                             <p class="problem"><b>Reminder: </b>Patron has an indefinite restriction.</p>
275                                         [% END %]
276
277                                         [% IF errmsgloo.data_corrupted %]
278                                             <p class="problem">The item has not been checked in due to a configuration issue in your system. You must ask an administrator to take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo">about page</a> and search for the "data problems" section</p>
279                                         [% END %]
280                                     [% END # /FOREACH errmsgloo %]
281                                 </div> <!-- /.dialog.dialog-alert -->
282                             [% END #/IF errmsgloop %]
283
284                             [% IF ( checkinmsg ) %]
285                                 [% IF ( checkinmsgtype == 'alert' ) %]
286                                     <div class="dialog alert">
287                                 [% ELSE %]
288                                     <div class="dialog message">
289                                 [% END %]
290                                         <p class="problem">[% checkinmsg | html_line_break %]</p>
291                                     </div>
292                             [% END # /IF checkinmsg %]
293                         [% END # /BLOCK all_checkin_messages %]
294
295                         [% IF wrongbranch %]
296                             <div id="wrong-branch-modal" class="modal fade audio-alert-action">
297                                 <div class="modal-dialog">
298                                     <div class="modal-content">
299                                         <form method="post" action="returns.pl" name="mainform" id="mainform">
300                                             <div class="modal-header">
301                                                 <h3>
302                                                     Cannot check in
303                                                 </h3>
304                                             </div>
305                                             <div class="modal-body">
306                                                 <p>
307                                                     <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">
308                                                         [% itembarcode | html %]: [% title | html %]
309                                                     </a>
310                                                 </p>
311                                                 <p>
312                                                     <strong>
313                                                         NOT CHECKED IN
314                                                     </strong>
315                                                 </p>
316                                                 <p>
317                                                     This item must be checked in at following library:
318                                                     <strong>
319                                                         [% Branches.GetName( rightbranch ) | html %]
320                                                     </strong>
321                                                 </p>
322                                                 [% INCLUDE all_checkin_messages %]
323                                             </div> <!-- /.modal-body -->
324                                             <div class="modal-footer">
325                                                 <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
326                                             </div>
327                                         </form> <!-- /#mainform -->
328                                     </div> <!-- /.modal-content -->
329                                 </div> <!-- /.modal-dialog -->
330                             </div> <!-- /#wrong-branch-modal -->
331                         [% END # /IF wrongbranch %]
332
333                         <!-- case of a mistake in transfer loop -->
334
335                         [% IF WrongTransfer && !transfertodo %]
336                             <div id="wrong-transfer-modal" class="modal fade audio-alert-action">
337                                 <div class="modal-dialog">
338                                     <div class="modal-content">
339                                         <div class="modal-header">
340                                             <h3>
341                                                 Please return item to: [% Branches.GetName( TransferWaitingAt ) | html %]
342                                             </h3>
343                                         </div>
344                                         <div class="modal-body">
345                                             <p>
346                                                 <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">
347                                                     [% itembarcode | html %]: [% title | html %]
348                                                 </a>
349                                             </p>
350                                             [% INCLUDE all_checkin_messages %]
351                                         </div>
352                                         <div class="modal-footer">
353                                             <!-- CONFIRM -->
354                                             <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
355                                             <!-- PRINT SLIP -->
356                                             <button type="button" data-dismiss="modal" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;&amp;branchcode=[% TransferWaitingAt | html %]&amp;op=slip"><i class="fa fa-print"></i> Print transfer slip</button>
357                                             <!-- CANCEL TRANSFER -->
358                                             <form method="post" action="returns.pl" name="mainform">
359                                                 <button class="btn btn-default deny" type="submit"><i class="fa fa-times"></i> Cancel transfer</button>
360                                                 <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
361                                                 <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
362                                                 <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
363                                                 <input type="hidden" name="canceltransfer" value="1" />
364                                                 [% FOREACH inputloo IN inputloop %]
365                                                     <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
366                                                     <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
367                                                     <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
368                                                 [% END %]
369                                             </form> <!-- /mainform -->
370                                         </div> <!-- /.modal-footer -->
371                                     </div> <!-- /.modal-content -->
372                                 </div> <!-- /.modal-dialog -->
373                             </div> <!-- /#wrong-transfer-modal -->
374                         [% END # /IF WrongTransfer && !transfertodo %]
375
376                         [% IF ( found ) %]
377                             [% IF ( waiting ) %]
378                                 <div id="hold-found1" class="modal fade audio-alert-action">
379                                     <div class="modal-dialog">
380                                         <div class="modal-content">
381                                             <form method="post" action="returns.pl" class="confirm">
382                                                 <div class="modal-header">
383                                                     <h3>
384                                                         Hold found (item is already waiting):
385                                                         <br/>
386                                                         <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% title | html %]</a>
387                                                         <div class="hold-found-barcode">
388                                                             <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% itembiblionumber | uri %]&amp;itemnumber=[% itemnumber | uri %]">[% itembarcode | html %]</a>
389                                                         </div>
390                                                     </h3>
391                                                 </div>
392
393                                                 <div class="modal-body">
394                                                     [% IF ( reservenotes ) %]
395                                                         <h4>Notes: [% reservenotes | html %]</h4>
396                                                     [% END %]
397
398                                                     <h4>Hold for:</h4>
399                                                     <ul>
400                                                         <li>
401                                                             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.surname | html %], [% patron.firstname | html %]</a> ([% patron.cardnumber | html %])
402                                                             <span class="patron-category"> - [% patron.category.description | html %]</span>
403                                                         </li>
404                                                         [% INCLUDE display_holdpatron_address %]
405                                                         [% IF ( patron.phone ) %]
406                                                             <li> [% patron.phone | html %]</li>
407                                                         [% END %]
408
409                                                         [% IF ( patron.email ) %]
410                                                             <li><a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a></li>
411                                                         [% END %]
412
413                                                         [% IF ( patron.debarred ) %]
414                                                             <li class="error">Patron is RESTRICTED</li>
415                                                         [% END %]
416
417                                                         [% IF ( patron.gonenoaddress ) %]
418                                                             <li class="error">Patron's address is in doubt</li>
419                                                         [% END %]
420                                                     </ul>
421
422                                                     [% IF ( transfertodo ) %]
423                                                         <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
424                                                     [% ELSE %]
425                                                         <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
426                                                     [% END %]
427
428                                                     [% FOREACH inputloo IN inputloop %]
429                                                         <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
430                                                         <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
431                                                         <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
432                                                     [% END %]
433
434                                                     <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
435                                                     <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
436                                                     <input type="hidden" name="biblionumber" value="[% itembiblionumber | html %]" />
437                                                     <input type="hidden" name="reserve_id" value="[% reserve_id | html %]" />
438                                                     <input type="hidden" name="diffBranch" value="[% destbranch | html %]" />
439                                                     <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
440                                                     <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
441                                                     <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
442
443                                                     <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
444                                                     <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
445                                                     [% INCLUDE all_checkin_messages %]
446                                                 </div> <!-- /.modal-body -->
447
448                                                 <div class="modal-footer">
449                                                     <input type="hidden" name="cancel_reserve" value="0" />
450
451                                                     <button type="submit" class="btn btn-default approve" data-dismiss="modal">
452                                                         <i class="fa fa-check"></i> Confirm hold
453                                                     </button>
454
455                                                     <input type="hidden" name="print_slip" value="0" />
456                                                     <button type="submit" class="btn btn-default print">
457                                                         <i class="fa fa-print"></i> Print slip and confirm
458                                                     </button>
459
460                                                     <button type="submit" class="btn btn-default deny cancel-hold">
461                                                         <i class="fa fa-times"></i> Cancel hold
462                                                     </button>
463                                                 </div> <!-- /.modal-footer -->
464                                             </form> <!-- /.confirm -->
465                                         </div> <!-- /.modal-content -->
466                                     </div> <!-- /.modal-dialog -->
467                                 </div> <!-- /#hold-found1 -->
468                             [% END # /IF waiting %]
469
470                             [% IF transfer || needstransfer %]
471                                 <div id="item-transfer-modal" class="modal fade audio-alert-action">
472                                     <div class="modal-dialog">
473                                         <div class="modal-content">
474                                             <form method="post" action="returns.pl" name="mainform" id="mainform">
475                                                 <div class="modal-header">
476                                                     <h3>
477                                                         Please return this item to [% Branches.GetName( returnbranch ) | html %]
478                                                     </h3>
479                                                 </div>
480                                                 <div class="modal-body">
481                                                     <p>
482                                                         <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">
483                                                             [% itembarcode | html %]: [% title | html %]
484                                                         </a>
485                                                     </p>
486                                                     [% IF !transfer %]
487                                                         <p>
488                                                             Transfer now?
489                                                         </p>
490                                                     [% END %]
491                                                     <input type="hidden" name="tobranch" value="[% returnbranch | html %]" />
492                                                     <input type="hidden" name="transferitem" value="[% itemnumber | html %]" />
493                                                     <input type="hidden" name="barcode" value="0" />
494                                                     [% INCLUDE all_checkin_messages %]
495                                                 </div>
496                                                 <div class="modal-footer">
497                                                     [% IF !transfer %]
498                                                         <button type="submit" name="dotransfer" value="Yes" class="btn btn-default approve"><i class="fa fa-check"></i> Yes</button>
499                                                         <button type="submit" name="dotransfer" value="Yes" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;&amp;branchcode=[% returnbranch | html %]&amp;op=slip"><i class="fa fa-print"></i> Yes, print slip</button>
500                                                         <button type="button" data-dismiss="modal" class="btn btn-default deny" name="notransfer" value="No"><i class="fa fa-times"></i> No</button>
501                                                     [% ELSE %]
502                                                         <button type="button" data-dismiss="modal" class="btn btn-default approve"><i class="fa fa-check"></i> OK</button>
503                                                         <button type="button" data-dismiss="modal" name="dotransfer" class="btn btn-default print openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber | html %]&amp;branchcode=[% returnbranch | html %]&amp;op=slip"><i class="fa fa-print"></i> Print slip</button>
504                                                     [% END %]
505                                                     <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
506                                                     <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
507                                                     <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
508                                                     <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
509                                                     <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
510                                                     [% FOREACH inputloo IN inputloop %]
511                                                         <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
512                                                         <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
513                                                         <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
514                                                     [% END %]
515                                                 </div> <!-- /.modal-footer -->
516                                             </form> <!-- /#mainform -->
517                                         </div> <!-- /.modal-content -->
518                                     </div> <!-- /.modal-dialog -->
519                                 </div> <!-- /#item-transfer-modal -->
520                             [% END # /IF transfer || needstransfer %]
521
522                             <!-- case of simple return no issue or transfer but with a reservation  -->
523                             [% IF ( reserved ) %]
524                                 <!-- reserved -->
525                                 <div id="hold-found2" class="modal fade audio-alert-action">
526                                     <div class="modal-dialog">
527                                         <div class="modal-content">
528                                             <form method="post" action="returns.pl" class="confirm">
529                                                 <div class="modal-header">
530                                                     <h3>
531                                                         Hold found:
532                                                         <br/>
533                                                         <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber | uri %]">[% title | html %]</a>
534                                                         <div class="hold-found-barcode">
535                                                             (<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% itembiblionumber | uri %]&amp;itemnumber=[% itemnumber | uri %]">[% itembarcode | html %]</a>)
536                                                         </div>
537                                                     </h3>
538                                                 </div>
539
540                                                 <div class="modal-body">
541                                                     [% IF ( reservenotes ) %]
542                                                         <h4>Notes:</h4>
543                                                         <p>[% reservenotes | html %]</p>
544                                                         <hr />
545                                                     [% END %]
546                                                     <h5>Hold for:</h5>
547                                                     <ul>
548                                                         <li>
549                                                             [% INCLUDE 'patron-title.inc' patron=patron hide_patron_infos_if_needed=1 link_to="circulation_reserves" %]
550                                                             <span class="patron-category"> - [% patron.category.description | html %]</span>
551                                                         </li>
552
553                                                         [% INCLUDE display_holdpatron_address %]
554
555                                                         [% IF ( patron.phone ) %]
556                                                             <li>[% patron.phone | html %]</li>
557                                                         [% END %]
558
559                                                         [% IF ( patron.email ) %]
560                                                             <li>
561                                                                 [% IF ( transfertodo ) %]
562                                                                     [% patron.email | html %]
563                                                                 [% ELSE %]
564                                                                     <a id="boremail" href="mailto:[% patron.email | html %]">[% patron.email | html %]</a>
565                                                                 [% END %]
566                                                             </li>
567                                                         [% END %]
568
569                                                         [% UNLESS ( transfertodo) %]
570                                                             [% INCLUDE display_bormessagepref %]
571                                                         [% END %]
572
573                                                         [% IF ( patron.debarred ) %]
574                                                             <li class="error">Patron is RESTRICTED</li>
575                                                         [% END %]
576
577                                                         [% IF ( patron.gonenoaddress ) %]
578                                                             <li class="error">Patron's address is in doubt</li>
579                                                         [% END %]
580                                                     </ul>
581                                                     [% IF ( transfertodo ) %]
582                                                         <h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) | html %]</h4>
583                                                     [% ELSE %]
584                                                         <h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) | html %]</h4>
585                                                     [% END %]
586
587                                                     <input type="hidden" name="print_slip" value="0" />
588
589
590                                                     [% FOREACH inputloo IN inputloop %]
591                                                         <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
592                                                         <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
593                                                         <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
594                                                     [% END %]
595
596                                                     <input type="hidden" name="itemnumber" value="[% itemnumber | html %]" />
597                                                     <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
598                                                     <input type="hidden" name="biblionumber" value="[% itembiblionumber | html %]" />
599                                                     <input type="hidden" name="reserve_id" value="[% reserve_id | html %]" />
600                                                     <input type="hidden" name="diffBranch" value="[% destbranch | html %]" />
601                                                     <input type="hidden" name="exemptfine" value="[% exemptfine | html %]" />
602                                                     <input type="hidden" name="dropboxmode" value="[% dropboxmode | html %]" />
603                                                     <input type="hidden" name="forgivemanualholdsexpire" value="[% forgivemanualholdsexpire | html %]" />
604                                                     <input type="hidden" name="return_date_override" value="[% return_date_override | html %]" />
605                                                     <input type="hidden" name="return_date_override_remember" value="[% return_date_override_remember | html %]" />
606                                                     [% INCLUDE all_checkin_messages %]
607                                                 </div>
608
609                                                 <div class="modal-footer">
610                                                     [% IF ( transfertodo ) %]
611                                                         <button type="submit" class="btn btn-default approve">
612                                                             <i class="fa fa-check"></i> Confirm hold and transfer
613                                                         </button>
614                                                         <button type="submit" class="btn btn-default print">
615                                                             <i class="fa fa-print"></i> Print slip, transfer, and confirm
616                                                         </button>
617                                                     [% ELSE %]
618                                                         <button type="submit" class="btn btn-default approve">
619                                                             <i class="fa fa-check"></i> Confirm hold
620                                                         </button>
621                                                         <button type="submit" class="btn btn-default print">
622                                                             <i class="fa fa-print"></i> Print slip and confirm
623                                                         </button>
624                                                     [% END %]
625
626                                                     <button data-dismiss="modal" aria-hidden="true" type="submit" class="btn btn-default deny">
627                                                         <i class="fa fa-times"></i> Ignore
628                                                     </button>
629                                                 </div> <!-- /.modal-footer -->
630                                             </form> <!-- /.confirm -->
631                                         </div> <!-- /.modal-content -->
632                                     </div> <!-- /.modal-dialog -->
633                                 </div> <!-- /#hold-found2 -->
634                             [% END #/IF reserved %]
635                         [% END # /IF found %]
636
637                         <div class="static_checkin_messages" style="display:none">
638                             [% INCLUDE all_checkin_messages %]
639                         </div>
640
641                         <form id="checkin-form" method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off" >
642                             <fieldset id="circ_returns_checkin">
643                                 <div class="show_checkin_dialog" style="float:right;display:none"><button type="button" class="btn btn-default btn-sm" data-toggle="tooltip" title="Show the last checkin message"><i class="fa fa-info"></i></button></div>
644                                 <h3>Check in</h3>
645                                 <div class="row">
646                                     <div class="col-sm-6">
647                                         <div class="hint">Enter item barcode:</div>
648                                             <div class="form-control-group">
649                                                 [% IF ( exemptfine ) %]
650                                                     <input name="barcode" id="barcode" size="14" class="focus input-warning" type="text" />
651                                                 [% ELSIF ( dropboxmode ) %]
652                                                     <input name="barcode" id="barcode" size="14" class="barcode focus input-warning" />
653                                                 [% ELSE %]
654                                                     <input name="barcode" id="barcode" size="14" class="barcode focus" />
655                                                 [% END %]
656                                                 <button type="submit" class="btn btn-default">Check in</button>
657                                                 [% FOREACH inputloo IN inputloop %]
658                                                     <input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
659                                                     <input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
660                                                     <input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
661                                                 [% END %]
662                                             </div>
663                                         <div id="show-circ-settings">
664                                             <a href="#"><i class="fa circ-settings-icon fa-caret-down"></i> Checkin settings</a>
665                                         </div>
666                                     </div>
667                                     <div class="col-sm-6">
668                                         [% IF ( exemptfine ) %]
669                                             <div id="exemptfines" class="checkin-active-setting">
670                                         [% ELSE %]
671                                             <div id="exemptfines" class="checkin-active-setting" style="display:none;">
672                                         [% END %]
673                                             <p><i class="fa fa-check"></i> Fines for returned items are forgiven.</p>
674                                         </div>
675
676                                         [% IF ( forgivemanualholdsexpire ) %]
677                                             <div id="forgivemanualholdsexpire-alert" class="checkin-active-setting">
678                                         [% ELSE %]
679                                             <div id="forgivemanualholdsexpire-alert" class="checkin-active-setting" style="display:none;">
680                                         [% END %]
681                                                 <p><i class="fa fa-check"></i> Fines are not charged for manually cancelled holds.</p>
682                                             </div>
683
684                                         [% IF ( dropboxmode ) %]
685                                             <div id="dropboxmode" class="checkin-active-setting">
686                                         [% ELSE %]
687                                             <div id="dropboxmode" class="checkin-active-setting" style="display:none;">
688                                         [% END %]
689                                             <p><i class="fa fa-check"></i> Book drop mode. <span class="single-line">( Effective checkin date is [% dropboxdate | $KohaDates with_hours => 1 %] )</span></p>
690                                         </div>
691                                         [% IF ( return_date_override_remember ) %]
692                                             <div id="return_date_remember" class="checkin-active-setting">
693                                         [% ELSE %]
694                                             <div id="return_date_remember" class="checkin-active-setting" style="display:none;">
695                                         [% END %]
696                                             <p><i class="fa fa-check"></i> Saved check-in date: <span id="saved_return_date" class="single-line">[% return_date_override | html %]</span></p>
697                                         </div>
698                                     </div>
699                                 </div>
700
701                                 <div class="circ-settings">
702                                     [% IF Koha.Preference('SpecifyReturnDate') %]
703                                         <div class="date-select" id="return_date_override_fields">
704                                             <div class="hint">Specify return date [% INCLUDE 'date-format.inc' %]: </div>
705
706                                             <input type="text" size="13" id="return_date_override" name="return_date_override" value="[% return_date_override | html %]" />
707
708
709
710                                             <button type="button" class="action btn btn-default btn-xs" id="cleardate" name="cleardate">Clear</button>
711                                             <div class="circ-setting">
712                                                 [% IF ( return_date_override_remember ) %]
713                                                     <input type="checkbox" id="return_date_override_remember" name="return_date_override_remember" checked="checked" />
714                                                 [% ELSE %]
715                                                     <input type="checkbox" id="return_date_override_remember" name="return_date_override_remember" />
716                                                 [% END %]
717                                                 <label for="return_date_override_remember"> Remember due date for next check in</label>
718                                             </div>
719                                         </div> <!-- /.date-select -->
720                                     [% END %]
721
722                                     [% IF ( CAN_user_updatecharges_writeoff && overduecharges ) %]
723                                         <div id="forgive-overdue-fines" class="circ-setting">
724                                             [% IF ( exemptfine ) %]
725                                                 <input type="checkbox" id="exemptcheck" name="exemptfine" value="exemptfine" checked="checked" />
726                                             [% ELSE %]
727                                                 <input type="checkbox" id="exemptcheck" name="exemptfine" value="exemptfine" />
728                                             [% END %]
729                                             <label for="exemptcheck">Forgive overdue charges</label>
730                                         </div>
731                                     [% END %] <!-- overduecharges -->
732
733                                     <div id="book-drop-mode" class="circ-setting">
734                                         [% IF ( dropboxmode ) %]
735                                             <input type="checkbox" id="dropboxcheck" name="dropboxmode" value="dropboxmode" checked="checked" />
736                                         [% ELSE %]
737                                             <input type="checkbox" id="dropboxcheck" name="dropboxmode" value="dropboxmode" />
738                                         [% END %]
739                                         <label for="dropboxcheck">Book drop mode</label>
740                                     </div>
741
742                                     [% IF Koha.Preference('ExpireReservesMaxPickUpDelayCharge') %]
743                                         <div class="forgive-manual-hold-fees circ-setting">
744                                             [% IF ( forgivemanualholdsexpire ) %]
745                                                 <input type="checkbox" id="forgivemanualholdsexpire" name="forgivemanualholdsexpire" value="forgivemanualholdsexpire" checked="checked" />
746                                             [% ELSE %]
747                                                 <input type="checkbox" id="forgivemanualholdsexpire" name="forgivemanualholdsexpire" value="forgivemanualholdsexpire" />
748                                             [% END %]
749                                             <label for="forgivemanualholdsexpire">Forgive fees for manually expired holds</label>
750                                         </div>
751                                     [% END %] <!-- overduecharges -->
752
753                                 </div> <!-- /.circ-settings -->
754                             </fieldset> <!-- /#circ_returns_checkin -->
755                         </form> <!-- /#checkin-form -->
756
757                         [% IF ( riloop ) %]
758                             <h2>Checked-in items</h2>
759                             <table id="checkedintable">
760                                 <thead>
761                                     <tr>
762                                         <th class="ci-duedate">Due date</th>
763                                         <th class="ci-title">Title</th>
764                                         <th class="ci-author">Author</th>
765                                         <th class="ci-barcode">Barcode</th>
766                                         <th class="ci-homelibrary">Home library</th>
767                                         <th class="ci-holdinglibrary">Holding library</th>
768                                         <th class="ci-shelvinglocation">Shelving location</th>
769                                         <th class="ci-callnumber">Call number</th>
770                                         <th class="ci-dateaccessioned">Date acquired</th>
771                                         <th class="ci-type">Type</th>
772                                         <th class="ci-patron">Patron</th>
773                                         <th class="ci-note">Note</th>
774                                     </tr>
775                                 </thead>
776
777                                 [% FOREACH riloo IN riloop %]
778                                     <tr>
779                                         <td class="ci-duedate">
780                                             [% IF ( riloo.duedate ) %]
781                                                 [% IF ( riloo.return_overdue ) %]
782                                                     <span class="overdue">[% riloo.duedate | html %] (overdue)</span>
783                                                 [% ELSE %]
784                                                     [% riloo.duedate | html %]
785                                                 [% END %]
786                                             [% ELSE %]
787                                                 Not checked out
788                                             [% END %]
789                                         </td>
790                                         <td class="ci-title">
791                                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% riloo.itembiblionumber | uri %]">
792                                                 [% riloo.itemtitle | html %]
793                                                 [% FOREACH subtitle IN riloo.subtitle.split(' \\| ') %] <span class="subtitle">[% subtitle | html %]</span>[% END %]
794                                                 [% FOREACH part_number IN riloo.part_number.split(' \\| ') %] <span class="part_number">[% part_number | html %]</span>[% END %]
795                                                 [% FOREACH part_name IN riloo.part_name.split(' \\| ') %] <span class="part_name">[% part_name | html %]<span>[% END %]
796                                             </a>
797                                             [% IF ( riloo.enumchron ) %]
798                                                 <br/>
799                                                 <span class="item_enumeration" style="white-space: nowrap;">[% riloo.enumchron | html %]</span>
800                                             [% END %]
801                                         </td>
802                                         <td class="ci-author">[% riloo.itemauthor | html %]</td>
803                                         <td class="ci-barcode">
804                                             <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% riloo.itembiblionumber | uri %]&amp;itemnumber=[% riloo.itemnumber | uri %]#item[% riloo.itemnumber | uri %]">[% riloo.barcode | html %]</a>
805                                         </td>
806                                         <td class="ci-homelibrary">
807                                             [% Branches.GetName( riloo.homebranch ) | html %]
808                                         </td>
809                                         <td class="ci-holdinglibrary">
810                                             [% Branches.GetName( riloo.holdingbranch ) | html %]
811                                         </td>
812                                         <td class="ci-shelvinglocation">
813                                             <span class="shelvingloc">[% riloo.location | html %]</span>
814                                         </td>
815                                         <td class="ci-callnumber">
816                                             [% riloo.itemcallnumber | html %]
817                                         </td>
818                                         <td class="ci-dateaccessioned">
819                                             [% riloo.dateaccessioned | $KohaDates %]
820                                         </td>
821                                         <td class="ci-type">
822                                             [% ItemTypes.GetDescription( riloo.itemtype ) | html %] [% AuthorisedValues.GetByCode('CCODE', riloo.ccode) | html %]
823                                         </td>
824                                         <td class="ci-patron">
825                                             [% IF ( riloo.duedate ) %]
826                                                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% riloo.patron.borrowernumber | uri %]">
827                                                     [% riloo.patron.surname | html %], [% riloo.patron.firstname | html %] ([% riloo.patron.category.description | html %])
828                                                 </a>
829                                                 [% IF riloo.borissuescount %]
830                                                     <span class="results_summary nowrap">
831                                                         <span class="label">Checkouts:</span>
832                                                         <span class="number_box">
833                                                             <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% riloo.patron.borrowernumber | uri %]">[% riloo.borissuescount | html %]</a>
834                                                         </span>
835                                                     </span>
836                                                 [% END %]
837                                             [% ELSE %]
838                                                 Not checked out
839                                             [% END %]
840                                         </td>
841                                         <td class="ci-note">
842                                             [% IF ( riloo.patron.borrowernotes ) %]
843                                                 <p><span class="circ-hlt patron-note">[% riloo.patron.borrowernotes | html %]</span></p>
844                                             [% END %]
845                                             [% IF ( riloo.itemnote ) %]
846                                                 <p><span class="circ-hlt item-note-public">[% riloo.itemnote | html %]</span></p>
847                                             [% END %]
848                                             [% IF ( riloo.itemnotes_nonpublic ) %]
849                                                 <p><span class="circ-hlt item-note-nonpublic">[% riloo.itemnotes_nonpublic | html %]</span></p>
850                                             [% END %]
851                                         </td>
852                                     </tr>
853                                 [% END # /FOREACH riloo %]
854                             </table> <!-- /#checkedintable -->
855                         [% END # /IF riloop %]
856
857                     [% IF Koha.Preference('CircSidebar') %]
858                             </div> <!-- /.col-sm-10.col-sm-push-2 -->
859                             <div class="col-sm-2 col-sm-pull-10">
860                                 <aside>
861                                     [% INCLUDE 'circ-nav.inc' %]
862                                 </aside>
863                             </div> <!-- /.col-sm-2.col-sm-pull-10 -->
864                         </div> <!-- /.row -->
865                     [% ELSE %]
866                             </div> <!-- /.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 -->
867                         </div> <!-- /.row -->
868                     [% END %]
869
870                 </main>
871             </div> <!-- /.col-sm-12 -->
872         </div> <!-- /.row -->
873
874 [% MACRO jsinclude BLOCK %]
875     [% INCLUDE 'datatables.inc' %]
876     [% INCLUDE 'columns_settings.inc' %]
877     [% INCLUDE 'calendar.inc' %]
878     [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
879     [% Asset.js("js/pages/circulation.js") | $raw %]
880     [% INCLUDE 'timepicker.inc' %]
881
882     <script>
883         function Dopop(link) {
884             var newin = window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
885             $("#barcode").focus();
886         }
887         $(document).ready(function () {
888             $(".static_checkin_messages").show();
889             $(".modal").modal({ backdrop: 'static' }).on('shown.bs.modal', function() {
890                 $("#barcode").prop("disabled", true);
891                 $(".static_checkin_messages").hide();
892                 $(".show_checkin_dialog").show();
893             }).on('hidden.bs.modal', function() {
894                 $("#barcode").prop("disabled", false).focus();
895             });
896
897             $("body").on("click", ".show_checkin_dialog button", function(e){
898                 e.preventDefault();
899                 $(".modal").modal("show");
900             });
901
902             $(".print-slip").on('click', function(e) {
903                 e.preventDefault();
904                 Dopop('hold-transfer-slip.pl?borrowernumber=[% patron.borrowernumber | html %]&amp;biblionumber=[% biblionumber | html %]');
905             });
906
907             [% IF print_slip %]
908                 Dopop('hold-transfer-slip.pl?borrowernumber=[% borrowernumber | html %]&amp;biblionumber=[% biblionumber | html %]&amp;itemnumber=[% itemnumber | html %]');
909             [% END %]
910
911             var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'returns', 'checkedintable', 'json' ) | $raw %]
912             var returns_table = KohaTable("checkedintable", {
913                     "bFilter":false,
914                     "bPaginate":false,
915                     "bInfo":false,
916                     "bSort":false,
917                     "dom": 'B<"clearfix">t',
918                     }, columns_settings);
919
920             $("#return_date_override").datetimepicker({
921                 onClose: function(dateText, inst) {
922                     if (validate_date(dateText, inst) ) {
923                         $("#barcode").focus();
924                     }
925                 },
926                 defaultDate: -1,
927                 hour: 23,
928                 minute: 59,
929                 maxDate: 0
930             }).on("change", function(e, value) {
931                 if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
932             });
933             $("#return_date_override").on("blur", function() {
934                 check_valid_return_date();
935             });
936             $("#checkin-form").submit(function( event ) {
937                 if ( !check_valid_return_date() ) {
938                     event.preventDefault();
939                 }
940             });
941
942             function check_valid_return_date() {
943                 if ( $("#return_date_override").val() ) {
944                     var datetime = DateTime_from_syspref( $("#return_date_override").val() );
945                     var now = new Date();
946                     if ( !datetime || datetime > now ) {
947                         alert("Invalid return date/time!");
948                         $("#return_date_override").val("")
949                         return false;
950                     }
951                 }
952                 // Add saved date information to onscreen message, which
953                 // may or may not be hidden
954                 $("#saved_return_date").text( $("#return_date_override").val() );
955                 return true;
956             }
957
958             $("#exemptcheck").change(function () {
959                 if (this.checked == true) {
960                     $("#barcode").addClass("input-warning");
961                     $("#exemptfines").show();
962                 } else {
963                     $("#barcode").removeClass("input-warning");
964                     $("#exemptfines").hide();
965                 }
966                 $("#barcode").focus();
967             });
968             $("#dropboxcheck").change(function () {
969                 if (this.checked == true) {
970                     $("#barcode").addClass("input-warning");
971                     $("#dropboxmode").show();
972
973                     $("#return_date_override_fields :input").prop('disabled', true);
974                     $("#return_date_override").datetimepicker("disable");
975                 } else {
976                     $("#barcode").removeClass("input-warning");
977                     $("#dropboxmode").hide();
978
979                     $("#return_date_override_fields :input").prop('disabled', false);
980                     $("#return_date_override").datetimepicker("enable");
981                 }
982                 $("#barcode").focus();
983             });
984             $("#forgivemanualholdsexpire").change(function () {
985                 if (this.checked == true) {
986                     $("#barcode").addClass("input-warning");
987                     $("#forgivemanualholdsexpire-alert").show();
988                 } else {
989                     $("#barcode").removeClass("input-warning");
990                     $("#forgivemanualholdsexpire-alert").hide();
991                 }
992                 $("#barcode").focus();
993             });
994
995             [% IF(overduecharges) %]
996                 $("#barcode").focus(function () {
997                     if (($("#exemptcheck").prop("checked") == true) || ($("#dropboxcheck").prop("checked") == true)) {
998                         $("#barcode").addClass("input-warning");
999                     } else {
1000                         $("#barcode").removeClass("input-warning");
1001                     }
1002                 });
1003                 $("#barcode").blur(function () {
1004                     $("#barcode").removeClass("input-warning");
1005                 });
1006             [% END %]
1007
1008             $('.openWin').on("click",function(e){
1009                 Dopop( $(this).data("url") );
1010             });
1011
1012             $('.print').on("click",function(e){
1013                 this.form.print_slip.value = 1;
1014                 this.form.submit();
1015             });
1016
1017             $('.cancel-hold').on("click",function(e){
1018                 this.form.cancel_reserve.value = 1;
1019                 this.form.submit();
1020             });
1021
1022             $('.action').on("click",function(e){
1023                 this.checked = false;
1024                 this.form.return_date_override.value = '';
1025                 this.form.return_date_override_remember.checked = false;
1026                 this.form.barcode.focus();
1027                 $("#return_date_remember").hide();
1028                 return false;
1029             });
1030
1031             $("#return_date_override_remember").on("change", function(){
1032                 if( $(this).prop("checked" ) ){
1033                     if( $("#return_date_override").val() == "" ){
1034                         $("#saved_return_date").text( _("No date selected") );
1035                     } else {
1036                         $("#saved_return_date").text( $("#return_date_override").val() );
1037                     }
1038                     $("#return_date_remember").show();
1039                 } else {
1040                     $("#return_date_remember").hide();
1041                 }
1042             });
1043             $('[data-toggle="tooltip"]').tooltip();
1044         });
1045     </script>
1046 [% END %]
1047
1048 [% INCLUDE 'intranet-bottom.inc' %]