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