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