Bug 23112: (follow-up) Conditionally prevent checkout
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / ill / ill-requests.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% USE Koha %]
5 [% USE KohaDates %]
6 [% SET footerjs = 1 %]
7 [% USE AuthorisedValues %]
8 [% USE ColumnsSettings %]
9 [% USE Price %]
10
11 [% INCLUDE 'doc-head-open.inc' %]
12 <title>Koha &rsaquo; ILL requests</title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 </head>
15
16 <body id="illrequests" class="ill">
17 [% INCLUDE 'header.inc' %]
18 [% INCLUDE 'cat-search.inc' %]
19
20 <div id="breadcrumbs">
21     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
22     <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
23     [% IF query_type == 'create' %]
24          &rsaquo; New request
25     [% ELSIF query_type == 'status' %]
26          &rsaquo; Status
27     [% END %]
28 </div>
29
30 <div class="main container-fluid">
31     <div class="row">
32
33         [% IF query_type == 'illlist' %]
34             <div class="col-sm-2">
35                 <aside>
36                     <form method="get" id="illfilter_form">
37                         <fieldset class="brief">
38                             <h3>Filters</h3>
39                             <ol>
40                                 <li>
41                                     <label for="illfilter_status">Status:</label>
42                                     <select name="illfilter_status" id="illfilter_status">
43                                         <option value=""></option>
44                                     </select>
45                                 </li>
46                                 <li>
47                                     <label for="illfilter_dateplaced_start">Date placed between:</label>
48                                     <input type="text" name="illfilter_dateplaced_start" id="illfilter_dateplaced_start" class="datepicker" />
49                                 </li>
50                                 <li>
51                                     <label for="illfilter_dateplaced_end">and:</label>
52                                     <input type="text" name="illfilter_dateplaced_end" id="illfilter_dateplaced_end" class="datepicker" />
53                                 </li>
54                                 <li>
55                                     <label for="illfilter_datemodified_start">Updated between:</label>
56                                     <input type="text" name="illfilter_datemodified_start" id="illfilter_datemodified_start" class="datepicker" />
57                                 </li>
58                                 <li>
59                                     <label for="illfilter_datemodified_end">and:</label>
60                                     <input type="text" name="illfilter_datemodified_end" id="illfilter_datemodified_end" class="datepicker" />
61                                 </li>
62                                 <li>
63                                     <label for="illfilter_branchname">Library:</label>
64                                     <select name="illfilter_branchname" id="illfilter_branchname">
65                                         <option value=""></option>
66                                     </select>
67                                 </li>
68                                 <li>
69                                     <label for="illfilter_patron">Patron:</label>
70                                     <input type="text" name="illfilter_patron" id="illfilter_patron" />
71                                 </li>
72                             </ol>
73                             <fieldset class="action">
74                                 <input type="submit" value="Search" />
75                                 <input type="button" value="Clear" id="clear_search" />
76                             </fieldset>
77                         </fieldset>
78                     </form> <!-- /#illfilter_form -->
79                 </aside>
80             </div> <!-- /.col-sm-2 -->
81             <div class="col-sm-10">
82                 <main>
83         [% ELSE %]
84             <div class="col-sm-10 col-sm-offset-2">
85                 <main>
86         [% END %]
87             <div id="interlibraryloans">
88         [% IF !backends_available || !has_branch %]
89             <div class="dialog message">ILL module configuration problem. Take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo">about page</a></div>
90         [% ELSE %]
91                 [% INCLUDE 'ill-toolbar.inc' %]
92
93                 [% IF whole.error %]
94                     <h1>Error performing operation</h1>
95                     <!-- Dispatch on Status -->
96                     <p>We encountered an error:</p>
97                     <p>
98                       <pre>[% whole.message | html %] ([% whole.status | html %])</pre>
99                     </p>
100                 [% END %]
101
102                 [% IF query_type == 'create' %]
103                     <h1>New ILL request</h1>
104                     [% PROCESS $whole.template %]
105
106                 [% ELSIF query_type == 'confirm' %]
107                     <h1>Confirm ILL request</h1>
108                     [% PROCESS $whole.template %]
109
110                 [% ELSIF query_type == 'cancel' and !whole.error %]
111                     <h1>Cancel a confirmed request</h1>
112                     [% PROCESS $whole.template %]
113
114                 [% ELSIF query_type == 'check_out' and !whole.error %]
115                     [% IF !whole.stage || whole.stage == 'form' %]
116                         <h1 id="ill-issue-title">Issue requested item to [% INCLUDE 'patron-title.inc' patron = request.patron %]</h1>
117                         [% IF !request.biblio_id || request.biblio_id.length == 0 %]
118                         <div class="alert">This item cannot be issued as it has no biblio record associated with it</div>
119                         [% END %]
120                         [% IF whole.value.errors.itemcount %]
121                         <div class="alert">The bibliographic record for this request has multiple items, it should only have one. Please fix this then try again.</div>
122                         [% END %]
123                         [% IF whole.value.errors.item_creation %]
124                         <div class="alert">An unknown error occurred while trying to add an item</div>
125                         [% END %]
126                         [% IF whole.value.errors.item_check_out %]
127                         <div class="alert">An unknown error occurred while trying to check out the item</div>
128                         [% END %]
129                         [% IF whole.value.check_out_errors %]
130                             [% IF whole.value.check_out_errors.error.STATS %]
131                             <div class="alert">
132                                 Local use recorded
133                             </div>
134                             [% ELSE %]
135                             <div class="alert">
136                                 There was a problem checking this item out, please check for problems with the <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% whole.value.patron.borrowernumber | uri %]">patron's account</a>
137                             </div>
138                             [% END %]
139                         [% END %]
140                         [% IF request.biblio_id && request.biblio_id.length > 0  && !whole.value.check_out_errors.error.STATS %]
141                             <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
142                                 <fieldset class="rows">
143                                     <legend>Check out details</legend>
144                                     [% items = whole.value.biblio.items.unblessed %]
145                                     [% IF items.size == 1 %]
146                                         <p>The bibliographic record for this request already has an item attached to it, you are about to check it out</p>
147                                     [% ELSE %]
148                                         <p>A bibliographic record for this request exists, but no item. You are about to create an item and check it out</p>
149                                     [% END %]
150                                     <ol>
151                                         <li class="ill_checkout_inhouse">
152                                             <label for="inhouse" class="ill_checkout_inhouse_label">Statistical patron:</label>
153                                             <select id="ill_checkout_inhouse_select" name="inhouse" class="ill_checkout_inhouse_select">
154                                                 <option value=""></option>
155                                                 [% FOREACH stat IN whole.value.statistical %]
156                                                     [% IF stat.borrowernumber == params.inhouse %]
157                                                         <option value="[% stat.cardnumber | html %]" selected>[% INCLUDE 'patron-title.inc' patron = stat %]</option>
158                                                     [% ELSE %]
159                                                         <option value="[% stat.cardnumber | html %]">[% INCLUDE 'patron-title.inc' patron = stat %]</option>
160                                                     [% END %]
161                                                 [% END %]
162                                             </select>
163                                             [% IF whole.value.errors.inhouse %]
164                                             <span class="required">You must choose a valid patron</span>
165                                             [% END %]
166                                             <div class="hint">If you do not wish to check out the item to [% INCLUDE 'patron-title.inc' patron = request.patron %] and would rather issue it to an in-house statistical patron, choose the patron here</div>
167                                         </li>
168                                         <li class="ill_checkout_item_type">
169                                             <label for="item_type" class="ill_checkout_item_type_label required">Item type:</label>
170                                             [% IF items.size != 1 %]
171                                                 <select id="ill_checkout_item_type_select" name="item_type" required>
172                                                     [% FOREACH type IN whole.value.itemtypes %]
173                                                         [% IF type.itemtype == params.item_type %]
174                                                         <option value="[% type.itemtype | html %]" selected>
175                                                         [% ELSE %]
176                                                         <option value="[% type.itemtype | html %]">
177                                                         [% END %]
178                                                             [% type.description | html %]
179                                                         </option>
180                                                     [% END %]
181                                                 </select>
182                                             [% ELSE %]
183                                                 [% FOREACH type IN whole.value.itemtypes %]
184                                                     [% IF type.itemtype == items.0.itype %]
185                                                         [% type.description | html %]
186                                                     [% END %]
187                                                 [% END %]
188                                             [% END %]
189                                             [% IF whole.value.errors.item_type %]
190                                             <span class="required">You must choose an item type</span>
191                                             [% END %]
192                                         </li>
193                                         [% IF items.size == 1 %]
194                                             <li>
195                                                 <label for="barcode" class="ill_checkout_barcode_label">Item barcode:</label>
196                                                 [% items.0.barcode | html %]
197                                             </li>
198                                         [% END %]
199                                         <li class="ill_checkout_branchcode">
200                                             <label for="branchcode" class="ill_checkout_branchcode_label required">Library:</label>
201                                             [% branchcode = items.size == 1 ? items.0.homebranch : params.branchcode ? params.branchcode : request.branchcode %]
202                                             [% IF items.size != 1 %]
203                                                 <select name="branchcode" id="ill_checkout_branchcode_select" required>
204                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
205                                                 </select>
206                                             [% ELSE %]
207                                                 [% FOREACH branch IN whole.value.libraries.unblessed %]
208                                                     [% IF branch.branchcode == branchcode %]
209                                                         [% branch.branchname | html %]
210                                                     [% END %]
211                                                 [% END %]
212                                             [% END %]
213                                             [% IF whole.value.errors.branchcode %]
214                                             <span class="required">You must choose a branch</span>
215                                             [% END %]
216                                         </li>
217                                         <li class="ill_checkout_due_date">
218                                             <label for="duedate" class="ill_checkout_duedate_label">Due date:</label>
219                                             <input name="duedate" id="ill_checkout_duedate_input" type="text" value="[% params.duedate | html %]"> [% INCLUDE 'date-format.inc' %]
220                                             <div class="hint">If you do not specify a due date, it will be set according to circulation rules</p>
221                                         </li>
222                                     </ol>
223                                 </fieldset>
224                                 <fieldset class="action">
225                                     <input type="hidden" value="check_out" name="method">
226                                     <input type="hidden" value="form" name="stage">
227                                     [% IF items.size == 1 %]
228                                         <input name="branchcode" type="hidden" value="[% branchcode | html %]">
229                                         <input name="item_type" type="hidden" value="[% items.0.itype | html %]">
230                                     [% END %]
231                                     <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
232                                     <input type="submit" value="Submit">
233                                     <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]">Cancel</a>
234                                 </fieldset>
235                             </form>
236                         [% END %]
237                         [% IF whole.value.check_out_errors.error.STATS %]
238                             <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]">Return to request</a>
239                         [% END %]
240                     [% ELSIF whole.stage == 'done_check_out' %]
241                         <h1>Item checked out</h1>
242                         <fieldset class="rows">
243                             <legend>Check out details</legend>
244                             <ol>
245                                 <li>
246                                     <label>Checked out to:</label>
247                                     [% INCLUDE 'patron-title.inc' patron = whole.value.patron %]
248                                 </li>
249                                 <li>
250                                     <label>Due date:</label>
251                                     [% whole.value.check_out.date_due | $KohaDates with_hours => 1 %]
252                                 </li>
253                             </ol>
254                         </fieldset>
255                         <fieldset class="action">
256                             <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]">Return to request</a>
257                         </fieldset>
258                     [% END %]
259
260                 [% ELSIF query_type == 'generic_confirm' %]
261                     <h1>Place request with partner libraries</h1>
262                   [% IF error %]
263                     [% IF error == 'no_target_email' %]
264                         <div class="alert">
265                             No target email addresses found. Either select at least
266                             one partner or check your ILL partner library records.
267                         </div>
268                     [% ELSIF error == 'no_library_email' %]
269                         <div class="alert">
270                             Your library has no usable email address. Please set it.
271                         </div>
272                     [% ELSIF error == 'unkown_error' %]
273                         <div class="alert">
274                             Unknown error processing your request. Contact your administrator.
275                         </div>
276                     [% END %]
277                   [% END %]
278                     <!-- Start of GENERIC_EMAIL case -->
279                     [% IF whole.value.partners %]
280                        [% ill_url = "/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=" _ request.illrequest_id %]
281                         <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
282                             <fieldset class="rows">
283                                 <legend>Interlibrary loan request details</legend>
284                                 <ol>
285                                     <li>
286                                         <label for="partner_filter">Filter partner libraries:</label>
287                                         <input type="text" id="partner_filter" />
288                                     </li>
289                                     <li>
290                                         <label for="partners" class="required">Select partner libraries:</label>
291                                         <select size="5" multiple="true" id="partners" name="partners" required="required">
292                                             [% FOREACH partner IN whole.value.partners %]
293                                                 <option value=[% partner.email | html %]>
294                                                     [% partner.branchcode _ " - " _ partner.surname %]
295                                                 </option>
296                                             [% END %]
297                                         </select>
298
299                                     </li>
300                                     <li>
301                                         <label for="subject" class="required">Subject line:</label>
302                                         <input type="text" name="subject" id="subject" type="text" value="[% whole.value.draft.subject | html %]" required="required" />
303                                     </li>
304                                     <li>
305                                         <label for="body" class="required">Email text:</label>
306                                         <textarea name="body" id="body" rows="20" cols="80" required="required">[% whole.value.draft.body | html %]</textarea>
307                                     </li>
308                                 </ol>
309                                 <input type="hidden" value="generic_confirm" name="method">
310                                 <input type="hidden" value="draft" name="stage">
311                                 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
312                             </fieldset>
313                             <fieldset class="action">
314                                 <input type="submit" class="btn btn-default" value="Send email"/>
315                                 <span><a href="[% ill_url | url %]" title="Return to request details">Cancel</a></span>
316                             </fieldset>
317                         </form>
318                     [% ELSE %]
319                         <fieldset class="rows">
320                             <legend>Interlibrary loan request details</legend>
321                             <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
322                             <p>Be sure to provide email addresses for these patrons.</p>
323                             <p><span><a href="[% ill_url | url %]" title="Return to request details">Cancel</a></span></p>
324                         </fieldset>
325                     [% END %]
326                 <!-- generic_confirm ends here -->
327
328                 [% ELSIF query_type == 'edit_action' %]
329                     <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
330                         <fieldset class="rows">
331                             <legend>Request details</legend>
332                             <ol>
333                                 [% type = request.get_type %]
334                                 <li class="borrowernumber">
335                                     <label for="borrowernumber">Patron ID:</label>
336                                     [% request.borrowernumber | html %]
337                                 </li>
338                                 <li class="biblio_id">
339                                     <label for="biblio_id" class="biblio_id">Bibliographic record ID:</label>
340                                     <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id | html %]">
341                                 </li>
342                                 <li class="branchcode">
343                                     <label for="library" class="branchcode">Library:</label>
344                                     <select name="branchcode" id="library">
345                                         [% PROCESS options_for_libraries libraries => Branches.all( selected => request.branchcode ) %]
346                                     </select>
347                                 </li>
348                                 <li class="status">
349                                     <label class="status">Status:</label>
350                                     [% stat = request.status %]
351                                     [% current_alias = request.status_alias %]
352                                     <select id="status_alias" name="status_alias">
353                                         [% IF !current_alias %]
354                                         <option value="" selected>
355                                         [% ELSE %]
356                                         <option value="">
357                                         [% END %]
358                                             [% request.capabilities.$stat.name | html %]
359                                         </option>
360                                         [% FOREACH alias IN AuthorisedValues.Get('ILLSTATUS') %]
361                                             [% IF alias.authorised_value == current_alias %]
362                                             <option value="[% alias.authorised_value | html %]" selected>
363                                             [% ELSE %]
364                                             <option value="[% alias.authorised_value | html %]">
365                                             [% END %]
366                                                 [% alias.lib | html %]
367                                             </option>
368                                         [% END %]
369                                     </select>
370                                 </li>
371                                 <li class="updated">
372                                     <label class="updated">Last updated:</label>
373                                     [% request.updated | $KohaDates  with_hours => 1 %]
374                                 </li>
375                                 <li class="medium">
376                                     <label class="medium">Request type:</label>
377                                     [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
378                                 </li>
379                                 <li class="cost">
380                                     <label class="cost">Cost:</label>
381                                     [% IF request.cost %][% request.cost | $Price %][% ELSE %]<span>N/A</span>[% END %]
382                                 </li>
383                                 <li class="price_paid">
384                                     <label class="price_paid">Price paid:</label>
385                                     <input name="price_paid" id="price_paid" type="text" value="[% request.price_paid | html %]">
386                                 </li>
387                                 <li class="req_id">
388                                     <label class="req_id">Request number:</label>
389                                     [% request.id_prefix _ request.illrequest_id | html %]
390                                 </li>
391                                 <li class="notesstaff">
392                                     <label for="notesstaff" class="notesstaff">Staff notes:</label>
393                                     <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff | html %]</textarea>
394                                 </li>
395                                 <li class="notesopac">
396                                     <label for="notesopac" class="notesopac">Opac notes:</label>
397                                     <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac | html %]</textarea>
398                                 </li>
399                             </ol>
400                         </fieldset>
401                         <fieldset class="action">
402                             <input type="hidden" value="edit_action" name="method">
403                             <input type="hidden" value="form" name="stage">
404                             <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
405                             <input type="hidden" value="[% request.borrowernumber | html %]" name="borrowernumber">
406                             <input type="submit" value="Submit">
407                             <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]">Cancel</a>
408                         </fieldset>
409                     </form>
410
411                 [% ELSIF query_type == 'delete_confirm' %]
412
413                     <div class="dialog alert">
414                         <h3>Are you sure you wish to delete this request?</h3>
415                         <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
416                             <input type="hidden" name="method" value="delete" />
417                             <input type="hidden" name="confirmed" value="1" />
418                             <input type="hidden" name="illrequest_id" value="[% request.id | html %]" />
419                             <button type="submit" class="btn btn-default approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
420                         </form>
421                         <a class="btn btn-default deny" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=[% request.id | html %]"><i class="fa fa-fw fa-remove"></i>No, do not delete</a>
422                     </div>
423
424                 [% ELSIF query_type == 'illview' %]
425                     [% req_status = request.status %]
426
427                     [% IF error %]
428                       [% IF error == 'migrate_target' %]
429                           <div class="alert">
430                               The backend you tried to migrate to does not yet support migrations, please try again with an alternative target.
431                           </div>
432                       [% END %]
433                     [% END %]
434
435                     <h1>Manage ILL request</h1>
436                     <div id="request-toolbar" class="btn-toolbar">
437                         <a title="Edit request" id="ill-toolbar-btn-edit-action" class="btn btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=edit_action&amp;illrequest_id=[% request.illrequest_id | html %]">
438                         <span class="fa fa-pencil"></span>
439                         Edit request
440                         </a>
441                         [% FOREACH action IN request.available_actions %]
442                             [% needs_prefs = action.needs_prefs.size ? action.needs_prefs : [] %]
443                             [% needs_perms = action.needs_perms.size ? action.needs_perms : [] %]
444                             [% needs_all = action.needs_all.size ? action.needs_all : [] %]
445                             [% has_prefs_count = 0 %]
446                             [% has_perms_count = 0 %]
447                             [% has_all_count = 0 %]
448                             [% FOREACH pref IN needs_prefs %]
449                                 [% IF Koha.Preference(pref) %]
450                                     [% has_prefs_count = has_prefs_count + 1 %]
451                                 [% END %]
452                             [% END %]
453                             [% FOREACH perm IN needs_perms %]
454                                 [% perm_name = 'CAN_' _ perm %]
455                                 [% IF ($perm_name) %]
456                                     [% has_perms_count = has_perms_count + 1 %]
457                                 [% END %]
458                             [% END %]
459                             [% FOREACH func IN needs_all %]
460                                 [% IF func(request) %]
461                                     [% has_all_count = has_all_count + 1 %]
462                                 [% END %]
463                             [% END %]
464                             [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %]
465                             [% IF action.method == 'migrate' %]
466                                 [% IF backends.size > 2 %]
467                                     <div class="dropdown btn-group">
468                                         <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
469                                             <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %] <span class="caret"></span>
470                                         </button>
471                                         <ul class="dropdown-menu" aria-labelledby="ill-migrate-dropdown">
472                                             [% FOREACH backend IN backends %]
473                                                 [% IF backend != request.backend %]
474                                                     <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]&amp;backend=[% backend | uri %]">[% backend | html %]</a></li>
475                                                 [% END %]
476                                             [% END %]
477                                         </ul>
478                                     </div>
479                                 [% ELSIF backends.size == 2 %]
480                                     [% FOREACH backend IN backends %]
481                                         [% IF backend != request.backend %]
482                                             <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]&amp;backend=[% backend | uri %]">
483                                             <span class="fa [% action.ui_method_icon | html %]"></span>
484                                             [% action.ui_method_name | html %]
485                                             </a>
486                                         [% END %]
487                                     [% END %]
488                                 [% END %]
489                             [% ELSIF action.method != 0 %]
490                                 <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&amp;illrequest_id=[% request.illrequest_id | uri %]">
491                                 <span class="fa [% action.ui_method_icon | html %]"></span>
492                                 [% action.ui_method_name | html %]
493                                 </a>
494                             [% END %]
495                         [% END %]
496                         <a title="Display supplier metadata" id="ill-request-display-metadata" class="btn btn-default pull-right" href="#">
497                             <span class="fa fa-eye"></span>
498                             Display supplier metadata
499                         </a>
500                         <a title="ILL request log" id="ill-request-display-log" class="btn btn-default pull-right" href="#">
501                             <span class="fa fa-calendar"></span>
502                             ILL request log
503                         </a>
504                     </div>
505                     <div class="ill-view-panel panel panel-default">
506                         <div class="panel-heading">
507                             <h3>Request details</h3>
508                         </div>
509                         <div class="panel-body">
510                             <h4>Details from library</h4>
511                             <div class="rows">
512                                 <ol>
513                                     <li class="orderid">
514                                         <span class="label orderid">Order ID:</span>
515                                         [% IF request.orderid %][% request.orderid | html %][% ELSE %]<span>N/A</span>[% END %]
516                                     </li>
517                                     <li class="borrowernumber">
518                                         <span class="label borrowernumber">Patron:</span>
519                                         [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
520                                         <a href="[% borrowerlink | url %]" title="View borrower details">
521                                         [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %]
522                                         </a>
523                                     </li>
524
525                                     <li class="biblio_id">
526                                         <span class="label biblio_id">Bibliographic record ID:</span>
527                                         [% IF request.biblio_id %]
528                                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% request.biblio_id | uri %]">[% request.biblio_id | html %]</a>
529                                         [% ELSE %]
530                                             <span>N/A</span>
531                                         [% END %]
532                                     </li>
533                                     <li class="branchcode">
534                                         <span class="label branchcode">Library:</span>
535                                         [% Branches.GetName(request.branchcode) | html %]
536                                     </li>
537                                     <li class="status">
538                                         <span class="label status">Status:</span>
539                                         [% IF request.statusalias %]
540                                             [% request.statusalias.lib | html %]
541                                         [% ELSE %]
542                                             [% request.capabilities.$req_status.name | html%]
543                                             [% IF request.requested_partners.length > 0 %]
544                                                 ([% request.requested_partners | html %])
545                                             [% END %]
546                                         [% END %]
547                                     </li>
548                                     <li class="updated">
549                                         <span class="label updated">Last updated:</span>
550                                         [% request.updated | $KohaDates  with_hours => 1 %]
551                                     </li>
552                                     <li class="medium">
553                                         <span class="label medium">Request type:</span>
554                                         [% type = request.get_type %]
555                                         [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
556                                     </li>
557                                     <li class="cost">
558                                         <span class="label cost">Cost:</span>
559                                         [% IF request.cost %][% request.cost | $Price %][% ELSE %]<span>N/A</span>[% END %]
560                                     </li>
561                                     <li class="price_paid">
562                                         <span class="label price_paid">Price paid:</span>
563                                         [% IF request.price_paid %][% request.price_paid | $Price %][% ELSE %]<span>N/A</span>[% END %]
564                                     </li>
565                                     <li class="req_id">
566                                         <span class="label req_id">Request number:</span>
567                                         [% request.id_prefix _ request.illrequest_id | html %]
568                                     </li>
569                                     <li class="notesstaff">
570                                         <span class="label notes_staff">Staff notes:</span>
571                                         <p>[% request.notesstaff | html %]</p>
572                                     </li>
573                                     <li class="notesopac">
574                                         <span class="label notes_opac">Notes:</span>
575                                         <p>[% request.notesopac | html %]</p>
576                                     </li>
577                                 </ol>
578                             </div>
579                             <div class="rows">
580                                 <h4>Details from supplier ([% request.backend | html %])</h4>
581                                 <ol>
582                                     [% FOREACH meta IN request.metadata %]
583                                         <li class="requestmeta-[% meta.key.replace('\s','_') | html %]">
584                                             <span class="label">[% meta.key | html %]:</span>
585                                             [% meta.value | html %]
586                                         </li>
587                                     [% END %]
588                                 </ol>
589                             </div>
590                         </div>
591                     </div>
592
593                     <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
594                         <div class="modal-dialog">
595                             <div class="modal-content">
596                                 <div class="modal-header">
597                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
598                                     <h3 id="dataPreviewLabel"> Supplier metadata</h3>
599                                 </div>
600                                 <div class="modal-body">
601                                     <div id="requestattributes">
602                                         [% FOREACH attr IN request.illrequestattributes %]
603                                         <div class="requestattr-[% attr.type | html %]">
604                                             <span class="label">[% attr.type | html %]:</span>
605                                             [% attr.value | html %]
606                                         </div>
607                                             [% END %]
608                                     </div>
609                                 </div>
610                                 <div class="modal-footer">
611                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
612                                 </div>
613                             </div>
614                         </div>
615                     </div>
616
617                     <div id="requestLog" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
618                         <div class="modal-dialog">
619                             <div class="modal-content">
620                                 <div class="modal-header">
621                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
622                                     <h3 id="requestLogLabel"> Request log</h3>
623                                 </div>
624                                 <div class="modal-body">
625                                 [% IF request.logs.size > 0 %]
626                                     [% FOREACH log IN request.logs %]
627                                         [% tpl = log.template %]
628                                         [% INCLUDE $tpl log=log %]
629                                     [% END %]
630                                 [% ELSE %]
631                                     There are no recorded logs for this request
632                                 [% END %]
633                                 </div>
634                                 <div class="modal-footer">
635                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
636                                 </div>
637                             </div>
638                         </div>
639                     </div>
640
641                     <div class="ill-view-panel panel panel-default">
642                         <div class="panel-heading">
643                             <h3>[% request.illcomments.count | html %] comments</h3>
644                         </div>
645                         <div class="panel-body">
646                             [% IF request.illcomments.count && request.illcomments.count > 0 %]
647                                 [% FOREACH comment IN request.illcomments %]
648                                     <div class="rows comment_[% comment.patron.categorycode | html %]">
649                                     <h5>Comment by:
650                                     <a href="[% borrowerlink | url %]" title="View borrower details">
651                                     [% comment.patron.firstname _ " " _ comment.patron.surname _ " [" _ comment.patron.cardnumber _ "]" | html %]</a>
652                                     [% comment.timestamp | $KohaDates with_hours => 1 %]</h5>
653                                     <p>[% comment.comment | html %]</p>
654                                     </div>
655                                 [% END %]
656                             [% END %]
657                                 <div class="rows">
658                                     <h3><a id="toggle_addcomment" href="#">Add comment</a></h3>
659                                     <div id="addcomment" class="content_hidden">
660                                         <form class="validated" method="post" action="/cgi-bin/koha/ill/ill-requests.pl">
661                                             <input type="hidden" value="save_comment" name="method">
662                                             <input type="hidden" value="[% csrf_token | html %]" name="csrf_token">
663                                             <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
664                                             <fieldset class="rows">
665                                                 <ol>
666                                                     <li>
667                                                         <label class="required" for="comment">Comment: </label>
668                                                         <textarea class="required" required="required" cols="80" rows="10" id="comment" name="comment"></textarea>
669                                                         <span class="required">Required</span>
670                                                     </li>
671                                                 </ol>
672                                             </fieldset>
673                                             <fieldset class="action">
674                                                 <input type="submit" value="Submit">
675                                             </fieldset>
676                                         </form>
677                                     </div>
678                                 </div>
679                         </div>
680                     </div>
681
682                 [% ELSIF query_type == 'illlist' %]
683                     <!-- illlist -->
684                     <h1>View ILL requests</h1>
685                     <div id="results">
686                         <h3>Details for all requests</h3>
687                         [% INCLUDE 'ill-list-table.inc' %]
688
689                     </div> <!-- /#results -->
690                 [% ELSE %]
691                 <!-- Custom Backend Action -->
692                 [% PROCESS $whole.template %]
693
694                 [% END %]
695         [% END %]
696                 </div> <!-- /#interlibraryloans -->
697             </main>
698         </div> <!-- /.col-sm-10 -->
699     </div> <!-- /.row -->
700
701
702 [% MACRO jsinclude BLOCK %]
703     [% INCLUDE 'datatables.inc' %]
704     [% INCLUDE 'columns_settings.inc' %]
705     [% INCLUDE 'calendar.inc' %]
706     [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
707     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
708     <script>
709         var prefilters = '[% prefilters | $raw %]';
710         // Set column settings
711         var columns_settings = [% ColumnsSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %];
712         $("#ill_checkout_duedate_input").datetimepicker({
713             hour: 23,
714             minute: 59
715         }).on("change", function(e, value) {
716             if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
717         });
718     </script>
719     <script>
720         $('#ill_checkout_inhouse_select').on('change', function() {
721             if ($(this).val().length > 0) {
722                 $('.ill_checkout_due_date').hide();
723             } else {
724                 $('.ill_checkout_due_date').show();
725             }
726         });
727     </script>
728     [% INCLUDE 'ill-list-table-strings.inc' %]
729     [% Asset.js("js/ill-list-table.js") | $raw %]
730 [% END %]
731
732 [% TRY %]
733 [% PROCESS backend_jsinclude %]
734 [% CATCH %]
735 [% END %]
736
737 [% INCLUDE 'intranet-bottom.inc' %]