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