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_[% KOHA_VERSION %].js"></script>
9 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].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" class="required">Select partner libraries:</label>
371 <select size="5" multiple="true" id="partners" name="partners" required="required">
372 [% FOREACH partner IN whole.value.partners %]
373 <option value=[% partner.email %]>
374 [% partner.branchcode _ " - " _ partner.surname %]
381 <label for="subject" class="required">Subject Line</label>
382 <input type="text" name="subject" id="subject" type="text" value="[% whole.value.draft.subject %]" required="required" />
385 <label for="body" class="required">Email text:</label>
386 <textarea name="body" id="body" rows="20" cols="80" required="required">[% whole.value.draft.body %]</textarea>
389 <input type="hidden" value="generic_confirm" name="method">
390 <input type="hidden" value="draft" name="stage">
391 <input type="hidden" value="[% request.illrequest_id %]" name="illrequest_id">
393 <fieldset class="action">
394 <input type="submit" class="btn btn-default" value="Send email"/>
395 <span><a href="[% ill_url %]" title="Return to request details">Cancel</a></span>
399 <fieldset class="rows">
400 <legend>Interlibrary loan request details</legend>
401 <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
402 <p>Be sure to provide email addresses for these patrons.</p>
403 <p><span><a href="[% ill_url %]" title="Return to request details">Cancel</a></span></p>
406 <!-- generic_confirm ends here -->
408 [% ELSIF query_type == 'edit_action' %]
409 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
410 <fieldset class="rows">
411 <legend>Request details</legend>
413 <li class="borrowernumber">
414 <label for="borrowernumber">Patron ID:</label>
415 <input name="borrowernumber" id="borrowernumber" type="text" value="[% request.borrowernumber %]">
417 <li class="biblio_id">
418 <label for="biblio_id" class="biblio_id">Biblio ID:</label>
419 <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id %]">
421 <li class="branchcode">
422 <label for="library" class="branchcode">Library:</label>
423 <select name="branchcode" id="library">
424 [% PROCESS options_for_libraries libraries => Branches.all( selected => request.branchcode ) %]
428 <label class="status">Status:</label>
429 [% stat = request.status %]
430 [% request.capabilities.$stat.name %]
433 <label class="updated">Last updated:</label>
434 [% request.updated | $KohaDates with_hours => 1 %]
437 <label class="medium">Request type:</label>
441 <label class="cost">Cost:</label>
442 [% request.cost || 'N/A' %]
445 <label class="req_id">Request number:</label>
446 [% request.id_prefix _ request.illrequest_id %]
448 <li class="notesstaff">
449 <label for="notesstaff" class="notesstaff">Staff notes:</label>
450 <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff %]</textarea>
452 <li class="notesopac">
453 <label for="notesopac" class="notesopac">Opac notes:</label>
454 <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac %]</textarea>
458 <fieldset class="action">
459 <input type="hidden" value="edit_action" name="method">
460 <input type="hidden" value="form" name="stage">
461 <input type="hidden" value="[% request.illrequest_id %]" name="illrequest_id">
462 <input type="submit" value="Submit">
463 <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id %]">Cancel</a>
467 [% ELSIF query_type == 'delete_confirm' %]
469 <div class="dialog alert">
470 <h3>Are you sure you wish to delete this request?</h3>
471 <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
472 <input type="hidden" name="method" value="delete" />
473 <input type="hidden" name="confirmed" value="1" />
474 <input type="hidden" name="illrequest_id" value="[% request.id %]" />
475 <button type="submit" class="btn btn-default btn-sm approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
477 <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>
480 [% ELSIF query_type == 'illview' %]
481 [% actions = request.available_actions %]
482 [% capabilities = request.capabilities %]
483 [% req_status = request.status %]
484 <h1>Manage ILL request</h1>
485 <div id="toolbar" class="btn-toolbar">
486 <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 %]">
487 <span class="fa fa-pencil"></span>
490 [% FOREACH action IN actions %]
491 [% IF action.method != 0 %]
492 <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 %]">
493 <span class="fa [% action.ui_method_icon %]"></span>
494 [% action.ui_method_name %]
499 <div id="ill-view-panel" class="panel panel-default">
500 <div class="panel-heading">
501 <h3>Request details</h3>
503 <div class="panel-body">
504 <h4>Details from library</h4>
506 <div class="orderid">
507 <span class="label orderid">Order ID:</span>
508 [% request.orderid || "N/A" %]
510 <div 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 %]" title="View borrower details">
514 [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" %]
518 <div class="biblio_id">
519 <span class="label biblio_id">Biblio ID:</span>
520 [% request.biblio_id || "N/A" %]
522 <div class="branchcode">
523 <span class="label branchcode">Library:</span>
524 [% Branches.GetName(request.branchcode) %]
527 <span class="label status">Status:</span>
528 [% capabilities.$req_status.name %]
530 <div class="updated">
531 <span class="label updated">Last updated:</span>
532 [% request.updated | $KohaDates with_hours => 1 %]
535 <span class="label medium">Request type:</span>
539 <span class="label cost">Cost:</span>
540 [% request.cost || "N/A" %]
543 <span class="label req_id">Request number:</span>
544 [% request.id_prefix _ request.illrequest_id %]
546 <div class="notesstaff">
547 <span class="label notes_staff">Staff notes:</span>
548 <pre>[% request.notesstaff %]</pre>
550 <div class="notesopac">
551 <span class="label notes_opac">Notes:</span>
552 <pre>[% request.notesopac %]</pre>
556 <h4>Details from supplier ([% request.backend %])</h4>
557 [% FOREACH meta IN request.metadata %]
558 <div class="requestmeta-[% meta.key %]">
559 <span class="label">[% meta.key %]:</span>
565 <h3><a id="toggle_requestattributes" href="#">Toggle full supplier metadata</a></h3>
566 <div id="requestattributes" class="content_hidden">
567 [% FOREACH attr IN request.illrequestattributes %]
568 <div class="requestattr-[% attr.type %]">
569 <span class="label">[% attr.type %]:</span>
579 [% ELSIF query_type == 'illlist' %]
581 <h1>View ILL requests</h1>
583 <h3>Details for all requests</h3>
585 <table id="ill-requests">
587 <tr id="illview-header">
595 <th>Request number</th>
596 <th class="actions"></th>
599 <tbody id="illview-body">
604 <!-- Custom Backend Action -->
605 [% INCLUDE $whole.template %]
615 [% PROCESS backend_jsinclude %]
619 [% INCLUDE 'intranet-bottom.inc' %]