Bug 28805: (follow-up) Fix template logic error
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / circ / circulation_batch_checkouts.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% USE Koha %]
5 [% USE KohaDates %]
6 [% USE Price %]
7 [% USE AuthorisedValues %]
8 [% PROCESS 'i18n.inc' %]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 [% SET destination = "circ" %]
12 <title>[% FILTER collapse %]
13     [% IF patron %]
14         [% patron_in_title = INCLUDE 'patron-title.inc' invert_name = 1 no_html = 1 %]
15         [% tx("Batch check out to {patron}", { patron = patron_in_title }) | html %] &rsaquo;
16     [% END %]
17     [% t("Circulation") | html %] &rsaquo;
18     [% t("Koha") | html %]
19 [% END %]</title>
20 [% INCLUDE 'doc-head-close.inc' %]
21 </head>
22
23 <body id="circ_circulation_batch_checkouts" class="circ">
24
25 [% WRAPPER 'header.inc' %]
26     [% INCLUDE 'circ-search.inc' %]
27 [% END %]
28
29 [% WRAPPER 'sub-header.inc' %]
30     [% WRAPPER breadcrumbs %]
31         [% WRAPPER breadcrumb_item %]
32             <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
33         [% END %]
34         [% IF patron %]
35             [% WRAPPER breadcrumb_item %]
36                 <a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% borrowernumber | uri %]">Check out to [% INCLUDE 'patron-title.inc' %]</a>
37             [% END %]
38         [% END %]
39         [% WRAPPER breadcrumb_item bc_active= 1 %]
40             <span>Batch check out</span>
41         [% END %]
42     [% END #/ WRAPPER breadcrumbs %]
43 [% END #/ WRAPPER sub-header.inc %]
44
45 <div class="main container-fluid">
46     <div class="row">
47         [% IF patron %]
48             <div class="col-sm-10 col-sm-push-2">
49         [% ELSE %]
50             <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
51         [% END %]
52             <main>
53             <h1>Batch check out</h1>
54
55 [% IF patron %]
56 [% INCLUDE 'members-toolbar.inc' %]
57 [% END %]
58
59 [% IF patron and not batch_allowed %]
60   <div class="dialog alert">You are not allowed to use batch checkout for this patron</div>
61 [% ELSIF patron and noissues and not checkout_infos %]
62   <div class="dialog alert">
63       Cannot check out!
64       [% IF ( charges ) %]
65           [% INCLUDE 'blocked-fines.inc' fines = chargesamount %]
66       [% END %]
67       [% IF ( charges_guarantors_guarantees ) %]
68           <li>
69               <span class="circ-hlt">Charges:</span> Patron's guarantors and their other guarantees collectively owe [% charges_guarantors_guarantees | $Price %].
70               [% IF noissues %]
71                   <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
72               [% END %]
73           </li>
74       [% END %]
75       [% IF ( charges_guarantees ) %]
76           <li>
77               <span class="circ-hlt">Charges:</span> Patron's guarantees collectively owe [% chargesamount_guarantees | $Price %].
78               [% IF noissues %]
79                   <span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
80               [% END %]
81           </li>
82       [% END %]
83   </div>
84 [% ELSIF patron and not checkout_infos %]
85   <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/circ/circulation.pl">
86     <fieldset id="circ_circulation_issue">
87       <label for="barcode">Checking out to [% INCLUDE 'patron-title.inc' %]</label>
88       <fieldset class="rows">
89         <legend>Use a file</legend>
90         <ol>
91           <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
92         </ol>
93       </fieldset>
94       <fieldset class="rows">
95         <legend>Or list barcodes one by one</legend>
96         <ol>
97           <li>
98             <label for="barcodelist">Barcode list (one barcode per line): </label>
99             <textarea rows="10" cols="30" id="barcodelist" name="barcodelist"></textarea>
100           </li>
101         </ol>
102       </fieldset>
103       [% IF Koha.Preference('SpecifyDueDate') || Koha.Preference('OnSiteCheckouts') %]
104       <fieldset class="rows">
105           <ol>
106           [% IF Koha.Preference('SpecifyDueDate') %]
107           <legend>Due date</legend>
108             <li>
109               <label for="duedatespec">Hard due date: [% INCLUDE 'date-format.inc' %]</label>
110               <input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" class="flatpickr" data-flatpickr-enable-time="true"/>
111             </li>
112           [% END %]
113           [% IF Koha.Preference('OnSiteCheckouts') %]
114             <li>
115               <div id="onsite_checkout-select">
116                   <label for="onsite_checkout">On-site checkout:</label>
117                   <input type="checkbox" id="onsite_checkout" name="onsite_checkout" class="circ_setting"/>
118               </div>
119             </li>
120           [% END %]
121           </ol>
122       </fieldset>
123       [% END %]
124
125       <input type="hidden" name="op" value="show" />
126     </fieldset>
127
128     <fieldset class="action">
129         <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
130         <input type="hidden" name="branch" value="[% branch | html %]" />
131         <input type="hidden" name="batch" value="1" />
132         <input type="submit" class="btn btn-primary" value="Check out" />
133     </fieldset>
134   </form>
135
136 [% ELSIF patron %]
137   [% IF confirmation_needed && CAN_user_circulate_force_checkout %]
138     <h3>Batch checkout confirmation [% IF patron %] for [% INCLUDE 'patron-title.inc' invert_name = 1 %] [% END %]</h3>
139     <form method="post" action="/cgi-bin/koha/circ/circulation.pl" id="mainform" name="mainform" autocomplete="off">
140   [% ELSE %]
141     <h3>Batch checkout information [% IF patron.borrowernumber %] for [% INCLUDE 'patron-title.inc' invert_name = 1 %] |[% batch | html %]|[% END %]</h3>
142   [% END %]
143     <table id="checkout_infos">
144       <thead>
145         <tr>
146           [% IF confirmation_needed && CAN_user_circulate_force_checkout %]
147             <th class="NoSort"></th>
148           [% END %]
149           <th>Barcode</th>
150           <th class="anti-the">Title</th>
151           <th>Information</th>
152         </tr>
153       </thead>
154       <tbody>
155         [% FOR checkout_info IN checkout_infos %]
156           <tr>
157             [% IF confirmation_needed && CAN_user_circulate_force_checkout %]
158               <td>
159                 [% IF checkout_info.NEEDSCONFIRMATION %]
160                   <input type="checkbox" name="barcodes" value="[% checkout_info.barcode | html %]" checked="checked" />
161                 [% END %]
162               </td>
163             [% END %]
164             <td>[% checkout_info.barcode | html %]</td>
165             <td>
166                 [% INCLUDE 'biblio-title.inc' biblio=checkout_info.biblio link = 1 %] [% IF checkout_info.biblio.author %], by [% checkout_info.biblio.author | html %][% END %][% IF ( checkout_info.item.itemnotes ) %]- <span class="circ-hlt">[% checkout_info.item.itemnotes | $raw %]</span>[% END %] <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% checkout_info.biblio.biblionumber | uri %]&amp;itemnumber=[% checkout_info.item.itemnumber | uri %]#item[% checkout_info.item.itemnumber | uri %]">[% checkout_info.item.barcode | html %]</a>
167             </td>
168             <td>
169               [% IF checkout_info.NEEDSCONFIRMATION %]
170                 <ul class="fa-ul warn">
171                   [% IF checkout_info.AGE_RESTRICTION %]
172                       <li><i class="fa fa-li fa-warning"></i>Age restriction [% checkout_info.AGE_RESTRICTION | html %].</li>
173                   [% END %]
174                   [% IF checkout_info.RENEW_ISSUE %]
175                       <li><i class="fa fa-li fa-warning"></i>This item is currently checked out to this patron. Renew?</li>
176                   [% END %]
177                   [% IF checkout_info.RESERVE_WAITING %]
178                       <li><i class="fa fa-li fa-warning"></i>This item is waiting for another patron.</li>
179                   [% END %]
180                   [% IF checkout_info.TRANSFERRED %]
181                       <li><i class="fa fa-li fa-warning"></i>This item is on hold and being transferred for another patron.</li>
182                   [% END %]
183                   [% IF checkout_info.PROCESSING %]
184                       <li><i class="fa fa-li fa-warning"></i>This item is on hold and being processed for another patron.</li>
185                   [% END %]
186                   [% IF checkout_info.ISSUED_TO_ANOTHER %]
187                       <li><i class="fa fa-li fa-warning"></i>This item is checked out to another patron.
188                     [% IF CAN_user_circulate_force_checkout %]
189                       Check in and check out?
190                       [% END %]</li>
191                   [% END %]
192                   [% IF checkout_info.TOO_MANY %]
193                       <li><i class="fa fa-li fa-warning"></i>Too many checked out.</li>
194                   [% END %]
195                   [% IF checkout_info.BORRNOTSAMEBRANCH %]
196                       <li><i class="fa fa-li fa-warning"></i>This patron is from a different library ([% Branches.GetName( checkout_info.BORRNOTSAMEBRANCH ) | html %]).</li>
197                   [% END %]
198                   [% IF checkout_info.PATRON_CANT %]
199                       <li><i class="fa fa-li fa-warning"></i>This patron can't check out this item per library circulation policy.</li>
200                   [% END %]
201                   [% IF checkout_info.NOT_FOR_LOAN_FORCING %]
202                     [% IF checkout_info.itemtype_notforloan %]
203                         <li><i class="fa fa-li fa-warning"></i>Item type is normally not for loan.</li>
204                     [% ELSIF checkout_info.item_notforloan %]
205                       [% item_notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => checkout_info.item_notforloan ) %]
206                         <li><i class="fa fa-li fa-warning"></i>Item is normally not for loan [% IF item_notforloan_lib %]([% item_notforloan_lib | html %])[% END %].</li>
207                     [% END %]
208                   [% END %]
209                   [% IF checkout_info.USERBLOCKEDOVERDUE %]
210                       <li><i class="fa fa-li fa-warning"></i>Patron has [% checkout_info.USERBLOCKEDOVERDUE | html %] overdue item(s).</li>
211                   [% END %]
212                   [% IF checkout_info.ITEM_LOST %]
213                       <li><i class="fa fa-li fa-warning"></i>This item has been lost with a status of "[% checkout_info.ITEM_LOST | html %]."</li>
214                   [% END %]
215                   [% IF checkout_info.HIGHHOLDS %]
216                       <li><i class="fa fa-li fa-warning"></i>High demand item. Loan period shortened to [% checkout_info.HIGHHOLDS.duration | html %] days (due [% checkout_info.HIGHHOLDS.returndate | html %]).</li>
217                   [% END %]
218                   [% IF checkout_info.HIGHHOLDS %] <!-- FIXME -->
219                       <script>
220                           $(document).ready(function() {
221                               $("input[name=duedatespec]:hidden").val('[% checkout_info.HIGHHOLDS.returndate | html %]');
222                           });
223                       </script>
224                   [% END %]
225
226                   [% IF NOT checkout_info.IMPOSSIBLE && ( CAN_user_circulate_force_checkout || checkout_info.HIGHHOLDS ) && ( checkout_info.RESERVED || checkout_info.RESERVE_WAITING || checkout_info.TRANSFERRED || checkout_info.PROCESSING ) %] <!-- arbitrary choice, revert the hold is not possible-->
227                       <li><i class="fa fa-li fa-warning"></i>This item is on hold for another patron. The hold will be overridden, but not cancelled.</li>
228                   [% ELSIF checkout_info.RESERVED %]
229                       <li><i class="fa fa-li fa-warning"></i>This item is on hold for another patron.</li>
230                   [% END %]
231
232                   [% IF checkout_info.PREVISSUE %]
233                       <li>This item has previously been checked out to this patron.</li>
234                   [% END %]
235                 </ul>
236               [% END %]
237
238
239               [% IF checkout_info.alert.ITEM_LOST || checkout_info.alert.OTHER_CHARGES %]
240                 <ul class="info">
241                   [% IF checkout_info.alert.ITEM_LOST %]
242                       <li>This item has been lost with a status of "[% checkout_info.alert.ITEM_LOST | html %]."</li>
243                   [% END %]
244                   [% IF checkout_info.alert.OTHER_CHARGES %]
245                       <li>The patron has unpaid charges for holds, rentals etc of [% checkout_info.alert.OTHER_CHARGES | $Price %].</li>
246                   [% END %]
247                 </ul>
248               [% END %]
249
250               [% IF checkout_info.alert.RETURNED_FROM_ANOTHER %]
251                   <div class="dialog alert">Item was checked out to [% INCLUDE 'patron-title.inc' patron = checkout_info.alert.RETURNED_FROM_ANOTHER.patron %] and was returned automatically.</div>
252               [% END %]
253
254               [% IF checkout_info.IMPOSSIBLE %]
255                 <ul class="fa-ul error">
256                   [% IF checkout_info.STATS  %]
257                       <li><i class="fa fa-li fa-exclamation"></i>Local use recorded.</li>
258                   [% END %]
259
260                   [% IF checkout_info.NOT_FOR_LOAN %]
261                     [% IF checkout_info.itemtype_notforloan %]
262                        <li><i class="fa fa-li fa-exclamation"></i>Item type not for loan.</li>
263                     [% ELSIF checkout_info.item_notforloan %]
264                       [% item_notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => checkout_info.item_notforloan ) %]
265                         <li><i class="fa fa-li fa-exclamation"></i>Item not for loan [% IF item_notforloan_lib %]([% item_notforloan_lib | html %])[% END %].</li>
266                     [% END %]
267                   [% END %]
268                   [% IF checkout_info.WTHDRAWN %]
269                       <li><i class="fa fa-li fa-exclamation"></i>Item has been withdrawn.</li>
270                   [% END %]
271                   [% IF checkout_info.RESTRICTED %]
272                       <li><i class="fa fa-li fa-exclamation"></i>Item is restricted.</li>
273                   [% END %]
274                   [% IF checkout_info.GNA %]
275                       <li><i class="fa fa-li fa-exclamation"></i>Patron's address is in doubt.</li>
276                   [% END %]
277                   [% IF checkout_info.CARD_LOST %]
278                       <li><i class="fa fa-li fa-exclamation"></i>Patron's card is lost.</li>
279                   [% END %]
280                   [% IF checkout_info.DEBARRED %]
281                       <li><i class="fa fa-li fa-exclamation"></i>Patron is restricted.</li>
282                   [% END %]
283                   [% IF checkout_info.NO_MORE_RENEWALS %]
284                       <li><i class="fa fa-li fa-exclamation"></i>No more renewals possible.</li>
285                   [% END %]
286                   [% IF checkout_info.EXPIRED %]
287                       <li><i class="fa fa-li fa-exclamation"></i>Patron's card is expired.</li>
288                   [% END %]
289                   [% IF checkout_info.ITEMNOTSAMEBRANCH %]
290                       <li><i class="fa fa-li fa-exclamation"></i>This item belongs to [% Branches.GetName( checkout_info.itemhomebranch ) | html %] and cannot be checked out from this location.</li>
291                   [% END %]
292                   [% IF checkout_info.USERBLOCKEDREMAINING %]
293                       <li><i class="fa fa-li fa-exclamation"></i>Patron has had overdue items and is blocked for [% checkout_info.USERBLOCKEDREMAINING | html %] day(s).</li>
294                   [% END %]
295                   [% IF checkout_info.USERBLOCKEDOVERDUE %]
296                       <li><i class="fa fa-li fa-exclamation"></i>Checkouts are BLOCKED because patron has overdue items.</li>
297                   [% END %]
298                   [% IF checkout_info.TOO_MANY %]
299                       <li><i class="fa fa-li fa-exclamation"></i>Too many checked out.</li>
300                   [% END %]
301                   [% IF checkout_info.UNKNOWN_BARCODE %]
302                       <li><i class="fa fa-li fa-exclamation"></i>The barcode was not found [% checkout_info.barcode | html %].</li>
303                   [% END %]
304                   [% IF checkout_info.DEBT %]
305                       <li><i class="fa fa-li fa-exclamation"></i>The patron has a debt of [% checkout_info.DEBT | $Price %].</li> <!-- Need debt_confirmed -->
306                   [% END %]
307                 </p>
308               [% END %]
309
310               [% IF checkout_info.issue.date_due %]
311                 <li>Due on [% checkout_info.issue.date_due | $KohaDates as_due_date => 1 %]</li>
312               [% END %]
313             </td>
314           </tr>
315         [% END %]
316       </tbody>
317     </table>
318
319     [% IF confirmation_needed && CAN_user_circulate_force_checkout %]
320         <fieldset>
321             <legend>Please confirm checkout</legend>
322       <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
323       <input type="hidden" name="issueconfirmed" value="1" />
324       <input type="hidden" name="debt_confirmed" value="1" />
325       <input type="hidden" name="branch" value="[% branch | html %]" />
326       <input type="hidden" name="duedatespec" value="[% duedatespec | html %]" />
327       <input type="hidden" name="batch" value="1" />
328       <input type="hidden" name="onsite_checkout" value="[% onsite_checkout | html %]" />
329       <input type="submit" id="checkoutrenew" class="btn btn-primary" value="Checkout or renew" />
330         </fieldset>
331     </form>
332     [% END %]
333
334 [% ELSE %]
335     <div class="dialog message">This patron does not exist. <a href="/cgi-bin/koha/members/members-home.pl">Find another patron?</a></div>
336 [% END %]
337
338                   </main>
339                       </div> <!-- /.col-sm-10.col-sm-push-2 -->
340                       [% IF patron %]
341                           <div class="col-sm-2 col-sm-pull-10">
342                               <aside>
343                                   [% INCLUDE 'circ-menu.inc' %]
344                               </aside>
345                           </div> <!-- /.col-sm-2.col-sm-pull-10 -->
346                       [% END %]
347                   </div> <!-- /.row -->
348
349 [% MACRO jsinclude BLOCK %]
350     [% INCLUDE 'calendar.inc' %]
351     [% INCLUDE 'datatables.inc' %]
352     <script>
353         $(document).ready(function() {
354             if($('#barcodelist').length) {
355                 $('#barcodelist').focus();
356             } else if ($('#checkoutrenew').length) {
357                 $('#checkoutrenew').focus();
358             }
359             $("#checkout_infos").dataTable($.extend(true, {}, dataTablesDefaults, {
360                 "sDom": 't',
361                 "aaSorting": [],
362                 "aoColumnDefs": [
363                     { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
364                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
365                 ],
366                 "bPaginate": false
367             }));
368         });
369         // On-site batch checkout
370         function toggle_onsite_checkout(){
371             if ( $("#onsite_checkout").prop('checked') ) {
372                 const duedatespec_fp = document.querySelector("#duedatespec")._flatpickr;
373                 duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]");
374             };
375         };
376
377         $("#onsite_checkout").click(function(){
378             toggle_onsite_checkout();
379         });
380     </script>
381     [% INCLUDE 'str/members-menu.inc' %]
382     [% Asset.js("js/members-menu.js") | $raw %]
383 [% END %]
384
385 [% INCLUDE 'intranet-bottom.inc' %]