5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › ILL requests ›</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
9 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css">
10 [% INCLUDE 'datatables.inc' %]
11 <script type="text/javascript">
13 $(document).ready(function() {
15 // Illview Datatable setup
17 // Fields we don't want to display
32 // Fields we need to expand (flatten)
39 // This is auto populated
42 // The core fields that should be displayed first
55 // Remove any fields we're ignoring
56 var removeIgnore = function(dataObj) {
57 dataObj.forEach(function(thisRow) {
58 ignore.forEach(function(thisIgnore) {
59 if (thisRow.hasOwnProperty(thisIgnore)) {
60 delete thisRow[thisIgnore];
66 // Expand any fields we're expanding
67 var expandExpand = function(row) {
68 expand.forEach(function(thisExpand) {
69 if (row.hasOwnProperty(thisExpand)) {
70 if (!expanded.hasOwnProperty(thisExpand)) {
71 expanded[thisExpand] = [];
73 var expandObj = row[thisExpand];
74 Object.keys(expandObj).forEach(
75 function(thisExpandCol) {
76 var expColName = thisExpand + '_' + thisExpandCol;
77 // Keep a list of fields that have been expanded
78 // so we can create toggle links for them
79 if (expanded[thisExpand].indexOf(expColName) == -1) {
80 expanded[thisExpand].push(expColName);
82 expandObj[expColName] =
83 expandObj[thisExpandCol];
84 delete expandObj[thisExpandCol];
87 $.extend(true, row, expandObj);
88 delete row[thisExpand];
93 // Build a de-duped list of all column names
95 core.map(function(thisCore) {
96 allCols[thisCore] = 1;
99 // Strip the expand prefix if it exists, we do this for display
100 var stripPrefix = function(value) {
101 expand.forEach(function(thisExpand) {
102 var regex = new RegExp(thisExpand + '_', 'g');
103 value = value.replace(regex, '');
108 // Our 'render' function for borrowerlink
109 var createPatronLink = function(data, type, row) {
110 return '<a title="View borrower details" ' +
111 'href="/cgi-bin/koha/members/moremember.pl?' +
112 'borrowernumber='+row.borrowernumber+'">' +
113 row.patron_firstname + ' ' + row.patron_surname +
117 // Our 'render' function for the library name
118 var createLibrary = function(data, type, row) {
119 return row.library.branchname;
122 // Render function for request ID
123 var createRequestId = function(data, type, row) {
124 return row.id_prefix + row.illrequest_id;
127 // Render function for request status
128 var createStatus = function(data, type, row, meta) {
129 var origData = meta.settings.oInit.originalData;
130 if (origData.length > 0) {
131 var status_name = meta.settings.oInit.originalData[0].capabilities[
134 switch( status_name ) {
136 return _("New request");
138 return _("Requested");
139 case "Requested from partners":
140 return _("Requested from partners");
141 case "Request reverted":
142 return _("Request reverted");
143 case "Queued request":
144 return _("Queued request");
145 case "Cancellation requested":
146 return _("Cancellation requested");
148 return _("Completed");
149 case "Delete request":
150 return _("Delete request");
159 // Render function for creating a row's action link
160 var createActionLink = function(data, type, row) {
161 return '<a class="btn btn-default btn-sm" ' +
162 'href="/cgi-bin/koha/ill/ill-requests.pl?' +
163 'method=illview&illrequest_id=' +
165 '">' + _("Manage request") + '</a>';
168 // Columns that require special treatment
172 func: createActionLink
176 func: createPatronLink
179 name: _("Request number"),
180 func: createRequestId
195 // Toggle request attributes in Illview
196 $('#toggle_requestattributes').on('click', function(e) {
198 $('#requestattributes').toggleClass('content_hidden');
201 // Filter partner list
202 $('#partner_filter').keyup(function() {
203 var needle = $('#partner_filter').val();
204 $('#partners > option').each(function() {
205 var regex = new RegExp(needle, 'i');
207 needle.length == 0 ||
208 $(this).is(':selected') ||
209 $(this).text().match(regex)
218 // Get our data from the API and process it prior to passing
221 '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
223 var data = JSON.parse(ajax.responseText);
224 // Make a copy, we'll be removing columns next and need
225 // to be able to refer to data that has been removed
226 var dataCopy = $.extend(true, [], data);
227 // Remove all columns we're not interested in
228 removeIgnore(dataCopy);
229 // Expand columns that need it and create an array
230 // of all column names
231 $.each(dataCopy, function(k, row) {
235 // Assemble an array of column definitions for passing
238 Object.keys(allCols).forEach(function(thisCol) {
239 // Create the base column object
244 // We may need to process the data going in this
245 // column, so do it if necessary
247 specialCols.hasOwnProperty(thisCol) &&
248 specialCols[thisCol].hasOwnProperty('func')
250 colObj.render = specialCols[thisCol].func;
252 colObj.data = thisCol;
254 colData.push(colObj);
257 // Initialise the datatable
258 $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, {
259 'aoColumnDefs': [ // Last column shouldn't be sortable or searchable
261 'aTargets': [ 'actions' ],
266 'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending
267 'processing': true, // Display a message when manipulating
268 'iDisplayLength': 10, // 10 results per page
269 'sPaginationType': "full_numbers", // Pagination display
270 'deferRender': true, // Improve performance on big datasets
273 'originalData': data // Enable render functions to access
284 <body id="illrequests" class="ill">
285 [% INCLUDE 'header.inc' %]
286 [% INCLUDE 'cat-search.inc' %]
288 <div id="breadcrumbs">
289 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
290 <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
291 [% IF query_type == 'create' %]
293 [% ELSIF query_type == 'status' %]
298 <div id="doc3" class="yui-t2">
301 <div id="interlibraryloans" class="yui-b">
302 [% IF !backends_available %]
303 <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>
305 [% INCLUDE 'ill-toolbar.inc' %]
308 <h1>Error performing operation</h1>
309 <!-- Dispatch on Status -->
310 <p>We encountered an error:</p>
312 <pre>[% whole.message %] ([% whole.status %])</pre>
316 [% IF query_type == 'create' %]
317 <h1>New ILL request</h1>
318 [% IF whole.stage == 'copyrightclearance' %]
321 [% Koha.Preference('ILLModuleCopyrightClearance') %]
323 <a href="?method=create&stage=copyrightclearance&backend=[% whole.value.backend %]"
324 class="btn btn-sm btn-default btn-group"><i class="fa fa-check">Yes</i></a>
325 <a href="/cgi-bin/koha/ill/ill-requests.pl"
326 class="btn btn-sm btn-default btn-group"><i class="fa fa-times">No</i></a>
329 [% PROCESS $whole.template %]
332 [% ELSIF query_type == 'confirm' %]
333 <h1>Confirm ILL request</h1>
334 [% PROCESS $whole.template %]
336 [% ELSIF query_type == 'cancel' and !whole.error %]
337 <h1>Cancel a confirmed request</h1>
338 [% PROCESS $whole.template %]
340 [% ELSIF query_type == 'generic_confirm' %]
341 <h1>Place request with partner libraries</h1>
343 [% IF error == 'no_target_email' %]
345 No target email addresses found. Either select at least
346 one partner or check your ILL partner library records.
348 [% ELSIF error == 'no_library_email' %]
350 Your library has no usable email address. Please set it.
352 [% ELSIF error == 'unkown_error' %]
354 Unknown error processing your request. Contact your administrator.
358 <!-- Start of GENERIC_EMAIL case -->
359 [% IF whole.value.partners %]
360 [% ill_url = "/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=" _ request.illrequest_id %]
361 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
362 <fieldset class="rows">
363 <legend>Interlibrary loan request details</legend>
366 <label for="partner_filter">Filter partner libraries:</label>
367 <input type="text" id="partner_filter">
370 <label for="partners">Select partner libraries:</label>
371 <select size="5" multiple="true" id="partners"
373 [% FOREACH partner IN whole.value.partners %]
374 <option value=[% partner.email %]>
375 [% partner.branchcode _ " - " _ partner.surname %]
382 <label for="subject">Subject Line</label>
383 <input type="text" name="subject"
384 id="subject" type="text"
385 value="[% whole.value.draft.subject %]"/>
388 <label for="body">Email text:</label>
389 <textarea name="body" id="body" rows="20" cols="80">[% whole.value.draft.body %]</textarea>
392 <input type="hidden" value="generic_confirm" name="method">
393 <input type="hidden" value="draft" name="stage">
394 <input type="hidden" value="[% request.illrequest_id %]" name="illrequest_id">
396 <fieldset class="action">
397 <input type="submit" class="btn btn-default" value="Send email"/>
398 <span><a href="[% ill_url %]" title="Return to request details">Cancel</a></span>
402 <fieldset class="rows">
403 <legend>Interlibrary loan request details</legend>
404 <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
405 <p>Be sure to provide email addresses for these patrons.</p>
406 <p><span><a href="[% ill_url %]" title="Return to request details">Cancel</a></span></p>
409 <!-- generic_confirm ends here -->
411 [% ELSIF query_type == 'edit_action' %]
412 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
413 <fieldset class="rows">
414 <legend>Request details</legend>
416 <li class="borrowernumber">
417 <label for="borrowernumber">Patron ID:</label>
418 <input name="borrowernumber" id="borrowernumber" type="text" value="[% request.borrowernumber %]">
420 <li class="biblio_id">
421 <label for="biblio_id" class="biblio_id">Biblio ID:</label>
422 <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id %]">
424 <li class="branchcode">
425 <label for="branchcode" class="branchcode">Library:</label>
426 <select name="branchcode" id="branch">
427 [% FOREACH branch IN branches %]
428 [% IF ( branch.branchcode == request.branchcode ) %]
429 <option value="[% branch.branchcode %]" selected="selected">
430 [% branch.branchname %]
433 <option value="[% branch.branchcode %]">
434 [% branch.branchname %]
441 <label class="status">Status:</label>
442 [% stat = request.status %]
443 [% request.capabilities.$stat.name %]
446 <label class="updated">Last updated:</label>
447 [% request.updated | $KohaDates with_hours => 1 %]
450 <label class="medium">Request type:</label>
454 <label class="cost">Cost:</label>
455 [% request.cost || 'N/A' %]
458 <label class="req_id">Request number:</label>
459 [% request.id_prefix _ request.illrequest_id %]
461 <li class="notesstaff">
462 <label for="notesstaff" class="notesstaff">Staff notes:</label>
463 <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff %]</textarea>
465 <li class="notesopac">
466 <label for="notesopac" class="notesopac">Opac notes:</label>
467 <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac %]</textarea>
471 <fieldset class="action">
472 <input type="hidden" value="edit_action" name="method">
473 <input type="hidden" value="form" name="stage">
474 <input type="hidden" value="[% request.illrequest_id %]" name="illrequest_id">
475 <input type="submit" value="Submit">
476 <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id %]">Cancel</a>
480 [% ELSIF query_type == 'delete_confirm' %]
482 <div class="dialog alert">
483 <h3>Are you sure you wish to delete this request?</h3>
484 <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
485 <input type="hidden" name="method" value="delete" />
486 <input type="hidden" name="confirmed" value="1" />
487 <input type="hidden" name="illrequest_id" value="[% request.id %]" />
488 <button type="submit" class="btn btn-default btn-sm approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
490 <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>
493 [% ELSIF query_type == 'illview' %]
494 [% actions = request.available_actions %]
495 [% capabilities = request.capabilities %]
496 [% req_status = request.status %]
497 <h1>Manage ILL request</h1>
498 <div id="toolbar" class="btn-toolbar">
499 <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 %]">
500 <span class="fa fa-pencil"></span>
503 [% FOREACH action IN actions %]
504 [% IF action.method != 0 %]
505 <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 %]">
506 <span class="fa [% action.ui_method_icon %]"></span>
507 [% action.ui_method_name %]
512 <div id="ill-view-panel" class="panel panel-default">
513 <div class="panel-heading">
514 <h3>Request details</h3>
516 <div class="panel-body">
517 <h4>Details from library</h4>
519 <div class="orderid">
520 <span class="label orderid">Order ID:</span>
521 [% request.orderid || "N/A" %]
523 <div class="borrowernumber">
524 <span class="label borrowernumber">Patron:</span>
525 [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
526 <a href="[% borrowerlink %]" title="View borrower details">
527 [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" %]
531 <div class="biblio_id">
532 <span class="label biblio_id">Biblio ID:</span>
533 [% request.biblio_id || "N/A" %]
535 <div class="branchcode">
536 <span class="label branchcode">Library:</span>
537 [% Branches.GetName(request.branchcode) %]
540 <span class="label status">Status:</span>
541 [% capabilities.$req_status.name %]
543 <div class="updated">
544 <span class="label updated">Last updated:</span>
545 [% request.updated | $KohaDates with_hours => 1 %]
548 <span class="label medium">Request type:</span>
552 <span class="label cost">Cost:</span>
553 [% request.cost || "N/A" %]
556 <span class="label req_id">Request number:</span>
557 [% request.id_prefix _ request.illrequest_id %]
559 <div class="notesstaff">
560 <span class="label notes_staff">Staff notes:</span>
561 <pre>[% request.notesstaff %]</pre>
563 <div class="notesopac">
564 <span class="label notes_opac">Notes:</span>
565 <pre>[% request.notesopac %]</pre>
569 <h4>Details from supplier ([% request.backend %])</h4>
570 [% FOREACH meta IN request.metadata %]
571 <div class="requestmeta-[% meta.key %]">
572 <span class="label">[% meta.key %]:</span>
578 <h3><a id="toggle_requestattributes" href="#">Toggle full supplier metadata</a></h3>
579 <div id="requestattributes" class="content_hidden">
580 [% FOREACH attr IN request.illrequestattributes %]
581 <div class="requestattr-[% attr.type %]">
582 <span class="label">[% attr.type %]:</span>
592 [% ELSIF query_type == 'illlist' %]
594 <h1>View ILL requests</h1>
596 <h3>Details for all requests</h3>
598 <table id="ill-requests">
600 <tr id="illview-header">
608 <th>Request number</th>
609 <th class="actions"></th>
612 <tbody id="illview-body">
617 <!-- Custom Backend Action -->
618 [% INCLUDE $whole.template %]
628 [% PROCESS backend_jsinclude %]
632 [% INCLUDE 'intranet-bottom.inc' %]