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
55 'action' // Action should always be last
58 // Remove any fields we're ignoring
59 var removeIgnore = function(dataObj) {
60 dataObj.forEach(function(thisRow) {
61 ignore.forEach(function(thisIgnore) {
62 if (thisRow.hasOwnProperty(thisIgnore)) {
63 delete thisRow[thisIgnore];
69 // Expand any fields we're expanding
70 var expandExpand = function(row) {
71 expand.forEach(function(thisExpand) {
72 if (row.hasOwnProperty(thisExpand)) {
73 if (!expanded.hasOwnProperty(thisExpand)) {
74 expanded[thisExpand] = [];
76 var expandObj = row[thisExpand];
77 Object.keys(expandObj).forEach(
78 function(thisExpandCol) {
79 var expColName = thisExpand + '_' + thisExpandCol;
80 // Keep a list of fields that have been expanded
81 // so we can create toggle links for them
82 if (expanded[thisExpand].indexOf(expColName) == -1) {
83 expanded[thisExpand].push(expColName);
85 expandObj[expColName] =
86 expandObj[thisExpandCol];
87 delete expandObj[thisExpandCol];
90 $.extend(true, row, expandObj);
91 delete row[thisExpand];
96 // Build a de-duped list of all column names
98 core.map(function(thisCore) {
99 allCols[thisCore] = 1;
102 // Strip the expand prefix if it exists, we do this for display
103 var stripPrefix = function(value) {
104 expand.forEach(function(thisExpand) {
105 var regex = new RegExp(thisExpand + '_', 'g');
106 value = value.replace(regex, '');
111 // Our 'render' function for borrowerlink
112 var createPatronLink = function(data, type, row) {
113 return '<a title="' + _("View borrower details") + '" ' +
114 'href="/cgi-bin/koha/members/moremember.pl?' +
115 'borrowernumber='+row.borrowernumber+'">' +
116 row.patron_firstname + ' ' + row.patron_surname +
120 // Our 'render' function for biblio_id
121 var createBiblioLink = function(data, type, row) {
122 return (row.biblio_id) ?
123 '<a title="' + _("View biblio details") + '" ' +
124 'href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' +
125 row.biblio_id + '">' +
130 // Our 'render' function for the library name
131 var createLibrary = function(data, type, row) {
132 return row.library.branchname;
135 // Render function for request ID
136 var createRequestId = function(data, type, row) {
137 return row.id_prefix + row.illrequest_id;
140 // Render function for request status
141 var createStatus = function(data, type, row, meta) {
142 var origData = meta.settings.oInit.originalData;
143 if (origData.length > 0) {
144 var status_name = meta.settings.oInit.originalData[0].capabilities[
147 switch( status_name ) {
149 return _("New request");
151 return _("Requested");
152 case "Requested from partners":
153 return _("Requested from partners");
154 case "Request reverted":
155 return _("Request reverted");
156 case "Queued request":
157 return _("Queued request");
158 case "Cancellation requested":
159 return _("Cancellation requested");
161 return _("Completed");
162 case "Delete request":
163 return _("Delete request");
172 // Render function for creating a row's action link
173 var createActionLink = function(data, type, row) {
174 return '<a class="btn btn-default btn-sm" ' +
175 'href="/cgi-bin/koha/ill/ill-requests.pl?' +
176 'method=illview&illrequest_id=' +
178 '">' + _("Manage request") + '</a>';
181 // Columns that require special treatment
185 func: createActionLink
189 func: createPatronLink
192 name: _("Request number"),
193 func: createRequestId
200 name: _("Bibliograpic record ID"),
201 func: createBiblioLink
209 // Toggle request attributes in Illview
210 $('#toggle_requestattributes').on('click', function(e) {
212 $('#requestattributes').toggleClass('content_hidden');
215 // Toggle new comment form in Illview
216 $('#toggle_addcomment').on('click', function(e) {
218 $('#addcomment').toggleClass('content_hidden');
221 // Filter partner list
222 $('#partner_filter').keyup(function() {
223 var needle = $('#partner_filter').val();
224 $('#partners > option').each(function() {
225 var regex = new RegExp(needle, 'i');
227 needle.length == 0 ||
228 $(this).is(':selected') ||
229 $(this).text().match(regex)
238 // Display the modal containing request supplier metadata
239 $('#ill-request-display-metadata').on('click', function(e) {
241 $('#dataPreview').modal({show:true});
244 // Get our data from the API and process it prior to passing
247 '/api/v1/illrequests?embed=metadata,patron,capabilities,library,comments'
249 var data = JSON.parse(ajax.responseText);
250 // Make a copy, we'll be removing columns next and need
251 // to be able to refer to data that has been removed
252 var dataCopy = $.extend(true, [], data);
253 // Remove all columns we're not interested in
254 removeIgnore(dataCopy);
255 // Expand columns that need it and create an array
256 // of all column names
257 $.each(dataCopy, function(k, row) {
261 // Assemble an array of column definitions for passing
264 Object.keys(allCols).forEach(function(thisCol) {
265 // Create the base column object
270 // We may need to process the data going in this
271 // column, so do it if necessary
273 specialCols.hasOwnProperty(thisCol) &&
274 specialCols[thisCol].hasOwnProperty('func')
276 colObj.render = specialCols[thisCol].func;
278 colObj.data = thisCol;
280 colData.push(colObj);
283 // Initialise the datatable
284 $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, {
285 'aoColumnDefs': [ // Last column shouldn't be sortable or searchable
287 'aTargets': [ 'actions' ],
292 'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending
293 'processing': true, // Display a message when manipulating
294 'iDisplayLength': 10, // 10 results per page
295 'sPaginationType': "full_numbers", // Pagination display
296 'deferRender': true, // Improve performance on big datasets
299 'originalData': data // Enable render functions to access
310 <body id="illrequests" class="ill">
311 [% INCLUDE 'header.inc' %]
312 [% INCLUDE 'cat-search.inc' %]
314 <div id="breadcrumbs">
315 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
316 <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
317 [% IF query_type == 'create' %]
319 [% ELSIF query_type == 'status' %]
324 <div id="doc3" class="yui-t2">
327 <div id="interlibraryloans" class="yui-b">
328 [% IF !backends_available %]
329 <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>
331 [% INCLUDE 'ill-toolbar.inc' %]
334 <h1>Error performing operation</h1>
335 <!-- Dispatch on Status -->
336 <p>We encountered an error:</p>
338 <pre>[% whole.message | html %] ([% whole.status | html %])</pre>
342 [% IF query_type == 'create' %]
343 <h1>New ILL request</h1>
344 [% PROCESS $whole.template %]
346 [% ELSIF query_type == 'confirm' %]
347 <h1>Confirm ILL request</h1>
348 [% PROCESS $whole.template %]
350 [% ELSIF query_type == 'cancel' and !whole.error %]
351 <h1>Cancel a confirmed request</h1>
352 [% PROCESS $whole.template %]
354 [% ELSIF query_type == 'generic_confirm' %]
355 <h1>Place request with partner libraries</h1>
357 [% IF error == 'no_target_email' %]
359 No target email addresses found. Either select at least
360 one partner or check your ILL partner library records.
362 [% ELSIF error == 'no_library_email' %]
364 Your library has no usable email address. Please set it.
366 [% ELSIF error == 'unkown_error' %]
368 Unknown error processing your request. Contact your administrator.
372 <!-- Start of GENERIC_EMAIL case -->
373 [% IF whole.value.partners %]
374 [% ill_url = "/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=" _ request.illrequest_id %]
375 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
376 <fieldset class="rows">
377 <legend>Interlibrary loan request details</legend>
380 <label for="partner_filter">Filter partner libraries:</label>
381 <input type="text" id="partner_filter">
384 <label for="partners" class="required">Select partner libraries:</label>
385 <select size="5" multiple="true" id="partners" name="partners" required="required">
386 [% FOREACH partner IN whole.value.partners %]
387 <option value=[% partner.email | html %]>
388 [% partner.branchcode _ " - " _ partner.surname %]
395 <label for="subject" class="required">Subject Line</label>
396 <input type="text" name="subject" id="subject" type="text" value="[% whole.value.draft.subject | html %]" required="required" />
399 <label for="body" class="required">Email text:</label>
400 <textarea name="body" id="body" rows="20" cols="80" required="required">[% whole.value.draft.body | html %]</textarea>
403 <input type="hidden" value="generic_confirm" name="method">
404 <input type="hidden" value="draft" name="stage">
405 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
407 <fieldset class="action">
408 <input type="submit" class="btn btn-default" value="Send email"/>
409 <span><a href="[% ill_url | uri %]" title="Return to request details">Cancel</a></span>
413 <fieldset class="rows">
414 <legend>Interlibrary loan request details</legend>
415 <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
416 <p>Be sure to provide email addresses for these patrons.</p>
417 <p><span><a href="[% ill_url | uri %]" title="Return to request details">Cancel</a></span></p>
420 <!-- generic_confirm ends here -->
422 [% ELSIF query_type == 'edit_action' %]
423 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
424 <fieldset class="rows">
425 <legend>Request details</legend>
427 [% type = request.get_type %]
428 <li class="borrowernumber">
429 <label for="borrowernumber">Patron ID:</label>
430 [% request.borrowernumber | html %]
432 <li class="biblio_id">
433 <label for="biblio_id" class="biblio_id">Bibliographic record ID:</label>
434 <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id | html %]">
436 <li class="branchcode">
437 <label for="library" class="branchcode">Library:</label>
438 <select name="branchcode" id="library">
439 [% PROCESS options_for_libraries libraries => Branches.all( selected => request.branchcode ) %]
443 <label class="status">Status:</label>
444 [% stat = request.status %]
445 [% request.capabilities.$stat.name | html %]
448 <label class="updated">Last updated:</label>
449 [% request.updated | $KohaDates with_hours => 1 | html %]
452 <label class="medium">Request type:</label>
453 [% type || 'N/A' | html %]
456 <label class="cost">Cost:</label>
457 [% IF request.cost %][% request.cost | html %][% ELSE %]<span>N/A</span>[% END %]
459 <li class="price_paid">
460 <label class="price_paid">Price paid:</label>
461 <input name="price_paid" id="price_paid" type="text" value="[% request.price_paid | html %]">
464 <label class="req_id">Request number:</label>
465 [% request.id_prefix _ request.illrequest_id | html %]
467 <li class="notesstaff">
468 <label for="notesstaff" class="notesstaff">Staff notes:</label>
469 <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff | html %]</textarea>
471 <li class="notesopac">
472 <label for="notesopac" class="notesopac">Opac notes:</label>
473 <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac | html %]</textarea>
477 <fieldset class="action">
478 <input type="hidden" value="edit_action" name="method">
479 <input type="hidden" value="form" name="stage">
480 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
481 <input type="hidden" value="[% request.borrowernumber | html %]" name="borrowernumber">
482 <input type="submit" value="Submit">
483 <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id | html %]">Cancel</a>
487 [% ELSIF query_type == 'delete_confirm' %]
489 <div class="dialog alert">
490 <h3>Are you sure you wish to delete this request?</h3>
491 <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
492 <input type="hidden" name="method" value="delete" />
493 <input type="hidden" name="confirmed" value="1" />
494 <input type="hidden" name="illrequest_id" value="[% request.id | html %]" />
495 <button type="submit" class="btn btn-default btn-sm approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
497 <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>
500 [% ELSIF query_type == 'illview' %]
501 [% req_status = request.status %]
502 <h1>Manage ILL request</h1>
503 <div id="toolbar" class="btn-toolbar">
504 <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 %]">
505 <span class="fa fa-pencil"></span>
508 [% FOREACH action IN request.available_actions %]
509 [% IF action.method != 0 %]
510 <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 %]">
511 <span class="fa [% action.ui_method_icon | html %]"></span>
512 [% action.ui_method_name | html %]
516 <a title="Display supplier metadata" id="ill-request-display-metadata" class="btn btn-sm btn-default pull-right" href="#">
517 <span class="fa fa-eye"></span>
518 Display supplier metadata
521 <div id="ill-view-panel" class="panel panel-default">
522 <div class="panel-heading">
523 <h3>Request details</h3>
525 <div class="panel-body">
526 <h4>Details from library</h4>
528 <div class="orderid">
529 <span class="label orderid">Order ID:</span>
530 [% IF request.orderid %][% request.orderid | html %][% ELSE %]<span>N/A</span>[% END %]
532 <div class="borrowernumber">
533 <span class="label borrowernumber">Patron:</span>
534 [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
535 <a href="[% borrowerlink | uri %]" title="View borrower details">
536 [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %]
540 <div class="biblio_id">
541 <span class="label biblio_id">Bibliographic record ID:</span>
542 [% IF request.biblio_id %]
543 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% request.biblio_id | uri %]">[% request.biblio_id | html %]</a>
548 <div class="branchcode">
549 <span class="label branchcode">Library:</span>
550 [% Branches.GetName(request.branchcode) | html %]
553 <span class="label status">Status:</span>
554 [% request.capabilities.$req_status.name | html %]
556 <div class="updated">
557 <span class="label updated">Last updated:</span>
558 [% request.updated | $KohaDates with_hours => 1 | html %]
561 <span class="label medium">Request type:</span>
562 % type = request.get_type %]
563 [% type || 'N/A' | html %]
566 <span class="label cost">Cost:</span>
567 [% IF request.cost %][% request.cost | html %][% ELSE %]<span>N/A</span>[% END %]
569 <div class="price_paid">
570 <span class="label price_paid">Price paid:</span>
571 [% IF request.price_paid %][% request.price_paid | html %][% ELSE %]<span>N/A</span>[% END %]
574 <span class="label req_id">Request number:</span>
575 [% request.id_prefix _ request.illrequest_id | html %]
577 <div class="notesstaff">
578 <span class="label notes_staff">Staff notes:</span>
579 <pre>[% request.notesstaff | html %]</pre>
581 <div class="notesopac">
582 <span class="label notes_opac">Notes:</span>
583 <pre>[% request.notesopac | html %]</pre>
587 <h4>Details from supplier ([% request.backend | html %])</h4>
588 [% FOREACH meta IN request.metadata %]
589 <div class="requestmeta-[% meta.key.replace('\s','_') | html %]">
590 <span class="label">[% meta.key | html %]:</span>
591 [% meta.value | html %]
598 <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
599 <div class="modal-dialog">
600 <div class="modal-content">
601 <div class="modal-header">
602 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
603 <h3 id="dataPreviewLabel"> Supplier metadata</h3>
605 <div class="modal-body">
606 <div id="requestattributes">
607 [% FOREACH attr IN request.illrequestattributes %]
608 <div class="requestattr-[% attr.type | html %]">
609 <span class="label">[% attr.type | html %]:</span>
610 [% attr.value | html %]
615 <div class="modal-footer">
616 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
622 <div id="ill-view-panel" class="panel panel-default">
623 <div class="panel-heading">
624 <h3>[% request.illcomments.count | html %] comments</h3>
626 <div class="panel-body">
627 [% IF request.illcomments.count && request.illcomments.count > 0 %]
628 [% FOREACH comment IN request.illcomments %]
629 <div class="rows comment_[% comment.patron.categorycode | html %]">
631 <a href="[% borrowerlink | uri %]" title="View borrower details">
632 [% comment.patron.firstname _ " " _ comment.patron.surname _ " [" _ comment.patron.cardnumber _ "]" | html %]</a>
633 [% comment.timestamp | $KohaDates with_hours => 1 %]</h5>
634 <p>[% comment.comment | html %]</p>
639 <h3><a id="toggle_addcomment" href="#">Add comment</a></h3>
640 <div id="addcomment" class="content_hidden">
641 <form class="validated" method="post" action="/cgi-bin/koha/ill/ill-requests.pl">
642 <input type="hidden" value="save_comment" name="method">
643 <input type="hidden" value="[% csrf_token | html %]" name="csrf_token">
644 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
645 <fieldset class="rows">
648 <label class="required" for="comment">Comment: </label>
649 <textarea type="text" class="required" required="required" value="" cols="80" rows="10" id="comment" name="comment"></textarea>
650 <span class="required">Required</span>
654 <fieldset class="action">
655 <input type="submit" value="Submit">
663 [% ELSIF query_type == 'illlist' %]
665 <h1>View ILL requests</h1>
667 <h3>Details for all requests</h3>
669 <table id="ill-requests">
671 <tr id="illview-header">
675 <th>Bibliographic record ID</th>
679 <th>Request number</th>
681 <th class="actions"></th>
684 <tbody id="illview-body">
689 <!-- Custom Backend Action -->
690 [% PROCESS $whole.template %]
700 [% PROCESS backend_jsinclude %]
704 [% INCLUDE 'intranet-bottom.inc' %]