Bug 23112: Add permission checks
[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 [% request.patron.firstname %] [% request.patron.surname %]</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 %]">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 %]" selected>[% stat.firstname %] [% stat.surname %]</option>
158                                                     [% ELSE %]
159                                                         <option value="[% stat.cardnumber %]">[% stat.firstname %] [% stat.surname %]</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 [% request.patron.firstname | html %] [% request.patron.surname | html %] 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 %]
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 %]
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  %]">
229                                         <input name="item_type" type="hidden" value="[% items.0.itype %]">
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                                     [% whole.value.patron.firstname | html %] [% whole.value.patron.surname | html %]
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                             [% has_prefs_count = 0 %]
445                             [% has_perms_count = 0 %]
446                             [% FOREACH pref IN needs_prefs %]
447                                 [% IF Koha.Preference(pref) %]
448                                     [% has_prefs_count = has_prefs_count + 1 %]
449                                 [% END %]
450                             [% END %]
451                             [% FOREACH perm IN needs_perms %]
452                                 [% perm_name = 'CAN_' _ perm %]
453                                 [% IF ($perm_name) %]
454                                     [% has_perms_count = has_perms_count + 1 %]
455                                 [% END %]
456                             [% END %]
457                             [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size %]
458                             [% IF action.method == 'migrate' %]
459                                 [% IF backends.size > 2 %]
460                                     <div class="dropdown btn-group">
461                                         <button class="btn btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
462                                             <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %] <span class="caret"></span>
463                                         </button>
464                                         <ul class="dropdown-menu" aria-labelledby="ill-migrate-dropdown">
465                                             [% FOREACH backend IN backends %]
466                                                 [% IF backend != request.backend %]
467                                                     <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>
468                                                 [% END %]
469                                             [% END %]
470                                         </ul>
471                                     </div>
472                                 [% ELSIF backends.size == 2 %]
473                                     [% FOREACH backend IN backends %]
474                                         [% IF backend != request.backend %]
475                                             <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 %]">
476                                             <span class="fa [% action.ui_method_icon | html %]"></span>
477                                             [% action.ui_method_name | html %]
478                                             </a>
479                                         [% END %]
480                                     [% END %]
481                                 [% END %]
482                             [% ELSIF action.method != 0 %]
483                                 <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 %]">
484                                 <span class="fa [% action.ui_method_icon | html %]"></span>
485                                 [% action.ui_method_name | html %]
486                                 </a>
487                             [% END %]
488                         [% END %]
489                         <a title="Display supplier metadata" id="ill-request-display-metadata" class="btn btn-default pull-right" href="#">
490                             <span class="fa fa-eye"></span>
491                             Display supplier metadata
492                         </a>
493                         <a title="ILL request log" id="ill-request-display-log" class="btn btn-default pull-right" href="#">
494                             <span class="fa fa-calendar"></span>
495                             ILL request log
496                         </a>
497                     </div>
498                     <div class="ill-view-panel panel panel-default">
499                         <div class="panel-heading">
500                             <h3>Request details</h3>
501                         </div>
502                         <div class="panel-body">
503                             <h4>Details from library</h4>
504                             <div class="rows">
505                                 <ol>
506                                     <li class="orderid">
507                                         <span class="label orderid">Order ID:</span>
508                                         [% IF request.orderid %][% request.orderid | html %][% ELSE %]<span>N/A</span>[% END %]
509                                     </li>
510                                     <li class="borrowernumber">
511                                         <span class="label borrowernumber">Patron:</span>
512                                         [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
513                                         <a href="[% borrowerlink | url %]" title="View borrower details">
514                                         [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %]
515                                         </a>
516                                     </li>
517
518                                     <li class="biblio_id">
519                                         <span class="label biblio_id">Bibliographic record ID:</span>
520                                         [% IF request.biblio_id %]
521                                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% request.biblio_id | uri %]">[% request.biblio_id | html %]</a>
522                                         [% ELSE %]
523                                             <span>N/A</span>
524                                         [% END %]
525                                     </li>
526                                     <li class="branchcode">
527                                         <span class="label branchcode">Library:</span>
528                                         [% Branches.GetName(request.branchcode) | html %]
529                                     </li>
530                                     <li class="status">
531                                         <span class="label status">Status:</span>
532                                         [% IF request.statusalias %]
533                                             [% request.statusalias.lib | html %]
534                                         [% ELSE %]
535                                             [% request.capabilities.$req_status.name | html%]
536                                             [% IF request.requested_partners.length > 0 %]
537                                                 ([% request.requested_partners | html %])
538                                             [% END %]
539                                         [% END %]
540                                     </li>
541                                     <li class="updated">
542                                         <span class="label updated">Last updated:</span>
543                                         [% request.updated | $KohaDates  with_hours => 1 %]
544                                     </li>
545                                     <li class="medium">
546                                         <span class="label medium">Request type:</span>
547                                         [% type = request.get_type %]
548                                         [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
549                                     </li>
550                                     <li class="cost">
551                                         <span class="label cost">Cost:</span>
552                                         [% IF request.cost %][% request.cost | $Price %][% ELSE %]<span>N/A</span>[% END %]
553                                     </li>
554                                     <li class="price_paid">
555                                         <span class="label price_paid">Price paid:</span>
556                                         [% IF request.price_paid %][% request.price_paid | $Price %][% ELSE %]<span>N/A</span>[% END %]
557                                     </li>
558                                     <li class="req_id">
559                                         <span class="label req_id">Request number:</span>
560                                         [% request.id_prefix _ request.illrequest_id | html %]
561                                     </li>
562                                     <li class="notesstaff">
563                                         <span class="label notes_staff">Staff notes:</span>
564                                         <p>[% request.notesstaff | html %]</p>
565                                     </li>
566                                     <li class="notesopac">
567                                         <span class="label notes_opac">Notes:</span>
568                                         <p>[% request.notesopac | html %]</p>
569                                     </li>
570                                 </ol>
571                             </div>
572                             <div class="rows">
573                                 <h4>Details from supplier ([% request.backend | html %])</h4>
574                                 <ol>
575                                     [% FOREACH meta IN request.metadata %]
576                                         <li class="requestmeta-[% meta.key.replace('\s','_') | html %]">
577                                             <span class="label">[% meta.key | html %]:</span>
578                                             [% meta.value | html %]
579                                         </li>
580                                     [% END %]
581                                 </ol>
582                             </div>
583                         </div>
584                     </div>
585
586                     <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
587                         <div class="modal-dialog">
588                             <div class="modal-content">
589                                 <div class="modal-header">
590                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
591                                     <h3 id="dataPreviewLabel"> Supplier metadata</h3>
592                                 </div>
593                                 <div class="modal-body">
594                                     <div id="requestattributes">
595                                         [% FOREACH attr IN request.illrequestattributes %]
596                                         <div class="requestattr-[% attr.type | html %]">
597                                             <span class="label">[% attr.type | html %]:</span>
598                                             [% attr.value | html %]
599                                         </div>
600                                             [% END %]
601                                     </div>
602                                 </div>
603                                 <div class="modal-footer">
604                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
605                                 </div>
606                             </div>
607                         </div>
608                     </div>
609
610                     <div id="requestLog" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
611                         <div class="modal-dialog">
612                             <div class="modal-content">
613                                 <div class="modal-header">
614                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
615                                     <h3 id="requestLogLabel"> Request log</h3>
616                                 </div>
617                                 <div class="modal-body">
618                                 [% IF request.logs.size > 0 %]
619                                     [% FOREACH log IN request.logs %]
620                                         [% tpl = log.template %]
621                                         [% INCLUDE $tpl log=log %]
622                                     [% END %]
623                                 [% ELSE %]
624                                     There are no recorded logs for this request
625                                 [% END %]
626                                 </div>
627                                 <div class="modal-footer">
628                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
629                                 </div>
630                             </div>
631                         </div>
632                     </div>
633
634                     <div class="ill-view-panel panel panel-default">
635                         <div class="panel-heading">
636                             <h3>[% request.illcomments.count | html %] comments</h3>
637                         </div>
638                         <div class="panel-body">
639                             [% IF request.illcomments.count && request.illcomments.count > 0 %]
640                                 [% FOREACH comment IN request.illcomments %]
641                                     <div class="rows comment_[% comment.patron.categorycode | html %]">
642                                     <h5>Comment by:
643                                     <a href="[% borrowerlink | url %]" title="View borrower details">
644                                     [% comment.patron.firstname _ " " _ comment.patron.surname _ " [" _ comment.patron.cardnumber _ "]" | html %]</a>
645                                     [% comment.timestamp | $KohaDates with_hours => 1 %]</h5>
646                                     <p>[% comment.comment | html %]</p>
647                                     </div>
648                                 [% END %]
649                             [% END %]
650                                 <div class="rows">
651                                     <h3><a id="toggle_addcomment" href="#">Add comment</a></h3>
652                                     <div id="addcomment" class="content_hidden">
653                                         <form class="validated" method="post" action="/cgi-bin/koha/ill/ill-requests.pl">
654                                             <input type="hidden" value="save_comment" name="method">
655                                             <input type="hidden" value="[% csrf_token | html %]" name="csrf_token">
656                                             <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
657                                             <fieldset class="rows">
658                                                 <ol>
659                                                     <li>
660                                                         <label class="required" for="comment">Comment: </label>
661                                                         <textarea class="required" required="required" cols="80" rows="10" id="comment" name="comment"></textarea>
662                                                         <span class="required">Required</span>
663                                                     </li>
664                                                 </ol>
665                                             </fieldset>
666                                             <fieldset class="action">
667                                                 <input type="submit" value="Submit">
668                                             </fieldset>
669                                         </form>
670                                     </div>
671                                 </div>
672                         </div>
673                     </div>
674
675                 [% ELSIF query_type == 'illlist' %]
676                     <!-- illlist -->
677                     <h1>View ILL requests</h1>
678                     <div id="results">
679                         <h3>Details for all requests</h3>
680                         [% INCLUDE 'ill-list-table.inc' %]
681
682                     </div> <!-- /#results -->
683                 [% ELSE %]
684                 <!-- Custom Backend Action -->
685                 [% PROCESS $whole.template %]
686
687                 [% END %]
688         [% END %]
689                 </div> <!-- /#interlibraryloans -->
690             </main>
691         </div> <!-- /.col-sm-10 -->
692     </div> <!-- /.row -->
693
694
695 [% MACRO jsinclude BLOCK %]
696     [% INCLUDE 'datatables.inc' %]
697     [% INCLUDE 'columns_settings.inc' %]
698     [% INCLUDE 'calendar.inc' %]
699     [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
700     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
701     <script>
702         var prefilters = '[% prefilters | $raw %]';
703         // Set column settings
704         var columns_settings = [% ColumnsSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %];
705         $("#ill_checkout_duedate_input").datetimepicker({
706             hour: 23,
707             minute: 59
708         }).on("change", function(e, value) {
709             if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
710         });
711     </script>
712     <script>
713         $('#ill_checkout_inhouse_select').on('change', function() {
714             if ($(this).val().length > 0) {
715                 $('.ill_checkout_due_date').hide();
716             } else {
717                 $('.ill_checkout_due_date').show();
718             }
719         });
720     </script>
721     [% INCLUDE 'ill-list-table-strings.inc' %]
722     [% Asset.js("js/ill-list-table.js") | $raw %]
723     [% Asset.js("js/ill-check-out.js") | $raw %]
724 [% END %]
725
726 [% TRY %]
727 [% PROCESS backend_jsinclude %]
728 [% CATCH %]
729 [% END %]
730
731 [% INCLUDE 'intranet-bottom.inc' %]