Bug 19469: (QA follow-up) When altering priorities, use the existing priority numbers...
[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 [% SET footerjs = 1 %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 [% UNLESS ( multi_hold ) %]
11     <title>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Place a hold on [% title | html %]</title>
12 [% ELSE %]
13     <title>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Confirm holds</title>
14 [% END %]
15 [% INCLUDE 'doc-head-close.inc' %]
16 [% Asset.css("css/datatables.css") | $raw %]
17 </head>
18
19 <body id="circ_request" class="catalog">
20 [% INCLUDE 'header.inc' %]
21 [% INCLUDE 'circ-search.inc' %]
22
23 [% UNLESS ( multi_hold ) %]
24     <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | html %]">[% title | html %]</a> &rsaquo; Place a hold on [% title | html %]</div>
25 [% ELSE %]
26     <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> &rsaquo; Confirm holds</div>
27 [% END %]
28
29  <div id="doc3" class="yui-t2">
30
31    <div id="bd">
32         <div id="yui-main">
33         <div class="yui-b">
34 [% IF ( noitems ) %]
35     <div class="dialog alert">
36     [%IF (multi_hold) %]
37         <strong>Cannot place hold:</strong> one or more records without items attached.
38     [% ELSE %]
39         <strong>Cannot place hold:</strong> this record has no items attached.
40     [% END %]
41     </div>
42 [% END %]
43
44   [% IF ( messagetransfert ) %]
45                 <div class="dialog message">
46                                 <h2>Hold found for ([% nextreservtitle | html %]), please transfer</h2>
47                         <p>Hold placed by : <strong> [% nextreservsurname | html %] [% nextreservfirstname | html %]</strong> at : <strong> [% branchname | html %] </strong>, Please transfer this item.
48                         </p>
49                         <form name="cancelReservewithtransfert" action="branchreserves.pl" method="post">
50                                 <input type="submit" class="button" />
51                         </form>
52                 </div>
53   [% END %]
54
55   [% UNLESS ( multi_hold ) %]
56     <h1>Place a hold on [% INCLUDE 'biblio-default-view.inc' %][% title | html %]</a></h1>
57   [% ELSE %]
58     <h1>Confirm holds</h1>
59   [% END %]
60
61   [% UNLESS patron OR patron.borrowernumber OR noitems %]
62     [% IF ( messageborrower ) %]
63       <div class="dialog alert"><h3>Patron not found</h3><p>No patron with this name, please, try another</p> </div>
64     [% END %]
65     <form  id="holds_patronsearch" action="request.pl?biblionumber=[% biblionumber | html %]" method="post">
66         <fieldset id="circ_holds_selectborrower" class="brief">
67
68         [% UNLESS borrowers %]
69                 <label for="patron">Patron: </label>
70                 <div class="hint">Enter patron card number or partial name:</div>
71                 <input type="text" size="40" id="patron" class="focus" name="findborrower" />
72                 <input type="submit" value="Search" />
73             [% IF multi_hold %]
74                 <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
75                 <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
76             [% ELSE %]
77                 <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
78             [% END %]
79             </fieldset>
80         [% ELSE %]
81             [% INCLUDE 'circ-patron-search-results.inc' destination = "holds" %]
82           </fieldset>
83
84         [% END %]
85         [% IF ( multi_hold ) %]
86             <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
87             <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
88         [% END %]
89     </form>
90   [% ELSIF NOT noitems %]
91
92 [% IF ( exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted ) %]
93     <div class="dialog alert">
94
95     [% UNLESS ( multi_hold ) %]
96       <h3>Cannot place hold</h3>
97       <ul>
98         [% IF ( exceeded_maxreserves ) %]
99           <li><strong>Too many holds: </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 [% maxreserves | html %] total holds.</li>
100         [% ELSIF ( exceeded_holds_per_record ) %]
101           <li><strong>Too many holds for this record: </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>
102         [% ELSIF ( alreadypossession ) %]
103           <li> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]">[% patron.firstname | html %] [% patron.surname | html %]</a> <strong>is already in possession</strong> of one item.</li>
104         [% ELSIF ( alreadyreserved ) %]
105           <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]">[% patron.firstname | html %] [% patron.surname | html %]</a> <strong>already has a hold</strong> on this item.</li>
106         [% ELSIF ( ageRestricted ) %]
107           <li><strong>Age restricted</strong></li>
108         [% ELSIF ( none_available ) %]
109           <li> <strong>No items are available</strong> to be placed on hold.</li>
110         [% ELSIF ( maxreserves ) %]
111           <li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]">[% patron.firstname | html %] [% patron.surname | html %] </a> has too many holds.</li>
112         [% END %]
113       </ul>
114     [% ELSE %]
115         <h3>Cannot place hold on some items</h3>
116         [% IF ( exceeded_maxreserves ) %]
117           <li><strong>Too many holds: </strong> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]">[% 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>
118         [% ELSIF ( exceeded_holds_per_record ) %]
119             [% FOREACH biblioloo IN biblioloop %]
120                 [% IF (biblioloo.tooManyHoldsForThisRecord) %]
121                     <li><strong>Too many holds for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | html %]"> [% 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>
122                 [% END %]
123             [% END %]
124         [% END %]
125     [% END %]
126
127     </div>
128 [% END %]
129
130 [% IF ( expiry || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
131 <div class="dialog message"><ul>
132     [% IF ( expiry ) %]
133     <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]">[% patron.firstname | html %] [% patron.surname | html %]</a>: <strong>Account has expired</strong></li>
134     [% END %]
135
136     [% IF patron.is_debarred %]
137     <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]#reldebarments">[% patron.firstname | html %] [% patron.surname | html %]</a>: <strong>Patron has restrictions</strong></li>
138     [% END %]
139
140     [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
141     <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">[% patron.firstname | html %] [% patron.surname | html %]</a>: <strong>Patron has outstanding fines: [% amount_outstanding | format('%.2f') %]</strong></li>
142     [% END %]
143
144     [% IF ( diffbranch ) %]
145     <li> <strong>Pickup library is different. </strong>Patron: <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]">[% patron.firstname | html %] [% patron.surname | html %]</a> Patron's home library: ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )</li>
146     [% END %]
147
148 </ul></div>
149 [% END %]
150
151   [% IF ( messageborrower ) %]
152    <div class="dialog alert"><h3>Patron not found:</h3> <p>Name or barcode not found. Please try an other </p></div>
153   [% END %]
154
155   <fieldset class="rows left">
156     <legend>Hold details</legend>
157         [% UNLESS ( multi_hold ) %]
158             <form action="placerequest.pl" method="post" onsubmit="return check();" name="form" id="hold-request-form">
159         [% ELSE %]
160             <form action="placerequest.pl" method="post" onsubmit="return checkMultiHold();" name="form">
161         [% END %]
162
163         <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
164         <input type="hidden" name="type" value="str8" />
165
166         [% IF ( multi_hold ) %]
167             <input type="hidden" name="multi_hold" value="[% multi_hold | html %]"/>
168             <input type="hidden" name="biblionumbers" id="multi_hold_bibs" value="[% biblionumbers | html %]"/>
169             <input type="hidden" name="bad_bibs" id="bad_bibs" value=""/>
170             <input type="hidden" name="request" value="any"/>
171             [% FOREACH biblioloo IN biblioloop %]
172               <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]"/>
173               <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]"/>
174             [% END %]
175         [% ELSE %]
176             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
177             <input type="hidden" name="title" value="[% title | html %]" />
178             <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
179         [% END %]
180
181        <ol> <li><span class="label">Patron:</span>
182             [% IF ( patron.borrowernumber ) %]
183                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]">[% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %])</a>
184             [% ELSE %]
185                 Not defined yet
186             [% END %]
187         </li>
188         [% UNLESS ( multi_hold ) %]
189           <li>
190               <span class="label">Estimated priority:</span>
191               <strong>[% fixedRank | html %]</strong>
192           </li>
193         [% END %]
194         <li>
195             <label for="holdnotes">Notes:</label>
196             <textarea id="holdnotes" name="notes" cols="30" rows="1"></textarea>
197         </li>
198         <li>
199             <label for="pickup">Pickup at:</label>
200             <select name="pickup" size="1" id="pickup">
201                 [% PROCESS options_for_libraries libraries => Branches.all({ search_params => { pickup_location => 1 } }) %]
202             </select>
203         </li>
204
205         [% UNLESS ( multi_hold ) %]
206             [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
207                 <li>
208                     <label for="itemtype">Request specific item type:</label>
209                     <select name="itemtype" size="1" id="itemtype">
210                         <option value="">Any item type</option>
211                         [%- FOREACH itemtype IN available_itemtypes %]
212                             <option value="[% itemtype | html %]">[% ItemTypes.GetDescription( itemtype ) | html %]</option>
213                         [%- END %]
214                     </select>
215                 </li>
216             [% END %]
217         [% END %]
218
219         [% IF ( reserve_in_future ) %]
220         <li>
221         <label for="from">Hold starts on date:</label>
222         <input name="reserve_date" id="from" size="10" class="datepickerfrom">
223         <a href="#" id="clear-date-from" class="clear-date">Clear date</a>
224         </li>
225         [% END %]
226
227         <li>
228         <label for="to">Hold expires on date:</label>
229         <input name="expiration_date" id="to" size="10" class="datepickerto" />
230         <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
231         </li>
232
233         [% UNLESS ( multi_hold ) %]
234           <li> <label for="requestany">Hold next available item </label>
235                [% IF force_hold_level == 'item' %]
236                    <input type="checkbox" id="requestany" name="request" disabled="true" />
237                [% ELSIF force_hold_level == 'record' %]
238                    <input type="checkbox" id="requestany" checked="checked" value="Any" disabled="true"/>
239                    <input type="hidden" name="request" value="Any"/>
240                [% ELSE %]
241                    <input type="checkbox" id="requestany" name="request" checked="checked" value="Any" />
242                 [% END %]
243                <input type="hidden" name="biblioitem" value="[% biblioitemnumber | html %]" />
244                <input type="hidden" name="alreadyreserved" value="[% alreadyreserved | html %]" />
245           </li>
246
247           [% IF remaining_holds_for_record > 1 %]
248               <li>
249                    <label for="holds_to_place_count">Holds to place (count)</label>
250                    <input type="number" name="holds_to_place_count" min="1" max="[% remaining_holds_for_record | html %]" step="1" value="1" />
251               </li>
252             [% ELSE %]
253                 <input type="hidden" name="holds_to_place_count" value="1" />
254             [% END %]
255         [% END %]
256
257 </ol>
258    [% UNLESS ( multi_hold ) %]
259         <fieldset class="action">
260             [% IF ( patron.borrowernumber ) %]
261                 [% IF ( override_required ) %]
262                     <input type="submit" class="warning" value="Place hold" />
263                 [% ELSIF ( none_available ) %]
264                     <input type="submit" disabled="disabled" value="Place hold" />
265                 [% ELSE %]
266                     <input type="submit" value="Place hold" />
267                 [% END %]
268             [% END %]
269         </fieldset>
270         [% FOREACH bibitemloo IN bibitemloop %]
271           <ol>
272             [% UNLESS ( item_level_itypes ) %]
273               <li><span class="label">Item type:</span> [% bibitemloo.description | html %]</li>
274             [% END %]
275
276             [% IF ( bibitemloo.publicationyear ) %]<li><span class="label">Publication year:</span> [% bibitemloo.publicationyear | html %]</li>[% END %]
277           </ol>
278
279         <h2 style="padding: 0 1em;">
280             Place a hold on a specific item
281             [% IF bibitemloo.force_hold_level == 'item' %]
282                 <span class="error"><i>(Required)</i></span>
283             [% END %]
284         </h2>
285         <table id="requestspecific">
286             <thead>
287                 <tr>
288                     <th>Hold</th>
289                 [% IF ( item_level_itypes ) %]
290                     <th>Item type</th>
291                 [% END %]
292                     <th>Barcode</th>
293                     <th>Home library</th>
294                     <th>Last location</th>
295                     <th>Call no.</th>
296                     <th>Copy number</th>
297                 [% IF itemdata_enumchron %]
298                     <th>Vol no.</th>
299                 [% END %]
300                     <th class="title-string">Information</th>
301                 </tr>
302             </thead>
303             <tbody>
304             [% SET selected = 0 %]
305             [% FOREACH itemloo IN bibitemloo.itemloop %]
306             [% UNLESS ( itemloo.hide ) %]
307                 <tr class="[% itemloo.backgroundcolor | html %]">
308                     <td>
309                 [% IF itemloo.force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
310                     <span class="error">
311                         <i class="fa fa-times fa-lg" alt="Cannot be put on hold"></i>
312                         Hold must be record level
313                     </span>
314                 [% ELSIF ( itemloo.available ) %]
315                     <input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" />
316                 [% ELSIF ( itemloo.override ) %]
317                     <input type="radio" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" />
318                     <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" alt="Requires override of hold policy"/></i>
319                 [% ELSE %]
320                     <span class="error">
321                         <i class="fa fa-times fa-lg" alt="Cannot be put on hold"></i>
322                         [% IF itemloo.not_holdable %]
323                             [% IF itemloo.not_holdable == 'damaged' %]
324                                 Item damaged
325                             [% ELSIF itemloo.not_holdable == 'ageRestricted' %]
326                                 Age restricted
327                             [% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %]
328                                 Exceeded max holds per record
329                             [% ELSIF itemloo.not_holdable == 'tooManyReserves' %]
330                                 Too many holds
331                             [% ELSIF itemloo.not_holdable == 'notReservable' %]
332                                 Not holdable
333                             [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %]
334                                 Patron is from different library
335                             [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
336                                 Patron already has hold for this item
337                             [% ELSE %]
338                                 [% itemloo.not_holdable | html %]
339                             [% END %]
340                         [% END %]
341                     </span>
342                 [% END %]
343                     </td>
344                 [% IF ( item_level_itypes ) %]
345                     <td>
346                     [% UNLESS ( noItemTypeImages ) %]
347                         [% IF ( itemloo.imageurl ) %]<img src="[% itemloo.imageurl | html %]" alt="" /> <br /> [% END %]
348                     [% END %]
349                         [% itemloo.itypename | html %]
350                     </td>
351                 [% END %]
352
353                     <td>
354                         [% itemloo.barcode | html %]
355                     </td>
356                     <td>
357                         [% Branches.GetName( itemloo.homebranch ) | html %]
358                     </td>
359                     <td>
360                         [% Branches.GetName( itemloo.holdingbranch ) | html %]
361                     </td>
362                     <td>
363                         [% itemloo.itemcallnumber | html %]
364                     </td>
365                     <td>
366                         [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %]&nbsp;[% END %]
367                     </td>
368                 [% IF itemdata_enumchron %]
369                     <td>
370                         [% itemloo.enumchron | html %]
371                     </td>
372                 [% END %]
373                     <td>
374                 [% IF ( itemloo.onloan ) %]
375                     <span title="[% itemloo.date_due | html %]" class="checkedout">Due [% itemloo.date_due | $KohaDates as_due_date => 1 | html %]</span>
376                 [% ELSE %]
377                     <span title="0000-00-00">
378                         [% IF ( itemloo.transfertwhen ) %]
379                             In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %],
380                             to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %]
381                         [% END %]
382                     </span>
383                 [% END %]
384                 [% IF ( itemloo.message ) %]
385                    Unavailable (lost or missing)
386                 [% END %]
387
388                 [% IF ( itemloo.notforloan ) %]
389                    Not for loan ([% itemloo.notforloanvalue | html %])
390                 [% END %]
391
392                 [% IF ( itemloo.reservedate ) %]
393                     [% IF ( itemloo.nocancel ) %]
394                             Can't be cancelled when item is in transit
395                     [% ELSE %]
396                     [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %]
397                     [% IF ( itemloo.canreservefromotherbranches ) %]for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedFor.borrowernumber | html %]">[% itemloo.ReservedFor.firstname | html %] [% itemloo.ReservedFor.surname | html %]</a>[% END %] [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %]
398                     since
399                     [% IF ( itemloo.waitingdate ) %][% itemloo.waitingdate | $KohaDates %][% ELSE %][% IF ( itemloo.reservedate ) %][% itemloo.reservedate | html %][% END %][% END %]. <a class="info" href="modrequest.pl?CancelBiblioNumber=[% itemloo.biblionumber | html %]&amp;CancelBorrowerNumber=[% itemloo.ReservedFor.borrowernumber | html %]&amp;CancelItemnumber=[% itemloo.itemnumber | html %]"  onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);">Cancel hold</a>
400
401                     [% END %]
402                 [% ELSE %]
403                     Not on hold
404                 [% END %]
405
406                 [% IF itemloo.item_level_holds == "N" %]
407                     <br/>Item level hold not allowed from OPAC
408                 [% ELSIF itemloo.item_level_holds == "F" %]
409                     <br/>Item level hold forced from OPAC
410                 [% END %]
411                 [% IF ( itemloo.damaged ) %]
412                     <br />Damaged
413                 [% END %]
414                     </td>
415                 </tr>
416             [% END %] <!--UNLESS item hide-->
417             [% END %] <!-- itemloop -->
418             </tbody>
419         </table>
420     [% IF ( bibitemloo.hiddencount ) %]
421         <form>
422         <p class="hiddencount"><a href="request.pl?biblionumber=[% bibitemloo.biblionumber | html %]&amp;borrowernumber=[% bibitemloo.borrowernumber | html %]&amp;showallitems=1">Show all items ([% bibitemloo.hiddencount | html %] hidden)</a></p>
423         </form>
424     [% END %] <!-- hiddencount -->
425     [% END %] <!-- bibitemloop -->
426
427   [% ELSE %]<!-- UNLESS multi_hold -->
428
429     <table id="requesttitles">
430       <tr>
431         <th>Title</th>
432         [% UNLESS ( item_level_itypes ) %]
433           <th>Item type</th>
434         [% END %]
435         <th>Priority</th>
436         <th>Information</th>
437       </tr>
438       [% FOREACH biblioloo IN biblioloop %]
439         [% IF ( biblioloo.warn ) %]
440           <tr class="onissue">
441         [% ELSE %]
442           <tr>
443         [% END %]
444           <td>
445             <ul>
446               <li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | html %]">[% biblioloo.title | html %]</a></li>
447               [% IF ( biblioloo.publicationyear ) %]
448                 <li><span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]</li>
449               [% END %]
450             </ul>
451             [% UNLESS ( biblioloo.warn ) %]
452               <span class="multi_hold_item" title="[% biblioloo.biblionumber | html %]"></span>
453             [% ELSE %]
454               <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
455             [% END %]
456           </td>
457           [% UNLESS ( item_level_itypes ) %]
458             <td>
459               <img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | html %]" />
460             </td>
461           [% END %]
462             <td>[% biblioloo.rank | html %]</td>
463           <td>
464             [% IF ( biblioloo.alreadyres ) %]
465               <ul>
466             [% ELSE %]
467               [% IF ( biblioloo.none_avail ) %]
468                 <ul>
469               [% END %]
470             [% END %]
471
472           [% IF ( biblioloo.alreadyres ) %]
473               <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | html %]">[% patron.firstname | html %] [% patron.surname | html %]</a> <strong>already has a hold</strong> on this item </li>
474           [% END %]
475           [% IF ( biblioloo.none_avail ) %]
476               <li> <strong>No items are available</strong> to be placed on hold</li>
477           [% END %]
478
479             [% IF ( biblioloo.alreadyres ) %]
480               </ul>
481             [% ELSE %]
482               [% IF ( biblioloo.none_avail ) %]
483                 </ul>
484               [% END %]
485             [% END %]
486
487           </td>
488         </tr>
489       [% END %]
490     </table>
491
492   [% END %]<!-- /multi_hold -->
493
494     <fieldset class="action">
495         [% IF ( patron AND patron.borrowernumber ) %]
496             [% IF ( override_required ) %]
497                 <input type="submit" class="warning" value="Place hold" />
498             [% ELSIF ( none_available ) %]
499                 <input type="submit" disabled="disabled" value="Place hold" />
500             [% ELSE %]
501                 <input type="submit" value="Place hold" />
502             [% END %]
503         [% END %]
504     </fieldset>
505     </form>
506         </fieldset>
507 [% END %]
508
509 [% UNLESS ( patron ) %]
510     [% IF ( reserveloop ) %]
511         <form name="T[% time %]" action="modrequest.pl" method="post">
512             [% IF ( multi_hold ) %]
513                 <input type = "hidden" name="multi_hold" value="1"/>
514                 <input type = "hidden" name="biblionumbers" value="[% biblionumbers %]"/>
515             [% END %]
516
517             <fieldset class="rows left">
518                 <legend>Existing holds</legend>
519
520                 [% FOREACH biblioloo IN biblioloop %]
521                     [% IF ( biblioloo.reserveloop ) %]
522                         [% IF ( multi_hold ) %]
523                             <h3>
524                                 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">
525                                     [% biblioloo.title | html %]
526                                 </a>
527                             </h3>
528                         [% END %]
529
530                         [% IF Koha.Preference('HoldsSplitQueue') == 'branch' %]
531                             [% SET branchcodes = [] %]
532
533                             [% FOREACH h IN biblioloo.reserveloop %]
534                                 [% branchcodes.push( h.branchcode ) %]
535                             [% END %]
536                             [% branchcodes = branchcodes.unique %]
537
538                             [% FOREACH b IN branchcodes.sort %]
539                                 [% SET holds_by_branch = [] %]
540                                 [% FOREACH h IN biblioloo.reserveloop %]
541                                     [% IF h.branchcode == b %]
542                                         [% holds_by_branch.push( h ) %]
543                                     [% END %]
544                                 [% END %]
545                                 <fieldset>
546                                     <legend>[% Branches.GetName( b ) %]</legend>
547                                     [% INCLUDE holds_table.inc holds=holds_by_branch %]
548                                 </fieldset>
549                             [% END %]
550                         [% ELSIF Koha.Preference('HoldsSplitQueue') == 'itemtype' %]
551                             [% SET itemtypes = [] %]
552
553                             [% FOREACH h IN biblioloo.reserveloop %]
554                                 [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
555                                 [% itemtypes_all.push( hold_itemtype ) %]
556                             [% END %]
557                             [% itemtypes = itemtypes.unique %]
558
559                             [% FOREACH i IN itemtypes.sort %]
560                                 [% SET holds_by_itemtype = [] %]
561                                 [% FOREACH h IN biblioloo.reserveloop %]
562                                     [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
563                                     [% IF hold_itemtype == i %]
564                                         [% holds_by_itemtype.push( h ) %]
565                                     [% END %]
566                                 [% END %]
567
568                                 <fieldset>
569                                     [% IF i %]
570                                         <legend>[% ItemTypes.GetDescription( i ) %]</legend>
571                                     [% ELSE %]
572                                         <legend>Any item type</legend>
573                                     [% END %]
574                                     [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
575                                 </fieldset>
576                             [% END %]
577                         [% ELSIF Koha.Preference('HoldsSplitQueue') == 'branch_itemtype' %]
578                             [% SET branchcodes = [] %]
579
580                             [% FOREACH h IN biblioloo.reserveloop %]
581                                 [% branchcodes.push( h.branchcode ) %]
582                             [% END %]
583                             [% branchcodes = branchcodes.unique %]
584
585                             [% FOREACH b IN branchcodes.sort %]
586                                 <fieldset class="contrast">
587                                     <legend>[% Branches.GetName( b ) %]</legend>
588                                     [% SET holds_by_branch = [] %]
589                                     [% FOREACH h IN biblioloo.reserveloop %]
590                                         [% IF h.branchcode == b %]
591                                             [% holds_by_branch.push( h ) %]
592                                         [% END %]
593                                     [% END %]
594
595                                     [% SET itemtypes = [] %]
596                                     [% FOREACH h IN holds_by_branch %]
597                                         [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
598                                         [% itemtypes.push( hold_itemtype ) %]
599                                     [% END %]
600                                     [% itemtypes = itemtypes.unique %]
601
602                                     [% FOREACH i IN itemtypes.sort %]
603                                         <fieldset class="standard">
604                                             [% IF i %]
605                                                 <legend>[% ItemTypes.GetDescription( i ) %]</legend>
606                                             [% ELSE %]
607                                                 <legend>Any item type</legend>
608                                             [% END %]
609
610                                             [% SET holds_by_itemtype = [] %]
611                                             [% FOREACH h IN holds_by_branch %]
612                                                 [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
613                                                 [% IF hold_itemtype == i %]
614                                                     [% holds_by_itemtype.push( h ) %]
615                                                 [% END %]
616                                             [% END %]
617                                             [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
618                                         </fieldset>
619                                     [% END %]
620                                 </fieldset>
621                             [% END %]
622                         [% ELSE %]
623                             [% INCLUDE holds_table.inc holds=biblioloo.reserveloop %]
624                         [% END %]
625
626                     [% END %]<!-- /reserveloop -->
627                 [% END %]<!-- /biblioloop -->
628
629                 <fieldset class="action">
630                     <input type="submit" name="submit" value="Update hold(s)" />
631                 </fieldset>
632             </fieldset>
633         </form>
634     [% END %]
635 [% END %]
636 </div>
637 </div>
638
639 <div class="yui-b">
640 [% UNLESS ( multi_hold ) %]
641   [% INCLUDE 'biblio-view-menu.inc' %]
642 [% END %]
643
644 </div>
645 </div>
646
647 [% MACRO jsinclude BLOCK %]
648     [% INCLUDE 'datatables.inc' %]
649     [% INCLUDE 'calendar.inc' %]
650     [% Asset.js("js/circ-patron-search-results.js") | $raw %]
651     <script>
652         var MSG_CONFIRM_DELETE_HOLD   = _("Are you sure you want to cancel this hold?");
653         var patron_homebranch = "[% Branches.GetName( patron.branchcode ) |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
654         var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
655         [% itemloo.itemnumber | html %]: {
656             homebranch: "[% Branches.GetName( itemloo.homebranch ) |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
657             holdallowed: [% itemloo.holdallowed | html %]
658             },
659             [% END %][% END %][% END %]
660         };
661         var MSG_NO_ITEMS_AVAILABLE = _("A hold cannot be requested on any of these items.");
662
663         $(document).ready(function() {
664             function ToggleHoldsToPlace() {
665                 if ( $("#requestany").prop('checked') ) {
666                     $("#holds_to_place_count").prop('disabled', false);
667                 } else {
668                     $("#holds_to_place_count").prop('disabled', true);
669                 }
670             }
671             ToggleHoldsToPlace();
672             $("#requestany").on('change', function(){
673                 ToggleHoldsToPlace();
674             });
675
676             [% IF AutoResumeSuspendedHolds %]
677                 $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
678             [% END %]
679
680             var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, {
681                 'bPaginate': false,
682                 "sDom": '<"top pager"ilf>t',
683                 "aoColumnDefs": [
684                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
685                 ]
686             }));
687
688             //Override fieldset styling for dataTables search box
689             $("div.top.pager").css("margin-left","1em");
690             $(".dataTables_filter label").css({
691                 "width":"auto",
692                 "margin-right":"0em"
693             });
694
695         });
696
697         function check() {
698             var msg = "";
699             var count_reserv = 0;
700
701             // check if we have checkitem form
702             if (document.form.checkitem){
703                 for (i=0;i<document.form.checkitem.length;i++){
704                     if (document.form.checkitem[i].checked == true) {
705                         count_reserv++ ;
706                     }
707                 }
708                 // for only one item, check the checkitem without consider the loop checkitem
709                 if (i==0){
710                     if (document.form.checkitem.checked == true) {
711                         count_reserv++;
712                     }
713                 }
714             }
715
716             if (document.form.requestany.checked == true){
717                 count_reserv++ ;
718             }
719
720             if (count_reserv == "0"){
721                 msg += (_("- Please select an item to place a hold") + "\n");
722             }
723
724             if (msg == "") {
725                 $('#hold-request-form').preventDoubleFormSubmit();
726                 return(true);
727             } else {
728                 alert(msg);
729                 return(false);
730             }
731         }
732
733         function checkMultiHold() {
734             var spans = $(".multi_hold_item");
735             if ($(spans).size() == 0) {
736                 alert(MSG_NO_ITEMS_AVAILABLE);
737                 return false;
738             }
739
740             var biblionumbers = "";
741             $(spans).each(function() {
742                 var bibnum = $(this).attr("title");
743                 biblionumbers += bibnum + "/";
744             });
745
746             var badSpans = $(".not_holdable");
747             var badBibs = "";
748             $(badSpans).each(function() {
749                 var bibnum = $(this).attr("title");
750                 badBibs += bibnum + "/";
751             });
752
753             $("#multi_hold_bibs").val(biblionumbers);
754             $("#bad_bibs").val(badBibs);
755
756             $('#hold-request-form').preventDoubleFormSubmit();
757
758             return true;
759         }
760
761          $(document).ready(function() {
762             $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic
763                 var itemnumber = this.value;
764                 var msg = '';
765
766                 switch (override_items[itemnumber].holdallowed) {
767                     case 0: msg = _("This item normally cannot be put on hold."); break;
768                     case 1: msg = _("This item normally cannot be put on hold except for patrons from %s.").format(override_items[itemnumber].homebranch); break;
769                 }
770
771                 msg += "\n\n" + _("Place hold on this item?");
772
773                 return confirm(msg);
774             });
775             $("input.warning").click(function() {
776                 return confirm( _("None of these items can normally be put on hold for this patron.") + "\n\n" + _("Place hold?") );
777             });
778             $("#requestany").click(function() {
779                 if(this.checked){
780                     $("input[name=checkitem]").each(function() {
781                         $(this).prop("checked", false);
782                     });
783                 }
784             });
785             $("input[name=checkitem]").click(function() {
786                 onechecked = 0;
787                 $("input[name=checkitem]").each(function() {
788                     if(this.checked){
789                         onechecked = 1;
790                     }
791                 });
792                 if(onechecked == 1){
793                     $("#requestany").prop("checked", false);
794                 } else {
795                     $("#requestany").prop("checked",true);
796                 }
797             });
798             var prev_rank_request;
799             var priorities;
800             $("select[name=rank-request]").on("focus", function() {
801                 prev_rank_request = $(this).val();
802                 var row = $(this).parents("tr:first");
803                 priorities = row.parent().find("select[name=rank-request]").map( function() {
804                     return $(this).val();
805                 }).get();
806             }).change(function() {
807                 var row = $(this).parents("tr:first");
808                 var value = parseInt($(this).val());
809                 var rowsCount = row.parent().children('tr').length - 1;
810                 value = value > rowsCount ? rowsCount : value;
811                 var after = row.parent().find("tr:nth-child("+(value+1)+")");
812
813                 if (prev_rank_request > value) {
814                     row.insertBefore(after);
815                 } else {
816                     row.insertAfter(after);
817                 }
818
819                 var next_priority = 0;
820                 row.parent().find("select[name=rank-request]").each(function () {
821                     $(this).val(priorities[next_priority]);
822                     next_priority++;
823                 });
824             });
825
826             $(".clear-date").on("click",function(e){
827                 e.preventDefault();
828                 var fieldID = this.id.replace("clear-date-","");
829                 $("#" + fieldID).val("");
830             });
831
832             // Confirm cancelation of hold
833             $(".cancel-hold").on("click",function(e) {
834                 return confirmDelete(MSG_CONFIRM_DELETE_HOLD);
835             });
836
837             [% UNLESS ( patron || patron.borrowernumber || borrowers || noitems ) %]
838                 [% IF ( CircAutocompl ) %]
839                 $( "#patron" ).autocomplete({
840                     source: "/cgi-bin/koha/circ/ysearch.pl",
841                     minLength: 3,
842                     select: function( event, ui ) {
843                         $( "#patron" ).val( ui.item.cardnumber );
844                         $( "#holds_patronsearch" ).submit();
845                         return false;
846                     }
847                 })
848                 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
849                     return $( "<li></li>" )
850                     .data( "ui-autocomplete-item", item )
851                     .append( "<a>" + item.surname + ", " + item.firstname +
852                              " (" + item.cardnumber + ") <small>" + item.address +
853                              " " + item.city + " " + item.zipcode + " " +
854                              item.country + "</small></a>" )
855                     .appendTo( ul );
856                 };
857                 [% END %]
858             [% END %]
859
860         });
861     </script>
862 [% END %]
863
864 [% INCLUDE 'intranet-bottom.inc' %]