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
189 name: _("Bibliograpic Record ID")
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 [% PROCESS $whole.template %]
322 [% ELSIF query_type == 'confirm' %]
323 <h1>Confirm ILL request</h1>
324 [% PROCESS $whole.template %]
326 [% ELSIF query_type == 'cancel' and !whole.error %]
327 <h1>Cancel a confirmed request</h1>
328 [% PROCESS $whole.template %]
330 [% ELSIF query_type == 'generic_confirm' %]
331 <h1>Place request with partner libraries</h1>
333 [% IF error == 'no_target_email' %]
335 No target email addresses found. Either select at least
336 one partner or check your ILL partner library records.
338 [% ELSIF error == 'no_library_email' %]
340 Your library has no usable email address. Please set it.
342 [% ELSIF error == 'unkown_error' %]
344 Unknown error processing your request. Contact your administrator.
348 <!-- Start of GENERIC_EMAIL case -->
349 [% IF whole.value.partners %]
350 [% ill_url = "/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=" _ request.illrequest_id %]
351 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
352 <fieldset class="rows">
353 <legend>Interlibrary loan request details</legend>
356 <label for="partner_filter">Filter partner libraries:</label>
357 <input type="text" id="partner_filter">
360 <label for="partners" class="required">Select partner libraries:</label>
361 <select size="5" multiple="true" id="partners" name="partners" required="required">
362 [% FOREACH partner IN whole.value.partners %]
363 <option value=[% partner.email | html %]>
364 [% partner.branchcode _ " - " _ partner.surname %]
371 <label for="subject" class="required">Subject Line</label>
372 <input type="text" name="subject" id="subject" type="text" value="[% whole.value.draft.subject | html %]" required="required" />
375 <label for="body" class="required">Email text:</label>
376 <textarea name="body" id="body" rows="20" cols="80" required="required">[% whole.value.draft.body | html %]</textarea>
379 <input type="hidden" value="generic_confirm" name="method">
380 <input type="hidden" value="draft" name="stage">
381 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
383 <fieldset class="action">
384 <input type="submit" class="btn btn-default" value="Send email"/>
385 <span><a href="[% ill_url | html %]" title="Return to request details">Cancel</a></span>
389 <fieldset class="rows">
390 <legend>Interlibrary loan request details</legend>
391 <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
392 <p>Be sure to provide email addresses for these patrons.</p>
393 <p><span><a href="[% ill_url | html %]" title="Return to request details">Cancel</a></span></p>
396 <!-- generic_confirm ends here -->
398 [% ELSIF query_type == 'edit_action' %]
399 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
400 <fieldset class="rows">
401 <legend>Request details</legend>
403 <li class="borrowernumber">
404 <label for="borrowernumber">Patron ID:</label>
405 [% request.borrowernumber | html %]
407 <li class="biblio_id">
408 <label for="biblio_id" class="biblio_id">Bibliographic record ID:</label>
409 <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id | html %]">
411 <li class="branchcode">
412 <label for="library" class="branchcode">Library:</label>
413 <select name="branchcode" id="library">
414 [% PROCESS options_for_libraries libraries => Branches.all( selected => request.branchcode ) %]
418 <label class="status">Status:</label>
419 [% stat = request.status | html %]
420 [% request.capabilities.$stat.name | html %]
423 <label class="updated">Last updated:</label>
424 [% request.updated | $KohaDates with_hours => 1 | html %]
427 <label class="medium">Request type:</label>
428 [% request.medium | html %]
431 <label class="cost">Cost:</label>
432 [% request.cost || 'N/A' | html %]
435 <label class="req_id">Request number:</label>
436 [% request.id_prefix _ request.illrequest_id | html %]
438 <li class="notesstaff">
439 <label for="notesstaff" class="notesstaff">Staff notes:</label>
440 <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff | html %]</textarea>
442 <li class="notesopac">
443 <label for="notesopac" class="notesopac">Opac notes:</label>
444 <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac | html %]</textarea>
448 <fieldset class="action">
449 <input type="hidden" value="edit_action" name="method">
450 <input type="hidden" value="form" name="stage">
451 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
452 <input type="hidden" value="[% request.borrowernumber | html %]" name="borrowernumber">
453 <input type="submit" value="Submit">
454 <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id | html %]">Cancel</a>
458 [% ELSIF query_type == 'delete_confirm' %]
460 <div class="dialog alert">
461 <h3>Are you sure you wish to delete this request?</h3>
462 <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
463 <input type="hidden" name="method" value="delete" />
464 <input type="hidden" name="confirmed" value="1" />
465 <input type="hidden" name="illrequest_id" value="[% request.id | html %]" />
466 <button type="submit" class="btn btn-default btn-sm approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
468 <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>
471 [% ELSIF query_type == 'illview' %]
472 [% req_status = request.status %]
473 <h1>Manage ILL request</h1>
474 <div id="toolbar" class="btn-toolbar">
475 <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 %]">
476 <span class="fa fa-pencil"></span>
479 [% FOREACH action IN request.available_actions %]
480 [% IF action.method != 0 %]
481 <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 %]">
482 <span class="fa [% action.ui_method_icon | html %]"></span>
483 [% action.ui_method_name | html %]
487 <a title="Display supplier metadata" id="ill-request-display-metadata" class="btn btn-sm btn-default pull-right" href="#">
488 <span class="fa fa-eye"></span>
489 Display supplier metadata
492 <div id="ill-view-panel" class="panel panel-default">
493 <div class="panel-heading">
494 <h3>Request details</h3>
496 <div class="panel-body">
497 <h4>Details from library</h4>
499 <div class="orderid">
500 <span class="label orderid">Order ID:</span>
501 [% request.orderid || "N/A" | html %]
503 <div class="borrowernumber">
504 <span class="label borrowernumber">Patron:</span>
505 [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
506 <a href="[% borrowerlink | html %]" title="View borrower details">
507 [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %]
511 <div class="biblio_id">
512 <span class="label biblio_id">Bibliographic record ID:</span>
513 [% request.biblio_id || "N/A" | html %]
515 <div class="branchcode">
516 <span class="label branchcode">Library:</span>
517 [% Branches.GetName(request.branchcode) | html %]
520 <span class="label status">Status:</span>
521 [% request.capabilities.$req_status.name | html %]
523 <div class="updated">
524 <span class="label updated">Last updated:</span>
525 [% request.updated | $KohaDates with_hours => 1 | html %]
528 <span class="label medium">Request type:</span>
529 [% request.medium | html %]
532 <span class="label cost">Cost:</span>
533 [% request.cost || "N/A" | html %]
536 <span class="label req_id">Request number:</span>
537 [% request.id_prefix _ request.illrequest_id | html %]
539 <div class="notesstaff">
540 <span class="label notes_staff">Staff notes:</span>
541 <pre>[% request.notesstaff | html %]</pre>
543 <div class="notesopac">
544 <span class="label notes_opac">Notes:</span>
545 <pre>[% request.notesopac | html %]</pre>
549 <h4>Details from supplier ([% request.backend | html %])</h4>
550 [% FOREACH meta IN request.metadata %]
551 <div class="requestmeta-[% meta.key | html %]">
552 <span class="label">[% meta.key | html %]:</span>
553 [% meta.value | html %]
560 <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
561 <div class="modal-dialog">
562 <div class="modal-content">
563 <div class="modal-header">
564 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
565 <h3 id="dataPreviewLabel"> Supplier metadata</h3>
567 <div class="modal-body">
568 <div id="requestattributes">
569 [% FOREACH attr IN request.illrequestattributes %]
570 <div class="requestattr-[% attr.type | html %]">
571 <span class="label">[% attr.type | html %]:</span>
572 [% attr.value | html %]
577 <div class="modal-footer">
578 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
584 [% ELSIF query_type == 'illlist' %]
586 <h1>View ILL requests</h1>
588 <h3>Details for all requests</h3>
590 <table id="ill-requests">
592 <tr id="illview-header">
596 <th>Bibliographic record ID</th>
600 <th>Request number</th>
601 <th class="actions"></th>
604 <tbody id="illview-body">
609 <!-- Custom Backend Action -->
610 [% INCLUDE $whole.template %]
620 [% PROCESS backend_jsinclude %]
624 [% INCLUDE 'intranet-bottom.inc' %]