Bug 24857: No words
[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 typeX:</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 ) %]<span>Waiting</span>[% ELSE %]<span>On hold</span>[% END %]
805                                                             [% IF ( itemloo.canreservefromotherbranches ) %]
806                                                                 <span>for</span> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedFor.borrowernumber | uri %]">[% itemloo.ReservedFor.firstname | html %] [% itemloo.ReservedFor.surname | html %]</a>
807                                                             [% END %]
808                                                             [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %]
809                                                             [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] <span>since</span>
810                                                             [% IF ( itemloo.waitingdate ) %]
811                                                                 [% itemloo.waitingdate | $KohaDates %]
812                                                             [% ELSE %]
813                                                                 [% IF ( itemloo.reservedate ) %]
814                                                                     [% itemloo.reservedate | html %]
815                                                                 [% END %]
816                                                             [% END %].
817                                                             <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>
818                                                         [% END # /IF itemloo.nocancel %]
819                                                     [% ELSE %]
820                                                         Not on hold
821                                                     [% END # /IF itemloo.reservedate %]
822
823                                                     [% IF itemloo.item_level_holds == "N" %]
824                                                         <br/>Item level hold not allowed from OPAC
825                                                     [% ELSIF itemloo.item_level_holds == "F" %]
826                                                         <br/>Item level hold forced from OPAC
827                                                     [% END %]
828
829                                                     [% IF ( itemloo.itemlost ) %]
830                                                        <span class="lost">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => itemloo.itemlost ) | html %]</span>
831                                                     [% END %]
832
833                                                     [% IF ( itemloo.damaged ) %]
834                                                         <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => itemloo.damaged ) | html %]</span>
835                                                     [% END %]
836
837                                                     [% IF ( itemloo.withdrawn ) %]
838                                                        <span class="wdn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => itemloo.withdrawn ) | html %]</span>
839                                                     [% END %]
840
841                                                     [% IF ( itemloo.notforloan ) %]
842                                                        <span class="nfl">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])</span>
843                                                     [% ELSIF ( itemloo.notforloanitype ) %]
844                                                        <span class="nfl">Not for loan (Itemtype not for loan)</span>
845                                                     [% END %]
846                                                 </td>
847                                             </tr>
848                                         [% END # / UNLESS itemloo.hide %]
849                                     [% END # /FOREACH itemloo %]
850                                 </tbody>
851                             </table> <!-- /#requestspecific -->
852
853                             [% IF hiddencount %]
854                                 <form>
855                                     <p class="hiddencount">
856                                         <a href="request.pl?biblionumber=[% biblio.biblionumber | uri %]&amp;borrowernumber=[% borrowernumber | uri %]&amp;showallitems=1">Show all items ([% biblio.hiddencount | html %] hidden)</a>
857                                     </p>
858                                 </form>
859                             [% END # /IF hiddencount %]
860
861                         [% ELSE # /UNLESS multi_hold %]
862
863                             <table id="requesttitles">
864                                 <tr>
865                                     <th>&nbsp;</th>
866                                     <th>Pickup location</th>
867                                     <th>Title</th>
868                                     [% UNLESS Koha.Preference('item-level_itypes') %]
869                                         <th>Item type</th>
870                                     [% END %]
871                                     <th>Priority</th>
872                                     <th>Information</th>
873                                 </tr>
874                                 [% FOREACH biblioloo IN biblioloop %]
875                                     [% IF ( biblioloo.warn ) %]
876                                         <tr class="onissue">
877                                     [% ELSE %]
878                                         <tr>
879                                     [% END %]
880                                         <td>
881                                             [% UNLESS ( biblioloo.warn ) %]
882                                                 <input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]"/>
883                                             [% END %]
884                                         </td>
885                                         <td>
886                                             [% UNLESS ( biblioloo.none_avail || biblioloo.noitems ) %]
887                                                 <select name="pickup_[% biblioloo.biblionumber | html %]"
888                                                         class="multi_pickup_select"
889                                                         data-biblio-id="[% biblioloo.biblionumber | html %]"
890                                                         data-patron-id="[% patron.borrowernumber | html %]"
891                                                         data-pickup-locations='[% biblioloo.pickup_locations_codes.json | $raw %]'>
892                                                     <option value=""></option>
893                                                     [% FOREACH pickup_location IN biblioloo.pickup_locations %]
894                                                         <option value="[% pickup_location.branchcode | html %]">[% pickup_location.branchname | html %]</option>
895                                                     [% END %]
896                                                 </select>
897                                             [% END %]
898                                         </td>
899                                         <td>
900                                             <ul>
901                                                 <li>
902                                                     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
903                                                     [% IF biblioloo.author %] by [% biblioloo.author | html %][% END %]
904                                                 </li>
905                                                 [% IF ( biblioloo.publicationyear ) %]
906                                                     <li>
907                                                         <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
908                                                     </li>
909                                                 [% END %]
910                                             </ul>
911                                             [% IF ( biblioloo.warn ) %]
912                                                 <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
913                                             [% END %]
914                                         </td>
915                                         [% UNLESS Koha.Preference('item-level_itypes') %]
916                                             <td>
917                                                 <img src="[% biblioloo.itemtype.image_location | html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
918                                             </td>
919                                         [% END %]
920                                         <td>[% biblioloo.rank | html %]</td>
921                                         <td>
922                                             [% IF ( biblioloo.checked_previously ) %]
923                                                 <span>Patron has previously checked out this title</span><br/>
924                                             [% END %]
925                                             [% IF ( biblioloo.alreadyres ) %]
926                                                 <ul>
927                                             [% ELSE %]
928                                                 [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
929                                                     <ul>
930                                                 [% END %]
931                                             [% END %]
932
933                                             [% IF ( biblioloo.alreadyres ) %]
934                                             <li>
935                                                 [% 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
936                                             </li>
937                                             [% END %]
938                                             [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
939                                                 <li> <strong>No items are available</strong> to be placed on hold</li>
940                                             [% END %]
941
942                                             [% IF ( biblioloo.alreadyres ) %]
943                                                 </ul>
944                                             [% ELSE %]
945                                                 [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
946                                                     </ul>
947                                                 [% END %]
948                                             [% END %]
949                                         </td>
950                                     </tr>
951                                 [% END # /FOREACH biblioloo %]
952                             </table> <!-- /#requesttitles -->
953
954                         [% END # /UNLESS multi_hold %]
955
956                         <fieldset class="action">
957                             [% IF ( patron AND patron.borrowernumber ) %]
958                                 [% IF ( multi_hold ) %]
959                                     [% IF ( override_required ) %]
960                                         <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place holds</button>
961                                     [% ELSIF ( no_bibs_available ) %]
962                                         <button type="submit" class="btn btn-default btn-disabled" disabled="disabled">Place holds</button>
963                                     [% ELSIF ( none_available ) %]
964                                         <button type="submit" class="btn btn-default">Place holds</button>
965                                     [% ELSE %]
966                                         <button type="submit" class="btn btn-default" id="multi_hold_submit">Place holds</button>
967                                     [% END %]
968                                 [% ELSE %]
969                                     [% IF ( override_required ) %]
970                                         <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
971                                     [% ELSIF ( none_available ) %]
972                                         <button type="submit" class="btn btn-default btn-disabled" disabled="disabled">Place hold</button>
973                                     [% ELSE %]
974                                         <button type="submit" class="btn btn-default">Place hold</button>
975                                     [% END %]
976                                 [% END %]
977                             [% END # /IF patron %]
978                         </fieldset> <!-- /.action -->
979                     </form> <!-- /#hold-request-form -->
980                 </fieldset> <!-- /.rows -->
981             [% END %]
982
983             [% UNLESS ( patron ) %]
984                 [% UNLESS borrowers %]
985                     [% SET hold_count = Biblio.HoldsCount( biblio.biblionumber ) | html %]
986                     [% IF hold_count %]
987                         <label for ="always_show_holds">Always show holds</label>
988                         [% IF always_show_holds == 'DONT' %]
989                             <input type="checkbox" name="always_show_holds" id="always_show_holds" value="DO">
990                             [% UNLESS reserveloop %]
991                                 <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>
992                             [% END %]
993                         [% ELSE %]
994                             <input type="checkbox" name="always_show_holds" value="DO" id="always_show_holds" checked="checked">
995                         [% END %]
996                     [% END %]
997                 [% END %]
998                 [% IF ( reserveloop ) %]
999                     <form id="existing_holds" name="T[% time | html %]" action="modrequest.pl" method="post" style="display:block">
1000                         [% IF ( multi_hold ) %]
1001                             [% FOREACH biblionumber IN biblionumbers %]
1002                             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/>
1003                             [% END %]
1004                         [% END %]
1005
1006                         [% IF enqueued %]
1007                             <div class="dialog message">
1008                                 <p>The job has been enqueued! It will be processed as soon as possible.</p>
1009                                 <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>
1010                             </div>
1011                         [% END %]
1012
1013                         <h2>Existing holds</h2>
1014                         <div id="toolbar" class="btn-toolbar">
1015                             <input type="submit" name="submit" value="Update hold(s)" /> <button class="cancel_selected_holds" data-bulk="true"></button>
1016                         <fieldset id="cancellation-reason-fieldset" class="action">
1017                             [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
1018                             [% IF hold_cancellation.count %]
1019                                 <label for="cancellation-reason">Cancellation reason: </label>
1020                                 <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
1021                                     <option value="">No reason given</option>
1022                                     [% FOREACH reason IN hold_cancellation %]
1023                                         <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
1024                                     [% END %]
1025                                 </select>
1026                             [% END %]
1027                         </fieldset>
1028                         </div>
1029
1030                         [% FOREACH biblioloo IN biblioloop %]
1031                             [% IF ( biblioloo.reserveloop ) %]
1032                                 <div class="hold_title" id="hold_title_[% biblioloo.biblionumber | html %]">
1033                                     [% IF ( multi_hold ) %]
1034                                         <h3>
1035                                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">
1036                                                 [% biblioloo.title | html %]
1037                                             </a> <span class="number_box"><span>[% biblioloo.reserveloop.size | html %] [% tn('Hold', 'Holds', biblioloo.reserveloop.size) | $raw %]</span></span>
1038                                         </h3>
1039                                     [% END %]
1040
1041                                     [% IF Koha.Preference('HoldsSplitQueue') == 'branch' %]
1042
1043                                         [% SET branchcodes = [] %]
1044
1045                                         [% FOREACH h IN biblioloo.reserveloop %]
1046                                             [% branchcodes.push( h.branchcode ) %]
1047                                         [% END %]
1048                                         [% branchcodes = branchcodes.unique %]
1049                                         [% IF ( branchcodes.empty ) %]
1050                                             <div class="note">
1051                                                 There are no holds on this title.
1052                                             </div>
1053                                         [% ELSE %]
1054
1055                                             [% FOREACH b IN branchcodes.sort %]
1056                                                 [% SET holds_by_branch = [] %]
1057                                                 [% FOREACH h IN biblioloo.reserveloop %]
1058                                                     [% IF h.branchcode == b %]
1059                                                         [% holds_by_branch.push( h ) %]
1060                                                     [% END %]
1061                                                 [% END %]
1062                                                 <div class="holds_by_library">
1063                                                     <h4>[% Branches.GetName( b ) | html %]</h4>
1064
1065                                                     [% INCLUDE holds_table.inc holds=holds_by_branch %]
1066                                                 </div>
1067                                             [% END # /FOREACh b %]
1068                                         [% END # /IF ( branchcodes.empty ) %]
1069
1070                                     [% ELSIF Koha.Preference('HoldsSplitQueue') == 'itemtype' %]
1071
1072                                         [% SET itemtypes = [] %]
1073
1074                                         [% FOREACH h IN biblioloo.reserveloop %]
1075                                             [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1076                                             [% itemtypes.push( hold_itemtype ) %]
1077                                         [% END %]
1078                                         [% itemtypes = itemtypes.unique %]
1079                                         [% IF ( itemtypes.empty ) %]
1080                                             <div class="note">
1081                                                 There are no holds on this title.
1082                                             </div>
1083                                         [% ELSE %]
1084
1085                                             [% FOREACH i IN itemtypes.sort %]
1086                                                 [% SET holds_by_itemtype = [] %]
1087                                                 [% FOREACH h IN biblioloo.reserveloop %]
1088                                                     [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1089                                                     [% IF hold_itemtype == i %]
1090                                                         [% holds_by_itemtype.push( h ) %]
1091                                                     [% END %]
1092                                                 [% END %]
1093
1094                                                 <div class="holds_by_itemtype">
1095                                                     [% IF i %]
1096                                                         <h4>[% ItemTypes.GetDescription( i ) | html %]</h4>
1097                                                     [% ELSE %]
1098                                                         <h4>Any item type</h4>
1099                                                     [% END %]
1100                                                     [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
1101                                                 </div>
1102                                             [% END # /FOREACH i %]
1103                                         [% END # /IF ( itemtypes.empty ) %]
1104
1105                                     [% ELSIF Koha.Preference('HoldsSplitQueue') == 'branch_itemtype' %]
1106                                         [% SET branchcodes = [] %]
1107
1108                                         [% FOREACH h IN biblioloo.reserveloop %]
1109                                             [% branchcodes.push( h.branchcode ) %]
1110                                         [% END %]
1111                                         [% branchcodes = branchcodes.unique %]
1112                                         [% IF ( branchcodes.empty ) %]
1113                                             <div class="note">
1114                                                 There are no holds on this title.
1115                                             </div>
1116                                         [% ELSE %]
1117
1118                                             [% FOREACH b IN branchcodes.sort %]
1119                                                 <div class="holds_by_library">
1120                                                     <h4 class="library_holds">[% Branches.GetName( b ) | html %]</h4>
1121                                                     [% SET holds_by_branch = [] %]
1122                                                     [% FOREACH h IN biblioloo.reserveloop %]
1123                                                         [% IF h.branchcode == b %]
1124                                                             [% holds_by_branch.push( h ) %]
1125                                                         [% END %]
1126                                                     [% END %]
1127
1128                                                     [% SET itemtypes = [] %]
1129                                                     [% FOREACH h IN holds_by_branch %]
1130                                                         [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1131                                                         [% itemtypes.push( hold_itemtype ) %]
1132                                                     [% END %]
1133                                                     [% itemtypes = itemtypes.unique %]
1134
1135                                                     [% FOREACH i IN itemtypes.sort %]
1136                                                         <div class="holds_by_itemtype">
1137                                                             <h5 class="itemtype_holds">
1138                                                                 [% IF i %]
1139                                                                     [% ItemTypes.GetDescription( i ) | html %]
1140                                                                 [% ELSE %]
1141                                                                     <span>Any item type</span>
1142                                                                 [% END %]
1143                                                             </h5>
1144
1145                                                             [% SET holds_by_itemtype = [] %]
1146                                                             [% FOREACH h IN holds_by_branch %]
1147                                                                 [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1148                                                                 [% IF hold_itemtype == i %]
1149                                                                     [% holds_by_itemtype.push( h ) %]
1150                                                                 [% END %]
1151                                                             [% END %]
1152                                                             [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
1153                                                         </div> <!-- /.holds_by_itemtype -->
1154                                                     [% END %]
1155                                                 </div> <!-- /.holds_by_library -->
1156                                             [% END # /FOREACH b %]
1157                                         [% END # /IF ( branchcodes.empty ) %]
1158
1159                                     [% ELSE %]
1160
1161                                         [% IF ( biblioloo.reserveloop.size ) %]
1162                                             [% INCLUDE holds_table.inc holds=biblioloo.reserveloop %]
1163                                         [% ELSE %]
1164                                             <div class="note">
1165                                                 There are no holds on this title.
1166                                             </div>
1167                                         [% END %]
1168
1169                                     [% END # /IF HoldsSplitQueue %]
1170                                 </div> <!-- /hold_title -->
1171                             [% END # /IF biblioloo.reserveloop %]
1172                         [% END # FOREACH biblioloo %]
1173                     </form> <!-- /#existing_holds -->
1174                 [% END # IF reserveloop %]
1175             [% END # UNLESS patron %]
1176
1177         </main>
1178
1179         [% IF ( multi_hold || nobiblio ) # No sidebar menu when placing multiple holds or biblio not found %]
1180             </div> <!-- /.col-md-10.col-md-offset-1 -->
1181         [% ELSE %]
1182             </div> <!-- /.col-sm-10.col-sm-push-2 -->
1183                 <div class="col-sm-2 col-sm-pull-10">
1184                     <aside>
1185                         [% INCLUDE 'biblio-view-menu.inc' %]
1186                     </aside>
1187                 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1188         [% END %]
1189     </div> <!-- /.row -->
1190
1191     <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
1192         <div class="modal-dialog" role="document">
1193             <div class="modal-content">
1194                 <div class="modal-header">
1195                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
1196                     <h3>Confirm deletion</h3>
1197                 </div>
1198
1199                 <div class="modal-body">
1200                     <p>Are you sure you want to cancel this hold?</p>
1201
1202                     <fieldset class="action">
1203                         [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
1204                         [% IF hold_cancellation.count %]
1205                             <label for="cancellation-reason">Cancellation reason: </label>
1206                             <select class="cancellation-reason" name="modal-cancellation-reason" id="modal-cancellation-reason">
1207                                 <option value="">No reason given</option>
1208                                 [% FOREACH reason IN hold_cancellation %]
1209                                     <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
1210                                 [% END %]
1211                             </select>
1212                         [% END %]
1213                     </fieldset>
1214                 </div>
1215
1216                 <div class="modal-footer">
1217                     <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
1218                     <a href="#" data-dismiss="modal">Cancel</a>
1219                 </div>
1220             </div>
1221         </div>
1222     </div>
1223
1224 [% MACRO jsinclude BLOCK %]
1225     [% INCLUDE 'datatables.inc' %]
1226     [% INCLUDE 'calendar.inc' %]
1227     [% INCLUDE 'columns_settings.inc' %]
1228     [% Asset.js("lib/hc-sticky.js") | $raw %]
1229     [% INCLUDE 'select2.inc' %]
1230     [% Asset.js("js/holds.js") | $raw%]
1231
1232     [% SET url_biblio_params = "biblionumber=" _ biblionumbers.join("&amp;biblionumber=") %]
1233     [% IF multi_hold %]
1234         [% SET url_biblio_params = url_biblio_params _ "&amp;multi_hold=1" %]
1235     [% END %]
1236
1237     <script>
1238         var Sticky;
1239         var biblionumbers = [[% biblionumbers.join(', ') | $raw %]];
1240         var borrowernumber = "[% patron.borrowernumber | $raw %]";
1241         var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
1242         var override_items = {[% FOREACH biblio IN biblioloop %][% FOREACH itemloo IN biblio.itemloop %][% IF ( itemloo.override ) %]
1243         [% itemloo.itemnumber | html %]: {
1244             homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]",
1245             holdallowed: "[% itemloo.holdallowed | html %]"
1246             },
1247             [% END %][% END %][% END %]
1248         };
1249         var ERROR_MAP = {
1250             damaged: _("Item damaged"),
1251             ageRestricted: _("Age restricted"),
1252             tooManyHoldsForThisRecord: _("Exceeded max holds per record"),
1253             tooManyReservesToday: _("Daily hold limit reached for patron"),
1254             tooManyReserves: _("Too many holds"),
1255             notReservable: _("Not holdable"),
1256             noReservesAllowed: _("No reserves allowed"),
1257             cannotReserveFromOtherBranches: _("Patron is from different library"),
1258             itemAlreadyOnHold: _("Patron already has hold for this item"),
1259             cannotBeTransferred: _("Cannot be transferred to pickup library"),
1260             pickupNotInHoldGroup: _("Only pickup locations within the same hold group are allowed")
1261         }
1262
1263         var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
1264         $.fn.select2.defaults.set("width", "100%" );
1265         $.fn.select2.defaults.set("dropdownAutoWidth", true );
1266
1267         $(document).ready(function() {
1268             $('#cancellation-reason-fieldset').hide();
1269             $('.rank-request').on('change', function() {
1270                 if ( $(".rank-request option:selected[value='del']").length ) {
1271                     $('#cancellation-reason-fieldset').show();
1272                 } else {
1273                     $('#cancellation-reason-fieldset').hide();
1274                 }
1275             });
1276
1277             if( $("#circ_holds_select").length > 0 ){
1278                 [% SET active = clubs ? 1 : 0 %]
1279                 /* Set active tab based on whether a club search was submitted */
1280                 var tabs = $("#circ_holds_select li:eq(" + [% active | $raw %] + ") a").tab("show");
1281                 $( tabs[0].hash ).find("input.focus").focus();
1282
1283                 /* Change active focus when tabs change */
1284                 $("#circ_holds_select a[data-toggle='tab']").on("shown.bs.tab", function (e) {
1285                     active_tab = e.target.hash;
1286                     $( active_tab ).find("input.focus").focus();
1287                 });
1288             }
1289
1290
1291             function ToggleHoldsToPlace() {
1292                 if ( $("#requestany").prop('checked') ) {
1293                     $("#holds_to_place_count").prop('disabled', false);
1294                 } else {
1295                     $("#holds_to_place_count").prop('disabled', true);
1296                 }
1297             }
1298             ToggleHoldsToPlace();
1299             $("#requestany").on('change', function(){
1300                 ToggleHoldsToPlace();
1301             });
1302
1303             [% IF Koha.Preference('UseBranchTransferLimits') %]
1304                 $("#pickup").on('change', function(){
1305                     var pickup = $("#pickup").val();
1306                     var url = "?pickup=" + pickup;
1307                     url += "&borrowernumber=" + borrowernumber;
1308                     url += "&biblionumber=" + biblionumbers[0];
1309                     window.location.replace(url);
1310                 });
1311             [% END %]
1312
1313             var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, {
1314                 'bPaginate': false,
1315                 "sDom": '<"top pager"ilf>t',
1316             }));
1317
1318             //Override fieldset styling for dataTables search box
1319             $("div.top.pager").css("margin-left","1em");
1320             $(".dataTables_filter label").css({
1321                 "width":"auto",
1322                 "margin-right":"0em"
1323             });
1324
1325             $("#club-request-form").on("submit", function() {
1326                 let $t = $(this);
1327                 $('.clubalert, .holdalert').addClass('hide');
1328                 const data = {
1329                     pickup_library_id: $('select[name="pickup"]').val()
1330                 };
1331                 if($('input[name="checkitem"]:checked').length)
1332                     data.item_id = $('input[name="checkitem"]:checked').val();
1333                 if($('input[name="borrowernumber"]').length)
1334                     data.patron_id = $('input[name="borrowernumber"]').val();
1335                 if($('textarea[name="notes"]').length)
1336                     data.notes = $('textarea[name="notes"]').val()||null;
1337                 if($('input[name="itemtype"]').length) {
1338                     data.item_type = $('input[name="itemtype"]').val()||null;
1339                 }
1340                 if($('input[name="default_patron_home"]:checked').length) {
1341                     data.default_patron_home = 1;
1342                 }
1343
1344                 const count = $('input[name="holds_to_place_count"]').length?$('input[name="holds_to_place_count"]').val():1;
1345                 var newloc = 'request.pl?';
1346                 biblionumbers.forEach(function (biblionumber) {
1347                     newloc += '&biblionumber=' + biblionumber;
1348                 });
1349
1350                 biblionumbers.forEach(function(biblionumber) {
1351                     data.biblio_id = biblionumber;
1352                     let options = {
1353                         url: $t.attr('action'),
1354                         method: $t.attr('method').toUpperCase(),
1355                         contentType: 'application/json',
1356                         data: JSON.stringify(data)
1357                     };
1358                     for(let i = 0; i < count; i++) {
1359                         $.ajax(options)
1360                         .then(function(result) {
1361                             document.location = newloc;
1362                         })
1363                         .fail(function(err) {
1364                             var message = err.responseJSON.error;
1365                             var match = err.responseJSON.error.match(/Reason: (\w+)\s*$/);
1366                             if(match && ERROR_MAP[match[1]]) {
1367                                 message = '<div><strong>'+_("Cannot place hold")+'</strong></div><div>'+ERROR_MAP[match[1]]+'</div>'
1368                             }
1369                             $('.clubalert, .holdalert').removeClass('hide').html(message);
1370                         });
1371                     }
1372                 });
1373
1374                 return false;
1375             });
1376
1377             [% UNLESS ( multi_hold ) %]
1378                 $("#hold-request-form").on("submit", function(){
1379                     return check($(this));
1380                 });
1381             [% ELSE %]
1382                 $("#hold-request-form").on("submit", function(){
1383                     return checkMultiHold();
1384                 });
1385             [% END %]
1386
1387             $(".pickup_location_dropdown").each( function () {
1388                 $(this).pickup_locations_dropdown();
1389             });
1390
1391             $("#pickup_multi").select2({
1392                 width: '30%',
1393                 allowClear: true
1394             });
1395
1396             $('.multi_pickup_select').select2({
1397                 width: '100%',
1398                 allowClear: true
1399             });
1400
1401             $("#pickup_multi").on("change", function() {
1402                 var selection = $(this).val();
1403                 if ( selection != '' ) {
1404                     $(".multi_pickup_select").each(function() {
1405                         var valid_pickup_locations = $(this).data('pickup-locations');
1406                         if ( valid_pickup_locations.includes(selection) ) {
1407                             $(this).val(selection);
1408                             $(this).trigger("change");
1409                         }
1410                     });
1411                 }
1412             });
1413
1414             $("#pickup").each( function () {
1415                 $(this).pickup_locations_dropdown();
1416             });
1417
1418             $(".pickup_locations").each(function () {
1419                 $(this).pickup_locations_dropdown();
1420             });
1421         });
1422
1423         function check( table ) {
1424
1425             var msg = "";
1426
1427             if ( ! $("#requestany").is(":checked") ) {
1428                 // requestany not selected, go through the item-specific cases
1429                 if ( $('input[type="radio"]:checked').length > 0 ) {
1430                     // got item-specific hold requests in the form!
1431                     // verify they have a pickup location selected
1432
1433                     if (table.find('input[type="radio"]:checked')
1434                                 .closest('tr')
1435                                 .find(".pickup_locations").val() === null) {
1436
1437                         msg = _("- Please select a pickup location for the item" + "\n")
1438                     }
1439                 }
1440                 else {
1441                     msg = (_("- Please select an item to place a hold") + "\n");
1442                 }
1443             }
1444
1445             if (msg == "") {
1446                 $('#hold-request-form').preventDoubleFormSubmit();
1447                 return(true);
1448             } else {
1449                 alert(msg);
1450                 return(false);
1451             }
1452         }
1453
1454         function checkMultiHold() {
1455
1456             var selected_bibs = $(".multi_hold_item_checkbox:checked");
1457             if ( selected_bibs.length > 0 ) {
1458                 // there are biblios selected in the form!
1459                 // verify they have a pickup location selected
1460
1461                 var pickup_not_set = 0;
1462                 selected_bibs.each(function() {
1463                     if ( $(this).closest('tr').find(".multi_pickup_select").val() === "" ) {
1464                         pickup_not_set++;
1465                     }
1466                     else {
1467                         var bibnum = $(this).attr("title");
1468                     }
1469                 });
1470                 if ( pickup_not_set > 0 ) {
1471                     alert( _("Please make sure all selected titles have a pickup location set" + "\n") );
1472                     return false;
1473                 }
1474             }
1475             else {
1476                 alert( _("Please select at least one title" + "\n") );
1477                 return false;
1478             }
1479
1480             $('#hold-request-form').preventDoubleFormSubmit();
1481
1482             return true;
1483         }
1484
1485          $(document).ready(function() {
1486
1487             $("#always_show_holds").change(function(){
1488                 if( $(this).prop('checked') ){
1489                     document.cookie = 'always_show_holds=DO';
1490                 } else {
1491                     document.cookie = 'always_show_holds=DONT';
1492                 }
1493             });
1494             $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic
1495                 var itemnumber = this.value;
1496                 var msg = '';
1497
1498                 switch (override_items[itemnumber].holdallowed) {
1499                     case "not_allowed": msg = _("This item normally cannot be put on hold."); break;
1500                     case "from_home_library": msg = _("This item normally cannot be put on hold except for patrons from %s.").format(override_items[itemnumber].homebranch); break;
1501                 }
1502
1503                 msg += "\n\n" + _("Place hold on this item?");
1504
1505                 return confirm(msg);
1506             });
1507             $("button.warning").click(function() {
1508                 return confirm( _("None of these items can normally be put on hold for this patron.") + "\n\n" + _("Place hold?") );
1509             });
1510             $("#requestany").click(function() {
1511                 if(this.checked){
1512                     $("input[name=checkitem]").each(function() {
1513                         $(this).prop("checked", false);
1514                     });
1515                 }
1516             });
1517             $("input[name=checkitem]").click(function() {
1518                 onechecked = 0;
1519                 $("input[name=checkitem]").each(function() {
1520                     if(this.checked){
1521                         onechecked = 1;
1522                     }
1523                 });
1524                 if(onechecked == 1){
1525                     $("#requestany").prop("checked", false);
1526                     $("#holds_to_place_count").prop('disabled', true);
1527                 } else {
1528                     $("#requestany").prop("checked",true);
1529                     $("#holds_to_place_count").prop('disabled', false);
1530                 }
1531             });
1532             var prev_rank_request;
1533             $("select[name=rank-request]").on("focus", function() {
1534                 prev_rank_request = $(this).val();
1535                 var row = $(this).parents("tr:first");
1536             }).change(function() {
1537                 var row = $(this).parents("tr:first");
1538                 var value = parseInt($(this).val());
1539                 var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found
1540                 if( !isNaN(value) ) {  //If moved to 'del'
1541                     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)
1542                     if (prev_rank_request > value) {
1543                         row.insertBefore(after);
1544                     } else {
1545                         row.insertAfter(after);
1546                     }
1547                 }
1548
1549                 var next_priority = 1;
1550                 $("select[name=rank-request]").each(function () {
1551                     if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds
1552                     $(this).val(next_priority);
1553                     next_priority++;
1554                 });
1555             });
1556
1557             $(".clear-date").on("click",function(e){
1558                 e.preventDefault();
1559                 var fieldID = this.id.replace("clear-date-","");
1560                 $("#" + fieldID).val("");
1561             });
1562
1563             // Confirm cancellation of hold
1564             let cancel_link;
1565             $(".cancel-hold").on("click",function(e) {
1566                 e.preventDefault;
1567                 cancel_link = $(this);
1568                 $('#cancelModal').modal();
1569                 return false;
1570             });
1571             $("#cancelModalConfirmBtn").on("click",function(e) {
1572                 let link;
1573                 if(cancel_link.data('bulk')) {
1574                     [% SET data_url = 'biblionumber=' _ biblionumbers.join('&biblionumber=') %]
1575                     link = `request.pl?[% data_url | url %]&amp;action=cancelBulk&amp;ids=${$('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')).join(',')}`;
1576                 } else {
1577                     let borrowernumber = cancel_link.data('borrowernumber');
1578                     let biblionumber = cancel_link.data('biblionumber');
1579                     let reserve_id = cancel_link.data('id');
1580                     link = `request.pl?action=cancel&amp;borrowernumber=${ borrowernumber }&amp;biblionumber=${ biblionumber }&amp;reserve_id=${ reserve_id }`;
1581                 }
1582                 let reason = $("#modal-cancellation-reason").val();
1583                 if ( reason ) {
1584                     link += "&amp;cancellation-reason=" + reason
1585                 }
1586                 window.location.href = link;
1587                 return false;
1588             });
1589
1590             [% UNLESS ( patron || patron.borrowernumber || borrowers || noitems || nobiblio ) %]
1591                 [% IF ( PatronAutoComplete ) %]
1592                 $( "#search_patron_filter" ).autocomplete({
1593                     source: "/cgi-bin/koha/circ/ysearch.pl",
1594                     minLength: 3,
1595                     select: function( event, ui ) {
1596                         document.location.href = '/cgi-bin/koha/reserve/request.pl?[% url_biblio_params | url %]&borrowernumber=' + ui.item.borrowernumber;
1597                     }
1598                 })
1599                 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
1600                     return $( "<li></li>" )
1601                     .data( "ui-autocomplete-item", item )
1602                     .append(
1603                         "<a>"
1604                             + ( item.surname ? item.surname.escapeHtml() : "" )
1605                             + ", "
1606                             + ( item.firstname ? item.firstname.escapeHtml() : "" )
1607                             + ( item.middle_name ? " " + item.middle_name.escapeHtml() : "" )
1608                             + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")"
1609                             + " "
1610                             + "<small>"
1611                                 + ( item.address ? item.address.escapeHtml() : "" )
1612                                 + " "
1613                                 + ( item.city ? item.city.escapeHtml() : "" )
1614                                 + " "
1615                                 + ( item.zipcode ? item.zipcode.escapeHtml() : "" )
1616                                 + " "
1617                                 + ( item.country ? item.country.escapeHtml() : "" )
1618                             + "</small>"
1619                         + "</a>" )
1620                     .appendTo( ul );
1621                 };
1622                 [% END %]
1623             [% END %]
1624
1625             Sticky = $("#toolbar");
1626             Sticky.hcSticky({
1627                 stickTo: "#existing_holds",
1628                 stickyClass: "floating"
1629             });
1630
1631             if(!localStorage.selectedHolds  || document.referrer.replace(/\?.*/, '') !== document.location.origin+document.location.pathname) {
1632                 localStorage.selectedHolds = [];
1633             }
1634
1635             $('.holds_table .select_hold').each(function() {
1636                 if(localStorage.selectedHolds.includes($(this).data('id'))) {
1637                     $(this).prop('checked', true);
1638                 }
1639             });
1640
1641             $('.holds_table .select_hold_all').each(function() {
1642                 var table = $(this).parents('.holds_table');
1643                 var count = $('.select_hold:not(:checked)', table).length;
1644                 $('.select_hold_all', table).prop('checked', !count);
1645             });
1646
1647             $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1648
1649             $('.holds_table .select_hold_all').click(function() {
1650                 var table = $(this).parents('.holds_table');
1651                 var count = $('.select_hold:checked', table).length;
1652                 $('.select_hold', table).prop('checked', !count);
1653                 $(this).prop('checked', !count);
1654                 $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1655                 localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id'));
1656             });
1657
1658             $('.holds_table .select_hold').click(function() {
1659                 var table = $(this).parents('.holds_table');
1660                 var count = $('.select_hold:not(:checked)', table).length;
1661                 $('.select_hold_all', table).prop('checked', !count);
1662                 $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1663                 localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id'));
1664             });
1665
1666             $('.cancel_selected_holds').click(function(e) {
1667                 e.preventDefault();
1668                 if($('.holds_table .select_hold:checked').length) {
1669                     cancel_link = $(this);
1670                     delete localStorage.selectedHolds;
1671                     $('#cancelModal').modal();
1672                 }
1673                 return false;
1674             });
1675         });
1676     </script>
1677
1678     <script>
1679         table_settings = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
1680     </script>
1681
1682     [% 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' %]
1683     <script>
1684         $(document).ready(function() {
1685             $("#holds_patronsearch").on("submit", filter);
1686         });
1687         $('.printholdslip').click(function(){
1688                 var reserve_id = $(this).attr('data-reserve_id');
1689                 window.open("/cgi-bin/koha/circ/hold-transfer-slip.pl?reserve_id=" + reserve_id);
1690                 return false;
1691         })
1692     </script>
1693 [% END %]
1694
1695 [% INCLUDE 'intranet-bottom.inc' %]