5 [% columns = [ 'metadata_Author', 'metadata_Title', 'borrowername', 'biblio_id', 'library', 'status', 'updated', 'illrequest_id', 'action' ] %]
7 [% BLOCK translate_column %]
9 [%- CASE 'metadata_Author' -%]Author
10 [%- CASE 'metadata_Title' -%]Title
11 [%- CASE 'borrowername' -%]Patron
12 [%- CASE 'biblio_id' -%]Biblio ID
13 [%- CASE 'library' -%]Library
14 [%- CASE 'status' -%]Status
15 [%- CASE 'updated' -%]Updated on
16 [%- CASE 'illrequest_id' -%]Request number
20 [% INCLUDE 'doc-head-open.inc' %]
21 <title>Koha › ILL requests ›</title>
22 [% INCLUDE 'doc-head-close.inc' %]
23 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
24 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css">
25 [% INCLUDE 'datatables.inc' %]
26 <script type="text/javascript">
28 $(document).ready(function() {
30 // Illview Datatable setup
32 // Fields we don't want to display
47 // Fields we need to expand (flatten)
54 // This is auto populated
57 // The core fields that should be displayed first
70 // Extra fields that we need to tack on to the end
71 var extra = [ 'action' ];
73 // Remove any fields we're ignoring
74 var removeIgnore = function(dataObj) {
75 dataObj.forEach(function(thisRow) {
76 ignore.forEach(function(thisIgnore) {
77 if (thisRow.hasOwnProperty(thisIgnore)) {
78 delete thisRow[thisIgnore];
84 // Expand any fields we're expanding
85 var expandExpand = function(row) {
86 expand.forEach(function(thisExpand) {
87 if (row.hasOwnProperty(thisExpand)) {
88 if (!expanded.hasOwnProperty(thisExpand)) {
89 expanded[thisExpand] = [];
91 var expandObj = row[thisExpand];
92 Object.keys(expandObj).forEach(
93 function(thisExpandCol) {
94 var expColName = thisExpand + '_' + thisExpandCol;
95 // Keep a list of fields that have been expanded
96 // so we can create toggle links for them
97 if (expanded[thisExpand].indexOf(expColName) == -1) {
98 expanded[thisExpand].push(expColName);
100 expandObj[expColName] =
101 expandObj[thisExpandCol];
102 delete expandObj[thisExpandCol];
105 $.extend(true, row, expandObj);
106 delete row[thisExpand];
111 // Build a de-duped list of all column names
113 core.map(function(thisCore) {
114 allCols[thisCore] = 1;
117 // Strip the expand prefix if it exists, we do this for display
118 var stripPrefix = function(value) {
119 expand.forEach(function(thisExpand) {
120 var regex = new RegExp(thisExpand + '_', 'g');
121 value = value.replace(regex, '');
126 // Our 'render' function for borrowerlink
127 var createPatronLink = function(data, type, row) {
128 return '<a title="View borrower details" ' +
129 'href="/cgi-bin/koha/members/moremember.pl?' +
130 'borrowernumber='+row.borrowernumber+'">' +
131 row.patron_firstname + ' ' + row.patron_surname +
135 // Our 'render' function for the library name
136 var createLibrary = function(data, type, row) {
137 return row.library.branchname;
140 // Render function for request ID
141 var createRequestId = function(data, type, row) {
142 return row.id_prefix + row.illrequest_id;
145 // Render function for request status
146 var createStatus = function(data, type, row, meta) {
147 var origData = meta.settings.oInit.originalData;
148 if (origData.length > 0) {
149 var status_name = meta.settings.oInit.originalData[0].capabilities[
152 switch( status_name ) {
154 return _("New request");
156 return _("Requested");
157 case "Requested from partners":
158 return _("Requested from partners");
159 case "Request reverted":
160 return _("Request reverted");
161 case "Queued request":
162 return _("Queued request");
163 case "Cancellation requested":
164 return _("Cancellation requested");
166 return _("Completed");
167 case "Delete request":
168 return _("Delete request");
177 // Render function for creating a row's action link
178 var createActionLink = function(data, type, row) {
179 return '<a class="btn btn-default btn-sm" ' +
180 'href="/cgi-bin/koha/ill/ill-requests.pl?' +
181 'method=illview&illrequest_id=' +
183 '">' + _("Manage request") + '</a>';
186 // Columns that require special treatment
190 func: createActionLink
194 func: createPatronLink
197 name: _("Request number"),
198 func: createRequestId
213 // Toggle request attributes in Illview
214 $('#toggle_requestattributes').on('click', function(e) {
216 $('#requestattributes').toggleClass('content_hidden');
219 // Filter partner list
220 $('#partner_filter').keyup(function() {
221 var needle = $('#partner_filter').val();
222 $('#partners > option').each(function() {
223 var regex = new RegExp(needle, 'i');
225 needle.length == 0 ||
226 $(this).is(':selected') ||
227 $(this).text().match(regex)
236 // Get our data from the API and process it prior to passing
239 '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
241 var data = JSON.parse(ajax.responseText);
242 // Make a copy, we'll be removing columns next and need
243 // to be able to refer to data that has been removed
244 var dataCopy = $.extend(true, [], data);
245 // Remove all columns we're not interested in
246 removeIgnore(dataCopy);
247 // Expand columns that need it and create an array
248 // of all column names
249 $.each(dataCopy, function(k, row) {
253 // Append any extra columns we need to tag on
254 if (extra.length > 0) {
255 extra.forEach(function(thisExtra) {
256 allCols[thisExtra] = 1;
260 // Assemble an array of column definitions for passing
263 Object.keys(allCols).forEach(function(thisCol) {
264 // Create the base column object
269 // We may need to process the data going in this
270 // column, so do it if necessary
272 specialCols.hasOwnProperty(thisCol) &&
273 specialCols[thisCol].hasOwnProperty('func')
275 colObj.render = specialCols[thisCol].func;
277 colObj.data = thisCol;
279 colData.push(colObj);
282 // Initialise the datatable
283 $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, {
284 'aoColumnDefs': [ // Last column shouldn't be sortable or searchable
286 'aTargets': [ 'action' ],
291 'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending
292 'processing': true, // Display a message when manipulating
293 'iDisplayLength': 10, // 10 results per page
294 'sPaginationType': "full_numbers", // Pagination display
295 'deferRender': true, // Improve performance on big datasets
298 'originalData': data // Enable render functions to access
309 <body id="illrequests" class="ill">
310 [% INCLUDE 'header.inc' %]
311 [% INCLUDE 'cat-search.inc' %]
313 <div id="breadcrumbs">
314 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
315 <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
316 [% IF query_type == 'create' %]
318 [% ELSIF query_type == 'status' %]
323 <div id="doc3" class="yui-t2">
326 <div id="interlibraryloans" class="yui-b">
327 [% IF !backends_available %]
328 <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>
330 [% INCLUDE 'ill-toolbar.inc' %]
333 <h1>Error performing operation</h1>
334 <!-- Dispatch on Status -->
335 <p>We encountered an error:</p>
337 <pre>[% whole.message %] ([% whole.status %])</pre>
341 [% IF query_type == 'create' %]
342 <h1>New ILL request</h1>
343 [% IF whole.stage == 'copyrightclearance' %]
346 [% Koha.Preference('ILLModuleCopyrightClearance') %]
348 <a href="?method=create&stage=copyrightclearance&backend=[% whole.value.backend %]"
349 class="btn btn-sm btn-default btn-group"><i class="fa fa-check">Yes</i></a>
350 <a href="/cgi-bin/koha/ill/ill-requests.pl"
351 class="btn btn-sm btn-default btn-group"><i class="fa fa-times">No</i></a>
354 [% PROCESS $whole.template %]
357 [% ELSIF query_type == 'confirm' %]
358 <h1>Confirm ILL request</h1>
359 [% PROCESS $whole.template %]
361 [% ELSIF query_type == 'cancel' and !whole.error %]
362 <h1>Cancel a confirmed request</h1>
363 [% PROCESS $whole.template %]
365 [% ELSIF query_type == 'generic_confirm' %]
366 <h1>Place request with partner libraries</h1>
369 [% IF error == 'no_target_email' %]
370 No target email addresses found. Either select at least
371 one partner or check your ILL partner library records.
372 [% ELSIF error == 'no_library_email' %]
373 Your library has no usable email address. Please set it.
374 [% ELSIF error == 'unkown_error' %]
375 Unknown error processing your request. Contact your administrator.
379 <!-- Start of GENERIC_EMAIL case -->
380 [% IF whole.value.partners %]
381 [% ill_url = "/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=" _ request.illrequest_id %]
382 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
383 <fieldset class="rows">
384 <legend>Interlibrary loan request details</legend>
387 <label for="partner_filter">Filter partner libraries:</label>
388 <input type="text" id="partner_filter">
391 <label for="partners">Select partner libraries:</label>
392 <select size="5" multiple="true" id="partners"
394 [% FOREACH partner IN whole.value.partners %]
395 <option value=[% partner.email %]>
396 [% partner.branchcode _ " - " _ partner.surname %]
403 <label for="subject">Subject Line</label>
404 <input type="text" name="subject"
405 id="subject" type="text"
406 value="[% whole.value.draft.subject %]"/>
409 <label for="body">Email text:</label>
410 <textarea name="body" id="body" rows="20" cols="80">[% whole.value.draft.body %]</textarea>
413 <input type="hidden" value="generic_confirm" name="method">
414 <input type="hidden" value="draft" name="stage">
415 <input type="hidden" value="[% request.illrequest_id %]" name="illrequest_id">
417 <fieldset class="action">
418 <input type="submit" class="btn btn-default" value="Send email"/>
419 <span><a href="[% ill_url %]" title="Return to request details">Cancel</a></span>
423 <fieldset class="rows">
424 <legend>Interlibrary loan request details</legend>
425 <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
426 <p>Be sure to provide email addresses for these patrons.</p>
427 <p><span><a href="[% ill_url %]" title="Return to request details">Cancel</a></span></p>
430 <!-- generic_confirm ends here -->
432 [% ELSIF query_type == 'edit_action' %]
433 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
434 <fieldset class="rows">
435 <legend>Request details</legend>
437 <li class="borrowernumber">
438 <label for="borrowernumber">Patron ID:</label>
439 <input name="borrowernumber" id="borrowernumber" type="text" value="[% request.borrowernumber %]">
441 <li class="biblio_id">
442 <label for="biblio_id" class="biblio_id">Biblio ID:</label>
443 <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id %]">
445 <li class="branchcode">
446 <label for="branchcode" class="branchcode">Library:</label>
447 <select name="branchcode" id="branch">
448 [% FOREACH branch IN branches %]
449 [% IF ( branch.branchcode == request.branchcode ) %]
450 <option value="[% branch.branchcode %]" selected="selected">
451 [% branch.branchname %]
454 <option value="[% branch.branchcode %]">
455 [% branch.branchname %]
462 <label class="status">Status:</label>
463 [% stat = request.status %]
464 [% request.capabilities.$stat.name %]
467 <label class="updated">Last updated:</label>
468 [% request.updated | $KohaDates with_hours => 1 %]
471 <label class="medium">Request type:</label>
475 <label class="cost">Cost:</label>
476 [% request.cost || 'N/A' %]
479 <label class="req_id">Request number:</label>
480 [% request.id_prefix _ request.illrequest_id %]
482 <li class="notesstaff">
483 <label for="notesstaff" class="notesstaff">Staff notes:</label>
484 <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff %]</textarea>
486 <li class="notesopac">
487 <label for="notesopac" class="notesopac">Opac notes:</label>
488 <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac %]</textarea>
492 <fieldset class="action">
493 <input type="hidden" value="edit_action" name="method">
494 <input type="hidden" value="form" name="stage">
495 <input type="hidden" value="[% request.illrequest_id %]" name="illrequest_id">
496 <input type="submit" value="Submit">
497 <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id %]">Cancel</a>
501 [% ELSIF query_type == 'delete_confirm' %]
503 <div class="dialog alert">
504 <h3>Are you sure you wish to delete this request?</h3>
506 <a class="btn btn-default btn-sm approve" href="?method=delete&illrequest_id=[% request.id %]&confirmed=1"><i class="fa fa-fw fa-check"></i>Yes</a>
507 <a class="btn btn-default btn-sm deny" href="?method=illview&illrequest_id=[% request.id %]"><i class="fa fa-fw fa-remove"></i>No</a>
512 [% ELSIF query_type == 'illview' %]
513 [% actions = request.available_actions %]
514 [% capabilities = request.capabilities %]
515 [% req_status = request.status %]
516 <h1>Manage ILL request</h1>
517 <div id="toolbar" class="btn-toolbar">
518 <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 %]">
519 <span class="fa fa-pencil"></span>
522 [% FOREACH action IN actions %]
523 [% IF action.method != 0 %]
524 <a title="[% action.ui_method_name %]" id="ill-toolbar-btn-[% action.id | lower %]" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method %]&illrequest_id=[% request.illrequest_id %]">
525 <span class="fa [% action.ui_method_icon %]"></span>
526 [% action.ui_method_name %]
531 <div id="ill-view-panel" class="panel panel-default">
532 <div class="panel-heading">
533 <h3>Request details</h3>
535 <div class="panel-body">
536 <h4>Details from library</h4>
538 <div class="orderid">
539 <span class="label orderid">Order ID:</span>
540 [% request.orderid || "N/A" %]
542 <div class="borrowernumber">
543 <span class="label borrowernumber">Patron:</span>
544 [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
545 <a href="[% borrowerlink %]" title="View borrower details">
546 [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" %]
550 <div class="biblio_id">
551 <span class="label biblio_id">Biblio ID:</span>
552 [% request.biblio_id || "N/A" %]
554 <div class="branchcode">
555 <span class="label branchcode">Library:</span>
556 [% Branches.GetName(request.branchcode) %]
559 <span class="label status">Status:</span>
560 [% capabilities.$req_status.name %]
562 <div class="updated">
563 <span class="label updated">Last updated:</span>
564 [% request.updated | $KohaDates with_hours => 1 %]
567 <span class="label medium">Request type:</span>
571 <span class="label cost">Cost:</span>
572 [% request.cost || "N/A" %]
575 <span class="label req_id">Request number:</span>
576 [% request.id_prefix _ request.illrequest_id %]
578 <div class="notesstaff">
579 <span class="label notes_staff">Staff notes:</span>
580 <pre>[% request.notesstaff %]</pre>
582 <div class="notesopac">
583 <span class="label notes_opac">Notes:</span>
584 <pre>[% request.notesopac %]</pre>
588 <h4>Details from supplier ([% request.backend %])</h4>
589 [% FOREACH meta IN request.metadata %]
590 <div class="requestmeta-[% meta.key %]">
591 <span class="label">[% meta.key %]:</span>
597 <h3><a id="toggle_requestattributes" href="#">Toggle full supplier metadata</a></h3>
598 <div id="requestattributes" class="content_hidden">
599 [% FOREACH attr IN request.illrequestattributes %]
600 <div class="requestattr-[% attr.type %]">
601 <span class="label">[% attr.type %]:</span>
611 [% ELSIF query_type == 'illlist' %]
613 <h1>View ILL requests</h1>
615 <h3>Details for all requests</h3>
617 <table id="ill-requests">
619 <tr id="illview-header">
620 [% FOR column IN columns %]
621 <th>[% PROCESS translate_column column=column %]</th>
625 <tbody id="illview-body">
630 <!-- Custom Backend Action -->
631 [% INCLUDE $whole.template %]
641 [% PROCESS backend_jsinclude %]
645 [% INCLUDE 'intranet-bottom.inc' %]