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