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