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