Bug 30395: Fix TT filtering of publicationyear in reserve/request.tt
[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 | html %]
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
1149     [% SET url_biblio_params = "biblionumber=" _ biblionumbers.join("&amp;biblionumber=") %]
1150     [% IF multi_hold %]
1151         [% SET url_biblio_params = url_biblio_params _ "&amp;multi_hold=1" %]
1152     [% END %]
1153
1154     <script>
1155         var Sticky;
1156         var biblionumbers = [[% biblionumbers.join(', ') | $raw %]];
1157         var borrowernumber = "[% patron.borrowernumber | $raw %]";
1158         var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
1159         var override_items = {[% FOREACH biblio IN biblioloop %][% FOREACH itemloo IN biblio.itemloop %][% IF ( itemloo.override ) %]
1160         [% itemloo.itemnumber | html %]: {
1161             homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]",
1162             holdallowed: "[% itemloo.holdallowed | html %]"
1163             },
1164             [% END %][% END %][% END %]
1165         };
1166         var ERROR_MAP = {
1167             damaged: _("Item damaged"),
1168             ageRestricted: _("Age restricted"),
1169             tooManyHoldsForThisRecord: _("Exceeded max holds per record"),
1170             tooManyReservesToday: _("Daily hold limit reached for patron"),
1171             tooManyReserves: _("Too many holds"),
1172             notReservable: _("Not holdable"),
1173             noReservesAllowed: _("No reserves allowed"),
1174             cannotReserveFromOtherBranches: _("Patron is from different library"),
1175             itemAlreadyOnHold: _("Patron already has hold for this item"),
1176             cannotBeTransferred: _("Cannot be transferred to pickup library"),
1177             pickupNotInHoldGroup: _("Only pickup locations within the same hold group are allowed")
1178         }
1179
1180         var MSG_CANCEL_SELECTED = _("Cancel selected (%s)");
1181         $.fn.select2.defaults.set("width", "100%" );
1182         $.fn.select2.defaults.set("dropdownAutoWidth", true );
1183
1184         $(document).ready(function() {
1185             $('#cancellation-reason-fieldset').hide();
1186             $('.rank-request').on('change', function() {
1187                 if ( $(".rank-request option:selected[value='del']").length ) {
1188                     $('#cancellation-reason-fieldset').show();
1189                 } else {
1190                     $('#cancellation-reason-fieldset').hide();
1191                 }
1192             });
1193
1194             [% SET active = clubs ? 1 : 0 %]
1195             $('#circ_holds_select').tabs({
1196                 active: [% active | $raw %],
1197                 activate: function(){
1198                     $(this).find("input.focus").focus();
1199                 },
1200                 create: function(){
1201                     $(this).find("input.focus").focus();
1202                 }
1203             });
1204             function ToggleHoldsToPlace() {
1205                 if ( $("#requestany").prop('checked') ) {
1206                     $("#holds_to_place_count").prop('disabled', false);
1207                 } else {
1208                     $("#holds_to_place_count").prop('disabled', true);
1209                 }
1210             }
1211             ToggleHoldsToPlace();
1212             $("#requestany").on('change', function(){
1213                 ToggleHoldsToPlace();
1214             });
1215
1216             [% IF Koha.Preference('UseBranchTransferLimits') %]
1217                 $("#pickup").on('change', function(){
1218                     var pickup = $("#pickup").val();
1219                     var url = "?pickup=" + pickup;
1220                     url += "&borrowernumber=" + borrowernumber;
1221                     url += "&biblionumber=" + biblionumbers[0];
1222                     window.location.replace(url);
1223                 });
1224             [% END %]
1225
1226             var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, {
1227                 'bPaginate': false,
1228                 "sDom": '<"top pager"ilf>t',
1229             }));
1230
1231             //Override fieldset styling for dataTables search box
1232             $("div.top.pager").css("margin-left","1em");
1233             $(".dataTables_filter label").css({
1234                 "width":"auto",
1235                 "margin-right":"0em"
1236             });
1237
1238             $("#club-request-form").on("submit", function() {
1239                 let $t = $(this);
1240                 $('.clubalert, .holdalert').addClass('hide');
1241                 const data = {
1242                     pickup_library_id: $('select[name="pickup"]').val()
1243                 };
1244                 if($('input[name="checkitem"]:checked').length)
1245                     data.item_id = $('input[name="checkitem"]:checked').val();
1246                 if($('input[name="borrowernumber"]').length)
1247                     data.patron_id = $('input[name="borrowernumber"]').val();
1248                 if($('textarea[name="notes"]').length)
1249                     data.notes = $('textarea[name="notes"]').val()||null;
1250                 if($('input[name="itemtype"]').length) {
1251                     data.item_type = $('input[name="itemtype"]').val()||null;
1252                 }
1253                 if($('input[name="default_patron_home"]:checked').length) {
1254                     data.default_patron_home = 1;
1255                 }
1256
1257                 const count = $('input[name="holds_to_place_count"]').length?$('input[name="holds_to_place_count"]').val():1;
1258                 var newloc = 'request.pl?';
1259                 biblionumbers.forEach(function (biblionumber) {
1260                     newloc += '&biblionumber=' + biblionumber;
1261                 });
1262
1263                 biblionumbers.forEach(function(biblionumber) {
1264                     data.biblio_id = biblionumber;
1265                     let options = {
1266                         url: $t.attr('action'),
1267                         method: $t.attr('method').toUpperCase(),
1268                         contentType: 'application/json',
1269                         data: JSON.stringify(data)
1270                     };
1271                     for(let i = 0; i < count; i++) {
1272                         $.ajax(options)
1273                         .then(function(result) {
1274                             document.location = newloc;
1275                         })
1276                         .fail(function(err) {
1277                             var message = err.responseJSON.error;
1278                             var match = err.responseJSON.error.match(/Reason: (\w+)\s*$/);
1279                             if(match && ERROR_MAP[match[1]]) {
1280                                 message = '<div><strong>'+_("Cannot place hold")+'</strong></div><div>'+ERROR_MAP[match[1]]+'</div>'
1281                             }
1282                             $('.clubalert, .holdalert').removeClass('hide').html(message);
1283                         });
1284                     }
1285                 });
1286
1287                 return false;
1288             });
1289
1290             [% UNLESS ( multi_hold ) %]
1291                 $("#hold-request-form").on("submit", function(){
1292                     return check($(this));
1293                 });
1294             [% ELSE %]
1295                 $("#hold-request-form").on("submit", function(){
1296                     return checkMultiHold();
1297                 });
1298             [% END %]
1299
1300             $(".pickup_location_dropdown").each( function () {
1301                 $(this).pickup_locations_dropdown();
1302             });
1303
1304             $("#pickup_multi").select2({
1305                 width: '30%',
1306                 allowClear: true
1307             });
1308
1309             $('.multi_pickup_select').select2({
1310                 width: '100%',
1311                 allowClear: true
1312             });
1313
1314             $("#pickup_multi").on("change", function() {
1315                 var selection = $(this).val();
1316                 if ( selection != '' ) {
1317                     $(".multi_pickup_select").each(function() {
1318                         var valid_pickup_locations = $(this).data('pickup-locations');
1319                         if ( valid_pickup_locations.includes(selection) ) {
1320                             $(this).val(selection);
1321                             $(this).trigger("change");
1322                         }
1323                     });
1324                 }
1325             });
1326
1327             $("#pickup").each( function () {
1328                 $(this).pickup_locations_dropdown();
1329             });
1330
1331             $(".pickup_locations").each(function () {
1332                 $(this).pickup_locations_dropdown();
1333             });
1334         });
1335
1336         function check( table ) {
1337
1338             var msg = "";
1339
1340             if ( $("#requestany").attr("checked") !== "checked" ) {
1341                 // requestany not selected, go through the item-specific cases
1342                 if ( $('input[type="radio"]:checked').length > 0 ) {
1343                     // got item-specific hold requests in the form!
1344                     // verify they have a pickup location selected
1345
1346                     if (table.find('input[type="radio"]:checked')
1347                                 .closest('tr')
1348                                 .find(".pickup_locations").val() === null) {
1349
1350                         msg = _("- Please select a pickup location for the item" + "\n")
1351                     }
1352                 }
1353                 else {
1354                     msg = (_("- Please select an item to place a hold") + "\n");
1355                 }
1356             }
1357
1358             if (msg == "") {
1359                 $('#hold-request-form').preventDoubleFormSubmit();
1360                 return(true);
1361             } else {
1362                 alert(msg);
1363                 return(false);
1364             }
1365         }
1366
1367         function checkMultiHold() {
1368
1369             var selected_bibs = $(".multi_hold_item_checkbox:checked");
1370             if ( selected_bibs.length > 0 ) {
1371                 // there are biblios selected in the form!
1372                 // verify they have a pickup location selected
1373
1374                 var pickup_not_set = 0;
1375                 selected_bibs.each(function() {
1376                     if ( $(this).closest('tr').find(".multi_pickup_select").val() === "" ) {
1377                         pickup_not_set++;
1378                     }
1379                     else {
1380                         var bibnum = $(this).attr("title");
1381                     }
1382                 });
1383                 if ( pickup_not_set > 0 ) {
1384                     alert( _("Please make sure all selected titles have a pickup location set" + "\n") );
1385                     return false;
1386                 }
1387             }
1388             else {
1389                 alert( _("Please select at least one title" + "\n") );
1390                 return false;
1391             }
1392
1393             var badSpans = $(".not_holdable");
1394             var badBibs = "";
1395             $(badSpans).each(function() {
1396                 var bibnum = $(this).attr("title");
1397                 badBibs += bibnum + "/";
1398             });
1399
1400             $("#bad_bibs").val(badBibs);
1401
1402             $('#hold-request-form').preventDoubleFormSubmit();
1403
1404             return true;
1405         }
1406
1407          $(document).ready(function() {
1408
1409             $("#always_show_holds").change(function(){
1410                 if( $(this).prop('checked') ){
1411                     document.cookie = 'always_show_holds=DO';
1412                 } else {
1413                     document.cookie = 'always_show_holds=DONT';
1414                 }
1415             });
1416             $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic
1417                 var itemnumber = this.value;
1418                 var msg = '';
1419
1420                 switch (override_items[itemnumber].holdallowed) {
1421                     case "not_allowed": msg = _("This item normally cannot be put on hold."); break;
1422                     case "from_home_library": msg = _("This item normally cannot be put on hold except for patrons from %s.").format(override_items[itemnumber].homebranch); break;
1423                 }
1424
1425                 msg += "\n\n" + _("Place hold on this item?");
1426
1427                 return confirm(msg);
1428             });
1429             $("button.warning").click(function() {
1430                 return confirm( _("None of these items can normally be put on hold for this patron.") + "\n\n" + _("Place hold?") );
1431             });
1432             $("#requestany").click(function() {
1433                 if(this.checked){
1434                     $("input[name=checkitem]").each(function() {
1435                         $(this).prop("checked", false);
1436                     });
1437                 }
1438             });
1439             $("input[name=checkitem]").click(function() {
1440                 onechecked = 0;
1441                 $("input[name=checkitem]").each(function() {
1442                     if(this.checked){
1443                         onechecked = 1;
1444                     }
1445                 });
1446                 if(onechecked == 1){
1447                     $("#requestany").prop("checked", false);
1448                     $("#holds_to_place_count").prop('disabled', true);
1449                 } else {
1450                     $("#requestany").prop("checked",true);
1451                     $("#holds_to_place_count").prop('disabled', false);
1452                 }
1453             });
1454             var prev_rank_request;
1455             $("select[name=rank-request]").on("focus", function() {
1456                 prev_rank_request = $(this).val();
1457                 var row = $(this).parents("tr:first");
1458             }).change(function() {
1459                 var row = $(this).parents("tr:first");
1460                 var value = parseInt($(this).val());
1461                 var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found
1462                 if( !isNaN(value) ) {  //If moved to 'del'
1463                     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)
1464                     if (prev_rank_request > value) {
1465                         row.insertBefore(after);
1466                     } else {
1467                         row.insertAfter(after);
1468                     }
1469                 }
1470
1471                 var next_priority = 1;
1472                 $("select[name=rank-request]").each(function () {
1473                     if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds
1474                     $(this).val(next_priority);
1475                     next_priority++;
1476                 });
1477             });
1478
1479             $(".clear-date").on("click",function(e){
1480                 e.preventDefault();
1481                 var fieldID = this.id.replace("clear-date-","");
1482                 $("#" + fieldID).val("");
1483             });
1484
1485             // Confirm cancellation of hold
1486             let cancel_link;
1487             $(".cancel-hold").on("click",function(e) {
1488                 e.preventDefault;
1489                 cancel_link = $(this);
1490                 $('#cancelModal').modal();
1491                 return false;
1492             });
1493             $("#cancelModalConfirmBtn").on("click",function(e) {
1494                 let link;
1495                 if(cancel_link.data('bulk')) {
1496                     [% SET data_url = 'biblionumber=' _ biblionumbers.join('&biblionumber=') %]
1497                     link = `request.pl?[% data_url | url %]&amp;action=cancelBulk&amp;ids=${$('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id')).join(',')}`;
1498                 } else {
1499                     let borrowernumber = cancel_link.data('borrowernumber');
1500                     let biblionumber = cancel_link.data('biblionumber');
1501                     let reserve_id = cancel_link.data('id');
1502                     link = `request.pl?action=cancel&amp;borrowernumber=${ borrowernumber }&amp;biblionumber=${ biblionumber }&amp;reserve_id=${ reserve_id }`;
1503                 }
1504                 let reason = $("#modal-cancellation-reason").val();
1505                 if ( reason ) {
1506                     link += "&amp;cancellation-reason=" + reason
1507                 }
1508                 window.location.href = link;
1509                 return false;
1510             });
1511
1512             [% UNLESS ( patron || patron.borrowernumber || borrowers || noitems || nobiblio ) %]
1513                 [% IF ( PatronAutoComplete ) %]
1514                 $( "#search_patron_filter" ).autocomplete({
1515                     source: "/cgi-bin/koha/circ/ysearch.pl",
1516                     minLength: 3,
1517                     select: function( event, ui ) {
1518                         document.location.href = '/cgi-bin/koha/reserve/request.pl?[% url_biblio_params | url %]&borrowernumber=' + ui.item.borrowernumber;
1519                     }
1520                 })
1521                 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
1522                     return $( "<li></li>" )
1523                     .data( "ui-autocomplete-item", item )
1524                     .append(
1525                         "<a>"
1526                             + ( item.surname ? item.surname.escapeHtml() : "" )
1527                             + ", "
1528                             + ( item.firstname ? item.firstname.escapeHtml() : "" )
1529                             + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")"
1530                             + " "
1531                             + "<small>"
1532                                 + ( item.address ? item.address.escapeHtml() : "" )
1533                                 + " "
1534                                 + ( item.city ? item.city.escapeHtml() : "" )
1535                                 + " "
1536                                 + ( item.zipcode ? item.zipcode.escapeHtml() : "" )
1537                                 + " "
1538                                 + ( item.country ? item.country.escapeHtml() : "" )
1539                             + "</small>"
1540                         + "</a>" )
1541                     .appendTo( ul );
1542                 };
1543                 [% END %]
1544             [% END %]
1545
1546             Sticky = $("#toolbar");
1547             Sticky.hcSticky({
1548                 stickTo: "#existing_holds",
1549                 stickyClass: "floating"
1550             });
1551
1552             if(!localStorage.selectedHolds  || document.referrer.replace(/\?.*/, '') !== document.location.origin+document.location.pathname) {
1553                 localStorage.selectedHolds = [];
1554             }
1555
1556             $('.holds_table .select_hold').each(function() {
1557                 if(localStorage.selectedHolds.includes($(this).data('id'))) {
1558                     $(this).prop('checked', true);
1559                 }
1560             });
1561
1562             $('.holds_table .select_hold_all').each(function() {
1563                 var table = $(this).parents('.holds_table');
1564                 var count = $('.select_hold:not(:checked)', table).length;
1565                 $('.select_hold_all', table).prop('checked', !count);
1566             });
1567
1568             $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1569
1570             $('.holds_table .select_hold_all').click(function() {
1571                 var table = $(this).parents('.holds_table');
1572                 var count = $('.select_hold:checked', table).length;
1573                 $('.select_hold', table).prop('checked', !count);
1574                 $(this).prop('checked', !count);
1575                 $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1576                 localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id'));
1577             });
1578
1579             $('.holds_table .select_hold').click(function() {
1580                 var table = $(this).parents('.holds_table');
1581                 var count = $('.select_hold:not(:checked)', table).length;
1582                 $('.select_hold_all', table).prop('checked', !count);
1583                 $('.cancel_selected_holds').html(MSG_CANCEL_SELECTED.format($('.holds_table .select_hold:checked').length));
1584                 localStorage.selectedHolds = $('.holds_table .select_hold:checked').toArray().map(el => $(el).data('id'));
1585             });
1586
1587             $('.cancel_selected_holds').click(function(e) {
1588                 e.preventDefault();
1589                 if($('.holds_table .select_hold:checked').length) {
1590                     cancel_link = $(this);
1591                     delete localStorage.selectedHolds;
1592                     $('#cancelModal').modal();
1593                 }
1594                 return false;
1595             });
1596         });
1597     </script>
1598
1599     <script>
1600         table_settings = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
1601     </script>
1602
1603     [% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/reserve/request.pl?' _ url_biblio_params, redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/reserve/request.pl?' _ url_biblio_params %]
1604     <script>
1605         $(document).ready(function() {
1606             $("#holds_patronsearch").on("submit", filter);
1607         });
1608         $('.printholdslip').click(function(){
1609                 var reserve_id = $(this).attr('data-reserve_id');
1610                 window.open("/cgi-bin/koha/circ/hold-transfer-slip.pl?reserve_id=" + reserve_id);
1611                 return false;
1612         })
1613     </script>
1614 [% END %]
1615
1616 [% INCLUDE 'intranet-bottom.inc' %]