Bug 27846: (follow-up) Markup corrections
[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>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Place a hold on [% INCLUDE 'biblio-title-head.inc' %]</title>
16 [% ELSE %]
17     <title>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Confirm holds</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 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 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" size="1" 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 ( 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 ( exceeded_maxreserves ) %]
334                                     <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>
335                                 [% ELSIF ( exceeded_holds_per_record ) %]
336                                     <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>
337                                 [% ELSIF ( alreadypossession ) %]
338                                     <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>
339                                 [% ELSIF ( alreadyreserved ) %]
340                                     <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>
341                                 [% ELSIF ( ageRestricted ) %]
342                                     <li><strong>Age restricted</strong></li>
343                                 [% ELSIF ( none_available ) %]
344                                     <li> <strong>No items are available</strong> to be placed on hold.</li>
345                                 [% ELSIF ( maxreserves ) %]
346                                     <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>
347                                 [% END # /IF exceeded_maxreserves %]
348                             </ul>
349                         [% ELSE # UNLESS multi_hold %]
350                             <h3>Cannot place hold on some items</h3>
351                             [% IF ( exceeded_maxreserves ) %]
352                                 <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>
353                             [% ELSIF ( exceeded_holds_per_record ) %]
354                                 [% FOREACH biblioloo IN biblioloop %]
355                                     [% IF (biblioloo.tooManyHoldsForThisRecord) %]
356                                         <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>
357                                     [% END %]
358                                 [% END %]
359                             [% END # /IF exceeded_maxreserves %]
360                         [% END # /UNLESS multi_hold %]
361                     </div>
362                 [% END # /IF ( exceeded_maxreserves || ... %]
363
364                 [% IF ( expiry || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
365                     <div class="dialog message">
366                         <ul>
367                             [% IF ( expiry ) %]
368                                 <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>
369                             [% END %]
370
371                             [% IF patron.is_debarred %]
372                                 <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>
373                             [% END %]
374
375                             [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
376                                 <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>
377                             [% END %]
378
379                             [% IF ( diffbranch ) %]
380                                 <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>
381                             [% END %]
382                         </ul> <!-- /.dialog.message -->
383                     </div>
384                 [% END # /IF expiry || diffbranch ... %]
385
386                 [% IF ( messageborrower ) %]
387                     <div class="dialog alert">
388                         <h3>Patron not found:</h3>
389                         <p>Name or barcode not found. Please try an other </p>
390                     </div>
391                 [% END %]
392
393                 <div class="dialog alert hide holdalert">
394                 </div>
395
396                 <fieldset class="rows">
397                     <legend>Hold details</legend>
398                     <form action="placerequest.pl" method="post" name="form" id="hold-request-form">
399
400                         <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
401                         <input type="hidden" name="type" value="str8" />
402
403                         [% IF ( multi_hold ) %]
404                             <input type="hidden" name="biblionumbers" id="multi_hold_bibs" value="[% biblionumbers | html %]"/>
405                             <input type="hidden" name="bad_bibs" id="bad_bibs" value=""/>
406                             <input type="hidden" name="request" value="any"/>
407                             [% FOREACH biblioloo IN biblioloop %]
408                                 <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]"/>
409                                 <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]"/>
410                             [% END %]
411                         [% ELSE %]
412                             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
413                             <input type="hidden" name="title" value="[% biblio.title | html %]" />
414                             <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
415                         [% END # /IF multi_hold %]
416
417                         <ol>
418                             <li>
419                                 <span class="label">Patron:</span>
420                                 [% IF ( patron.borrowernumber ) %]
421                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %])</a>
422                                 [% ELSE %]
423                                     Not defined yet
424                                 [% END %]
425                             </li>
426
427                             [% UNLESS ( multi_hold ) %]
428                                 <li>
429                                     <span class="label">Estimated priority:</span>
430                                     <strong>[% fixedRank | html %]</strong>
431                                 </li>
432                             [% END %]
433
434                             <li>
435                                 <label for="holdnotes">Notes:</label>
436                                 <textarea id="holdnotes" name="notes" cols="30" rows="1"></textarea>
437                             </li>
438                             <li>
439                                 <label for="pickup">Pickup at:</label>
440                                 <select name="pickup" size="1" id="pickup">
441                                     [% UNLESS ( multi_hold ) %]
442                                         [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
443                                     [% ELSE %]
444                                         [% PROCESS options_for_libraries libraries => Branches.all({ selected => pickup, search_params => { pickup_location => 1 } }) %]
445                                     [% END %]
446                                 </select>
447                             </li>
448
449                             [% UNLESS ( multi_hold ) %]
450                                 [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
451                                     <li>
452                                         <label for="itemtype">Request specific item type:</label>
453                                         <select name="itemtype" size="1" id="itemtype">
454                                             <option value="">Any item type</option>
455                                             [%- FOREACH itemtype IN available_itemtypes %]
456                                                 <option value="[% itemtype | html %]">[% ItemTypes.GetDescription( itemtype ) | html %]</option>
457                                             [%- END %]
458                                         </select>
459                                     </li>
460                                 [% END %]
461                             [% END # /UNLESS multi_hold %]
462
463                             [% IF ( reserve_in_future ) %]
464                                 <li>
465                                     <label for="from">Hold starts on date:</label>
466                                     <input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" >
467                                     <input type="hidden" class="datepickerfrom_hidden" />
468                                     <a href="#" id="clear-date-from" class="clear-date">Clear date</a>
469                                 </li>
470                             [% END %]
471
472                             <li>
473                                 <label for="to">Hold expires on date:</label>
474                                 <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
475                                 <input type="hidden" class="datepickerto_hidden" />
476                                 <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
477                             </li>
478
479                             [% UNLESS ( multi_hold ) %]
480                                 <li>
481                                     <label for="requestany">Hold next available item </label>
482                                     [% IF force_hold_level == 'item' %]
483                                         <input type="checkbox" id="requestany" name="request" disabled="true" />
484                                     [% ELSIF force_hold_level == 'record' %]
485                                         <input type="checkbox" id="requestany" checked="checked" value="Any" disabled="true"/>
486                                         <input type="hidden" name="request" value="Any"/>
487                                     [% ELSE %]
488                                         <input type="checkbox" id="requestany" name="request" checked="checked" value="Any" />
489                                     [% END %]
490                                     <input type="hidden" name="biblioitem" value="[% biblioitemnumber | html %]" />
491                                     <input type="hidden" name="alreadyreserved" value="[% alreadyreserved | html %]" />
492                                 </li>
493
494                                 [% IF remaining_holds_for_record > 1 %]
495                                     <li>
496                                         <label for="holds_to_place_count">Holds to place (count)</label>
497                                         <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" />
498                                     </li>
499                                 [% ELSE %]
500                                     <input type="hidden" name="holds_to_place_count" value="1" />
501                                 [% END %]
502                             [% END # /UNLESS multi_hold %]
503
504                             <li id="non_priority_list_item">
505                                 <label for="non_priority">Non priority hold:</label>
506                                 <input name="non_priority" id="non_priority" type="checkbox" />
507                                 <span class="hint">A non priority hold doesn't prevent a current checkout from renewing</span>
508                             </li>
509                         </ol>
510
511                         [% UNLESS ( multi_hold ) %]
512                             <fieldset class="action">
513                                 [% IF ( patron.borrowernumber ) %]
514                                     [% IF ( override_required ) %]
515                                         <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
516                                     [% ELSIF ( none_available ) %]
517                                         <button type="submit" disabled="disabled" class="btn btn-default btn-disabled">Place hold</button>
518                                     [% ELSE %]
519                                         <button type="submit" class="btn btn-default">Place hold</button>
520                                     [% END %]
521                                 [% END %]
522                             </fieldset>
523
524                             [% FOREACH bibitemloo IN bibitemloop %]
525                                 <ol>
526                                     [% UNLESS ( item_level_itypes ) %]
527                                         <li>
528                                             <span class="label">Item type:</span>
529                                             [% bibitemloo.description | html %]
530                                         </li>
531                                     [% END %]
532
533                                     [% IF ( bibitemloo.publicationyear ) %]
534                                         <li>
535                                             <span class="label">Publication year:</span>
536                                             [% bibitemloo.publicationyear | html %]
537                                         </li>
538                                     [% END %]
539                                 </ol>
540
541                                 <h2 style="padding: 0 1em;">
542                                     Place a hold on a specific item
543                                     [% IF bibitemloo.force_hold_level == 'item' %]
544                                          <span class="error"><em>(Required)</em></span>
545                                     [% END %]
546                                 </h2>
547
548                                 <table id="requestspecific">
549                                     <thead>
550                                         <tr>
551                                             <th>Hold</th>
552                                             [% IF ( item_level_itypes ) %]
553                                                 <th>Item type</th>
554                                             [% END %]
555                                             <th>Barcode</th>
556                                             <th>Home library</th>
557                                             <th>Last location</th>
558                                             [% IF itemdata_ccode %]
559                                                 <th>Collection</th>
560                                             [% END %]
561                                             <th>Call no.</th>
562                                             <th>Copy number</th>
563                                             [% IF itemdata_enumchron %]
564                                                 <th>Vol no.</th>
565                                             [% END %]
566                                             <th class="title-string">Information</th>
567                                             <th class="title-string">Allowed pickup locations</th>
568                                         </tr>
569                                     </thead>
570                                     <tbody>
571                                         [% SET selected = 0 %]
572                                         [% FOREACH itemloo IN bibitemloo.itemloop %]
573                                             [% UNLESS ( itemloo.hide ) %]
574                                                 <tr class="[% itemloo.backgroundcolor | html %]">
575                                                     <td>
576                                                         [% IF itemloo.force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
577                                                             <span class="error">
578                                                                 <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
579                                                                 Hold must be record level
580                                                             </span>
581                                                         [% ELSIF ( itemloo.available ) %]
582                                                             <input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" />
583                                                         [% ELSIF ( itemloo.override ) %]
584                                                             <input type="radio" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" />
585                                                             <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i>
586                                                         [% ELSE %]
587                                                             <span class="error">
588                                                                 <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
589                                                                 [% IF itemloo.not_holdable %]
590                                                                     [% IF itemloo.not_holdable == 'damaged' %]
591                                                                         Item damaged
592                                                                     [% ELSIF itemloo.not_holdable == 'ageRestricted' %]
593                                                                         Age restricted
594                                                                     [% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %]
595                                                                         Exceeded max holds per record
596                                                                     [% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %]
597                                                                         Daily hold limit reached for patron
598                                                                     [% ELSIF itemloo.not_holdable == 'tooManyReserves' %]
599                                                                         Too many holds
600                                                                     [% ELSIF itemloo.not_holdable == 'notReservable' %]
601                                                                         Not holdable
602                                                                     [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %]
603                                                                         Patron is from different library
604                                                                     [% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %]
605                                                                         Cannot place hold from patron's library
606                                                                     [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
607                                                                         Patron already has hold for this item
608                                                                     [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
609                                                                         Cannot be transferred to pickup library
610                                                                     [% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %]
611                                                                         Only pickup locations within the same hold group are allowed
612                                                                     [% ELSE %]
613                                                                         [% itemloo.not_holdable | html %]
614                                                                     [% END %]
615                                                                 [% END %]
616                                                             </span>
617                                                         [% END # /IF itemloo.force_hold_level %]
618                                                     </td>
619                                                     [% IF ( item_level_itypes ) %]
620                                                         <td>
621                                                             [% UNLESS ( noItemTypeImages ) %]
622                                                                 [% IF ( itemloo.imageurl ) %]<img src="[% itemloo.imageurl | html %]" alt="" /> <br /> [% END %]
623                                                             [% END %]
624                                                             [% itemloo.itypename | html %]
625                                                         </td>
626                                                     [% END %]
627                                                     <td>
628                                                         [% itemloo.barcode | html %]
629                                                     </td>
630                                                     <td>
631                                                         [% Branches.GetName( itemloo.homebranch ) | html %]
632                                                     </td>
633                                                     <td>
634                                                         [% Branches.GetName( itemloo.holdingbranch ) | html %]
635                                                     </td>
636                                                     [% IF itemdata_ccode %]
637                                                         <td>
638                                                             [% IF ( itemloo.ccode ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => itemloo.ccode ) | html %][% END %]
639                                                         </td>
640                                                     [% END %]
641                                                     <td>
642                                                         [% itemloo.itemcallnumber | html %]
643                                                     </td>
644                                                     <td>
645                                                         [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %]&nbsp;[% END %]
646                                                     </td>
647                                                     [% IF itemdata_enumchron %]
648                                                         <td>
649                                                             [% itemloo.enumchron | html %]
650                                                         </td>
651                                                     [% END %]
652                                                     <td>
653                                                         [% IF ( itemloo.onloan ) %]
654                                                             <span title="[% itemloo.date_due | html %]" class="checkedout">Due [% itemloo.date_due | $KohaDates  as_due_date => 1 %]</span>
655                                                         [% ELSE %]
656                                                             <span title="0000-00-00">
657                                                                 [% IF ( itemloo.transfertwhen ) %]
658                                                                     In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %],
659                                                                     to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %]
660                                                                 [% END %]
661                                                             </span>
662                                                         [% END %]
663
664                                                         [% IF ( itemloo.reservedate ) %]
665                                                             [% IF ( itemloo.nocancel ) %]
666                                                                     Can't be cancelled when item is in transit
667                                                             [% ELSE %]
668                                                                 [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %]
669                                                                 [% IF ( itemloo.canreservefromotherbranches ) %]
670                                                                     for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedFor.borrowernumber | uri %]">[% itemloo.ReservedFor.firstname | html %] [% itemloo.ReservedFor.surname | html %]</a>
671                                                                 [% END %]
672                                                                 [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %]
673                                                                 [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since
674                                                                 [% IF ( itemloo.waitingdate ) %]
675                                                                     [% itemloo.waitingdate | $KohaDates %]
676                                                                 [% ELSE %]
677                                                                     [% IF ( itemloo.reservedate ) %]
678                                                                         [% itemloo.reservedate | html %]
679                                                                     [% END %]
680                                                                 [% END %].
681                                                                 <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>
682                                                             [% END # /IF itemloo.nocancel %]
683                                                         [% ELSE %]
684                                                             Not on hold
685                                                         [% END # /IF itemloo.reservedate %]
686
687                                                         [% IF itemloo.item_level_holds == "N" %]
688                                                             <br/>Item level hold not allowed from OPAC
689                                                         [% ELSIF itemloo.item_level_holds == "F" %]
690                                                             <br/>Item level hold forced from OPAC
691                                                         [% END %]
692
693                                                         [% IF ( itemloo.itemlost ) %]
694                                                            <span class="lost">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => itemloo.itemlost ) | html %]</span>
695                                                         [% END %]
696
697                                                         [% IF ( itemloo.damaged ) %]
698                                                             <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => itemloo.damaged ) | html %]</span>
699                                                         [% END %]
700
701                                                         [% IF ( itemloo.withdrawn ) %]
702                                                            <span class="wdn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => itemloo.withdrawn ) | html %]</span>
703                                                         [% END %]
704
705                                                         [% IF ( itemloo.notforloan ) %]
706                                                            <span class="nfl">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])</span>
707                                                         [% END %]
708                                                     </td>
709                                                     <td>
710                                                     [% IF itemloo.any_pickup_location %]
711                                                         Any library
712                                                     [% ELSE %]
713                                                         [% itemloo.pickup_locations | html %]
714                                                     [% END %]
715                                                     </td>
716                                                 </tr>
717                                             [% END # / UNLESS itemloo.hide %]
718                                         [% END # /FOREACH itemloo %]
719                                     </tbody>
720                                 </table> <!-- /#requestspecific -->
721
722                                 [% IF ( bibitemloo.hiddencount ) %]
723                                     <form>
724                                         <p class="hiddencount">
725                                             <a href="request.pl?biblionumber=[% bibitemloo.biblionumber | uri %]&amp;borrowernumber=[% bibitemloo.borrowernumber | uri %]&amp;showallitems=1">Show all items ([% bibitemloo.hiddencount | html %] hidden)</a>
726                                         </p>
727                                     </form>
728                                 [% END # /IF bibitemloo.hiddencount %]
729                             [% END # /FOREACH bibitemloo %]
730
731                         [% ELSE # /UNLESS multi_hold %]
732
733                             <table id="requesttitles">
734                                 <tr>
735                                     <th>&nbsp;</th>
736                                     <th>Title</th>
737                                     [% UNLESS ( item_level_itypes ) %]
738                                         <th>Item type</th>
739                                     [% END %]
740                                     <th>Priority</th>
741                                     <th>Information</th>
742                                 </tr>
743                                 [% FOREACH biblioloo IN biblioloop %]
744                                     [% IF ( biblioloo.warn ) %]
745                                         <tr class="onissue">
746                                     [% ELSE %]
747                                         <tr>
748                                     [% END %]
749                                         <td>
750                                             [% UNLESS ( biblioloo.warn ) %]
751                                                     <input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]"/>
752                                                 </td>
753                                             [% END %]
754                                         <td>
755                                             <ul>
756                                                 <li>
757                                                     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
758                                                 </li>
759                                                 [% IF ( biblioloo.publicationyear ) %]
760                                                     <li>
761                                                         <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
762                                                     </li>
763                                                 [% END %]
764                                             </ul>
765                                             [% IF ( biblioloo.warn ) %]
766                                                 <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
767                                             [% END %]
768                                         </td>
769                                         [% UNLESS ( item_level_itypes ) %]
770                                             <td>
771                                                 <img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | html %]" />
772                                             </td>
773                                         [% END %]
774                                         <td>[% biblioloo.rank | html %]</td>
775                                         <td>
776                                             [% IF ( biblioloo.checked_previously ) %]
777                                                 <span>Patron has previously checked out this title</span><br/>
778                                             [% END %]
779                                             [% IF ( biblioloo.alreadyres ) %]
780                                                 <ul>
781                                             [% ELSE %]
782                                                 [% IF ( biblioloo.none_avail ) %]
783                                                     <ul>
784                                                 [% END %]
785                                             [% END %]
786
787                                             [% IF ( biblioloo.alreadyres ) %]
788                                                 <li>
789                                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>
790                                                     <strong>already has a hold</strong> on this item
791                                                 </li>
792                                             [% END %]
793                                             [% IF ( biblioloo.none_avail ) %]
794                                                 <li> <strong>No items are available</strong> to be placed on hold</li>
795                                             [% END %]
796
797                                             [% IF ( biblioloo.alreadyres ) %]
798                                                 </ul>
799                                             [% ELSE %]
800                                                 [% IF ( biblioloo.none_avail ) %]
801                                                     </ul>
802                                                 [% END %]
803                                             [% END %]
804                                         </td>
805                                     </tr>
806                                 [% END # /FOREACH biblioloo %]
807                             </table> <!-- /#requesttitles -->
808
809                         [% END # /UNLESS multi_hold %]
810
811                         <fieldset class="action">
812                             [% IF ( patron AND patron.borrowernumber ) %]
813                                 [% IF ( override_required ) %]
814                                     <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
815                                 [% ELSIF ( none_available ) %]
816                                     <button type="submit" disabled="disabled" class="btn btn-default btn-disabled">Place hold</button>
817                                 [% ELSE %]
818                                     [% IF ( multi_hold ) %]
819                                         <button type="submit" class="btn btn-default" id="multi_hold_submit">Place hold</button>
820                                     [% ELSE %]
821                                         <button type="submit" class="btn btn-default">Place hold</button>
822                                     [% END %]
823                                 [% END %]
824                             [% END # /IF patron %]
825                         </fieldset> <!-- /.action -->
826                     </form> <!-- /#hold-request-form -->
827                 </fieldset> <!-- /.rows -->
828             [% END %]
829
830             [% UNLESS ( patron ) %]
831                 [% IF ( reserveloop ) %]
832                     <form id="existing_holds" name="T[% time | html %]" action="modrequest.pl" method="post" style="display:block">
833                         [% IF ( multi_hold ) %]
834                             <input type = "hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
835                         [% END %]
836
837                         <h2>Existing holds</h2>
838                         <div id="toolbar" class="btn-toolbar">
839                             <input type="submit" name="submit" value="Update hold(s)" />
840                         <fieldset id="cancellation-reason-fieldset" class="action">
841                             [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
842                             [% IF hold_cancellation %]
843                                 <label for="cancellation-reason">Cancellation reason: </label>
844                                 <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
845                                     <option value="">No reason given</option>
846                                     [% FOREACH reason IN hold_cancellation %]
847                                         <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
848                                     [% END %]
849                                 </select>
850                             [% END %]
851                         </fieldset>
852                         </div>
853
854                         [% FOREACH biblioloo IN biblioloop %]
855                             [% IF ( biblioloo.reserveloop ) %]
856                                 [% IF ( multi_hold ) %]
857                                     <h3>
858                                         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">
859                                             [% biblioloo.title | html %]
860                                         </a>
861                                     </h3>
862                                 [% END %]
863
864                                 [% IF Koha.Preference('HoldsSplitQueue') == 'branch' %]
865                                     [% SET branchcodes = [] %]
866
867                                     [% FOREACH h IN biblioloo.reserveloop %]
868                                         [% branchcodes.push( h.branchcode ) %]
869                                     [% END %]
870                                     [% branchcodes = branchcodes.unique %]
871
872                                     [% FOREACH b IN branchcodes.sort %]
873                                         [% SET holds_by_branch = [] %]
874                                         [% FOREACH h IN biblioloo.reserveloop %]
875                                             [% IF h.branchcode == b %]
876                                                 [% holds_by_branch.push( h ) %]
877                                             [% END %]
878                                         [% END %]
879                                         <fieldset>
880                                             <legend>[% Branches.GetName( b ) | html %]</legend>
881                                             [% INCLUDE holds_table.inc holds=holds_by_branch %]
882                                         </fieldset>
883                                     [% END # /FOREACh b %]
884                                 [% ELSIF Koha.Preference('HoldsSplitQueue') == 'itemtype' %]
885                                     [% SET itemtypes = [] %]
886
887                                     [% FOREACH h IN biblioloo.reserveloop %]
888                                         [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
889                                         [% itemtypes.push( hold_itemtype ) %]
890                                     [% END %]
891                                     [% itemtypes = itemtypes.unique %]
892
893                                     [% FOREACH i IN itemtypes.sort %]
894                                         [% SET holds_by_itemtype = [] %]
895                                         [% FOREACH h IN biblioloo.reserveloop %]
896                                             [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
897                                             [% IF hold_itemtype == i %]
898                                                 [% holds_by_itemtype.push( h ) %]
899                                             [% END %]
900                                         [% END %]
901
902                                         <fieldset>
903                                             [% IF i %]
904                                                 <legend>[% ItemTypes.GetDescription( i ) | html %]</legend>
905                                             [% ELSE %]
906                                                 <legend>Any item type</legend>
907                                             [% END %]
908                                             [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
909                                         </fieldset>
910                                     [% END # /FOREACH i %]
911                                 [% ELSIF Koha.Preference('HoldsSplitQueue') == 'branch_itemtype' %]
912                                     [% SET branchcodes = [] %]
913
914                                     [% FOREACH h IN biblioloo.reserveloop %]
915                                         [% branchcodes.push( h.branchcode ) %]
916                                     [% END %]
917                                     [% branchcodes = branchcodes.unique %]
918
919                                     [% FOREACH b IN branchcodes.sort %]
920                                         <fieldset>
921                                             <legend>[% Branches.GetName( b ) | html %]</legend>
922                                             [% SET holds_by_branch = [] %]
923                                             [% FOREACH h IN biblioloo.reserveloop %]
924                                                 [% IF h.branchcode == b %]
925                                                     [% holds_by_branch.push( h ) %]
926                                                 [% END %]
927                                             [% END %]
928
929                                             [% SET itemtypes = [] %]
930                                             [% FOREACH h IN holds_by_branch %]
931                                                 [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
932                                                 [% itemtypes.push( hold_itemtype ) %]
933                                             [% END %]
934                                             [% itemtypes = itemtypes.unique %]
935
936                                             [% FOREACH i IN itemtypes.sort %]
937                                                 [% IF i %]
938                                                     <h3>[% ItemTypes.GetDescription( i ) | html %]</h3>
939                                                 [% ELSE %]
940                                                     <h3>Any item type</h3>
941                                                 [% END %]
942
943                                                 [% SET holds_by_itemtype = [] %]
944                                                 [% FOREACH h IN holds_by_branch %]
945                                                     [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
946                                                     [% IF hold_itemtype == i %]
947                                                         [% holds_by_itemtype.push( h ) %]
948                                                     [% END %]
949                                                 [% END %]
950                                                 [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
951                                             [% END %]
952                                         </fieldset>
953                                     [% END # /FOREACH b %]
954                                 [% ELSE %]
955                                     [% INCLUDE holds_table.inc holds=biblioloo.reserveloop %]
956                                 [% END # /IF HoldsSplitQueue %]
957
958                             [% END # /IF biblioloo.reserveloop %]
959                         [% END # FOREACH biblioloo %]
960                         </fieldset> <!-- /.rows -->
961                     </form> <!-- /name=TTime -->
962                 [% END # IF reserveloop %]
963             [% END # UNLESS patron %]
964
965         </main>
966
967         [% IF ( multi_hold ) # No sidebar menu when placing multiple holds %]
968             </div> <!-- /.col-md-10.col-md-offset-1 -->
969         [% ELSE %]
970             </div> <!-- /.col-sm-10.col-sm-push-2 -->
971                 <div class="col-sm-2 col-sm-pull-10">
972                     <aside>
973                         [% INCLUDE 'biblio-view-menu.inc' %]
974                     </aside>
975                 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
976         [% END %]
977     </div> <!-- /.row -->
978
979     <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
980         <div class="modal-dialog" role="document">
981             <div class="modal-content">
982                 <div class="modal-header">
983                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
984                     <h3>Confirm deletion</h3>
985                 </div>
986
987                 <div class="modal-body">
988                     <p>Are you sure you want to cancel this hold?</p>
989
990                     <fieldset class="action">
991                         [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
992                         [% IF hold_cancellation %]
993                             <label for="cancellation-reason">Cancellation reason: </label>
994                             <select class="cancellation-reason" name="modal-cancellation-reason" id="modal-cancellation-reason">
995                                 <option value="">No reason given</option>
996                                 [% FOREACH reason IN hold_cancellation %]
997                                     <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
998                                 [% END %]
999                             </select>
1000                         [% END %]
1001                     </fieldset>
1002                 </div>
1003
1004                 <div class="modal-footer">
1005                     <button id="cancelModalConfirmBtn" type="button" class="btn btn-danger">Confirm cancellation</button>
1006                     <a href="#" data-dismiss="modal">Cancel</a>
1007                 </div>
1008             </div>
1009         </div>
1010     </div>
1011
1012 [% MACRO jsinclude BLOCK %]
1013     [% INCLUDE 'datatables.inc' %]
1014     [% INCLUDE 'calendar.inc' %]
1015     [% INCLUDE 'columns_settings.inc' %]
1016     [% Asset.js("lib/hc-sticky.js") | $raw %]
1017     [% Asset.js("js/circ-patron-search-results.js") | $raw %]
1018     [% INCLUDE 'select2.inc' %]
1019     <script>
1020         var Sticky;
1021         var biblionumber = "[% biblionumber | $raw %]";
1022         var borrowernumber = "[% patron.borrowernumber | $raw %]";
1023         var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
1024         var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
1025         [% itemloo.itemnumber | html %]: {
1026             homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]",
1027             holdallowed: [% itemloo.holdallowed | html %]
1028             },
1029             [% END %][% END %][% END %]
1030         };
1031         var MSG_NO_ITEMS_AVAILABLE = _("A hold cannot be requested on any of these items.");
1032         var ERROR_MAP = {
1033             damaged: _("Item damaged"),
1034             ageRestricted: _("Age restricted"),
1035             tooManyHoldsForThisRecord: _("Exceeded max holds per record"),
1036             tooManyReservesToday: _("Daily hold limit reached for patron"),
1037             tooManyReserves: _("Too many holds"),
1038             notReservable: _("Not holdable"),
1039             cannotReserveFromOtherBranches: _("Patron is from different library"),
1040             itemAlreadyOnHold: _("Patron already has hold for this item"),
1041             cannotBeTransferred: _("Cannot be transferred to pickup library"),
1042             pickupNotInHoldGroup: _("Only pickup locations within the same hold group are allowed")
1043         }
1044         columns_settings_borrowers_table = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
1045         $.fn.select2.defaults.set("width", "100%" );
1046         $.fn.select2.defaults.set("dropdownAutoWidth", true );
1047
1048         $(document).ready(function() {
1049             $('#cancellation-reason-fieldset').hide();
1050             $('.rank-request').on('change', function() {
1051                 if ( $(".rank-request option:selected[value='del']").length ) {
1052                     $('#cancellation-reason-fieldset').show();
1053                 } else {
1054                     $('#cancellation-reason-fieldset').hide();
1055                 }
1056             });
1057
1058             [% SET active = clubs ? 1 : 0 %]
1059             $('#circ_holds_select').tabs({
1060                 active: [% active | $raw %],
1061                 activate: function(){
1062                     $(this).find("input.focus").focus();
1063                 },
1064                 create: function(){
1065                     $(this).find("input.focus").focus();
1066                 }
1067             });
1068             function ToggleHoldsToPlace() {
1069                 if ( $("#requestany").prop('checked') ) {
1070                     $("#holds_to_place_count").prop('disabled', false);
1071                 } else {
1072                     $("#holds_to_place_count").prop('disabled', true);
1073                 }
1074             }
1075             ToggleHoldsToPlace();
1076             $("#requestany").on('change', function(){
1077                 ToggleHoldsToPlace();
1078             });
1079
1080             [% IF Koha.Preference('UseBranchTransferLimits') %]
1081                 $("#pickup").on('change', function(){
1082                     var pickup = $("#pickup").val();
1083                     var url = "?pickup=" + pickup;
1084                     url += "&borrowernumber=" + borrowernumber;
1085                     url += "&biblionumber=" + biblionumber;
1086                     window.location.replace(url);
1087                 });
1088             [% END %]
1089
1090             [% IF AutoResumeSuspendedHolds %]
1091                 $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
1092             [% END %]
1093
1094             $(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden");
1095             $(".datepickerto").datepicker("option", "altFormat", "yy-mm-dd");
1096
1097             $(".datepickerfrom").datepicker("option", "altField", ".datepickerfrom_hidden");
1098             $(".datepickerfrom").datepicker("option", "altFormat", "yy-mm-dd");
1099
1100             var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, {
1101                 'bPaginate': false,
1102                 "sDom": '<"top pager"ilf>t',
1103                 "aoColumnDefs": [
1104                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
1105                 ]
1106             }));
1107
1108             //Override fieldset styling for dataTables search box
1109             $("div.top.pager").css("margin-left","1em");
1110             $(".dataTables_filter label").css({
1111                 "width":"auto",
1112                 "margin-right":"0em"
1113             });
1114
1115             $("#club-request-form").on("submit", function() {
1116                 let $t = $(this);
1117                 $('.clubalert, .holdalert').addClass('hide');
1118                 let biblionumbers = [biblionumber];
1119                 let biblionumbers_text;
1120                 const data = {
1121                     pickup_library_id: $('select[name="pickup"]').val()
1122                 };
1123                 if($('input[name="checkitem"]:checked').length)
1124                     data.item_id = $('input[name="checkitem"]:checked').val();
1125                 if($('input[name="borrowernumber"]').length)
1126                     data.patron_id = $('input[name="borrowernumber"]').val();
1127                 if($('textarea[name="notes"]').length)
1128                     data.notes = $('textarea[name="notes"]').val()||null;
1129                 if($('.datepickerto_hidden').length)
1130                     data.expiration_date = $('.datepickerto_hidden').val()||null;
1131                 if($('.datepickerfrom_hidden').length)
1132                     data.hold_date = $('.datepickerfrom_hidden').val()||null;
1133                 if($('input[name="itemtype"]').length) {
1134                     data.item_type = $('input[name="itemtype"]').val()||null;
1135                 }
1136                 if($('input[name="default_patron_home"]:checked').length) {
1137                     data.default_patron_home = 1;
1138                 }
1139                 if($('input[name="biblionumbers"]').length) {
1140                     biblionumbers_text = $('input[name="biblionumbers"]').val();
1141                     biblionumbers = biblionumbers_text.replace(/\/$/, '').split('/')
1142                 }
1143
1144                 const count = $('input[name="holds_to_place_count"]').length?$('input[name="holds_to_place_count"]').val():1;
1145                 biblionumbers.forEach(function(biblionumber) {
1146                     data.biblio_id = biblionumber;
1147                     let options = {
1148                         url: $t.attr('action'),
1149                         method: $t.attr('method').toUpperCase(),
1150                         contentType: 'application/json',
1151                         data: JSON.stringify(data)
1152                     };
1153                     for(let i = 0; i < count; i++) {
1154                         $.ajax(options)
1155                         .then(function(result) {
1156                             let url = 'request.pl?biblionumber='+biblionumber;
1157                             if(biblionumbers_text) {
1158                                 url = 'request.pl?biblionumbers='+biblionumbers_text;
1159                             }
1160                             document.location = url;
1161                         })
1162                         .fail(function(err) {
1163                             var message = err.responseJSON.error;
1164                             var match = err.responseJSON.error.match(/Reason: (\w+)\s*$/);
1165                             if(match && ERROR_MAP[match[1]]) {
1166                                 message = '<div><strong>'+_("Cannot place hold")+'</strong></div><div>'+ERROR_MAP[match[1]]+'</div>'
1167                             }
1168                             $('.clubalert, .holdalert').removeClass('hide').html(message);
1169                         });
1170                     }
1171                 });
1172
1173                 return false;
1174             });
1175
1176             [% UNLESS ( multi_hold ) %]
1177                 $("#hold-request-form").on("submit", function(){
1178                     return check();
1179                 });
1180             [% ELSE %]
1181                 $("#hold-request-form").on("submit", function(){
1182                     return checkMultiHold();
1183                 });
1184             [% END %]
1185
1186             $(".pickup_location_dropdown").each( function () {
1187                 var this_dropdown = $(this);
1188                 var hold_id = $(this).data('hold_id');
1189
1190                 this_dropdown.select2({
1191                     allowClear: false,
1192                     ajax: {
1193                       [%- IF Koha.Preference('AllowHoldPolicyOverride') -%]
1194                         url: '/api/v1/libraries',
1195                       [%- ELSE -%]
1196                         url: '/api/v1/holds/' + encodeURIComponent(hold_id) + '/pickup_locations',
1197                       [%- END -%]
1198                         delay: 300, // wait 300 milliseconds before triggering the request
1199                         dataType: 'json',
1200                         data: function (params) {
1201                             var search_term = (params.term === undefined) ? '' : params.term;
1202                             var query = {
1203                                 "q": JSON.stringify({"name":{"-like":search_term+'%'},"pickup_location":1}),
1204                                 "_order_by": "name"
1205                             };
1206                             return query;
1207                         },
1208                         processResults: function (data) {
1209                             var results = [];
1210                             data.forEach( function ( library ) {
1211                                 results.push(
1212                                     {
1213                                         "id": library.library_id.escapeHtml(),
1214                                         "text": library.name.escapeHtml()
1215                                     }
1216                                 );
1217                             });
1218                             return { "results": results };
1219                         }
1220                     }
1221                 });
1222             });
1223         });
1224
1225         function check() {
1226             var msg = "";
1227             var count_reserv = 0;
1228
1229             // check if we have checkitem form
1230             if (document.form.checkitem){
1231                 for (i=0;i<document.form.checkitem.length;i++){
1232                     if (document.form.checkitem[i].checked == true) {
1233                         count_reserv++ ;
1234                     }
1235                 }
1236                 // for only one item, check the checkitem without consider the loop checkitem
1237                 if (i==0){
1238                     if (document.form.checkitem.checked == true) {
1239                         count_reserv++;
1240                     }
1241                 }
1242             }
1243
1244             if (document.form.requestany.checked == true){
1245                 count_reserv++ ;
1246             }
1247
1248             if (count_reserv == "0"){
1249                 msg += (_("- Please select an item to place a hold") + "\n");
1250             }
1251
1252             if (msg == "") {
1253                 $('#hold-request-form').preventDoubleFormSubmit();
1254                 return(true);
1255             } else {
1256                 alert(msg);
1257                 return(false);
1258             }
1259         }
1260
1261         function checkMultiHold() {
1262             var spans = $(".multi_hold_item_checkbox:checked");
1263             if ($(spans).size() == 0) {
1264                 alert(MSG_NO_ITEMS_AVAILABLE);
1265                 return false;
1266             }
1267
1268             var biblionumbers = "";
1269             $(spans).each(function() {
1270                 var bibnum = $(this).attr("title");
1271                 biblionumbers += bibnum + "/";
1272             });
1273
1274             var badSpans = $(".not_holdable");
1275             var badBibs = "";
1276             $(badSpans).each(function() {
1277                 var bibnum = $(this).attr("title");
1278                 badBibs += bibnum + "/";
1279             });
1280
1281             $("#multi_hold_bibs").val(biblionumbers);
1282             $("#bad_bibs").val(badBibs);
1283
1284             $('#hold-request-form').preventDoubleFormSubmit();
1285
1286             return true;
1287         }
1288
1289          $(document).ready(function() {
1290             $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic
1291                 var itemnumber = this.value;
1292                 var msg = '';
1293
1294                 switch (override_items[itemnumber].holdallowed) {
1295                     case 0: msg = _("This item normally cannot be put on hold."); break;
1296                     case 1: msg = _("This item normally cannot be put on hold except for patrons from %s.").format(override_items[itemnumber].homebranch); break;
1297                 }
1298
1299                 msg += "\n\n" + _("Place hold on this item?");
1300
1301                 return confirm(msg);
1302             });
1303             $("button.warning").click(function() {
1304                 return confirm( _("None of these items can normally be put on hold for this patron.") + "\n\n" + _("Place hold?") );
1305             });
1306             $("#requestany").click(function() {
1307                 if(this.checked){
1308                     $("input[name=checkitem]").each(function() {
1309                         $(this).prop("checked", false);
1310                     });
1311                 }
1312             });
1313             $("input[name=checkitem]").click(function() {
1314                 onechecked = 0;
1315                 $("input[name=checkitem]").each(function() {
1316                     if(this.checked){
1317                         onechecked = 1;
1318                     }
1319                 });
1320                 if(onechecked == 1){
1321                     $("#requestany").prop("checked", false);
1322                     $("#holds_to_place_count").prop('disabled', true);
1323                 } else {
1324                     $("#requestany").prop("checked",true);
1325                     $("#holds_to_place_count").prop('disabled', false);
1326                 }
1327             });
1328             var prev_rank_request;
1329             $("select[name=rank-request]").on("focus", function() {
1330                 prev_rank_request = $(this).val();
1331                 var row = $(this).parents("tr:first");
1332             }).change(function() {
1333                 var row = $(this).parents("tr:first");
1334                 var value = parseInt($(this).val());
1335                 var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found
1336                 if( !isNaN(value) ) {  //If moved to 'del'
1337                     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)
1338                     if (prev_rank_request > value) {
1339                         row.insertBefore(after);
1340                     } else {
1341                         row.insertAfter(after);
1342                     }
1343                 }
1344
1345                 var next_priority = 1;
1346                 $("select[name=rank-request]").each(function () {
1347                     if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds
1348                     $(this).val(next_priority);
1349                     next_priority++;
1350                 });
1351             });
1352
1353             $(".clear-date").on("click",function(e){
1354                 e.preventDefault();
1355                 var fieldID = this.id.replace("clear-date-","");
1356                 $("#" + fieldID).val("");
1357             });
1358
1359             // Confirm cancellation of hold
1360             let cancel_link;
1361             $(".cancel-hold").on("click",function(e) {
1362                 e.preventDefault;
1363                 cancel_link = $(this);
1364                 $('#cancelModal').modal();
1365                 return false;
1366             });
1367             $("#cancelModalConfirmBtn").on("click",function(e) {
1368                 let borrowernumber = cancel_link.data('borrowernumber');
1369                 let biblionumber = cancel_link.data('biblionumber');
1370                 let reserve_id = cancel_link.data('id');
1371                 let reason = $("#modal-cancellation-reason").val();
1372                 let link = `request.pl?action=cancel&amp;borrowernumber=${ borrowernumber }&amp;biblionumber=${ biblionumber }&amp;reserve_id=${ reserve_id }`;
1373                 if ( reason ) {
1374                     link += "&amp;cancellation-reason=" + reason
1375                 }
1376                 window.location.href = link;
1377                 return false;
1378             });
1379
1380             [% UNLESS ( patron || patron.borrowernumber || borrowers || noitems ) %]
1381                 [% IF ( PatronAutoComplete ) %]
1382                 $( "#patron" ).autocomplete({
1383                     source: "/cgi-bin/koha/circ/ysearch.pl",
1384                     minLength: 3,
1385                     select: function( event, ui ) {
1386                         $( "#patron" ).val( ui.item.cardnumber );
1387                         $( "#holds_patronsearch" ).submit();
1388                         return false;
1389                     }
1390                 })
1391                 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
1392                     return $( "<li></li>" )
1393                     .data( "ui-autocomplete-item", item )
1394                     .append(
1395                         "<a>"
1396                             + ( item.surname ? item.surname.escapeHtml() : "" )
1397                             + ", "
1398                             + ( item.firstname ? item.firstname.escapeHtml() : "" )
1399                             + " (" + ( item.cardnumber ? item.cardnumber.escapeHtml() : "" ) + ")"
1400                             + " "
1401                             + "<small>"
1402                                 + ( item.address ? item.address.escapeHtml() : "" )
1403                                 + " "
1404                                 + ( item.city ? item.city.escapeHtml() : "" )
1405                                 + " "
1406                                 + ( item.zipcode ? item.zipcode.escapeHtml() : "" )
1407                                 + " "
1408                                 + ( item.country ? item.country.escapeHtml() : "" )
1409                             + "</small>"
1410                         + "</a>" )
1411                     .appendTo( ul );
1412                 };
1413                 [% END %]
1414             [% END %]
1415             Sticky = $("#toolbar");
1416             Sticky.hcSticky({
1417                 stickTo: "#existing_holds",
1418                 stickyClass: "floating"
1419             });
1420         });
1421     </script>
1422 [% END %]
1423
1424 [% INCLUDE 'intranet-bottom.inc' %]