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