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 biblio_id
120 var createBiblioLink = function(data, type, row) {
121 return (row.biblio_id) ?
122 '<a title="' + _("View biblio details") + '" ' +
123 'href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' +
124 row.biblio_id + '">' +
129 // Our 'render' function for the library name
130 var createLibrary = function(data, type, row) {
131 return row.library.branchname;
134 // Render function for request ID
135 var createRequestId = function(data, type, row) {
136 return row.id_prefix + row.illrequest_id;
139 // Render function for request status
140 var createStatus = function(data, type, row, meta) {
141 var origData = meta.settings.oInit.originalData;
142 if (origData.length > 0) {
143 var status_name = meta.settings.oInit.originalData[0].capabilities[
146 switch( status_name ) {
148 return _("New request");
150 return _("Requested");
151 case "Requested from partners":
152 return _("Requested from partners");
153 case "Request reverted":
154 return _("Request reverted");
155 case "Queued request":
156 return _("Queued request");
157 case "Cancellation requested":
158 return _("Cancellation requested");
160 return _("Completed");
161 case "Delete request":
162 return _("Delete request");
171 // Render function for creating a row's action link
172 var createActionLink = function(data, type, row) {
173 return '<a class="btn btn-default btn-sm" ' +
174 'href="/cgi-bin/koha/ill/ill-requests.pl?' +
175 'method=illview&illrequest_id=' +
177 '">' + _("Manage request") + '</a>';
180 // Columns that require special treatment
184 func: createActionLink
188 func: createPatronLink
191 name: _("Request number"),
192 func: createRequestId
199 name: _("Bibliograpic record ID"),
200 func: createBiblioLink
208 // Filter partner list
209 $('#partner_filter').keyup(function() {
210 var needle = $('#partner_filter').val();
211 $('#partners > option').each(function() {
212 var regex = new RegExp(needle, 'i');
214 needle.length == 0 ||
215 $(this).is(':selected') ||
216 $(this).text().match(regex)
225 // Display the modal containing request supplier metadata
226 $('#ill-request-display-metadata').on('click', function(e) {
228 $('#dataPreview').modal({show:true});
231 // Get our data from the API and process it prior to passing
234 '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
236 var data = JSON.parse(ajax.responseText);
237 // Make a copy, we'll be removing columns next and need
238 // to be able to refer to data that has been removed
239 var dataCopy = $.extend(true, [], data);
240 // Remove all columns we're not interested in
241 removeIgnore(dataCopy);
242 // Expand columns that need it and create an array
243 // of all column names
244 $.each(dataCopy, function(k, row) {
248 // Assemble an array of column definitions for passing
251 Object.keys(allCols).forEach(function(thisCol) {
252 // Create the base column object
257 // We may need to process the data going in this
258 // column, so do it if necessary
260 specialCols.hasOwnProperty(thisCol) &&
261 specialCols[thisCol].hasOwnProperty('func')
263 colObj.render = specialCols[thisCol].func;
265 colObj.data = thisCol;
267 colData.push(colObj);
270 // Initialise the datatable
271 $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, {
272 'aoColumnDefs': [ // Last column shouldn't be sortable or searchable
274 'aTargets': [ 'actions' ],
279 'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending
280 'processing': true, // Display a message when manipulating
281 'iDisplayLength': 10, // 10 results per page
282 'sPaginationType': "full_numbers", // Pagination display
283 'deferRender': true, // Improve performance on big datasets
286 'originalData': data // Enable render functions to access
297 <body id="illrequests" class="ill">
298 [% INCLUDE 'header.inc' %]
299 [% INCLUDE 'cat-search.inc' %]
301 <div id="breadcrumbs">
302 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
303 <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
304 [% IF query_type == 'create' %]
306 [% ELSIF query_type == 'status' %]
311 <div id="doc3" class="yui-t2">
314 <div id="interlibraryloans" class="yui-b">
315 [% IF !backends_available %]
316 <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>
318 [% INCLUDE 'ill-toolbar.inc' %]
321 <h1>Error performing operation</h1>
322 <!-- Dispatch on Status -->
323 <p>We encountered an error:</p>
325 <pre>[% whole.message | html %] ([% whole.status | html %])</pre>
329 [% IF query_type == 'create' %]
330 <h1>New ILL request</h1>
331 [% 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 | html %]>
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 | html %]" 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 | html %]</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 | html %]" name="illrequest_id">
394 <fieldset class="action">
395 <input type="submit" class="btn btn-default" value="Send email"/>
396 <span><a href="[% ill_url | html %]" 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 | html %]" 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 [% request.borrowernumber | html %]
418 <li class="biblio_id">
419 <label for="biblio_id" class="biblio_id">Bibliographic record ID:</label>
420 <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id | html %]">
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 | html %]
431 [% request.capabilities.$stat.name | html %]
434 <label class="updated">Last updated:</label>
435 [% request.updated | $KohaDates with_hours => 1 | html %]
438 <label class="medium">Request type:</label>
439 [% request.medium | html %]
442 <label class="cost">Cost:</label>
443 [% IF request.cost %][% request.cost | html %][% ELSE %]<span>N/A</span>[% END %]
445 <li class="price_paid">
446 <label class="price_paid">Price paid:</label>
447 <input name="price_paid" id="price_paid" type="text" value="[% request.price_paid | html %]">
450 <label class="req_id">Request number:</label>
451 [% request.id_prefix _ request.illrequest_id | html %]
453 <li class="notesstaff">
454 <label for="notesstaff" class="notesstaff">Staff notes:</label>
455 <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff | html %]</textarea>
457 <li class="notesopac">
458 <label for="notesopac" class="notesopac">Opac notes:</label>
459 <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac | html %]</textarea>
463 <fieldset class="action">
464 <input type="hidden" value="edit_action" name="method">
465 <input type="hidden" value="form" name="stage">
466 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
467 <input type="hidden" value="[% request.borrowernumber | html %]" name="borrowernumber">
468 <input type="submit" value="Submit">
469 <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id | html %]">Cancel</a>
473 [% ELSIF query_type == 'delete_confirm' %]
475 <div class="dialog alert">
476 <h3>Are you sure you wish to delete this request?</h3>
477 <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
478 <input type="hidden" name="method" value="delete" />
479 <input type="hidden" name="confirmed" value="1" />
480 <input type="hidden" name="illrequest_id" value="[% request.id | html %]" />
481 <button type="submit" class="btn btn-default btn-sm approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
483 <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>
486 [% ELSIF query_type == 'illview' %]
487 [% req_status = request.status %]
488 <h1>Manage ILL request</h1>
489 <div id="toolbar" class="btn-toolbar">
490 <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 %]">
491 <span class="fa fa-pencil"></span>
494 [% FOREACH action IN request.available_actions %]
495 [% IF action.method != 0 %]
496 <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 %]">
497 <span class="fa [% action.ui_method_icon | html %]"></span>
498 [% action.ui_method_name | html %]
502 <a title="Display supplier metadata" id="ill-request-display-metadata" class="btn btn-sm btn-default pull-right" href="#">
503 <span class="fa fa-eye"></span>
504 Display supplier metadata
507 <div id="ill-view-panel" class="panel panel-default">
508 <div class="panel-heading">
509 <h3>Request details</h3>
511 <div class="panel-body">
512 <h4>Details from library</h4>
514 <div class="orderid">
515 <span class="label orderid">Order ID:</span>
516 [% IF request.orderid %][% request.orderid | html %][% ELSE %]<span>N/A</span>[% END %]
518 <div class="borrowernumber">
519 <span class="label borrowernumber">Patron:</span>
520 [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
521 <a href="[% borrowerlink | html %]" title="View borrower details">
522 [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %]
526 <div class="biblio_id">
527 <span class="label biblio_id">Bibliographic record ID:</span>
528 [% IF request.biblio_id %]
529 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% request.biblio_id | html %]">[% request.biblio_id | html %]</a>
534 <div class="branchcode">
535 <span class="label branchcode">Library:</span>
536 [% Branches.GetName(request.branchcode) | html %]
539 <span class="label status">Status:</span>
540 [% request.capabilities.$req_status.name | html %]
542 <div class="updated">
543 <span class="label updated">Last updated:</span>
544 [% request.updated | $KohaDates with_hours => 1 | html %]
547 <span class="label medium">Request type:</span>
548 [% request.medium | html %]
551 <span class="label cost">Cost:</span>
552 [% IF request.cost %][% request.cost | html %][% ELSE %]<span>N/A</span>[% END %]
554 <div class="price_paid">
555 <span class="label price_paid">Price paid:</span>
556 [% IF request.price_paid %][% request.price_paid | html %][% ELSE %]<span>N/A</span>[% END %]
559 <span class="label req_id">Request number:</span>
560 [% request.id_prefix _ request.illrequest_id | html %]
562 <div class="notesstaff">
563 <span class="label notes_staff">Staff notes:</span>
564 <pre>[% request.notesstaff | html %]</pre>
566 <div class="notesopac">
567 <span class="label notes_opac">Notes:</span>
568 <pre>[% request.notesopac | html %]</pre>
572 <h4>Details from supplier ([% request.backend | html %])</h4>
573 [% FOREACH meta IN request.metadata %]
574 <div class="requestmeta-[% meta.key.replace('\s','_') | html %]">
575 <span class="label">[% meta.key | html %]:</span>
576 [% meta.value | html %]
583 <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
584 <div class="modal-dialog">
585 <div class="modal-content">
586 <div class="modal-header">
587 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
588 <h3 id="dataPreviewLabel"> Supplier metadata</h3>
590 <div class="modal-body">
591 <div id="requestattributes">
592 [% FOREACH attr IN request.illrequestattributes %]
593 <div class="requestattr-[% attr.type | html %]">
594 <span class="label">[% attr.type | html %]:</span>
595 [% attr.value | html %]
600 <div class="modal-footer">
601 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
607 [% ELSIF query_type == 'illlist' %]
609 <h1>View ILL requests</h1>
611 <h3>Details for all requests</h3>
613 <table id="ill-requests">
615 <tr id="illview-header">
619 <th>Bibliographic record ID</th>
623 <th>Request number</th>
624 <th class="actions"></th>
627 <tbody id="illview-body">
632 <!-- Custom Backend Action -->
633 [% PROCESS $whole.template %]
643 [% PROCESS backend_jsinclude %]
647 [% INCLUDE 'intranet-bottom.inc' %]