Bug 30992: Improve translatability for Waiting at|On hold
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reserve / request.tt
1 [% USE raw %]
2 [% USE To %]
3 [% USE Asset %]
4 [% USE JSON.Escape %]
5 [% USE Koha %]
6 [% USE Biblio %]
7 [% USE KohaDates %]
8 [% USE Branches %]
9 [% USE Categories %]
10 [% USE ItemTypes %]
11 [% USE AuthorisedValues %]
12 [% USE Price %]
13 [% USE TablesSettings %]
14 [% PROCESS 'i18n.inc' %]
15 [% SET footerjs = 1 %]
16 [% INCLUDE 'doc-head-open.inc' %]
17 [% SET libraries = Branches.all %]
18 [% SET categories = Categories.all.unblessed %]
19 [% SET columns = ['name', 'cardnumber', 'dateofbirth', 'category', 'branch', 'address', 'phone'] %]
20 [% PROCESS "patron-search.inc" %]
21 [% UNLESS ( multi_hold ) %]
22     <title>Place a hold on [% INCLUDE 'biblio-title-head.inc' %] &rsaquo; Holds &rsaquo; Circulation &rsaquo; Koha</title>
23 [% ELSE %]
24     <title>Confirm holds &rsaquo; Holds &rsaquo; Circulation &rsaquo; Koha</title>
25 [% END %]
26 [% INCLUDE 'doc-head-close.inc' %]
27 [% FILTER collapse %]
28     <style>
29         a.hold-arrow {
30             display:inline-block;
31             padding:3px;
32         }
33         a.hold-arrow:link,
34         a.hold-arrow:visited {
35             color: #538200;
36         }
37
38         a.hold-arrow:hover,
39         a.hold-arrow:active{
40             color: #75b700;
41         }
42
43         .hold-arrow:hover i,
44         .hold-arrow:active i {
45             border-color: #75b700;
46         }
47
48         a.cancel-hold {
49             display:inline-block;
50             padding:3px;
51         }
52
53         a.cancel-hold:link,
54         a.cancel-hold:visited{
55             color:#c00;
56             font-size:130%
57         }
58
59         .icon-move-hold-up::before {
60             content: "\f062";
61         }
62
63         .icon-move-hold-top {
64             border-top: 3px solid #538200;
65         }
66
67         .icon-move-hold-top::before {
68             content: "\f062";
69         }
70
71         .icon-move-hold-bottom {
72             border-bottom: 3px solid #538200;
73         }
74
75         .icon-move-hold-bottom::before {
76             content: "\f063";
77         }
78
79         .icon-move-hold-down::before {
80             content: "\f063";
81         }
82
83         .icon-unset-lowest::before {
84             content: "\f050";
85         }
86
87         .icon-set-lowest::before {
88             content: "\f04e";
89         }
90     </style>
91 [% END %]
92 </head>
93
94 <body id="circ_request" class="catalog">
95
96 [% INCLUDE 'header.inc' %]
97 [% INCLUDE 'circ-search.inc' %]
98
99 [% UNLESS ( multi_hold ) %]
100     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
101         <ol>
102             <li>
103                 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
104             </li>
105             <li>
106                 <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
107             </li>
108             <li>
109                 [% INCLUDE 'biblio-title.inc' link =1 %]
110             </li>
111             <li>
112                 <a href="#" aria-current="page">
113                     Place a hold
114                 </a>
115             </li>
116         </ol>
117     </nav>
118 [% ELSE %]
119     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
120         <ol>
121             <li>
122                 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
123             </li>
124             <li>
125                 <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
126             </li>
127             <li>
128                 [% IF ( patron ) %]
129                     <a href="#" aria-current="page">
130                         Place holds
131                     </a>
132                 [% ELSE %]
133                     [% IF clubcount %]
134                         <a href="#" aria-current="page">
135                             Search patrons or clubs
136                         </a>
137                     [% ELSE %]
138                         <a href="#" aria-current="page">
139                             Search patrons
140                         </a>
141                     [% END %]
142                 [% END %]
143             </li>
144         </ol>
145     </nav>
146 [% END # UNLESS multi_hold %]
147
148 <div class="main container-fluid">
149     <div class="row">
150         [% IF ( multi_hold || nobiblio ) # No sidebar menu when placing multiple holds or biblio not found %]
151             <div class="col-md-10 col-md-offset-1">
152         [% ELSE %]
153             <div class="col-sm-10 col-sm-push-2">
154         [% END %]
155
156         <main>
157             <h1>Holds</h1>
158
159             [% IF ( nobiblio ) %]
160                 <div class="dialog alert">
161                 [%IF (multi_hold) %]
162                     <strong>Cannot place hold:</strong> one or more records don't exist.
163                 [% ELSE %]
164                     <strong>Cannot place hold:</strong> this record doesn't exist.
165                 [% END %]
166                 </div>
167             [% END %]
168             [% IF ( noitems ) %]
169                 <div class="dialog alert">
170                 [%IF (multi_hold) %]
171                     <strong>Cannot place hold:</strong> one or more records without items attached.
172                 [% ELSE %]
173                     <strong>Cannot place hold:</strong> this record has no items attached.
174                 [% END %]
175                 </div>
176             [% END %]
177
178             [% IF ( messagetransfert ) %]
179                 <div class="dialog message">
180                     <h2>Hold found for ([% nextreservtitle | html %]), please transfer</h2>
181                     <p>Hold placed by : <strong> [% nextreservsurname | html %] [% nextreservfirstname | html %]</strong> at : <strong> [% branchname | html %] </strong>, Please transfer this item.
182                     </p>
183                     <form name="cancelReservewithtransfert" action="branchreserves.pl" method="post">
184                         <input type="submit" class="button" />
185                     </form>
186                 </div>
187             [% END %]
188
189             [% UNLESS ( multi_hold ) %]
190                 <h2>Place a hold on [% INCLUDE 'biblio-title.inc' link = 1 %] [% IF biblio.author %] by [% biblio.author | html %][% END %]</h2>
191             [% ELSE %]
192                 <h2>
193                     [% IF ( patron ) %]
194                         <span>Place holds</span>
195                     [% ELSE %]
196                         [% IF clubcount %]
197                             <span>Search patrons or clubs</span>
198                         [% ELSE %]
199                             <span>Search patrons</span>
200                         [% END %]
201                     [% END %]
202                 </h2>
203             [% END %]
204
205             [% UNLESS club OR patron OR patron.borrowernumber OR noitems OR nobiblio %]
206                 [% IF ( messageborrower ) %]
207                     <div class="dialog alert">
208                         <h3>Patron not found</h3>
209                         <p>No patron with this name, please, try another</p>
210                     </div>
211                 [% END %]
212
213                 [% IF ( messageclub ) %]
214                     <div class="dialog alert">
215                         <h3>Club not found</h3>
216                         <p>No club with this name, please, try another</p>
217                     </div>
218                 [% END %]
219                 <fieldset>
220                     [% UNLESS multi_hold %]
221                         [% IF clubcount %]
222                             <h2>Search patrons or clubs</h2>
223                         [% ELSE %]
224                             <h2>Search patrons</h2>
225                         [% END %]
226                     [% END %]
227                     <div id="circ_holds_select" class="toptabs">
228                         <ul class="nav nav-tabs" role="tablist">
229                             <li role="presentation" class="active"><a href="#holds_patronsearch_pane" aria-controls="holds_patronsearch_pane" role="tab" data-toggle="tab">Patrons</a></li>
230                             [% IF clubcount %]
231                                 <li role="presentation"><a href="#holds_clubsearch_pane" aria-controls="holds_clubsearch_pane" role="tab" data-toggle="tab">Clubs</a></li>
232                             [% END %]
233                         </ul>
234                         <div class="tab-content">
235                             <div id="holds_patronsearch_pane" role="tabpanel" class="tab-pane active">
236                                 [% PROCESS patron_search_filters_simple %]
237
238                                 [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
239                             </div>
240                             [% IF clubcount %]
241                                 <div id="holds_clubsearch_pane" role="tabpanel" class="tab-pane">
242                                     <form id="holds_clubsearch" action="request.pl" method="post">
243                                         <div class="hint">Enter club ID or partial name:</div>
244                                         <input type="text" size="40" id="club" class="focus" name="findclub" autocomplete="off" />
245                                         <input type="submit" value="Search" />
246                                         [% FOREACH biblionumber IN biblionumbers %]
247                                         <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/>
248                                         [% END %]
249
250                                     </form> <!-- /#holds_patronsearch -->
251                                     [% IF clubs %]
252                                         [% INCLUDE 'clubs-table.inc' destination = "holds" %]
253                                     [% END %]
254                                 </div>
255                             [% END %]
256                         </div> <!-- /.tab-content -->
257                     </div>
258                 </fieldset>
259             [% ELSIF club %]
260                 <div class="dialog alert hide clubalert">
261                 </div>
262                 <fieldset class="rows">
263                     <legend>Hold details</legend>
264                     <form action="/api/v1/clubs/[% club.id | html %]/holds" method="post" name="form" id="club-request-form">
265
266                         [% IF ( multi_hold ) %]
267                             <input type="hidden" name="request" value="any"/>
268                             [% FOREACH biblioloo IN biblioloop %]
269                                 [% UNLESS biblioloo.none_avail %]
270                                     <input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblioloo.biblionumber | html %]"/>
271                                     <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]"/>
272                                     <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]"/>
273                                 [% END %]
274                             [% END %]
275                         [% ELSE %]
276                             <input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblio.biblionumber | html %]"/>
277                             <input type="hidden" name="title" value="[% biblio.title | html %]" />
278                             <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
279                         [% END # /IF multi_hold %]
280                         <ol>
281                             <li>
282                                 <span class="label">Club: </span> [% club.name | html %]
283                             </li>
284                             <li>
285                                 <span class="label">Description: </span> [% club.description | html %]
286                             </li>
287                             <li>
288                                 <label for="pickup">Pickup at:</label>
289                                 <select name="pickup" id="pickup_club">
290                                     [% PROCESS options_for_libraries libraries => Branches.all({ selected => club.branchcode, search_params => { pickup_location => 1 } }) %]
291                                 </select>
292                             </li>
293                             <li>
294                                 <label for="default_patron_home">Pickup at patron's home library when possible:</label>
295                                 <input type="checkbox" id="default_patron_home" name="default_patron_home"/>
296                             </li>
297                         </ol>
298                         <h2 style="padding: 0 1em;">Members</h2>
299                         <ol>
300                             [% FOREACH member IN members %]
301                                 [% SET patron = member.patron %]
302                                 <li style="padding: 0.5em 1em;">
303                                     <div>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]</div>
304                                     [% IF member.exceeded_maxreserves %]
305                                         <div>
306                                             <i class="fa fa-error"></i>
307                                             <strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
308                                         </div>
309                                     [% END %]
310                                     [% IF ( patron.is_expired ) %]
311                                         <div>
312                                             <i class="fa fa-warning"></i>
313                                             <strong>Account has expired</strong>
314                                         </div>
315                                     [% END %]
316                                     [% IF patron.is_debarred %]
317                                         <div>
318                                             <i class="fa fa-warning"></i>
319                                             <strong>Patron has restrictions</strong>
320                                         </div>
321                                     [% END %]
322                                     [% IF member.amount_outstanding && Koha.Preference('maxoutstanding') && member.amount_outstanding > Koha.Preference('maxoutstanding') %]
323                                         <div>
324                                             <i class="fa fa-warning"></i>
325                                             <strong>Patron has outstanding fines: [% member.amount_outstanding | $Price %]</strong>
326                                         </div>
327                                     [% END %]
328
329                                     [% IF ( member.diffbranch ) %]
330                                         <div>
331                                             <i class="fa fa-warning"></i>
332                                             <strong>Pickup library is different.</strong> Patron's home library: ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )
333                                         </div>
334                                     [% END %]
335                                 </li>
336                             [% END %]
337                         [% UNLESS ( multi_hold ) %]
338                             <fieldset class="action">
339                                 <input type="submit" value="Place hold" />
340                             </fieldset>
341                         [% ELSE %]
342                             <table id="requesttitles">
343                                 <tr>
344                                     <th>&nbsp;</th>
345                                     <th>Title</th>
346                                     [% UNLESS Koha.Preference('item-level_itypes') %]
347                                         <th>Item type</th>
348                                     [% END %]
349                                     <th>Priority</th>
350                                     <th>Information</th>
351                                 </tr>
352                                 [% FOREACH biblioloo IN biblioloop %]
353                                     [% IF ( biblioloo.warn ) %]
354                                         <tr class="onissue">
355                                     [% ELSE %]
356                                         <tr>
357                                     [% END %]
358                                         <td>
359                                             [% UNLESS ( biblioloo.warn ) %]
360                                                     <input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]"/>
361                                                 </td>
362                                             [% END %]
363                                         <td>
364                                             <ul>
365                                                 <li>
366                                                     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
367                                                     [% IF biblioloo.author %] by [% biblioloo.author | html %][% END %]
368                                                 </li>
369                                                 [% IF ( biblioloo.publicationyear ) %]
370                                                     <li>
371                                                         <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
372                                                     </li>
373                                                 [% END %]
374                                             </ul>
375                                             [% IF ( biblioloo.warn ) %]
376                                                 <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
377                                             [% END %]
378                                         </td>
379                                         [% UNLESS Koha.Preference('item-level_itypes') %]
380                                             <td>
381                                                 <img src="[% biblioloo.itemtype.image_location| html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
382                                             </td>
383                                         [% END %]
384                                         <td>[% biblioloo.rank | html %]</td>
385                                         <td>
386                                             [% IF ( biblioloo.checked_previously ) %]
387                                                 <span>Patron has previously checked out this title</span><br/>
388                                             [% END %]
389                                             [% IF ( biblioloo.alreadyres ) %]
390                                                 <ul>
391                                             [% ELSE %]
392                                                 [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
393                                                     <ul>
394                                                 [% END %]
395                                             [% END %]
396
397                                             [% IF ( biblioloo.alreadyres ) %]
398                                                 <li>
399                                                     [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item
400                                                 </li>
401                                             [% END %]
402                                             [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
403                                                 <li> <strong>No items are available</strong> to be placed on hold</li>
404                                             [% END %]
405
406                                             [% IF ( biblioloo.alreadyres ) %]
407                                                 </ul>
408                                             [% ELSE %]
409                                                 [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
410                                                     </ul>
411                                                 [% END %]
412                                             [% END %]
413                                         </td>
414                                     </tr>
415                                 [% END # /FOREACH biblioloo %]
416                             </table> <!-- /#requesttitles -->
417                         [% END %]
418                     </form>
419                 </fieldset>
420             [% ELSIF NOT ( noitems || nobiblio ) # /UNLESS patron %]
421
422                 [% IF ( checked_previously && !multi_hold ) %]
423                     <div class="dialog alert">
424                         <ul>
425                             <li>Patron has previously checked out this title</li>
426                         </ul>
427                     </div>
428                 [% END %]
429
430                 [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted || recall ) %]
431                     <div class="dialog alert">
432
433                         [% UNLESS ( multi_hold ) %]
434                             <h3>Cannot place hold</h3>
435                             <ul>
436                                 [% IF ( no_reserves_allowed ) %]
437                                     <li><strong>No holds allowed:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] cannot place a hold on any of these items.</li>
438                                 [% ELSIF ( exceeded_maxreserves ) %]
439                                     <li><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% maxreserves | html %] total holds.</li>
440                                 [% ELSIF ( exceeded_holds_per_record ) %]
441                                     <li><strong>Too many holds for this record:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li>
442                                 [% ELSIF ( alreadypossession ) %]
443                                     <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 hide_patron_infos_if_needed => 1 %] <strong>is already in possession</strong> of one item.</li>
444                                 [% ELSIF ( alreadyreserved ) %]
445                                     <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item.</li>
446                                 [% ELSIF ( ageRestricted ) %]
447                                     <li><strong>Age restricted</strong></li>
448                                 [% ELSIF ( none_available ) %]
449                                     <li> <strong>No items are available</strong> to be placed on hold.</li>
450                                 [% ELSIF ( maxreserves ) %]
451                                     <li><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] has too many holds.</li>
452                                 [% ELSIF ( recall ) %]
453                                     <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] has <strong>already placed a recall</strong> on this item.</li>
454                                 [% END # /IF exceeded_maxreserves %]
455                             </ul>
456                         [% ELSE # UNLESS multi_hold %]
457                             <h3>Cannot place hold on some items</h3>
458                             [% IF (no_reserves_allowed ) %]
459                                 <li><strong>No holds allowed:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] cannot place holds on some of these title's items.</li>
460                             [% ELSIF ( exceeded_maxreserves ) %]
461                                 <li><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can place [% new_reserves_allowed | html %] of the requested [% new_reserves_count | html %] holds for a maximum of [% maxreserves | html %] total holds.</li>
462                             [% ELSIF ( exceeded_holds_per_record ) %]
463                                 [% FOREACH biblioloo IN biblioloop %]
464                                     [% IF (biblioloo.tooManyHoldsForThisRecord) %]
465                                         <li><strong>Too many holds for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]"> [% biblioloo.title | html %]</a>:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li>
466                                     [% END %]
467                                 [% END %]
468                             [% ELSIF ( none_available ) %]
469                                 <li><strong>No items available: </strong>One or more records have no items that can be held</li>
470                             [% END # /IF exceeded_maxreserves %]
471                         [% END # /UNLESS multi_hold %]
472                     </div>
473                 [% END # /IF ( exceeded_maxreserves || ... %]
474
475                 [% IF ( patron.is_expired || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
476                     <div class="dialog message">
477                         <ul>
478                             [% IF ( patron.is_expired ) %]
479                                 <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]: <strong>Account has expired</strong></li>
480                             [% END %]
481
482                             [% IF patron.is_debarred %]
483                                 <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]: <strong>Patron has restrictions</strong></li>
484                             [% END %]
485
486                             [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
487                                 <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 link_to => 'members_pay' %]: <strong>Patron has outstanding fines: [% amount_outstanding | $Price %]</strong></li>
488                             [% END %]
489
490                             [% IF ( diffbranch ) %]
491                                 <li><strong>Pickup library is different. </strong>Patron: [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] Patron's home library: ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )</li>
492                             [% END %]
493                         </ul> <!-- /.dialog.message -->
494                     </div>
495                 [% END # /IF patron.is_expired || diffbranch ... %]
496
497                 [% IF ( messageborrower ) %]
498                     <div class="dialog alert">
499                         <h3>Patron not found:</h3>
500                         <p>Name or barcode not found. Please try an other </p>
501                     </div>
502                 [% END %]
503
504                 <div class="dialog alert hide holdalert">
505                 </div>
506
507                 <fieldset class="rows">
508                     <legend>Hold details</legend>
509                     <form action="placerequest.pl" method="post" name="form" id="hold-request-form">
510
511                         <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
512                         [% FOREACH biblionumber IN biblionumbers %]
513                             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/>
514                         [% END %]
515                         [% IF ( multi_hold ) %]
516                             <input type="hidden" name="multi_holds" id="multi_holds" value="1" />
517                             <input type="hidden" name="request" value="any"/>
518                             [% FOREACH biblioloo IN biblioloop %]
519                                 [% UNLESS biblioloo.none_avail %]
520                                     <input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblioloo.biblionumber | html %]"/>
521                                     <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]"/>
522                                     <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]"/>
523                                 [% END %]
524                             [% END %]
525                         [% ELSE %]
526                             <input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblio.biblionumber | html %]"/>
527                             <input type="hidden" name="title" value="[% biblio.title | html %]" />
528                             <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
529                         [% END # /IF multi_hold %]
530
531                         <ol>
532                             <li>
533                                 <span class="label">Patron:</span>
534                                 [% IF ( patron.borrowernumber ) %]
535                                     [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]
536                                 [% ELSE %]
537                                     Not defined yet
538                                 [% END %]
539                             </li>
540
541                             [% UNLESS ( multi_hold ) %]
542                                 <li>
543                                     <span class="label">Estimated priority:</span>
544                                     <strong>[% fixedRank | html %]</strong>
545                                 </li>
546                             [% END %]
547
548                             <li>
549                                 <label for="holdnotes">Notes:</label>
550                                 <textarea id="holdnotes" name="notes" cols="30" rows="1"></textarea>
551                             </li>
552                             <li>
553                                 <label for="pickup">Pickup at:</label>
554                             [% UNLESS ( multi_hold ) %]
555                                 <select name="pickup" id="pickup"
556                                         data-biblio-id="[% biblio.biblionumber | html %]"
557                                         data-patron-id="[% patron.borrowernumber | html %]"
558                                         data-pickup-location-source="biblio">
559                                     [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
560                             [% ELSE %]
561                                 <select name="pickup" id="pickup_multi" data-patron-id="[% patron.borrowernumber | html %]">
562                                     <option value="" selected="selected"></option>
563                                 [% FOREACH pickup_location IN multi_pickup_locations %]
564                                     <option value="[% pickup_location.branchcode | html %]">[% pickup_location.branchname | html %]</option>
565                                 [% END %]
566                             [% END %]
567                                 </select>
568                             </li>
569
570                             [% UNLESS ( multi_hold ) %]
571                                 [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
572                                     <li>
573                                         <label for="itemtype">Request specific item type:</label>
574                                         <select name="itemtype" id="itemtype">
575                                             <option value="">Any item type</option>
576                                             [%- FOREACH itemtype IN available_itemtypes %]
577                                                 <option value="[% itemtype | html %]">[% ItemTypes.GetDescription( itemtype ) | html %]</option>
578                                             [%- END %]
579                                         </select>
580                                     </li>
581                                 [% END %]
582                             [% END # /UNLESS multi_hold %]
583
584                             [% IF ( reserve_in_future ) %]
585                                 <li>
586                                     <label for="from">Hold starts on date:</label>
587                                     <input id="reserve_date" name="reserve_date" id="from" size="10" type="text" data-date_to="expiration_date" class="flatpickr" data-flatpickr-futuredate="true" />
588                                 </li>
589                             [% END %]
590
591                             <li>
592                                 <label for="to">Hold expires on date:</label>
593                                 <input id="expiration_date" name="expiration_date" id="to" size="10" type="text" class="flatpickr" data-flatpickr-futuredate="true" />
594                             </li>
595
596                             [% UNLESS ( multi_hold ) %]
597                                 <li>
598                                     <label for="requestany">Hold next available item </label>
599                                     [% IF force_hold_level == 'item' %]
600                                         <input type="checkbox" id="requestany" name="request" disabled="true" />
601                                     [% ELSIF force_hold_level == 'record' %]
602                                         <input type="checkbox" id="requestany" checked="checked" value="Any" disabled="true"/>
603                                         <input type="hidden" name="request" value="Any"/>
604                                     [% ELSE %]
605                                         <input type="checkbox" id="requestany" name="request" checked="checked" value="Any" />
606                                     [% END %]
607                                     <input type="hidden" name="alreadyreserved" value="[% alreadyreserved | html %]" />
608                                 </li>
609
610                                 [% IF remaining_holds_for_record > 1 %]
611                                     <li>
612                                         <label for="holds_to_place_count">Holds to place (count)</label>
613                                         <input type="text" inputmode="numeric" pattern="[0-9]*" id="holds_to_place_count" name="holds_to_place_count" maxlength="[% remaining_holds_for_record | html %]" value="1" />
614                                     </li>
615                                 [% ELSE %]
616                                     <input type="hidden" name="holds_to_place_count" value="1" />
617                                 [% END %]
618                             [% END # /UNLESS multi_hold %]
619
620                             <li id="non_priority_list_item">
621                                 <label for="non_priority">Non priority hold:</label>
622                                 <input name="non_priority" id="non_priority" type="checkbox" />
623                                 <span class="hint">A non priority hold doesn't prevent a current checkout from renewing</span>
624                             </li>
625                         </ol>
626
627                         [% UNLESS ( multi_hold ) %]
628                             <fieldset class="action">
629                                 [% IF ( patron.borrowernumber ) %]
630                                     [% IF ( override_required ) %]
631                                         <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
632                                     [% ELSIF ( none_available ) %]
633                                         <button type="submit" disabled="disabled" class="btn btn-default btn-disabled">Place hold</button>
634                                     [% ELSE %]
635                                         <button type="submit" class="btn btn-default">Place hold</button>
636                                     [% END %]
637                                 [% END %]
638                             </fieldset>
639
640                             [% biblio = biblioloop.0 %]
641
642                             <ol>
643                                 [% UNLESS Koha.Preference('item-level_itypes') %]
644                                     <li>
645                                         <span class="label">Item type:</span>
646                                         [% biblio.itemtype.translated_description | html %]
647                                     </li>
648                                 [% END %]
649
650                                 [% IF ( biblio.biblioitem.publicationyear ) %]
651                                     <li>
652                                         <span class="label">Publication year:</span>
653                                         [% biblio.biblioitem.publicationyear | html %]
654                                     </li>
655                                 [% END %]
656                             </ol>
657
658                             <h2 style="padding: 0 1em;">
659                                 Place a hold on a specific item
660                                 [% IF force_hold_level == 'item' %]
661                                      <span class="error"><em>(Required)</em></span>
662                                 [% END %]
663                             </h2>
664
665                             <table id="requestspecific">
666                                 <thead>
667                                     <tr>
668                                         <th>Hold</th>
669                                         <th>Allowed pickup locations</th>
670                                         [% IF Koha.Preference('item-level_itypes') %]
671                                             <th>Item type</th>
672                                         [% END %]
673                                         <th>Barcode</th>
674                                         <th>Home library</th>
675                                         <th>Last location</th>
676                                         [% IF itemdata_ccode %]
677                                             <th>Collection</th>
678                                         [% END %]
679                                         <th>Call number</th>
680                                         <th>Copy number</th>
681                                         [% IF itemdata_enumchron %]
682                                             <th>Vol no.</th>
683                                         [% END %]
684                                         <th>Information</th>
685                                     </tr>
686                                 </thead>
687                                 <tbody>
688                                     [% SET selected = 0 %]
689                                     [% FOREACH itemloo IN biblio.itemloop %]
690                                         [% UNLESS ( itemloo.hide ) %]
691                                             <tr class="[% itemloo.backgroundcolor | html %]">
692                                                 <td>
693                                                     [% IF force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
694                                                         <span class="error">
695                                                             <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
696                                                             Hold must be record level
697                                                         </span>
698                                                     [% ELSIF ( itemloo.available ) %]
699                                                         <input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" />
700                                                     [% ELSIF ( itemloo.override ) %]
701                                                         <input type="radio" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" />
702                                                         <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i>
703                                                     [% ELSE %]
704                                                         <span class="error">
705                                                             <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
706                                                             [% IF itemloo.not_holdable %]
707                                                                 [% IF itemloo.not_holdable == 'damaged' %]
708                                                                     <span>Item damaged</span>
709                                                                 [% ELSIF itemloo.not_holdable == 'ageRestricted' %]
710                                                                     <span>Age restricted</span>
711                                                                 [% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %]
712                                                                     <span>Exceeded max holds per record</span>
713                                                                 [% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %]
714                                                                     <span>Daily hold limit reached for patron</span>
715                                                                 [% ELSIF itemloo.not_holdable == 'tooManyReserves' %]
716                                                                     <span>Too many holds</span>
717                                                                 [% ELSIF itemloo.not_holdable == 'notReservable' %]
718                                                                     <span>Not holdable</span>
719                                                                 [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %]
720                                                                     <span>Patron is from different library</span>
721                                                                 [% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %]
722                                                                     <span>Cannot place hold from patron's library</span>
723                                                                 [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
724                                                                     <span>Patron already has hold for this item</span>
725                                                                 [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
726                                                                     <span>Cannot be transferred to pickup library</span>
727                                                                 [% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %]
728                                                                     <span>Only pickup locations within the same hold group are allowed</span>
729                                                                 [% ELSIF itemloo.not_holdable == 'noReservesAllowed' %]
730                                                                     <span>No holds are allowed on this item</span>
731                                                                 [% ELSIF itemloo.not_holdable == 'libraryNotPickupLocation' %]
732                                                                     <span>Library is not a pickup location</span>
733                                                                 [% ELSIF itemloo.not_holdable == 'no_valid_pickup_location' %]
734                                                                     <span>No valid pickup location</span>
735                                                                 [% ELSIF itemloo.not_holdable == 'notforloan' %]
736                                                                     <span>Not for loan</span>
737                                                                 [% ELSE %]
738                                                                     <span>[% itemloo.not_holdable | html %]</span>
739                                                                 [% END %]
740                                                             [% END %]
741                                                         </span>
742                                                     [% END # /IF force_hold_level %]
743                                                 </td>
744                                                 <td>
745                                                 [% IF (itemloo.pickup_locations_count > 0) %]
746                                                     <select name="item_pickup_[% itemloo.itemnumber | html %]" class="pickup_locations" style="width:100%;"
747                                                             data-item-id="[% itemloo.itemnumber | html %]"
748                                                             data-patron-id="[% patron.borrowernumber | html %]"
749                                                             data-pickup-location-source="item">
750                                                     [% IF (itemloo.default_pickup_location) %]
751                                                         <option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option>
752                                                     [% END %]
753                                                     </select>
754                                                 [% END %]
755                                                 </td>
756                                                 [% IF Koha.Preference('item-level_itypes') %]
757                                                     <td>
758                                                         [% UNLESS ( noItemTypeImages ) %]
759                                                             [% IF ( itemloo.itemtype.image_location) %]<img src="[% itemloo.itemtype.image_location | html %]" alt="" /> <br /> [% END %]
760                                                         [% END %]
761                                                         [% itemloo.itemtype.translated_description | html %]
762                                                     </td>
763                                                 [% END %]
764                                                 <td>
765                                                     [% itemloo.barcode | html %]
766                                                 </td>
767                                                 <td>
768                                                     [% Branches.GetName( itemloo.homebranch ) | html %]
769                                                 </td>
770                                                 <td>
771                                                     [% Branches.GetName( itemloo.holdingbranch ) | html %]
772                                                 </td>
773                                                 [% IF itemdata_ccode %]
774                                                     <td>
775                                                         [% IF ( itemloo.ccode ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => itemloo.ccode ) | html %][% END %]
776                                                     </td>
777                                                 [% END %]
778                                                 <td>
779                                                     [% itemloo.itemcallnumber | html %]
780                                                 </td>
781                                                 <td>
782                                                     [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %]&nbsp;[% END %]
783                                                 </td>
784                                                 [% IF itemdata_enumchron %]
785                                                     <td>
786                                                         [% itemloo.enumchron | html %]
787                                                     </td>
788                                                 [% END %]
789                                                 [% IF ( itemloo.onloan ) %]
790                                                     <td data-order="[% itemloo.date_due | html %]">
791                                                         <span class="checkedout">Due [% itemloo.date_due | $KohaDates  as_due_date => 1 %]</span>
792                                                 [% ELSE %]
793                                                     <td>
794                                                         [% IF ( itemloo.transfertwhen ) %]
795                                                             <span>In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %],
796                                                             to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %]</span>
797                                                         [% END %]
798                                                 [% END %]
799
800                                                     [% IF ( itemloo.reservedate ) %]
801                                                         [% IF ( itemloo.nocancel ) %]
802                                                                 <span>Can't be cancelled when item is in transit</span>
803                                                         [% ELSE %]
804                                                             [% IF ( itemloo.waitingdate ) %]
805                                                                 [% IF ( itemloo.canreservefromotherbranches ) %]
806                                                                     <span>Waiting for [% INCLUDE 'patron-title.inc' patron=itemloo.ReservedFor %] at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since [% itemloo.waitingdate | $KohaDates %]</span>
807                                                                 [% ELSE %]
808                                                                     <span>Waiting at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since [% itemloo.waitingdate | $KohaDates %]</span>
809                                                                 [% END %]
810                                                             [% ELSE %]
811                                                                 [% IF ( itemloo.canreservefromotherbranches ) %]
812                                                                     [% IF itemloo.reservedate %]
813                                                                         <span>On hold for [% INCLUDE 'patron-title.inc' patron=itemloo.ReservedFor %] expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since</span>
814                                                                     [% ELSE %]
815                                                                         <span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %]</span>
816                                                                     [% END %]
817                                                                 [% ELSIF itemloo.reservedate %]
818                                                                     <span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since [% itemloo.reservedate | $KohaDates %]</span>
819                                                                 [% ELSE %]
820                                                                     <span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %]</span>
821                                                                 [% END %]
822                                                             [% END %]
823                                                             <a class="info cancel-hold" href="modrequest.pl?CancelBiblioNumber=[% itemloo.biblionumber | html %]&amp;CancelBorrowerNumber=[% itemloo.ReservedFor.borrowernumber | html %]&amp;CancelItemnumber=[% itemloo.itemnumber | html %]">Cancel hold</a>
824                                                         [% END # /IF itemloo.nocancel %]
825                                                     [% ELSE %]
826                                                         Not on hold
827                                                     [% END # /IF itemloo.reservedate %]
828
829                                                     [% IF itemloo.item_level_holds == "N" %]
830                                                         <br/>Item level hold not allowed from OPAC
831                                                     [% ELSIF itemloo.item_level_holds == "F" %]
832                                                         <br/>Item level hold forced from OPAC
833                                                     [% END %]
834
835                                                     [% IF ( itemloo.itemlost ) %]
836                                                        <span class="lost">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => itemloo.itemlost ) | html %]</span>
837                                                     [% END %]
838
839                                                     [% IF ( itemloo.damaged ) %]
840                                                         <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => itemloo.damaged ) | html %]</span>
841                                                     [% END %]
842
843                                                     [% IF ( itemloo.withdrawn ) %]
844                                                        <span class="wdn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => itemloo.withdrawn ) | html %]</span>
845                                                     [% END %]
846
847                                                     [% IF ( itemloo.notforloan ) %]
848                                                        <span class="nfl">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])</span>
849                                                     [% ELSIF ( itemloo.notforloanitype ) %]
850                                                        <span class="nfl">Not for loan (Itemtype not for loan)</span>
851                                                     [% END %]
852                                                 </td>
853                                             </tr>
854                                         [% END # / UNLESS itemloo.hide %]
855                                     [% END # /FOREACH itemloo %]
856                                 </tbody>
857                             </table> <!-- /#requestspecific -->
858
859                             [% IF hiddencount %]
860                                 <form>
861                                     <p class="hiddencount">
862                                         <a href="request.pl?biblionumber=[% biblio.biblionumber | uri %]&amp;borrowernumber=[% borrowernumber | uri %]&amp;showallitems=1">Show all items ([% biblio.hiddencount | html %] hidden)</a>
863                                     </p>
864                                 </form>
865                             [% END # /IF hiddencount %]
866
867                         [% ELSE # /UNLESS multi_hold %]
868
869                             <table id="requesttitles">
870                                 <tr>
871                                     <th>&nbsp;</th>
872                                     <th>Pickup location</th>
873                                     <th>Title</th>
874                                     [% UNLESS Koha.Preference('item-level_itypes') %]
875                                         <th>Item type</th>
876                                     [% END %]
877                                     <th>Priority</th>
878                                     <th>Information</th>
879                                 </tr>
880                                 [% FOREACH biblioloo IN biblioloop %]
881                                     [% IF ( biblioloo.warn ) %]
882                                         <tr class="onissue">
883                                     [% ELSE %]
884                                         <tr>
885                                     [% END %]
886                                         <td>
887                                             [% UNLESS ( biblioloo.warn ) %]
888                                                 <input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]"/>
889                                             [% END %]
890                                         </td>
891                                         <td>
892                                             [% UNLESS ( biblioloo.none_avail || biblioloo.noitems ) %]
893                                                 <select name="pickup_[% biblioloo.biblionumber | html %]"
894                                                         class="multi_pickup_select"
895                                                         data-biblio-id="[% biblioloo.biblionumber | html %]"
896                                                         data-patron-id="[% patron.borrowernumber | html %]"
897                                                         data-pickup-locations='[% biblioloo.pickup_locations_codes.json | $raw %]'>
898                                                     <option value=""></option>
899                                                     [% FOREACH pickup_location IN biblioloo.pickup_locations %]
900                                                         <option value="[% pickup_location.branchcode | html %]">[% pickup_location.branchname | html %]</option>
901                                                     [% END %]
902                                                 </select>
903                                             [% END %]
904                                         </td>
905                                         <td>
906                                             <ul>
907                                                 <li>
908                                                     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
909                                                     [% IF biblioloo.author %] by [% biblioloo.author | html %][% END %]
910                                                 </li>
911                                                 [% IF ( biblioloo.publicationyear ) %]
912                                                     <li>
913                                                         <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
914                                                     </li>
915                                                 [% END %]
916                                             </ul>
917                                             [% IF ( biblioloo.warn ) %]
918                                                 <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
919                                             [% END %]
920                                         </td>
921                                         [% UNLESS Koha.Preference('item-level_itypes') %]
922                                             <td>
923                                                 <img src="[% biblioloo.itemtype.image_location | html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
924                                             </td>
925                                         [% END %]
926                                         <td>[% biblioloo.rank | html %]</td>
927                                         <td>
928                                             [% IF ( biblioloo.checked_previously ) %]
929                                                 <span>Patron has previously checked out this title</span><br/>
930                                             [% END %]
931                                             [% IF ( biblioloo.alreadyres ) %]
932                                                 <ul>
933                                             [% ELSE %]
934                                                 [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
935                                                     <ul>
936                                                 [% END %]
937                                             [% END %]
938
939                                             [% IF ( biblioloo.alreadyres ) %]
940                                             <li>
941                                                 [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item
942                                             </li>
943                                             [% END %]
944                                             [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
945                                                 <li> <strong>No items are available</strong> to be placed on hold</li>
946                                             [% END %]
947
948                                             [% IF ( biblioloo.alreadyres ) %]
949                                                 </ul>
950                                             [% ELSE %]
951                                                 [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
952                                                     </ul>
953                                                 [% END %]
954                                             [% END %]
955                                         </td>
956                                     </tr>
957                                 [% END # /FOREACH biblioloo %]
958                             </table> <!-- /#requesttitles -->
959
960                         [% END # /UNLESS multi_hold %]
961
962                         <fieldset class="action">
963                             [% IF ( patron AND patron.borrowernumber ) %]
964                                 [% IF ( multi_hold ) %]
965                                     [% IF ( override_required ) %]
966                                         <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place holds</button>
967                                     [% ELSIF ( no_bibs_available ) %]
968                                         <button type="submit" class="btn btn-default btn-disabled" disabled="disabled">Place holds</button>
969                                     [% ELSIF ( none_available ) %]
970                                         <button type="submit" class="btn btn-default">Place holds</button>
971                                     [% ELSE %]
972                                         <button type="submit" class="btn btn-default" id="multi_hold_submit">Place holds</button>
973                                     [% END %]
974                                 [% ELSE %]
975                                     [% IF ( override_required ) %]
976                                         <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
977                                     [% ELSIF ( none_available ) %]
978                                         <button type="submit" class="btn btn-default btn-disabled" disabled="disabled">Place hold</button>
979                                     [% ELSE %]
980                                         <button type="submit" class="btn btn-default">Place hold</button>
981                                     [% END %]
982                                 [% END %]
983                             [% END # /IF patron %]
984                         </fieldset> <!-- /.action -->
985                     </form> <!-- /#hold-request-form -->
986                 </fieldset> <!-- /.rows -->
987             [% END %]
988
989             [% UNLESS ( patron ) %]
990                 [% UNLESS borrowers %]
991                     [% SET hold_count = Biblio.HoldsCount( biblio.biblionumber ) | html %]
992                     [% IF hold_count %]
993                         <label for ="always_show_holds">Always show holds</label>
994                         [% IF always_show_holds == 'DONT' %]
995                             <input type="checkbox" name="always_show_holds" id="always_show_holds" value="DO">
996                             [% UNLESS reserveloop %]
997                                 <a class="btn btn-default" value="Show holds" id="show_holds_now" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]&show_holds_now=1">Show holds ([% hold_count | html %])</a>
998                             [% END %]
999                         [% ELSE %]
1000                             <input type="checkbox" name="always_show_holds" value="DO" id="always_show_holds" checked="checked">
1001                         [% END %]
1002                     [% END %]
1003                 [% END %]
1004                 [% IF ( reserveloop ) %]
1005                     <form id="existing_holds" name="T[% time | html %]" action="modrequest.pl" method="post" style="display:block">
1006                         [% IF ( multi_hold ) %]
1007                             [% FOREACH biblionumber IN biblionumbers %]
1008                             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/>
1009                             [% END %]
1010                         [% END %]
1011
1012                         [% IF enqueued %]
1013                             <div class="dialog message">
1014                                 <p>The job has been enqueued! It will be processed as soon as possible.</p>
1015                                 <p><a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job_id | uri %]" title="View detail of the enqueued job">View detail of the enqueued job</a></p>
1016                             </div>
1017                         [% END %]
1018
1019                         <h2>Existing holds</h2>
1020                         <div id="toolbar" class="btn-toolbar">
1021                             <input type="submit" name="submit" value="Update hold(s)" /> <button class="cancel_selected_holds" data-bulk="true"></button>
1022                         <fieldset id="cancellation-reason-fieldset" class="action">
1023                             [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
1024                             [% IF hold_cancellation.count %]
1025                                 <label for="cancellation-reason">Cancellation reason: </label>
1026                                 <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
1027                                     <option value="">No reason given</option>
1028                                     [% FOREACH reason IN hold_cancellation %]
1029                                         <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
1030                                     [% END %]
1031                                 </select>
1032                             [% END %]
1033                         </fieldset>
1034                         </div>
1035
1036                         [% FOREACH biblioloo IN biblioloop %]
1037                             [% IF ( biblioloo.reserveloop ) %]
1038                                 <div class="hold_title" id="hold_title_[% biblioloo.biblionumber | html %]">
1039                                     [% IF ( multi_hold ) %]
1040                                         <h3>
1041                                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">
1042                                                 [% biblioloo.title | html %]
1043                                             </a> <span class="number_box"><span>[% biblioloo.reserveloop.size | html %] [% tn('Hold', 'Holds', biblioloo.reserveloop.size) | $raw %]</span></span>
1044                                         </h3>
1045                                     [% END %]
1046
1047                                     [% IF Koha.Preference('HoldsSplitQueue') == 'branch' %]
1048
1049                                         [% SET branchcodes = [] %]
1050
1051                                         [% FOREACH h IN biblioloo.reserveloop %]
1052                                             [% branchcodes.push( h.branchcode ) %]
1053                                         [% END %]
1054                                         [% branchcodes = branchcodes.unique %]
1055                                         [% IF ( branchcodes.empty ) %]
1056                                             <div class="note">
1057                                                 There are no holds on this title.
1058                                             </div>
1059                                         [% ELSE %]
1060
1061                                             [% FOREACH b IN branchcodes.sort %]
1062                                                 [% SET holds_by_branch = [] %]
1063                                                 [% FOREACH h IN biblioloo.reserveloop %]
1064                                                     [% IF h.branchcode == b %]
1065                                                         [% holds_by_branch.push( h ) %]
1066                                                     [% END %]
1067                                                 [% END %]
1068                                                 <div class="holds_by_library">
1069                                                     <h4>[% Branches.GetName( b ) | html %]</h4>
1070
1071                                                     [% INCLUDE holds_table.inc holds=holds_by_branch %]
1072                                                 </div>
1073                                             [% END # /FOREACh b %]
1074                                         [% END # /IF ( branchcodes.empty ) %]
1075
1076                                     [% ELSIF Koha.Preference('HoldsSplitQueue') == 'itemtype' %]
1077
1078                                         [% SET itemtypes = [] %]
1079
1080                                         [% FOREACH h IN biblioloo.reserveloop %]
1081                                             [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1082                                             [% itemtypes.push( hold_itemtype ) %]
1083                                         [% END %]
1084                                         [% itemtypes = itemtypes.unique %]
1085                                         [% IF ( itemtypes.empty ) %]
1086                                             <div class="note">
1087                                                 There are no holds on this title.
1088                                             </div>
1089                                         [% ELSE %]
1090
1091                                             [% FOREACH i IN itemtypes.sort %]
1092                                                 [% SET holds_by_itemtype = [] %]
1093                                                 [% FOREACH h IN biblioloo.reserveloop %]
1094                                                     [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1095                                                     [% IF hold_itemtype == i %]
1096                                                         [% holds_by_itemtype.push( h ) %]
1097                                                     [% END %]
1098                                                 [% END %]
1099
1100                                                 <div class="holds_by_itemtype">
1101                                                     [% IF i %]
1102                                                         <h4>[% ItemTypes.GetDescription( i ) | html %]</h4>
1103                                                     [% ELSE %]
1104                                                         <h4>Any item type</h4>
1105                                                     [% END %]
1106                                                     [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
1107                                                 </div>
1108                                             [% END # /FOREACH i %]
1109                                         [% END # /IF ( itemtypes.empty ) %]
1110
1111                                     [% ELSIF Koha.Preference('HoldsSplitQueue') == 'branch_itemtype' %]
1112                                         [% SET branchcodes = [] %]
1113
1114                                         [% FOREACH h IN biblioloo.reserveloop %]
1115                                             [% branchcodes.push( h.branchcode ) %]
1116                                         [% END %]
1117                                         [% branchcodes = branchcodes.unique %]
1118                                         [% IF ( branchcodes.empty ) %]
1119                                             <div class="note">
1120                                                 There are no holds on this title.
1121                                             </div>
1122                                         [% ELSE %]
1123
1124                                             [% FOREACH b IN branchcodes.sort %]
1125                                                 <div class="holds_by_library">
1126                                                     <h4 class="library_holds">[% Branches.GetName( b ) | html %]</h4>
1127                                                     [% SET holds_by_branch = [] %]
1128                                                     [% FOREACH h IN biblioloo.reserveloop %]
1129                                                         [% IF h.branchcode == b %]
1130                                                             [% holds_by_branch.push( h ) %]
1131                                                         [% END %]
1132                                                     [% END %]
1133
1134                                                     [% SET itemtypes = [] %]
1135                                                     [% FOREACH h IN holds_by_branch %]
1136                                                         [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1137                                                         [% itemtypes.push( hold_itemtype ) %]
1138                                                     [% END %]
1139                                                     [% itemtypes = itemtypes.unique %]
1140
1141                                                     [% FOREACH i IN itemtypes.sort %]
1142                                                         <div class="holds_by_itemtype">
1143                                                             <h5 class="itemtype_holds">
1144                                                                 [% IF i %]
1145                                                                     [% ItemTypes.GetDescription( i ) | html %]
1146                                                                 [% ELSE %]
1147                                                                     <span>Any item type</span>
1148                                                                 [% END %]
1149                                                             </h5>
1150
1151                                                             [% SET holds_by_itemtype = [] %]
1152                                                             [% FOREACH h IN holds_by_branch %]
1153                                                                 [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1154                                                                 [% IF hold_itemtype == i %]
1155                                                                     [% holds_by_itemtype.push( h ) %]
1156                                                                 [% END %]
1157                                                             [% END %]
1158                                                             [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
1159                                                         </div> <!-- /.holds_by_itemtype -->
1160                                                     [% END %]
1161                                                 </div> <!-- /.holds_by_library -->
1162                                             [% END # /FOREACH b %]
1163                                         [% END # /IF ( branchcodes.empty ) %]
1164
1165                                     [% ELSE %]
1166
1167                                         [% IF ( biblioloo.reserveloop.size ) %]
1168                                             [% INCLUDE holds_table.inc holds=biblioloo.reserveloop %]
1169                                         [% ELSE %]
1170                                             <div class="note">
1171                                                 There are no holds on this title.
1172                                             </div>
1173                                         [% END %]
1174
1175                                     [% END # /IF HoldsSplitQueue %]
1176                                 </div> <!-- /hold_title -->
1177                             [% END # /IF biblioloo.reserveloop %]
1178                         [% END # FOREACH biblioloo %]
1179                     </form> <!-- /#existing_holds -->
1180                 [% END # IF reserveloop %]
1181             [% END # UNLESS patron %]
1182
1183         </main>
1184
1185         [% IF ( multi_hold || nobiblio ) # No sidebar menu when placing multiple holds or biblio not found %]
1186             </div> <!-- /.col-md-10.col-md-offset-1 -->
1187         [% ELSE %]
1188             </div> <!-- /.col-sm-10.col-sm-push-2 -->
1189                 <div class="col-sm-2 col-sm-pull-10">
1190                     <aside>
1191                         [% INCLUDE 'biblio-view-menu.inc' %]
1192                     </aside>
1193                 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1194         [% END %]
1195     </div> <!-- /.row -->
1196
1197     <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
1198         <div class="modal-dialog" role="document">
1199             <div class="modal-content">
1200                 <div class="modal-header">
1201                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1202                     <h3>Confirm deletion</h3>
1203                 </div>
1204
1205                 <div class="modal-body">
1206                     <p>Are you sure you want to cancel this hold?</p>
1207
1208                     <fieldset class="action">
1209                         [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
1210                         [% IF hold_cancellation.count %]
1211                             <label for="cancellation-reason">Cancellation reason: </label>
1212                             <select class="cancellation-reason" name="modal-cancellation-reason" id="modal-cancellation-reason">
1213                                 <option value="">No reason given</option>
1214                                 [% FOREACH reason IN hold_cancellation %]
1215                                     <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
1216                                 [% END %]
1217                             </select>
1218                         [% END %]
1219                     </fieldset>
1220                 </div>
1221
1222                 <div class="modal-footer">
1223                     <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
1224                     <a href="#" data-dismiss="modal">Cancel</a>
1225                 </div>
1226             </div>
1227         </div>
1228     </div>
1229
1230 [% MACRO jsinclude BLOCK %]
1231     [% INCLUDE 'datatables.inc' %]
1232     [% INCLUDE 'calendar.inc' %]
1233     [% INCLUDE 'columns_settings.inc' %]
1234     [% Asset.js("lib/hc-sticky.js") | $raw %]
1235     [% INCLUDE 'select2.inc' %]
1236     [% Asset.js("js/holds.js") | $raw%]
1237
1238     [% SET url_biblio_params = "biblionumber=" _ biblionumbers.join("&amp;biblionumber=") %]
1239     [% IF multi_hold %]
1240         [% SET url_biblio_params = url_biblio_params _ "&amp;multi_hold=1" %]
1241     [% END %]
1242
1243     <script>
1244         var Sticky;
1245         var biblionumbers = [[% biblionumbers.join(', ') | $raw %]];
1246         var borrowernumber = "[% patron.borrowernumber | $raw %]";
1247         var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
1248         var override_items = {[% FOREACH biblio IN biblioloop %][% FOREACH itemloo IN biblio.itemloop %][% IF ( itemloo.override ) %]
1249         [% itemloo.itemnumber | html %]: {
1250             homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]",
1251             holdallowed: "[% itemloo.holdallowed | html %]"
1252             },
1253             [% END %][% END %][% END %]
1254         };
1255         var ERROR_MAP = {
1256             damaged: _("Item damaged"),
1257             ageRestricted: _("Age restricted"),
1258             tooManyHoldsForThisRecord: _("Exceeded max holds per record"),
1259             tooManyReservesToday: _("Daily hold limit reached for patron"),
1260             tooManyReserves: _("Too many holds"),
1261             notReservable: _("Not holdable"),
1262             noReservesAllowed: _("No reserves allowed"),
1263             cannotReserveFromOtherBranches: _("Patron is from different library"),
1264             itemAlreadyOnHold: _("Patron already has hold for this item"),
1265             cannotBeTransferred: _("Cannot be transferred to pickup library"),
1266             pickupNotInHoldGroup: _("Only pickup locations within the same hold group are allowed")
1267         }
1268
1269         var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
1270         $.fn.select2.defaults.set("width", "100%" );
1271         $.fn.select2.defaults.set("dropdownAutoWidth", true );
1272
1273         $(document).ready(function() {
1274             $('#cancellation-reason-fieldset').hide();
1275             $('.rank-request').on('change', function() {
1276                 if ( $(".rank-request option:selected[value='del']").length ) {
1277                     $('#cancellation-reason-fieldset').show();
1278                 } else {
1279                     $('#cancellation-reason-fieldset').hide();
1280                 }
1281             });
1282
1283             if( $("#circ_holds_select").length > 0 ){
1284                 [% SET active = clubs ? 1 : 0 %]
1285                 /* Set active tab based on whether a club search was submitted */
1286                 var tabs = $("#circ_holds_select li:eq(" + [% active | $raw %] + ") a").tab("show");
1287                 $( tabs[0].hash ).find("input.focus").focus();
1288
1289                 /* Change active focus when tabs change */
1290                 $("#circ_holds_select a[data-toggle='tab']").on("shown.bs.tab", function (e) {
1291                     active_tab = e.target.hash;
1292                     $( active_tab ).find("input.focus").focus();
1293                 });
1294             }
1295
1296
1297             function ToggleHoldsToPlace() {
1298                 if ( $("#requestany").prop('checked') ) {
1299                     $("#holds_to_place_count").prop('disabled', false);
1300                 } else {
1301                     $("#holds_to_place_count").prop('disabled', true);
1302                 }
1303             }
1304             ToggleHoldsToPlace();
1305             $("#requestany").on('change', function(){
1306                 ToggleHoldsToPlace();
1307             });
1308
1309             [% IF Koha.Preference('UseBranchTransferLimits') %]
1310                 $("#pickup").on('change', function(){
1311                     var pickup = $("#pickup").val();
1312                     var url = "?pickup=" + pickup;
1313                     url += "&borrowernumber=" + borrowernumber;
1314                     url += "&biblionumber=" + biblionumbers[0];
1315                     window.location.replace(url);
1316                 });
1317             [% END %]
1318
1319             var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, {
1320                 'bPaginate': false,
1321                 "sDom": '<"top pager"ilf>t',
1322             }));
1323
1324             //Override fieldset styling for dataTables search box
1325             $("div.top.pager").css("margin-left","1em");
1326             $(".dataTables_filter label").css({
1327                 "width":"auto",
1328                 "margin-right":"0em"
1329             });
1330
1331             $("#club-request-form").on("submit", function() {
1332                 let $t = $(this);
1333                 $('.clubalert, .holdalert').addClass('hide');
1334                 const data = {
1335                     pickup_library_id: $('select[name="pickup"]').val()
1336                 };
1337                 if($('input[name="checkitem"]:checked').length)
1338                     data.item_id = $('input[name="checkitem"]:checked').val();
1339                 if($('input[name="borrowernumber"]').length)
1340                     data.patron_id = $('input[name="borrowernumber"]').val();
1341                 if($('textarea[name="notes"]').length)
1342                     data.notes = $('textarea[name="notes"]').val()||null;
1343                 if($('input[name="itemtype"]').length) {
1344                     data.item_type = $('input[name="itemtype"]').val()||null;
1345                 }
1346                 if($('input[name="default_patron_home"]:checked').length) {
1347                     data.default_patron_home = 1;
1348                 }
1349
1350                 const count = $('input[name="holds_to_place_count"]').length?$('input[name="holds_to_place_count"]').val():1;
1351                 var newloc = 'request.pl?';
1352                 biblionumbers.forEach(function (biblionumber) {
1353                     newloc += '&biblionumber=' + biblionumber;
1354                 });
1355
1356                 biblionumbers.forEach(function(biblionumber) {
1357                     data.biblio_id = biblionumber;
1358                     let options = {
1359                         url: $t.attr('action'),
1360                         method: $t.attr('method').toUpperCase(),
1361                         contentType: 'application/json',
1362                         data: JSON.stringify(data)
1363                     };
1364                     for(let i = 0; i < count; i++) {
1365                         $.ajax(options)
1366                         .then(function(result) {
1367                             document.location = newloc;
1368                         })
1369                         .fail(function(err) {
1370                             var message = err.responseJSON.error;
1371                             var match = err.responseJSON.error.match(/Reason: (\w+)\s*$/);
1372                             if(match && ERROR_MAP[match[1]]) {
1373                                 message = '<div><strong>'+_("Cannot place hold")+'</strong></div><div>'+ERROR_MAP[match[1]]+'</div>'
1374                             }
1375                             $('.clubalert, .holdalert').removeClass('hide').html(message);
1376                         });
1377                     }
1378                 });
1379
1380                 return false;
1381             });
1382
1383             [% UNLESS ( multi_hold ) %]
1384                 $("#hold-request-form").on("submit", function(){
1385                     return check($(this));
1386                 });
1387             [% ELSE %]
1388                 $("#hold-request-form").on("submit", function(){
1389                     return checkMultiHold();
1390                 });
1391             [% END %]
1392
1393             $(".pickup_location_dropdown").each( function () {
1394                 $(this).pickup_locations_dropdown();
1395             });
1396
1397             $("#pickup_multi").select2({
1398                 width: '30%',
1399                 allowClear: true
1400             });
1401
1402             $('.multi_pickup_select').select2({
1403                 width: '100%',
1404                 allowClear: true
1405             });
1406
1407             $("#pickup_multi").on("change", function() {
1408                 var selection = $(this).val();
1409                 if ( selection != '' ) {
1410                     $(".multi_pickup_select").each(function() {
1411                         var valid_pickup_locations = $(this).data('pickup-locations');
1412                         if ( valid_pickup_locations.includes(selection) ) {
1413                             $(this).val(selection);
1414                             $(this).trigger("change");
1415                         }
1416                     });
1417                 }
1418             });
1419
1420             $("#pickup").each( function () {
1421                 $(this).pickup_locations_dropdown();
1422             });
1423
1424             $(".pickup_locations").each(function () {
1425                 $(this).pickup_locations_dropdown();
1426             });
1427         });
1428
1429         function check( table ) {
1430
1431             var msg = "";
1432
1433             if ( ! $("#requestany").is(":checked") ) {
1434                 // requestany not selected, go through the item-specific cases
1435                 if ( $('input[type="radio"]:checked').length > 0 ) {
1436                     // got item-specific hold requests in the form!
1437                     // verify they have a pickup location selected
1438
1439                     if (table.find('input[type="radio"]:checked')
1440                                 .closest('tr')
1441                                 .find(".pickup_locations").val() === null) {
1442
1443                         msg = _("- Please select a pickup location for the item" + "\n")
1444                     }
1445                 }
1446                 else {
1447                     msg = (_("- Please select an item to place a hold") + "\n");
1448                 }
1449             } else {
1450                 if( $("#pickup").length < 1 || $("#pickup").val() == "" ){
1451                     msg = _("- Please select a pickup location for this hold" + "\n");
1452                 }
1453             }
1454
1455
1456             if (msg == "") {
1457                 $('#hold-request-form').preventDoubleFormSubmit();
1458                 return(true);
1459             } else {
1460                 alert(msg);
1461                 return(false);
1462             }
1463         }
1464
1465         function checkMultiHold() {
1466
1467             var selected_bibs = $(".multi_hold_item_checkbox:checked");
1468             if ( selected_bibs.length > 0 ) {
1469                 // there are biblios selected in the form!
1470                 // verify they have a pickup location selected
1471
1472                 var pickup_not_set = 0;
1473                 selected_bibs.each(function() {
1474                     if ( $(this).closest('tr').find(".multi_pickup_select").val() === "" ) {
1475                         pickup_not_set++;
1476                     }
1477                     else {
1478                         var bibnum = $(this).attr("title");
1479                     }
1480                 });
1481                 if ( pickup_not_set > 0 ) {
1482                     alert( _("Please make sure all selected titles have a pickup location set" + "\n") );
1483                     return false;
1484                 }
1485             }
1486             else {
1487                 alert( _("Please select at least one title" + "\n") );
1488                 return false;
1489             }
1490
1491             $('#hold-request-form').preventDoubleFormSubmit();
1492
1493             return true;
1494         }
1495
1496          $(document).ready(function() {
1497
1498             $("#always_show_holds").change(function(){
1499                 if( $(this).prop('checked') ){
1500                     document.cookie = 'always_show_holds=DO';
1501                 } else {
1502                     document.cookie = 'always_show_holds=DONT';
1503                 }
1504             });
1505             $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic
1506                 var itemnumber = this.value;
1507                 var msg = '';
1508
1509                 switch (override_items[itemnumber].holdallowed) {
1510                     case "not_allowed": msg = _("This item normally cannot be put on hold."); break;
1511                     case "from_home_library": msg = _("This item normally cannot be put on hold except for patrons from %s.").format(override_items[itemnumber].homebranch); break;
1512                 }
1513
1514                 msg += "\n\n" + _("Place hold on this item?");
1515
1516                 return confirm(msg);
1517             });
1518             $("button.warning").click(function() {
1519                 return confirm( _("None of these items can normally be put on hold for this patron.") + "\n\n" + _("Place hold?") );
1520             });
1521             $("#requestany").click(function() {
1522                 if(this.checked){
1523                     $("input[name=checkitem]").each(function() {
1524                         $(this).prop("checked", false);
1525                     });
1526                 }
1527             });
1528             $("input[name=checkitem]").click(function() {
1529                 onechecked = 0;
1530                 $("input[name=checkitem]").each(function() {
1531                     if(this.checked){
1532                         onechecked = 1;
1533                     }
1534                 });
1535                 if(onechecked == 1){
1536                     $("#requestany").prop("checked", false);
1537                     $("#holds_to_place_count").prop('disabled', true);
1538                 } else {
1539                     $("#requestany").prop("checked",true);
1540                     $("#holds_to_place_count").prop('disabled', false);
1541                 }
1542             });
1543             var prev_rank_request;
1544             $("select[name=rank-request]").on("focus", function() {
1545                 prev_rank_request = $(this).val();
1546                 var row = $(this).parents("tr:first");
1547             }).change(function() {
1548                 var row = $(this).parents("tr:first");
1549                 var value = parseInt($(this).val());
1550                 var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found
1551                 if( !isNaN(value) ) {  //If moved to 'del'
1552                     var after = row.parent().find("tr:nth-child("+(value+1+found_holds )+")"); //Go to the row 1 after the new value (and skip found holds)
1553                     if (prev_rank_request > value) {
1554                         row.insertBefore(after);
1555                     } else {
1556                         row.insertAfter(after);
1557                     }
1558                 }
1559
1560                 var next_priority = 1;
1561                 $("select[name=rank-request]").each(function () {
1562                     if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds
1563                     $(this).val(next_priority);
1564                     next_priority++;
1565                 });
1566             });
1567
1568             $(".clear-date").on("click",function(e){
1569                 e.preventDefault();
1570                 var fieldID = this.id.replace("clear-date-","");
1571                 $("#" + fieldID).val("");
1572             });
1573
1574             // Confirm cancellation of hold
1575             let cancel_link;
1576             $(".cancel-hold").on("click",function(e) {
1577                 e.preventDefault;
1578                 cancel_link = $(this);
1579                 $('#cancelModal').modal();
1580                 return false;
1581             });
1582             $("#cancelModalConfirmBtn").on("click",function(e) {
1583                 let link;
1584                 if(cancel_link.data('bulk')) {
1585                     [% SET data_url = 'biblionumber=' _ biblionumbers.join('&biblionumber=') %]
1586                     link = `request.pl?[% data_url | url %]&amp;action=cancelBulk&amp;ids=${$('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')).join(',')}`;
1587                 } else {
1588                     let borrowernumber = cancel_link.data('borrowernumber');
1589                     let biblionumber = cancel_link.data('biblionumber');
1590                     let reserve_id = cancel_link.data('id');
1591                     link = `request.pl?action=cancel&amp;borrowernumber=${ borrowernumber }&amp;biblionumber=${ biblionumber }&amp;reserve_id=${ reserve_id }`;
1592                 }
1593                 let reason = $("#modal-cancellation-reason").val();
1594                 if ( reason ) {
1595                     link += "&amp;cancellation-reason=" + reason
1596                 }
1597                 window.location.href = link;
1598                 return false;
1599             });
1600
1601             [% UNLESS ( patron || patron.borrowernumber || borrowers || noitems || nobiblio ) %]
1602                 [% IF ( PatronAutoComplete ) %]
1603                     patron_autocomplete($("#search_patron_filter"), { 'link-to': 'reserve', 'url-params': '[% url_biblio_params | url %]' });
1604                 [% END %]
1605             [% END %]
1606
1607             Sticky = $("#toolbar");
1608             Sticky.hcSticky({
1609                 stickTo: "#existing_holds",
1610                 stickyClass: "floating"
1611             });
1612
1613             if(!localStorage.selectedHolds  || document.referrer.replace(/\?.*/, '') !== document.location.origin+document.location.pathname) {
1614                 localStorage.selectedHolds = [];
1615             }
1616
1617             $('.holds_table .select_hold').each(function() {
1618                 if(localStorage.selectedHolds.includes($(this).data('id'))) {
1619                     $(this).prop('checked', true);
1620                 }
1621             });
1622
1623             $('.holds_table .select_hold_all').each(function() {
1624                 var table = $(this).parents('.holds_table');
1625                 var count = $('.select_hold:not(:checked)', table).length;
1626                 $('.select_hold_all', table).prop('checked', !count);
1627             });
1628
1629             $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1630
1631             $('.holds_table .select_hold_all').click(function() {
1632                 var table = $(this).parents('.holds_table');
1633                 var count = $('.select_hold:checked', table).length;
1634                 $('.select_hold', table).prop('checked', !count);
1635                 $(this).prop('checked', !count);
1636                 $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1637                 localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id'));
1638             });
1639
1640             $('.holds_table .select_hold').click(function() {
1641                 var table = $(this).parents('.holds_table');
1642                 var count = $('.select_hold:not(:checked)', table).length;
1643                 $('.select_hold_all', table).prop('checked', !count);
1644                 $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1645                 localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id'));
1646             });
1647
1648             $('.cancel_selected_holds').click(function(e) {
1649                 e.preventDefault();
1650                 if($('.holds_table .select_hold:checked').length) {
1651                     cancel_link = $(this);
1652                     delete localStorage.selectedHolds;
1653                     $('#cancelModal').modal();
1654                 }
1655                 return false;
1656             });
1657         });
1658     </script>
1659
1660     <script>
1661         table_settings = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
1662     </script>
1663
1664     [% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/reserve/request.pl?' _ url_biblio_params, redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/reserve/request.pl?' _ url_biblio_params, redirect_if_attribute_equal => 'cardnumber' %]
1665     <script>
1666         $(document).ready(function() {
1667             $("#holds_patronsearch").on("submit", filter);
1668         });
1669         $('.printholdslip').click(function(){
1670                 var reserve_id = $(this).attr('data-reserve_id');
1671                 window.open("/cgi-bin/koha/circ/hold-transfer-slip.pl?reserve_id=" + reserve_id);
1672                 return false;
1673         })
1674     </script>
1675 [% END %]
1676
1677 [% INCLUDE 'intranet-bottom.inc' %]