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