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