6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › ILL requests ›</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
10 [% Asset.css("css/datatables.css") %]
11 [% INCLUDE 'datatables.inc' %]
12 <script type="text/javascript">
14 $(document).ready(function() {
16 // Illview Datatable setup
18 // Fields we don't want to display
33 // Fields we need to expand (flatten)
40 // This is auto populated
43 // The core fields that should be displayed first
56 // Remove any fields we're ignoring
57 var removeIgnore = function(dataObj) {
58 dataObj.forEach(function(thisRow) {
59 ignore.forEach(function(thisIgnore) {
60 if (thisRow.hasOwnProperty(thisIgnore)) {
61 delete thisRow[thisIgnore];
67 // Expand any fields we're expanding
68 var expandExpand = function(row) {
69 expand.forEach(function(thisExpand) {
70 if (row.hasOwnProperty(thisExpand)) {
71 if (!expanded.hasOwnProperty(thisExpand)) {
72 expanded[thisExpand] = [];
74 var expandObj = row[thisExpand];
75 Object.keys(expandObj).forEach(
76 function(thisExpandCol) {
77 var expColName = thisExpand + '_' + thisExpandCol;
78 // Keep a list of fields that have been expanded
79 // so we can create toggle links for them
80 if (expanded[thisExpand].indexOf(expColName) == -1) {
81 expanded[thisExpand].push(expColName);
83 expandObj[expColName] =
84 expandObj[thisExpandCol];
85 delete expandObj[thisExpandCol];
88 $.extend(true, row, expandObj);
89 delete row[thisExpand];
94 // Build a de-duped list of all column names
96 core.map(function(thisCore) {
97 allCols[thisCore] = 1;
100 // Strip the expand prefix if it exists, we do this for display
101 var stripPrefix = function(value) {
102 expand.forEach(function(thisExpand) {
103 var regex = new RegExp(thisExpand + '_', 'g');
104 value = value.replace(regex, '');
109 // Our 'render' function for borrowerlink
110 var createPatronLink = function(data, type, row) {
111 return '<a title="' + _("View borrower details") + '" ' +
112 'href="/cgi-bin/koha/members/moremember.pl?' +
113 'borrowernumber='+row.borrowernumber+'">' +
114 row.patron_firstname + ' ' + row.patron_surname +
118 // Our 'render' function for the library name
119 var createLibrary = function(data, type, row) {
120 return row.library.branchname;
123 // Render function for request ID
124 var createRequestId = function(data, type, row) {
125 return row.id_prefix + row.illrequest_id;
128 // Render function for request status
129 var createStatus = function(data, type, row, meta) {
130 var origData = meta.settings.oInit.originalData;
131 if (origData.length > 0) {
132 var status_name = meta.settings.oInit.originalData[0].capabilities[
135 switch( status_name ) {
137 return _("New request");
139 return _("Requested");
140 case "Requested from partners":
141 return _("Requested from partners");
142 case "Request reverted":
143 return _("Request reverted");
144 case "Queued request":
145 return _("Queued request");
146 case "Cancellation requested":
147 return _("Cancellation requested");
149 return _("Completed");
150 case "Delete request":
151 return _("Delete request");
160 // Render function for creating a row's action link
161 var createActionLink = function(data, type, row) {
162 return '<a class="btn btn-default btn-sm" ' +
163 'href="/cgi-bin/koha/ill/ill-requests.pl?' +
164 'method=illview&illrequest_id=' +
166 '">' + _("Manage request") + '</a>';
169 // Columns that require special treatment
173 func: createActionLink
177 func: createPatronLink
180 name: _("Request number"),
181 func: createRequestId
196 // Toggle request attributes in Illview
197 $('#toggle_requestattributes').on('click', function(e) {
199 $('#requestattributes').toggleClass('content_hidden');
202 // Filter partner list
203 $('#partner_filter').keyup(function() {
204 var needle = $('#partner_filter').val();
205 $('#partners > option').each(function() {
206 var regex = new RegExp(needle, 'i');
208 needle.length == 0 ||
209 $(this).is(':selected') ||
210 $(this).text().match(regex)
219 // Get our data from the API and process it prior to passing
222 '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
224 var data = JSON.parse(ajax.responseText);
225 // Make a copy, we'll be removing columns next and need
226 // to be able to refer to data that has been removed
227 var dataCopy = $.extend(true, [], data);
228 // Remove all columns we're not interested in
229 removeIgnore(dataCopy);
230 // Expand columns that need it and create an array
231 // of all column names
232 $.each(dataCopy, function(k, row) {
236 // Assemble an array of column definitions for passing
239 Object.keys(allCols).forEach(function(thisCol) {
240 // Create the base column object
245 // We may need to process the data going in this
246 // column, so do it if necessary
248 specialCols.hasOwnProperty(thisCol) &&
249 specialCols[thisCol].hasOwnProperty('func')
251 colObj.render = specialCols[thisCol].func;
253 colObj.data = thisCol;
255 colData.push(colObj);
258 // Initialise the datatable
259 $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, {
260 'aoColumnDefs': [ // Last column shouldn't be sortable or searchable
262 'aTargets': [ 'actions' ],
267 'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending
268 'processing': true, // Display a message when manipulating
269 'iDisplayLength': 10, // 10 results per page
270 'sPaginationType': "full_numbers", // Pagination display
271 'deferRender': true, // Improve performance on big datasets
274 'originalData': data // Enable render functions to access
285 <body id="illrequests" class="ill">
286 [% INCLUDE 'header.inc' %]
287 [% INCLUDE 'cat-search.inc' %]
289 <div id="breadcrumbs">
290 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
291 <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
292 [% IF query_type == 'create' %]
294 [% ELSIF query_type == 'status' %]
299 <div id="doc3" class="yui-t2">
302 <div id="interlibraryloans" class="yui-b">
303 [% IF !backends_available %]
304 <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>
306 [% INCLUDE 'ill-toolbar.inc' %]
309 <h1>Error performing operation</h1>
310 <!-- Dispatch on Status -->
311 <p>We encountered an error:</p>
313 <pre>[% whole.message %] ([% whole.status %])</pre>
317 [% IF query_type == 'create' %]
318 <h1>New ILL request</h1>
319 [% IF whole.stage == 'copyrightclearance' %]
322 [% Koha.Preference('ILLModuleCopyrightClearance') %]
324 <a href="?method=create&stage=copyrightclearance&backend=[% whole.value.backend %]"
325 class="btn btn-sm btn-default btn-group"><i class="fa fa-check">Yes</i></a>
326 <a href="/cgi-bin/koha/ill/ill-requests.pl"
327 class="btn btn-sm btn-default btn-group"><i class="fa fa-times">No</i></a>
330 [% PROCESS $whole.template %]
333 [% ELSIF query_type == 'confirm' %]
334 <h1>Confirm ILL request</h1>
335 [% PROCESS $whole.template %]
337 [% ELSIF query_type == 'cancel' and !whole.error %]
338 <h1>Cancel a confirmed request</h1>
339 [% PROCESS $whole.template %]
341 [% ELSIF query_type == 'generic_confirm' %]
342 <h1>Place request with partner libraries</h1>
344 [% IF error == 'no_target_email' %]
346 No target email addresses found. Either select at least
347 one partner or check your ILL partner library records.
349 [% ELSIF error == 'no_library_email' %]
351 Your library has no usable email address. Please set it.
353 [% ELSIF error == 'unkown_error' %]
355 Unknown error processing your request. Contact your administrator.
359 <!-- Start of GENERIC_EMAIL case -->
360 [% IF whole.value.partners %]
361 [% ill_url = "/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=" _ request.illrequest_id %]
362 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
363 <fieldset class="rows">
364 <legend>Interlibrary loan request details</legend>
367 <label for="partner_filter">Filter partner libraries:</label>
368 <input type="text" id="partner_filter">
371 <label for="partners" class="required">Select partner libraries:</label>
372 <select size="5" multiple="true" id="partners" name="partners" required="required">
373 [% FOREACH partner IN whole.value.partners %]
374 <option value=[% partner.email %]>
375 [% partner.branchcode _ " - " _ partner.surname %]
382 <label for="subject" class="required">Subject Line</label>
383 <input type="text" name="subject" id="subject" type="text" value="[% whole.value.draft.subject %]" required="required" />
386 <label for="body" class="required">Email text:</label>
387 <textarea name="body" id="body" rows="20" cols="80" required="required">[% whole.value.draft.body %]</textarea>
390 <input type="hidden" value="generic_confirm" name="method">
391 <input type="hidden" value="draft" name="stage">
392 <input type="hidden" value="[% request.illrequest_id %]" name="illrequest_id">
394 <fieldset class="action">
395 <input type="submit" class="btn btn-default" value="Send email"/>
396 <span><a href="[% ill_url %]" title="Return to request details">Cancel</a></span>
400 <fieldset class="rows">
401 <legend>Interlibrary loan request details</legend>
402 <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
403 <p>Be sure to provide email addresses for these patrons.</p>
404 <p><span><a href="[% ill_url %]" title="Return to request details">Cancel</a></span></p>
407 <!-- generic_confirm ends here -->
409 [% ELSIF query_type == 'edit_action' %]
410 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
411 <fieldset class="rows">
412 <legend>Request details</legend>
414 <li class="borrowernumber">
415 <label for="borrowernumber">Patron ID:</label>
416 <input name="borrowernumber" id="borrowernumber" type="text" value="[% request.borrowernumber %]">
418 <li class="biblio_id">
419 <label for="biblio_id" class="biblio_id">Biblio ID:</label>
420 <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id %]">
422 <li class="branchcode">
423 <label for="library" class="branchcode">Library:</label>
424 <select name="branchcode" id="library">
425 [% PROCESS options_for_libraries libraries => Branches.all( selected => request.branchcode ) %]
429 <label class="status">Status:</label>
430 [% stat = request.status %]
431 [% request.capabilities.$stat.name %]
434 <label class="updated">Last updated:</label>
435 [% request.updated | $KohaDates with_hours => 1 %]
438 <label class="medium">Request type:</label>
442 <label class="cost">Cost:</label>
443 [% request.cost || 'N/A' %]
446 <label class="req_id">Request number:</label>
447 [% request.id_prefix _ request.illrequest_id %]
449 <li class="notesstaff">
450 <label for="notesstaff" class="notesstaff">Staff notes:</label>
451 <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff %]</textarea>
453 <li class="notesopac">
454 <label for="notesopac" class="notesopac">Opac notes:</label>
455 <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac %]</textarea>
459 <fieldset class="action">
460 <input type="hidden" value="edit_action" name="method">
461 <input type="hidden" value="form" name="stage">
462 <input type="hidden" value="[% request.illrequest_id %]" name="illrequest_id">
463 <input type="submit" value="Submit">
464 <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id %]">Cancel</a>
468 [% ELSIF query_type == 'delete_confirm' %]
470 <div class="dialog alert">
471 <h3>Are you sure you wish to delete this request?</h3>
472 <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
473 <input type="hidden" name="method" value="delete" />
474 <input type="hidden" name="confirmed" value="1" />
475 <input type="hidden" name="illrequest_id" value="[% request.id %]" />
476 <button type="submit" class="btn btn-default btn-sm approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
478 <a class="btn btn-default btn-sm deny" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id %]"><i class="fa fa-fw fa-remove"></i>No, do not delete</a>
481 [% ELSIF query_type == 'illview' %]
482 [% actions = request.available_actions %]
483 [% capabilities = request.capabilities %]
484 [% req_status = request.status %]
485 <h1>Manage ILL request</h1>
486 <div id="toolbar" class="btn-toolbar">
487 <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 %]">
488 <span class="fa fa-pencil"></span>
491 [% FOREACH action IN actions %]
492 [% IF action.method != 0 %]
493 <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 %]">
494 <span class="fa [% action.ui_method_icon %]"></span>
495 [% action.ui_method_name %]
500 <div id="ill-view-panel" class="panel panel-default">
501 <div class="panel-heading">
502 <h3>Request details</h3>
504 <div class="panel-body">
505 <h4>Details from library</h4>
507 <div class="orderid">
508 <span class="label orderid">Order ID:</span>
509 [% request.orderid || "N/A" %]
511 <div class="borrowernumber">
512 <span class="label borrowernumber">Patron:</span>
513 [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
514 <a href="[% borrowerlink %]" title="View borrower details">
515 [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" %]
519 <div class="biblio_id">
520 <span class="label biblio_id">Biblio ID:</span>
521 [% request.biblio_id || "N/A" %]
523 <div class="branchcode">
524 <span class="label branchcode">Library:</span>
525 [% Branches.GetName(request.branchcode) %]
528 <span class="label status">Status:</span>
529 [% capabilities.$req_status.name %]
531 <div class="updated">
532 <span class="label updated">Last updated:</span>
533 [% request.updated | $KohaDates with_hours => 1 %]
536 <span class="label medium">Request type:</span>
540 <span class="label cost">Cost:</span>
541 [% request.cost || "N/A" %]
544 <span class="label req_id">Request number:</span>
545 [% request.id_prefix _ request.illrequest_id %]
547 <div class="notesstaff">
548 <span class="label notes_staff">Staff notes:</span>
549 <pre>[% request.notesstaff %]</pre>
551 <div class="notesopac">
552 <span class="label notes_opac">Notes:</span>
553 <pre>[% request.notesopac %]</pre>
557 <h4>Details from supplier ([% request.backend %])</h4>
558 [% FOREACH meta IN request.metadata %]
559 <div class="requestmeta-[% meta.key %]">
560 <span class="label">[% meta.key %]:</span>
566 <h3><a id="toggle_requestattributes" href="#">Toggle full supplier metadata</a></h3>
567 <div id="requestattributes" class="content_hidden">
568 [% FOREACH attr IN request.illrequestattributes %]
569 <div class="requestattr-[% attr.type %]">
570 <span class="label">[% attr.type %]:</span>
580 [% ELSIF query_type == 'illlist' %]
582 <h1>View ILL requests</h1>
584 <h3>Details for all requests</h3>
586 <table id="ill-requests">
588 <tr id="illview-header">
596 <th>Request number</th>
597 <th class="actions"></th>
600 <tbody id="illview-body">
605 <!-- Custom Backend Action -->
606 [% INCLUDE $whole.template %]
616 [% PROCESS backend_jsinclude %]
620 [% INCLUDE 'intranet-bottom.inc' %]