7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › ILL requests ›</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
11 [% Asset.css("css/datatables.css") | $raw %]
12 [% INCLUDE 'datatables.inc' %]
13 <script type="text/javascript">
15 $(document).ready(function() {
17 // Illview Datatable setup
19 // Fields we don't want to display
34 // Fields we need to expand (flatten)
41 // This is auto populated
44 // The core fields that should be displayed first
57 // Remove any fields we're ignoring
58 var removeIgnore = function(dataObj) {
59 dataObj.forEach(function(thisRow) {
60 ignore.forEach(function(thisIgnore) {
61 if (thisRow.hasOwnProperty(thisIgnore)) {
62 delete thisRow[thisIgnore];
68 // Expand any fields we're expanding
69 var expandExpand = function(row) {
70 expand.forEach(function(thisExpand) {
71 if (row.hasOwnProperty(thisExpand)) {
72 if (!expanded.hasOwnProperty(thisExpand)) {
73 expanded[thisExpand] = [];
75 var expandObj = row[thisExpand];
76 Object.keys(expandObj).forEach(
77 function(thisExpandCol) {
78 var expColName = thisExpand + '_' + thisExpandCol;
79 // Keep a list of fields that have been expanded
80 // so we can create toggle links for them
81 if (expanded[thisExpand].indexOf(expColName) == -1) {
82 expanded[thisExpand].push(expColName);
84 expandObj[expColName] =
85 expandObj[thisExpandCol];
86 delete expandObj[thisExpandCol];
89 $.extend(true, row, expandObj);
90 delete row[thisExpand];
95 // Build a de-duped list of all column names
97 core.map(function(thisCore) {
98 allCols[thisCore] = 1;
101 // Strip the expand prefix if it exists, we do this for display
102 var stripPrefix = function(value) {
103 expand.forEach(function(thisExpand) {
104 var regex = new RegExp(thisExpand + '_', 'g');
105 value = value.replace(regex, '');
110 // Our 'render' function for borrowerlink
111 var createPatronLink = function(data, type, row) {
112 return '<a title="' + _("View borrower details") + '" ' +
113 'href="/cgi-bin/koha/members/moremember.pl?' +
114 'borrowernumber='+row.borrowernumber+'">' +
115 row.patron_firstname + ' ' + row.patron_surname +
119 // Our 'render' function for the library name
120 var createLibrary = function(data, type, row) {
121 return row.library.branchname;
124 // Render function for request ID
125 var createRequestId = function(data, type, row) {
126 return row.id_prefix + row.illrequest_id;
129 // Render function for request status
130 var createStatus = function(data, type, row, meta) {
131 var origData = meta.settings.oInit.originalData;
132 if (origData.length > 0) {
133 var status_name = meta.settings.oInit.originalData[0].capabilities[
136 switch( status_name ) {
138 return _("New request");
140 return _("Requested");
141 case "Requested from partners":
142 return _("Requested from partners");
143 case "Request reverted":
144 return _("Request reverted");
145 case "Queued request":
146 return _("Queued request");
147 case "Cancellation requested":
148 return _("Cancellation requested");
150 return _("Completed");
151 case "Delete request":
152 return _("Delete request");
161 // Render function for creating a row's action link
162 var createActionLink = function(data, type, row) {
163 return '<a class="btn btn-default btn-sm" ' +
164 'href="/cgi-bin/koha/ill/ill-requests.pl?' +
165 'method=illview&illrequest_id=' +
167 '">' + _("Manage request") + '</a>';
170 // Columns that require special treatment
174 func: createActionLink
178 func: createPatronLink
181 name: _("Request number"),
182 func: createRequestId
197 // Filter partner list
198 $('#partner_filter').keyup(function() {
199 var needle = $('#partner_filter').val();
200 $('#partners > option').each(function() {
201 var regex = new RegExp(needle, 'i');
203 needle.length == 0 ||
204 $(this).is(':selected') ||
205 $(this).text().match(regex)
214 // Display the modal containing request supplier metadata
215 $('#ill-request-display-metadata').on('click', function(e) {
217 $('#dataPreview').modal({show:true});
220 // Get our data from the API and process it prior to passing
223 '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
225 var data = JSON.parse(ajax.responseText);
226 // Make a copy, we'll be removing columns next and need
227 // to be able to refer to data that has been removed
228 var dataCopy = $.extend(true, [], data);
229 // Remove all columns we're not interested in
230 removeIgnore(dataCopy);
231 // Expand columns that need it and create an array
232 // of all column names
233 $.each(dataCopy, function(k, row) {
237 // Assemble an array of column definitions for passing
240 Object.keys(allCols).forEach(function(thisCol) {
241 // Create the base column object
246 // We may need to process the data going in this
247 // column, so do it if necessary
249 specialCols.hasOwnProperty(thisCol) &&
250 specialCols[thisCol].hasOwnProperty('func')
252 colObj.render = specialCols[thisCol].func;
254 colObj.data = thisCol;
256 colData.push(colObj);
259 // Initialise the datatable
260 $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, {
261 'aoColumnDefs': [ // Last column shouldn't be sortable or searchable
263 'aTargets': [ 'actions' ],
268 'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending
269 'processing': true, // Display a message when manipulating
270 'iDisplayLength': 10, // 10 results per page
271 'sPaginationType': "full_numbers", // Pagination display
272 'deferRender': true, // Improve performance on big datasets
275 'originalData': data // Enable render functions to access
286 <body id="illrequests" class="ill">
287 [% INCLUDE 'header.inc' %]
288 [% INCLUDE 'cat-search.inc' %]
290 <div id="breadcrumbs">
291 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
292 <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
293 [% IF query_type == 'create' %]
295 [% ELSIF query_type == 'status' %]
300 <div id="doc3" class="yui-t2">
303 <div id="interlibraryloans" class="yui-b">
304 [% IF !backends_available %]
305 <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>
307 [% INCLUDE 'ill-toolbar.inc' %]
310 <h1>Error performing operation</h1>
311 <!-- Dispatch on Status -->
312 <p>We encountered an error:</p>
314 <pre>[% whole.message | html %] ([% whole.status | html %])</pre>
318 [% IF query_type == 'create' %]
319 <h1>New ILL request</h1>
320 [% IF whole.stage == 'copyrightclearance' %]
323 [% Koha.Preference('ILLModuleCopyrightClearance') | $raw %]
325 <a href="?method=create&stage=copyrightclearance&backend=[% whole.value.backend | html %]"
326 class="btn btn-sm btn-default btn-group"><i class="fa fa-check">Yes</i></a>
327 <a href="/cgi-bin/koha/ill/ill-requests.pl"
328 class="btn btn-sm btn-default btn-group"><i class="fa fa-times">No</i></a>
331 [% PROCESS $whole.template %]
334 [% ELSIF query_type == 'confirm' %]
335 <h1>Confirm ILL request</h1>
336 [% PROCESS $whole.template %]
338 [% ELSIF query_type == 'cancel' and !whole.error %]
339 <h1>Cancel a confirmed request</h1>
340 [% PROCESS $whole.template %]
342 [% ELSIF query_type == 'generic_confirm' %]
343 <h1>Place request with partner libraries</h1>
345 [% IF error == 'no_target_email' %]
347 No target email addresses found. Either select at least
348 one partner or check your ILL partner library records.
350 [% ELSIF error == 'no_library_email' %]
352 Your library has no usable email address. Please set it.
354 [% ELSIF error == 'unkown_error' %]
356 Unknown error processing your request. Contact your administrator.
360 <!-- Start of GENERIC_EMAIL case -->
361 [% IF whole.value.partners %]
362 [% ill_url = "/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=" _ request.illrequest_id %]
363 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
364 <fieldset class="rows">
365 <legend>Interlibrary loan request details</legend>
368 <label for="partner_filter">Filter partner libraries:</label>
369 <input type="text" id="partner_filter">
372 <label for="partners" class="required">Select partner libraries:</label>
373 <select size="5" multiple="true" id="partners" name="partners" required="required">
374 [% FOREACH partner IN whole.value.partners %]
375 <option value=[% partner.email | html %]>
376 [% partner.branchcode _ " - " _ partner.surname %]
383 <label for="subject" class="required">Subject Line</label>
384 <input type="text" name="subject" id="subject" type="text" value="[% whole.value.draft.subject | html %]" required="required" />
387 <label for="body" class="required">Email text:</label>
388 <textarea name="body" id="body" rows="20" cols="80" required="required">[% whole.value.draft.body | html %]</textarea>
391 <input type="hidden" value="generic_confirm" name="method">
392 <input type="hidden" value="draft" name="stage">
393 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
395 <fieldset class="action">
396 <input type="submit" class="btn btn-default" value="Send email"/>
397 <span><a href="[% ill_url | html %]" title="Return to request details">Cancel</a></span>
401 <fieldset class="rows">
402 <legend>Interlibrary loan request details</legend>
403 <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
404 <p>Be sure to provide email addresses for these patrons.</p>
405 <p><span><a href="[% ill_url | html %]" title="Return to request details">Cancel</a></span></p>
408 <!-- generic_confirm ends here -->
410 [% ELSIF query_type == 'edit_action' %]
411 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
412 <fieldset class="rows">
413 <legend>Request details</legend>
415 <li class="borrowernumber">
416 <label for="borrowernumber">Patron ID:</label>
417 <input name="borrowernumber" id="borrowernumber" type="text" value="[% request.borrowernumber | html %]">
419 <li class="biblio_id">
420 <label for="biblio_id" class="biblio_id">Biblio ID:</label>
421 <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id | html %]">
423 <li class="branchcode">
424 <label for="library" class="branchcode">Library:</label>
425 <select name="branchcode" id="library">
426 [% PROCESS options_for_libraries libraries => Branches.all( selected => request.branchcode ) %]
430 <label class="status">Status:</label>
431 [% stat = request.status | html %]
432 [% request.capabilities.$stat.name | html %]
435 <label class="updated">Last updated:</label>
436 [% request.updated | $KohaDates with_hours => 1 | html %]
439 <label class="medium">Request type:</label>
440 [% request.medium | html %]
443 <label class="cost">Cost:</label>
444 [% request.cost || 'N/A' | html %]
447 <label class="req_id">Request number:</label>
448 [% request.id_prefix _ request.illrequest_id | html %]
450 <li class="notesstaff">
451 <label for="notesstaff" class="notesstaff">Staff notes:</label>
452 <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff | html %]</textarea>
454 <li class="notesopac">
455 <label for="notesopac" class="notesopac">Opac notes:</label>
456 <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac | html %]</textarea>
460 <fieldset class="action">
461 <input type="hidden" value="edit_action" name="method">
462 <input type="hidden" value="form" name="stage">
463 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
464 <input type="submit" value="Submit">
465 <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id | html %]">Cancel</a>
469 [% ELSIF query_type == 'delete_confirm' %]
471 <div class="dialog alert">
472 <h3>Are you sure you wish to delete this request?</h3>
473 <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
474 <input type="hidden" name="method" value="delete" />
475 <input type="hidden" name="confirmed" value="1" />
476 <input type="hidden" name="illrequest_id" value="[% request.id | html %]" />
477 <button type="submit" class="btn btn-default btn-sm approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
479 <a class="btn btn-default btn-sm deny" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id | html %]"><i class="fa fa-fw fa-remove"></i>No, do not delete</a>
482 [% ELSIF query_type == 'illview' %]
483 [% actions = request.available_actions | html %]
484 [% capabilities = request.capabilities | html %]
485 [% req_status = request.status | html %]
486 <h1>Manage ILL request</h1>
487 <div id="toolbar" class="btn-toolbar">
488 <a title="Edit request" id="ill-toolbar-btn-edit-action" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=edit_action&illrequest_id=[% request.illrequest_id | html %]">
489 <span class="fa fa-pencil"></span>
492 [% FOREACH action IN actions %]
493 [% IF action.method != 0 %]
494 <a title="[% action.ui_method_name | html %]" id="ill-toolbar-btn-[% action.id | lower | html %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | html %]&illrequest_id=[% request.illrequest_id | html %]">
495 <span class="fa [% action.ui_method_icon | html %]"></span>
496 [% action.ui_method_name | html %]
500 <a title="Display supplier metadata" id="ill-request-display-metadata" class="btn btn-sm btn-default pull-right" href="#">
501 <span class="fa fa-eye"></span>
502 Display supplier metadata
505 <div id="ill-view-panel" class="panel panel-default">
506 <div class="panel-heading">
507 <h3>Request details</h3>
509 <div class="panel-body">
510 <h4>Details from library</h4>
512 <div class="orderid">
513 <span class="label orderid">Order ID:</span>
514 [% request.orderid || "N/A" | html %]
516 <div class="borrowernumber">
517 <span class="label borrowernumber">Patron:</span>
518 [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
519 <a href="[% borrowerlink | html %]" title="View borrower details">
520 [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %]
524 <div class="biblio_id">
525 <span class="label biblio_id">Biblio ID:</span>
526 [% request.biblio_id || "N/A" | html %]
528 <div class="branchcode">
529 <span class="label branchcode">Library:</span>
530 [% Branches.GetName(request.branchcode) | html %]
533 <span class="label status">Status:</span>
534 [% capabilities.$req_status.name | html %]
536 <div class="updated">
537 <span class="label updated">Last updated:</span>
538 [% request.updated | $KohaDates with_hours => 1 | html %]
541 <span class="label medium">Request type:</span>
542 [% request.medium | html %]
545 <span class="label cost">Cost:</span>
546 [% request.cost || "N/A" | html %]
549 <span class="label req_id">Request number:</span>
550 [% request.id_prefix _ request.illrequest_id | html %]
552 <div class="notesstaff">
553 <span class="label notes_staff">Staff notes:</span>
554 <pre>[% request.notesstaff | html %]</pre>
556 <div class="notesopac">
557 <span class="label notes_opac">Notes:</span>
558 <pre>[% request.notesopac | html %]</pre>
562 <h4>Details from supplier ([% request.backend | html %])</h4>
563 [% FOREACH meta IN request.metadata %]
564 <div class="requestmeta-[% meta.key | html %]">
565 <span class="label">[% meta.key | html %]:</span>
566 [% meta.value | html %]
573 <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
574 <div class="modal-dialog">
575 <div class="modal-content">
576 <div class="modal-header">
577 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
578 <h3 id="dataPreviewLabel"> Supplier metadata</h3>
580 <div class="modal-body">
581 <div id="requestattributes">
582 [% FOREACH attr IN request.illrequestattributes %]
583 <div class="requestattr-[% attr.type | html %]">
584 <span class="label">[% attr.type | html %]:</span>
585 [% attr.value | html %]
590 <div class="modal-footer">
591 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
597 [% ELSIF query_type == 'illlist' %]
599 <h1>View ILL requests</h1>
601 <h3>Details for all requests</h3>
603 <table id="ill-requests">
605 <tr id="illview-header">
613 <th>Request number</th>
614 <th class="actions"></th>
617 <tbody id="illview-body">
622 <!-- Custom Backend Action -->
623 [% INCLUDE $whole.template %]
633 [% PROCESS backend_jsinclude %]
637 [% INCLUDE 'intranet-bottom.inc' %]