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