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