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