Bug 24156: move ColumnsSettings to TablesSettings
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reserve / request.tt
blob44c46d23959aba05a2a668683a3e02da250c0de3
1 [% USE raw %]
2 [% USE To %]
3 [% USE Asset %]
4 [% USE Koha %]
5 [% USE KohaDates %]
6 [% USE Branches %]
7 [% USE Categories %]
8 [% USE ItemTypes %]
9 [% USE AuthorisedValues %]
10 [% USE Price %]
11 [% SET footerjs = 1 %]
12 [% INCLUDE 'doc-head-open.inc' %]
13 [% UNLESS ( multi_hold ) %]
14     <title>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Place a hold on [% INCLUDE 'biblio-title-head.inc' %]</title>
15 [% ELSE %]
16     <title>Koha &rsaquo; Circulation &rsaquo; Holds &rsaquo; Confirm holds</title>
17 [% END %]
18 [% INCLUDE 'doc-head-close.inc' %]
19 </head>
21 <body id="circ_request" class="catalog">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'circ-search.inc' %]
25 [% UNLESS ( multi_hold ) %]
26     <div id="breadcrumbs">
27         <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
28         <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> &rsaquo;
29         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">[% biblio.title | html %]</a> &rsaquo;
30         Place a hold on [% INCLUDE 'biblio-title.inc' %]
31     </div>
32 [% ELSE %]
33     <div id="breadcrumbs">
34         <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
35         <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> &rsaquo;
36         Confirm holds
37     </div>
38 [% END # UNLESS multi_hold %]
40 <div class="main container-fluid">
41     <div class="row">
42         [% IF ( multi_hold ) # No sidebar menu when placing multiple holds %]
43             <div class="col-md-10 col-md-offset-1">
44         [% ELSE %]
45             <div class="col-sm-10 col-sm-push-2">
46         [% END %]
48         <main>
50             [% IF ( noitems ) %]
51                 <div class="dialog alert">
52                 [%IF (multi_hold) %]
53                     <strong>Cannot place hold:</strong> one or more records without items attached.
54                 [% ELSE %]
55                     <strong>Cannot place hold:</strong> this record has no items attached.
56                 [% END %]
57                 </div>
58             [% END %]
60             [% IF ( messagetransfert ) %]
61                 <div class="dialog message">
62                     <h2>Hold found for ([% nextreservtitle | html %]), please transfer</h2>
63                     <p>Hold placed by : <strong> [% nextreservsurname | html %] [% nextreservfirstname | html %]</strong> at : <strong> [% branchname | html %] </strong>, Please transfer this item.
64                     </p>
65                     <form name="cancelReservewithtransfert" action="branchreserves.pl" method="post">
66                         <input type="submit" class="button" />
67                     </form>
68                 </div>
69             [% END %]
71             [% UNLESS ( multi_hold ) %]
72                 <h1>Place a hold on [% INCLUDE 'biblio-default-view.inc' %][% INCLUDE 'biblio-title.inc' %]</a></h1>
73             [% ELSE %]
74                 <h1>Confirm holds</h1>
75             [% END %]
77             [% UNLESS club OR patron OR patron.borrowernumber OR noitems %]
78                 [% IF ( messageborrower ) %]
79                     <div class="dialog alert">
80                         <h3>Patron not found</h3>
81                         <p>No patron with this name, please, try another</p>
82                     </div>
83                 [% END %]
85                 [% IF ( messageclub ) %]
86                     <div class="dialog alert">
87                         <h3>Club not found</h3>
88                         <p>No club with this name, please, try another</p>
89                     </div>
90                 [% END %]
91                 <fieldset class="brief">
92                     <label>Search patrons or clubs</label>
93                     <div id="circ_holds_select" class="toptabs">
94                         <ul>
95                             <li><a href="#holds_patronsearch_pane">Patrons</a></li>
96                             <li><a href="#holds_clubsearch_pane">Clubs</a></li>
97                         </ul>
98                         <div id="holds_patronsearch_pane">
99                             <form id="holds_patronsearch" action="request.pl?biblionumbers=[% biblionumbers | html %]" method="post">
100                                 <div class="hint">Enter patron card number or partial name:</div>
101                                 <input type="text" size="40" id="patron" class="focus" name="findborrower" autocomplete="off" />
102                                 <input type="submit" value="Search" />
103                                 [% IF multi_hold %]
104                                     <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
105                                 [% ELSE %]
106                                     <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
107                                 [% END %]
109                             </form> <!-- /#holds_patronsearch -->
110                             [% IF borrowers %]
111                                 [% INCLUDE 'circ-patron-search-results.inc' destination = "holds" %]
112                             [% END %]
113                         </div>
114                         <div id="holds_clubsearch_pane">
115                             <form id="holds_clubsearch" action="request.pl?biblionumber=[% biblionumber | html %]" method="post">
116                                 <div class="hint">Enter club ID or partial name:</div>
117                                 <input type="text" size="40" id="club" class="focus" name="findclub" autocomplete="off" />
118                                 <input type="submit" value="Search" />
119                                 [% IF multi_hold %]
120                                     <input type="hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
121                                 [% ELSE %]
122                                     <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
123                                 [% END %]
125                             </form> <!-- /#holds_patronsearch -->
126                             [% IF clubs %]
127                                 [% INCLUDE 'clubs-table.inc' destination = "holds" %]
128                             [% END %]
129                         </div>
130                     </div>
131                 </fieldset>
132             [% ELSIF club %]
133                 <div class="dialog alert hide clubalert">
134                 </div>
135                 <fieldset class="rows">
136                     <legend>Hold details</legend>
137                     <form action="/api/v1/clubs/[% club.id | html %]/holds" method="post" name="form" id="club-request-form">
139                         [% IF ( multi_hold ) %]
140                             <input type="hidden" name="biblionumbers" id="multi_hold_bibs" value="[% biblionumbers | html %]"/>
141                             <input type="hidden" name="bad_bibs" id="bad_bibs" value=""/>
142                             <input type="hidden" name="request" value="any"/>
143                             [% FOREACH biblioloo IN biblioloop %]
144                                 <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]"/>
145                                 <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]"/>
146                             [% END %]
147                         [% ELSE %]
148                             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
149                             <input type="hidden" name="title" value="[% biblio.title | html %]" />
150                             <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
151                         [% END # /IF multi_hold %]
152                         <ol>
153                             <li>
154                                 <span class="label">Club: </span> [% club.name | html %]
155                             </li>
156                             <li>
157                                 <span class="label">Description: </span> [% club.description | html %]
158                             </li>
159                             <li>
160                                 <label for="pickup">Pickup at:</label>
161                                 <select name="pickup" size="1" id="pickup">
162                                     [% PROCESS options_for_libraries libraries => Branches.all({ selected => club.branchcode, search_params => { pickup_location => 1 } }) %]
163                                 </select>
164                             </li>
165                         </ol>
166                         <h2 style="padding: 0 1em;">Members</h2>
167                         <ol>
168                             [% FOREACH member IN members %]
169                                 [% SET patron = member.patron %]
170                                 <li style="padding: 0.5em 1em;">
171                                     <div><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %])</a></div>
172                                     [% IF member.exceeded_maxreserves %]
173                                         <div>
174                                             <i class="fa fa-error"></i>
175                                             <strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
176                                         </div>
177                                     [% END %]
178                                     [% IF ( member.expiry ) %]
179                                         <div>
180                                             <i class="fa fa-warning"></i>
181                                             <strong>Account has expired</strong>
182                                         </div>
183                                     [% END %]
184                                     [% IF patron.is_debarred %]
185                                         <div>
186                                             <i class="fa fa-warning"></i>
187                                             <strong>Patron has restrictions</strong>
188                                         </div>
189                                     [% END %]
190                                     [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
191                                         <div>
192                                             <i class="fa fa-warning"></i>
193                                             <strong>Patron has outstanding fines: [% member.amount_outstanding | $Price %]</strong>
194                                         </div>
195                                     [% END %]
197                                     [% IF ( member.diffbranch ) %]
198                                         <div>
199                                             <i class="fa fa-warning"></i>
200                                             <strong>Pickup library is different.</strong> Patron's home library: ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )
201                                         </div>
202                                     [% END %]
203                                 </li>
204                             [% END %]
205                         </ol>
206                         [% UNLESS ( multi_hold ) %]
207                             <fieldset class="action">
208                                 <input type="submit" value="Place hold" />
209                             </fieldset>
210                         [% ELSE %]
211                             <table id="requesttitles">
212                                 <tr>
213                                     <th>&nbsp;</th>
214                                     <th>Title</th>
215                                     [% UNLESS ( item_level_itypes ) %]
216                                         <th>Item type</th>
217                                     [% END %]
218                                     <th>Priority</th>
219                                     <th>Information</th>
220                                 </tr>
221                                 [% FOREACH biblioloo IN biblioloop %]
222                                     [% IF ( biblioloo.warn ) %]
223                                         <tr class="onissue">
224                                     [% ELSE %]
225                                         <tr>
226                                     [% END %]
227                                         <td>
228                                             [% UNLESS ( biblioloo.warn ) %]
229                                                     <input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]"/>
230                                                 </td>
231                                             [% END %]
232                                         <td>
233                                             <ul>
234                                                 <li>
235                                                     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
236                                                 </li>
237                                                 [% IF ( biblioloo.publicationyear ) %]
238                                                     <li>
239                                                         <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
240                                                     </li>
241                                                 [% END %]
242                                             </ul>
243                                             [% IF ( biblioloo.warn ) %]
244                                                 <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
245                                             [% END %]
246                                         </td>
247                                         [% UNLESS ( item_level_itypes ) %]
248                                             <td>
249                                                 <img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | html %]" />
250                                             </td>
251                                         [% END %]
252                                         <td>[% biblioloo.rank | html %]</td>
253                                         <td>
254                                             [% IF ( biblioloo.checked_previously ) %]
255                                                 <span>Patron has previously checked out this title</span><br/>
256                                             [% END %]
257                                             [% IF ( biblioloo.alreadyres ) %]
258                                                 <ul>
259                                             [% ELSE %]
260                                                 [% IF ( biblioloo.none_avail ) %]
261                                                     <ul>
262                                                 [% END %]
263                                             [% END %]
265                                             [% IF ( biblioloo.alreadyres ) %]
266                                                 <li>
267                                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>
268                                                     <strong>already has a hold</strong> on this item
269                                                 </li>
270                                             [% END %]
271                                             [% IF ( biblioloo.none_avail ) %]
272                                                 <li> <strong>No items are available</strong> to be placed on hold</li>
273                                             [% END %]
275                                             [% IF ( biblioloo.alreadyres ) %]
276                                                 </ul>
277                                             [% ELSE %]
278                                                 [% IF ( biblioloo.none_avail ) %]
279                                                     </ul>
280                                                 [% END %]
281                                             [% END %]
282                                         </td>
283                                     </tr>
284                                 [% END # /FOREACH biblioloo %]
285                             </table> <!-- /#requesttitles -->
286                         [% END %]
287                     </form>
288                 </fieldset>
289             [% ELSIF NOT noitems # /UNLESS patron %]
291                 [% IF ( checked_previously && !multi_hold ) %]
292                     <div class="dialog alert">
293                         <ul>
294                             <li>Patron has previously checked out this title</li>
295                         </ul>
296                     </div>
297                 [% END %]
299                 [% IF ( exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted ) %]
300                     <div class="dialog alert">
302                         [% UNLESS ( multi_hold ) %]
303                             <h3>Cannot place hold</h3>
304                             <ul>
305                                 [% IF ( exceeded_maxreserves ) %]
306                                     <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>
307                                 [% ELSIF ( exceeded_holds_per_record ) %]
308                                     <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>
309                                 [% ELSIF ( alreadypossession ) %]
310                                     <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>
311                                 [% ELSIF ( alreadyreserved ) %]
312                                     <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>
313                                 [% ELSIF ( ageRestricted ) %]
314                                     <li><strong>Age restricted</strong></li>
315                                 [% ELSIF ( none_available ) %]
316                                     <li> <strong>No items are available</strong> to be placed on hold.</li>
317                                 [% ELSIF ( maxreserves ) %]
318                                     <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>
319                                 [% END # /IF exceeded_maxreserves %]
320                             </ul>
321                         [% ELSE # UNLESS multi_hold %]
322                             <h3>Cannot place hold on some items</h3>
323                             [% IF ( exceeded_maxreserves ) %]
324                                 <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>
325                             [% ELSIF ( exceeded_holds_per_record ) %]
326                                 [% FOREACH biblioloo IN biblioloop %]
327                                     [% IF (biblioloo.tooManyHoldsForThisRecord) %]
328                                         <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>
329                                     [% END %]
330                                 [% END %]
331                             [% END # /IF exceeded_maxreserves %]
332                         [% END # /UNLESS multi_hold %]
333                     </div>
334                 [% END # /IF ( exceeded_maxreserves || ... %]
336                 [% IF ( expiry || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
337                     <div class="dialog message">
338                         <ul>
339                             [% IF ( expiry ) %]
340                                 <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>
341                             [% END %]
343                             [% IF patron.is_debarred %]
344                                 <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>
345                             [% END %]
347                             [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
348                                 <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>
349                             [% END %]
351                             [% IF ( diffbranch ) %]
352                                 <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>
353                             [% END %]
354                         </ul> <!-- /.dialog.message -->
355                     </div>
356                 [% END # /IF expiry || diffbranch ... %]
358                 [% IF ( messageborrower ) %]
359                     <div class="dialog alert">
360                         <h3>Patron not found:</h3>
361                         <p>Name or barcode not found. Please try an other </p>
362                     </div>
363                 [% END %]
365                 <div class="dialog alert hide holdalert">
366                 </div>
368                 <fieldset class="rows">
369                     <legend>Hold details</legend>
370                     <form action="placerequest.pl" method="post" name="form" id="hold-request-form">
372                         <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
373                         <input type="hidden" name="type" value="str8" />
375                         [% IF ( multi_hold ) %]
376                             <input type="hidden" name="biblionumbers" id="multi_hold_bibs" value="[% biblionumbers | html %]"/>
377                             <input type="hidden" name="bad_bibs" id="bad_bibs" value=""/>
378                             <input type="hidden" name="request" value="any"/>
379                             [% FOREACH biblioloo IN biblioloop %]
380                                 <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]"/>
381                                 <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]"/>
382                             [% END %]
383                         [% ELSE %]
384                             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
385                             <input type="hidden" name="title" value="[% biblio.title | html %]" />
386                             <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
387                         [% END # /IF multi_hold %]
389                         <ol>
390                             <li>
391                                 <span class="label">Patron:</span>
392                                 [% IF ( patron.borrowernumber ) %]
393                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %])</a>
394                                 [% ELSE %]
395                                     Not defined yet
396                                 [% END %]
397                             </li>
399                             [% UNLESS ( multi_hold ) %]
400                                 <li>
401                                     <span class="label">Estimated priority:</span>
402                                     <strong>[% fixedRank | html %]</strong>
403                                 </li>
404                             [% END %]
406                             <li>
407                                 <label for="holdnotes">Notes:</label>
408                                 <textarea id="holdnotes" name="notes" cols="30" rows="1"></textarea>
409                             </li>
410                             <li>
411                                 <label for="pickup">Pickup at:</label>
412                                 <select name="pickup" size="1" id="pickup">
413                                     [% UNLESS ( multi_hold ) %]
414                                         [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
415                                     [% ELSE %]
416                                         [% PROCESS options_for_libraries libraries => Branches.all({ selected => pickup, search_params => { pickup_location => 1 } }) %]
417                                     [% END %]
418                                 </select>
419                             </li>
421                             [% UNLESS ( multi_hold ) %]
422                                 [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
423                                     <li>
424                                         <label for="itemtype">Request specific item type:</label>
425                                         <select name="itemtype" size="1" id="itemtype">
426                                             <option value="">Any item type</option>
427                                             [%- FOREACH itemtype IN available_itemtypes %]
428                                                 <option value="[% itemtype | html %]">[% ItemTypes.GetDescription( itemtype ) | html %]</option>
429                                             [%- END %]
430                                         </select>
431                                     </li>
432                                 [% END %]
433                             [% END # /UNLESS multi_hold %]
435                             [% IF ( reserve_in_future ) %]
436                                 <li>
437                                     <label for="from">Hold starts on date:</label>
438                                     <input name="reserve_date" id="from" size="10" class="datepickerfrom" type="text" >
439                                     <input type="hidden" class="datepickerfrom_hidden" />
440                                     <a href="#" id="clear-date-from" class="clear-date">Clear date</a>
441                                 </li>
442                             [% END %]
444                             <li>
445                                 <label for="to">Hold expires on date:</label>
446                                 <input name="expiration_date" id="to" size="10" class="datepickerto" type="text" />
447                                 <input type="hidden" class="datepickerto_hidden" />
448                                 <a href="#" id="clear-date-to" class="clear-date">Clear date</a>
449                             </li>
451                             [% UNLESS ( multi_hold ) %]
452                                 <li>
453                                     <label for="requestany">Hold next available item </label>
454                                     [% IF force_hold_level == 'item' %]
455                                         <input type="checkbox" id="requestany" name="request" disabled="true" />
456                                     [% ELSIF force_hold_level == 'record' %]
457                                         <input type="checkbox" id="requestany" checked="checked" value="Any" disabled="true"/>
458                                         <input type="hidden" name="request" value="Any"/>
459                                     [% ELSE %]
460                                         <input type="checkbox" id="requestany" name="request" checked="checked" value="Any" />
461                                     [% END %]
462                                     <input type="hidden" name="biblioitem" value="[% biblioitemnumber | html %]" />
463                                     <input type="hidden" name="alreadyreserved" value="[% alreadyreserved | html %]" />
464                                 </li>
466                                 [% IF remaining_holds_for_record > 1 %]
467                                     <li>
468                                         <label for="holds_to_place_count">Holds to place (count)</label>
469                                         <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" />
470                                     </li>
471                                 [% ELSE %]
472                                     <input type="hidden" name="holds_to_place_count" value="1" />
473                                 [% END %]
474                             [% END # /UNLESS multi_hold %]
475                         </ol>
477                         [% UNLESS ( multi_hold ) %]
478                             <fieldset class="action">
479                                 [% IF ( patron.borrowernumber ) %]
480                                     [% IF ( override_required ) %]
481                                         <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
482                                     [% ELSIF ( none_available ) %]
483                                         <button type="submit" disabled="disabled" class="btn btn-default btn-disabled">Place hold</button>
484                                     [% ELSE %]
485                                         <button type="submit" class="btn btn-default">Place hold</button>
486                                     [% END %]
487                                 [% END %]
488                             </fieldset>
490                             [% FOREACH bibitemloo IN bibitemloop %]
491                                 <ol>
492                                     [% UNLESS ( item_level_itypes ) %]
493                                         <li>
494                                             <span class="label">Item type:</span>
495                                             [% bibitemloo.description | html %]
496                                         </li>
497                                     [% END %]
499                                     [% IF ( bibitemloo.publicationyear ) %]
500                                         <li>
501                                             <span class="label">Publication year:</span>
502                                             [% bibitemloo.publicationyear | html %]
503                                         </li>
504                                     [% END %]
505                                 </ol>
507                                 <h2 style="padding: 0 1em;">
508                                     Place a hold on a specific item
509                                     [% IF bibitemloo.force_hold_level == 'item' %]
510                                          <span class="error"><i>(Required)</i></span>
511                                     [% END %]
512                                 </h2>
514                                 <table id="requestspecific">
515                                     <thead>
516                                         <tr>
517                                             <th>Hold</th>
518                                             [% IF ( item_level_itypes ) %]
519                                                 <th>Item type</th>
520                                             [% END %]
521                                             <th>Barcode</th>
522                                             <th>Home library</th>
523                                             <th>Last location</th>
524                                             [% IF itemdata_ccode %]
525                                                 <th>Collection</th>
526                                             [% END %]
527                                             <th>Call no.</th>
528                                             <th>Copy number</th>
529                                             [% IF itemdata_enumchron %]
530                                                 <th>Vol no.</th>
531                                             [% END %]
532                                             <th class="title-string">Information</th>
533                                             <th class="title-string">Allowed pickup locations</th>
534                                         </tr>
535                                     </thead>
536                                     <tbody>
537                                         [% SET selected = 0 %]
538                                         [% FOREACH itemloo IN bibitemloo.itemloop %]
539                                             [% UNLESS ( itemloo.hide ) %]
540                                                 <tr class="[% itemloo.backgroundcolor | html %]">
541                                                     <td>
542                                                         [% IF itemloo.force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
543                                                             <span class="error">
544                                                                 <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
545                                                                 Hold must be record level
546                                                             </span>
547                                                         [% ELSIF ( itemloo.available ) %]
548                                                             <input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" />
549                                                         [% ELSIF ( itemloo.override ) %]
550                                                             <input type="radio" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" />
551                                                             <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i>
552                                                         [% ELSE %]
553                                                             <span class="error">
554                                                                 <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
555                                                                 [% IF itemloo.not_holdable %]
556                                                                     [% IF itemloo.not_holdable == 'damaged' %]
557                                                                         Item damaged
558                                                                     [% ELSIF itemloo.not_holdable == 'ageRestricted' %]
559                                                                         Age restricted
560                                                                     [% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %]
561                                                                         Exceeded max holds per record
562                                                                     [% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %]
563                                                                         Daily hold limit reached for patron
564                                                                     [% ELSIF itemloo.not_holdable == 'tooManyReserves' %]
565                                                                         Too many holds
566                                                                     [% ELSIF itemloo.not_holdable == 'notReservable' %]
567                                                                         Not holdable
568                                                                     [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %]
569                                                                         Patron is from different library
570                                                                     [% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %]
571                                                                         Cannot place hold from patron's library
572                                                                     [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
573                                                                         Patron already has hold for this item
574                                                                     [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
575                                                                         Cannot be transferred to pickup library
576                                                                     [% ELSE %]
577                                                                         [% itemloo.not_holdable | html %]
578                                                                     [% END %]
579                                                                 [% END %]
580                                                             </span>
581                                                         [% END # /IF itemloo.force_hold_level %]
582                                                     </td>
583                                                     [% IF ( item_level_itypes ) %]
584                                                         <td>
585                                                             [% UNLESS ( noItemTypeImages ) %]
586                                                                 [% IF ( itemloo.imageurl ) %]<img src="[% itemloo.imageurl | html %]" alt="" /> <br /> [% END %]
587                                                             [% END %]
588                                                             [% itemloo.itypename | html %]
589                                                         </td>
590                                                     [% END %]
591                                                     <td>
592                                                         [% itemloo.barcode | html %]
593                                                     </td>
594                                                     <td>
595                                                         [% Branches.GetName( itemloo.homebranch ) | html %]
596                                                     </td>
597                                                     <td>
598                                                         [% Branches.GetName( itemloo.holdingbranch ) | html %]
599                                                     </td>
600                                                     [% IF itemdata_ccode %]
601                                                         <td>
602                                                             [% IF ( itemloo.ccode ) %][% AuthorisedValues.GetByCode( 'CCODE', itemloo.ccode ) | html %][% END %]
603                                                         </td>
604                                                     [% END %]
605                                                     <td>
606                                                         [% itemloo.itemcallnumber | html %]
607                                                     </td>
608                                                     <td>
609                                                         [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %]&nbsp;[% END %]
610                                                     </td>
611                                                     [% IF itemdata_enumchron %]
612                                                         <td>
613                                                             [% itemloo.enumchron | html %]
614                                                         </td>
615                                                     [% END %]
616                                                     <td>
617                                                         [% IF ( itemloo.onloan ) %]
618                                                             <span title="[% itemloo.date_due | html %]" class="checkedout">Due [% itemloo.date_due | $KohaDates  as_due_date => 1 %]</span>
619                                                         [% ELSE %]
620                                                             <span title="0000-00-00">
621                                                                 [% IF ( itemloo.transfertwhen ) %]
622                                                                     In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %],
623                                                                     to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %]
624                                                                 [% END %]
625                                                             </span>
626                                                         [% END %]
628                                                         [% IF ( itemloo.reservedate ) %]
629                                                             [% IF ( itemloo.nocancel ) %]
630                                                                     Can't be cancelled when item is in transit
631                                                             [% ELSE %]
632                                                                 [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %]
633                                                                 [% IF ( itemloo.canreservefromotherbranches ) %]
634                                                                     for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedFor.borrowernumber | uri %]">[% itemloo.ReservedFor.firstname | html %] [% itemloo.ReservedFor.surname | html %]</a>
635                                                                 [% END %]
636                                                                 [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %]
637                                                                 [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since
638                                                                 [% IF ( itemloo.waitingdate ) %]
639                                                                     [% itemloo.waitingdate | $KohaDates %]
640                                                                 [% ELSE %]
641                                                                     [% IF ( itemloo.reservedate ) %]
642                                                                         [% itemloo.reservedate | html %]
643                                                                     [% END %]
644                                                                 [% END %].
645                                                                 <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>
646                                                             [% END # /IF itemloo.nocancel %]
647                                                         [% ELSE %]
648                                                             Not on hold
649                                                         [% END # /IF itemloo.reservedate %]
651                                                         [% IF itemloo.item_level_holds == "N" %]
652                                                             <br/>Item level hold not allowed from OPAC
653                                                         [% ELSIF itemloo.item_level_holds == "F" %]
654                                                             <br/>Item level hold forced from OPAC
655                                                         [% END %]
657                                                         [% IF ( itemloo.itemlost ) %]
658                                                            <span class="lost">[% AuthorisedValues.GetByCode( 'LOST', itemloo.itemlost ) | html %]</span>
659                                                         [% END %]
661                                                         [% IF ( itemloo.damaged ) %]
662                                                             <span class="dmg">[% AuthorisedValues.GetByCode( 'DAMAGED', itemloo.damaged ) | html %]</span>
663                                                         [% END %]
665                                                         [% IF ( itemloo.withdrawn ) %]
666                                                            <span class="wdn">[% AuthorisedValues.GetByCode( 'WITHDRAWN', itemloo.withdrawn ) | html %]</span>
667                                                         [% END %]
669                                                         [% IF ( itemloo.notforloan ) %]
670                                                            <span class="nfl">Not for loan ([% AuthorisedValues.GetByCode( 'NOT_LOAN', itemloo.notforloan ) | html %])</span>
671                                                         [% END %]
672                                                     </td>
673                                                     <td>
674                                                         [% itemloo.pickup_locations | html %]
675                                                     </td>
676                                                 </tr>
677                                             [% END # / UNLESS itemloo.hide %]
678                                         [% END # /FOREACH itemloo %]
679                                     </tbody>
680                                 </table> <!-- /#requestspecific -->
682                                 [% IF ( bibitemloo.hiddencount ) %]
683                                     <form>
684                                         <p class="hiddencount">
685                                             <a href="request.pl?biblionumber=[% bibitemloo.biblionumber | uri %]&amp;borrowernumber=[% bibitemloo.borrowernumber | uri %]&amp;showallitems=1">Show all items ([% bibitemloo.hiddencount | html %] hidden)</a>
686                                         </p>
687                                     </form>
688                                 [% END # /IF bibitemloo.hiddencount %]
689                             [% END # /FOREACH bibitemloo %]
691                         [% ELSE # /UNLESS multi_hold %]
693                             <table id="requesttitles">
694                                 <tr>
695                                     <th>&nbsp;</th>
696                                     <th>Title</th>
697                                     [% UNLESS ( item_level_itypes ) %]
698                                         <th>Item type</th>
699                                     [% END %]
700                                     <th>Priority</th>
701                                     <th>Information</th>
702                                 </tr>
703                                 [% FOREACH biblioloo IN biblioloop %]
704                                     [% IF ( biblioloo.warn ) %]
705                                         <tr class="onissue">
706                                     [% ELSE %]
707                                         <tr>
708                                     [% END %]
709                                         <td>
710                                             [% UNLESS ( biblioloo.warn ) %]
711                                                     <input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]"/>
712                                                 </td>
713                                             [% END %]
714                                         <td>
715                                             <ul>
716                                                 <li>
717                                                     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
718                                                 </li>
719                                                 [% IF ( biblioloo.publicationyear ) %]
720                                                     <li>
721                                                         <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
722                                                     </li>
723                                                 [% END %]
724                                             </ul>
725                                             [% IF ( biblioloo.warn ) %]
726                                                 <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
727                                             [% END %]
728                                         </td>
729                                         [% UNLESS ( item_level_itypes ) %]
730                                             <td>
731                                                 <img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | html %]" />
732                                             </td>
733                                         [% END %]
734                                         <td>[% biblioloo.rank | html %]</td>
735                                         <td>
736                                             [% IF ( biblioloo.checked_previously ) %]
737                                                 <span>Patron has previously checked out this title</span><br/>
738                                             [% END %]
739                                             [% IF ( biblioloo.alreadyres ) %]
740                                                 <ul>
741                                             [% ELSE %]
742                                                 [% IF ( biblioloo.none_avail ) %]
743                                                     <ul>
744                                                 [% END %]
745                                             [% END %]
747                                             [% IF ( biblioloo.alreadyres ) %]
748                                                 <li>
749                                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% patron.firstname | html %] [% patron.surname | html %]</a>
750                                                     <strong>already has a hold</strong> on this item
751                                                 </li>
752                                             [% END %]
753                                             [% IF ( biblioloo.none_avail ) %]
754                                                 <li> <strong>No items are available</strong> to be placed on hold</li>
755                                             [% END %]
757                                             [% IF ( biblioloo.alreadyres ) %]
758                                                 </ul>
759                                             [% ELSE %]
760                                                 [% IF ( biblioloo.none_avail ) %]
761                                                     </ul>
762                                                 [% END %]
763                                             [% END %]
764                                         </td>
765                                     </tr>
766                                 [% END # /FOREACH biblioloo %]
767                             </table> <!-- /#requesttitles -->
769                         [% END # /UNLESS multi_hold %]
771                         <fieldset class="action">
772                             [% IF ( patron AND patron.borrowernumber ) %]
773                                 [% IF ( override_required ) %]
774                                     <button type="submit" class="btn btn-default warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
775                                 [% ELSIF ( none_available ) %]
776                                     <button type="submit" disabled="disabled" class="btn btn-default btn-disabled">Place hold</button>
777                                 [% ELSE %]
778                                     [% IF ( multi_hold ) %]
779                                         <button type="submit" class="btn btn-default" id="multi_hold_submit">Place hold</button>
780                                     [% ELSE %]
781                                         <button type="submit" class="btn btn-default">Place hold</button>
782                                     [% END %]
783                                 [% END %]
784                             [% END # /IF patron %]
785                         </fieldset> <!-- /.action -->
786                     </form> <!-- /#hold-request-form -->
787                 </fieldset> <!-- /.rows -->
788             [% END %]
790             [% UNLESS ( patron ) %]
791                 [% IF ( reserveloop ) %]
792                     <form name="T[% time | html %]" action="modrequest.pl" method="post">
793                         [% IF ( multi_hold ) %]
794                             <input type = "hidden" name="biblionumbers" value="[% biblionumbers | html %]"/>
795                         [% END %]
797                         <fieldset class="rows">
798                             <legend>Existing holds</legend>
800                             [% FOREACH biblioloo IN biblioloop %]
801                                 [% IF ( biblioloo.reserveloop ) %]
802                                     [% IF ( multi_hold ) %]
803                                         <h3>
804                                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">
805                                                 [% biblioloo.title | html %]
806                                             </a>
807                                         </h3>
808                                     [% END %]
810                                     [% IF Koha.Preference('HoldsSplitQueue') == 'branch' %]
811                                         [% SET branchcodes = [] %]
813                                         [% FOREACH h IN biblioloo.reserveloop %]
814                                             [% branchcodes.push( h.branchcode ) %]
815                                         [% END %]
816                                         [% branchcodes = branchcodes.unique %]
818                                         [% FOREACH b IN branchcodes.sort %]
819                                             [% SET holds_by_branch = [] %]
820                                             [% FOREACH h IN biblioloo.reserveloop %]
821                                                 [% IF h.branchcode == b %]
822                                                     [% holds_by_branch.push( h ) %]
823                                                 [% END %]
824                                             [% END %]
825                                             <fieldset>
826                                                 <legend>[% Branches.GetName( b ) | html %]</legend>
827                                                 [% INCLUDE holds_table.inc holds=holds_by_branch %]
828                                             </fieldset>
829                                         [% END # /FOREACh b %]
830                                     [% ELSIF Koha.Preference('HoldsSplitQueue') == 'itemtype' %]
831                                         [% SET itemtypes = [] %]
833                                         [% FOREACH h IN biblioloo.reserveloop %]
834                                             [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
835                                             [% itemtypes.push( hold_itemtype ) %]
836                                         [% END %]
837                                         [% itemtypes = itemtypes.unique %]
839                                         [% FOREACH i IN itemtypes.sort %]
840                                             [% SET holds_by_itemtype = [] %]
841                                             [% FOREACH h IN biblioloo.reserveloop %]
842                                                 [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
843                                                 [% IF hold_itemtype == i %]
844                                                     [% holds_by_itemtype.push( h ) %]
845                                                 [% END %]
846                                             [% END %]
848                                             <fieldset>
849                                                 [% IF i %]
850                                                     <legend>[% ItemTypes.GetDescription( i ) | html %]</legend>
851                                                 [% ELSE %]
852                                                     <legend>Any item type</legend>
853                                                 [% END %]
854                                                 [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
855                                             </fieldset>
856                                         [% END # /FOREACH i %]
857                                     [% ELSIF Koha.Preference('HoldsSplitQueue') == 'branch_itemtype' %]
858                                         [% SET branchcodes = [] %]
860                                         [% FOREACH h IN biblioloo.reserveloop %]
861                                             [% branchcodes.push( h.branchcode ) %]
862                                         [% END %]
863                                         [% branchcodes = branchcodes.unique %]
865                                         [% FOREACH b IN branchcodes.sort %]
866                                             <fieldset class="contrast">
867                                                 <legend>[% Branches.GetName( b ) | html %]</legend>
868                                                 [% SET holds_by_branch = [] %]
869                                                 [% FOREACH h IN biblioloo.reserveloop %]
870                                                     [% IF h.branchcode == b %]
871                                                         [% holds_by_branch.push( h ) %]
872                                                     [% END %]
873                                                 [% END %]
875                                                 [% SET itemtypes = [] %]
876                                                 [% FOREACH h IN holds_by_branch %]
877                                                     [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
878                                                     [% itemtypes.push( hold_itemtype ) %]
879                                                 [% END %]
880                                                 [% itemtypes = itemtypes.unique %]
882                                                 [% FOREACH i IN itemtypes.sort %]
883                                                     <fieldset class="standard">
884                                                         [% IF i %]
885                                                             <legend>[% ItemTypes.GetDescription( i ) | html %]</legend>
886                                                         [% ELSE %]
887                                                             <legend>Any item type</legend>
888                                                         [% END %]
890                                                         [% SET holds_by_itemtype = [] %]
891                                                         [% FOREACH h IN holds_by_branch %]
892                                                             [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
893                                                             [% IF hold_itemtype == i %]
894                                                                 [% holds_by_itemtype.push( h ) %]
895                                                             [% END %]
896                                                         [% END %]
897                                                         [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
898                                                     </fieldset>
899                                                 [% END %]
900                                             </fieldset>
901                                         [% END # /FOREACH b %]
902                                     [% ELSE %]
903                                         [% INCLUDE holds_table.inc holds=biblioloo.reserveloop %]
904                                     [% END # /IF HoldsSplitQueue %]
906                                 [% END # /IF biblioloo.reserveloop %]
907                             [% END # FOREACH biblioloo %]
909                             <fieldset class="action">
910                                 <input type="submit" name="submit" value="Update hold(s)" />
911                             </fieldset>
912                         </fieldset> <!-- /.rows -->
913                     </form> <!-- /name=TTime -->
914                 [% END # IF reserveloop %]
915             [% END # UNLESS patron %]
917         </main>
919         [% IF ( multi_hold ) # No sidebar menu when placing multiple holds %]
920             </div> <!-- /.col-md-10.col-md-offset-1 -->
921         [% ELSE %]
922             </div> <!-- /.col-sm-10.col-sm-push-2 -->
923                 <div class="col-sm-2 col-sm-pull-10">
924                     <aside>
925                         [% INCLUDE 'biblio-view-menu.inc' %]
926                     </aside>
927                 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
928         [% END %]
929     </div> <!-- /.row -->
932 [% MACRO jsinclude BLOCK %]
933     [% INCLUDE 'datatables.inc' %]
934     [% INCLUDE 'calendar.inc' %]
935     [% INCLUDE 'columns_settings.inc' %]
936     [% Asset.js("js/circ-patron-search-results.js") | $raw %]
937     <script>
938         var biblionumber = "[% biblionumber | $raw %]";
939         var borrowernumber = "[% patron.borrowernumber | $raw %]";
940         var MSG_CONFIRM_DELETE_HOLD   = _("Are you sure you want to cancel this hold?");
941         var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
942         var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
943         [% itemloo.itemnumber | html %]: {
944             homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]";
945             holdallowed: [% itemloo.holdallowed | html %]
946             },
947             [% END %][% END %][% END %]
948         };
949         var MSG_NO_ITEMS_AVAILABLE = _("A hold cannot be requested on any of these items.");
950         var ERROR_MAP = {
951             damaged: _("Item damaged"),
952             ageRestricted: _("Age restricted"),
953             tooManyHoldsForThisRecord: _("Exceeded max holds per record"),
954             tooManyReservesToday: _("Daily hold limit reached for patron"),
955             tooManyReserves: _("Too many holds"),
956             notReservable: _("Not holdable"),
957             cannotReserveFromOtherBranches: _("Patron is from different library"),
958             itemAlreadyOnHold: _("Patron already has hold for this item"),
959             cannotBeTransferred: _("Cannot be transferred to pickup library")
960         }
961         columns_settings_borrowers_table = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
963         $(document).ready(function() {
964             [% SET active = clubs ? 1 : 0 %]
965             $('#circ_holds_select').tabs({
966                 active: [% active | $raw %],
967                 activate: function(){
968                     $(this).find("input.focus").focus();
969                 },
970                 create: function(){
971                     $(this).find("input.focus").focus();
972                 }
973             });
974             function ToggleHoldsToPlace() {
975                 if ( $("#requestany").prop('checked') ) {
976                     $("#holds_to_place_count").prop('disabled', false);
977                 } else {
978                     $("#holds_to_place_count").prop('disabled', true);
979                 }
980             }
981             ToggleHoldsToPlace();
982             $("#requestany").on('change', function(){
983                 ToggleHoldsToPlace();
984             });
986             [% IF Koha.Preference('UseBranchTransferLimits') %]
987                 $("#pickup").on('change', function(){
988                     var pickup = $("#pickup").val();
989                     var url = "?pickup=" + pickup;
990                     url += "&borrowernumber=" + borrowernumber;
991                     url += "&biblionumber=" + biblionumber;
992                     window.location.replace(url);
993                 });
994             [% END %]
996             [% IF AutoResumeSuspendedHolds %]
997                 $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1);
998             [% END %]
1000             $(".datepickerto").datepicker("option", "altField", ".datepickerto_hidden");
1001             $(".datepickerto").datepicker("option", "altFormat", "yy-mm-dd");
1003             $(".datepickerfrom").datepicker("option", "altField", ".datepickerfrom_hidden");
1004             $(".datepickerfrom").datepicker("option", "altFormat", "yy-mm-dd");
1006             var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, {
1007                 'bPaginate': false,
1008                 "sDom": '<"top pager"ilf>t',
1009                 "aoColumnDefs": [
1010                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
1011                 ]
1012             }));
1014             //Override fieldset styling for dataTables search box
1015             $("div.top.pager").css("margin-left","1em");
1016             $(".dataTables_filter label").css({
1017                 "width":"auto",
1018                 "margin-right":"0em"
1019             });
1021             $("#club-request-form").on("submit", function() {
1022                 let $t = $(this);
1023                 $('.clubalert, .holdalert').addClass('hide');
1024                 let biblionumbers = [biblionumber];
1025                 let biblionumbers_text;
1026                 const data = {
1027                     pickup_library_id: $('select[name="pickup"]').val()
1028                 };
1029                 if($('input[name="checkitem"]:checked').length)
1030                     data.item_id = $('input[name="checkitem"]:checked').val();
1031                 if($('input[name="borrowernumber"]').length)
1032                     data.patron_id = $('input[name="borrowernumber"]').val();
1033                 if($('textarea[name="notes"]').length)
1034                     data.notes = $('textarea[name="notes"]').val()||null;
1035                 if($('.datepickerto_hidden').length)
1036                     data.expiration_date = $('.datepickerto_hidden').val()||null;
1037                 if($('.datepickerfrom_hidden').length)
1038                     data.hold_date = $('.datepickerfrom_hidden').val()||null;
1039                 if($('input[name="itemtype"]').length) {
1040                     data.item_type = $('input[name="itemtype"]').val()||null;
1041                 }
1042                 if($('input[name="biblionumbers"]').length) {
1043                     biblionumbers_text = $('input[name="biblionumbers"]').val();
1044                     biblionumbers = biblionumbers_text.replace(/\/$/, '').split('/')
1045                 }
1047                 const count = $('input[name="holds_to_place_count"]').length?$('input[name="holds_to_place_count"]').val():1;
1048                 biblionumbers.forEach(function(biblionumber) {
1049                     data.biblio_id = biblionumber;
1050                     let options = {
1051                         url: $t.attr('action'),
1052                         method: $t.attr('method').toUpperCase(),
1053                         contentType: 'application/json',
1054                         data: JSON.stringify(data)
1055                     };
1056                     for(let i = 0; i < count; i++) {
1057                         $.ajax(options)
1058                         .then(function(result) {
1059                             let url = 'request.pl?biblionumber='+biblionumber;
1060                             if(biblionumbers_text) {
1061                                 url = 'request.pl?biblionumbers='+biblionumbers_text;
1062                             }
1063                             document.location = url;
1064                         })
1065                         .fail(function(err) {
1066                             var message = err.responseJSON.error;
1067                             var match = err.responseJSON.error.match(/Reason: (\w+)\s*$/);
1068                             if(match && ERROR_MAP[match[1]]) {
1069                                 message = '<div><strong>'+_("Cannot place hold")+'</strong></div><div>'+ERROR_MAP[match[1]]+'</div>'
1070                             }
1071                             $('.clubalert, .holdalert').removeClass('hide').html(message);
1072                         });
1073                     }
1074                 });
1076                 return false;
1077             });
1079             [% UNLESS ( multi_hold ) %]
1080                 $("#hold-request-form").on("submit", function(){
1081                     return check();
1082                 });
1083             [% ELSE %]
1084                 $("#hold-request-form").on("submit", function(){
1085                     return checkMultiHold();
1086                 });
1087             [% END %]
1089         });
1091         function check() {
1092             var msg = "";
1093             var count_reserv = 0;
1095             // check if we have checkitem form
1096             if (document.form.checkitem){
1097                 for (i=0;i<document.form.checkitem.length;i++){
1098                     if (document.form.checkitem[i].checked == true) {
1099                         count_reserv++ ;
1100                     }
1101                 }
1102                 // for only one item, check the checkitem without consider the loop checkitem
1103                 if (i==0){
1104                     if (document.form.checkitem.checked == true) {
1105                         count_reserv++;
1106                     }
1107                 }
1108             }
1110             if (document.form.requestany.checked == true){
1111                 count_reserv++ ;
1112             }
1114             if (count_reserv == "0"){
1115                 msg += (_("- Please select an item to place a hold") + "\n");
1116             }
1118             if (msg == "") {
1119                 $('#hold-request-form').preventDoubleFormSubmit();
1120                 return(true);
1121             } else {
1122                 alert(msg);
1123                 return(false);
1124             }
1125         }
1127         function checkMultiHold() {
1128             var spans = $(".multi_hold_item_checkbox:checked");
1129             if ($(spans).size() == 0) {
1130                 alert(MSG_NO_ITEMS_AVAILABLE);
1131                 return false;
1132             }
1134             var biblionumbers = "";
1135             $(spans).each(function() {
1136                 var bibnum = $(this).attr("title");
1137                 biblionumbers += bibnum + "/";
1138             });
1140             var badSpans = $(".not_holdable");
1141             var badBibs = "";
1142             $(badSpans).each(function() {
1143                 var bibnum = $(this).attr("title");
1144                 badBibs += bibnum + "/";
1145             });
1147             $("#multi_hold_bibs").val(biblionumbers);
1148             $("#bad_bibs").val(badBibs);
1150             $('#hold-request-form').preventDoubleFormSubmit();
1152             return true;
1153         }
1155          $(document).ready(function() {
1156             $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic
1157                 var itemnumber = this.value;
1158                 var msg = '';
1160                 switch (override_items[itemnumber].holdallowed) {
1161                     case 0: msg = _("This item normally cannot be put on hold."); break;
1162                     case 1: msg = _("This item normally cannot be put on hold except for patrons from %s.").format(override_items[itemnumber].homebranch); break;
1163                 }
1165                 msg += "\n\n" + _("Place hold on this item?");
1167                 return confirm(msg);
1168             });
1169             $("button.warning").click(function() {
1170                 return confirm( _("None of these items can normally be put on hold for this patron.") + "\n\n" + _("Place hold?") );
1171             });
1172             $("#requestany").click(function() {
1173                 if(this.checked){
1174                     $("input[name=checkitem]").each(function() {
1175                         $(this).prop("checked", false);
1176                     });
1177                 }
1178             });
1179             $("input[name=checkitem]").click(function() {
1180                 onechecked = 0;
1181                 $("input[name=checkitem]").each(function() {
1182                     if(this.checked){
1183                         onechecked = 1;
1184                     }
1185                 });
1186                 if(onechecked == 1){
1187                     $("#requestany").prop("checked", false);
1188                     $("#holds_to_place_count").prop('disabled', true);
1189                 } else {
1190                     $("#requestany").prop("checked",true);
1191                     $("#holds_to_place_count").prop('disabled', false);
1192                 }
1193             });
1194             var prev_rank_request;
1195             $("select[name=rank-request]").on("focus", function() {
1196                 prev_rank_request = $(this).val();
1197                 var row = $(this).parents("tr:first");
1198             }).change(function() {
1199                 var row = $(this).parents("tr:first");
1200                 var value = parseInt($(this).val());
1201                 var found_holds = $("select[name='rank-request'][disabled='disabled']").length ; //Count how many are found
1202                 if( !isNaN(value) ) {  //If moved to 'del'
1203                     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)
1204                     if (prev_rank_request > value) {
1205                         row.insertBefore(after);
1206                     } else {
1207                         row.insertAfter(after);
1208                     }
1209                 }
1211                 var next_priority = 1;
1212                 $("select[name=rank-request]").each(function () {
1213                     if( isNaN( $(this).val() ) ){ return true; } //Don't reset found or del holds
1214                     $(this).val(next_priority);
1215                     next_priority++;
1216                 });
1217             });
1219             $(".clear-date").on("click",function(e){
1220                 e.preventDefault();
1221                 var fieldID = this.id.replace("clear-date-","");
1222                 $("#" + fieldID).val("");
1223             });
1225             // Confirm cancelation of hold
1226             $(".cancel-hold").on("click",function(e) {
1227                 return confirmDelete(MSG_CONFIRM_DELETE_HOLD);
1228             });
1230             [% UNLESS ( patron || patron.borrowernumber || borrowers || noitems ) %]
1231                 [% IF ( PatronAutoComplete ) %]
1232                 $( "#patron" ).autocomplete({
1233                     source: "/cgi-bin/koha/circ/ysearch.pl",
1234                     minLength: 3,
1235                     select: function( event, ui ) {
1236                         $( "#patron" ).val( ui.item.cardnumber );
1237                         $( "#holds_patronsearch" ).submit();
1238                         return false;
1239                     }
1240                 })
1241                 .data( "ui-autocomplete" )._renderItem = function( ul, item ) {
1242                     return $( "<li></li>" )
1243                     .data( "ui-autocomplete-item", item )
1244                     .append( "<a>" + item.surname + ", " + item.firstname +
1245                              " (" + item.cardnumber + ") <small>" + item.address +
1246                              " " + item.city + " " + item.zipcode + " " +
1247                              item.country + "</small></a>" )
1248                     .appendTo( ul );
1249                 };
1250                 [% END %]
1251             [% END %]
1253         });
1254     </script>
1255 [% END %]
1257 [% INCLUDE 'intranet-bottom.inc' %]