7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › ILL requests</title>
9 [% INCLUDE 'doc-head-close.inc' %]
12 <body id="illrequests" class="ill">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
16 <div id="breadcrumbs">
17 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
18 <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
19 [% IF query_type == 'create' %]
21 [% ELSIF query_type == 'status' %]
26 <div id="doc3" class="yui-t2">
28 [% IF query_type == 'illlist' %]
29 <div id="illfilter_yui_column" class="yui-b">
30 <form method="get" id="illfilter_form">
31 <fieldset class="brief">
35 <label for="illfilter_status">Status:</label>
36 <select name="illfilter_status" id="illfilter_status">
37 <option value=""></option>
41 <label for="illfilter_dateplaced_start">Date placed between:</label>
42 <input type="text" name="illfilter_dateplaced_start" id="illfilter_dateplaced_start" class="datepicker" />
45 <label for="illfilter_dateplaced_end">and:</label>
46 <input type="text" name="illfilter_dateplaced_end" id="illfilter_dateplaced_end" class="datepicker" />
49 <label for="illfilter_datemodified_start">Updated between:</label>
50 <input type="text" name="illfilter_datemodified_start" id="illfilter_datemodified_start" class="datepicker" />
53 <label for="illfilter_datemodified_end">and:</label>
54 <input type="text" name="illfilter_datemodified_end" id="illfilter_datemodified_end" class="datepicker" />
57 <label for="illfilter_branchname">Library:</label>
58 <select name="illfilter_branchname" id="illfilter_branchname">
59 <option value=""></option>
63 <label for="illfilter_barcode">Cardnumber:</label>
64 <input type="text" name="illfilter_barcode" id="illfilter_barcode" />
67 <fieldset class="action">
68 <input type="submit" value="Search" />
69 <input type="button" value="Clear" id="clear_search" />
76 <div id="interlibraryloans" class="yui-b">
77 [% IF !backends_available || !has_branch %]
78 <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>
80 [% INCLUDE 'ill-toolbar.inc' %]
83 <h1>Error performing operation</h1>
84 <!-- Dispatch on Status -->
85 <p>We encountered an error:</p>
87 <pre>[% whole.message | html %] ([% whole.status | html %])</pre>
91 [% IF query_type == 'create' %]
92 <h1>New ILL request</h1>
93 [% PROCESS $whole.template %]
95 [% ELSIF query_type == 'confirm' %]
96 <h1>Confirm ILL request</h1>
97 [% PROCESS $whole.template %]
99 [% ELSIF query_type == 'cancel' and !whole.error %]
100 <h1>Cancel a confirmed request</h1>
101 [% PROCESS $whole.template %]
103 [% ELSIF query_type == 'generic_confirm' %]
104 <h1>Place request with partner libraries</h1>
106 [% IF error == 'no_target_email' %]
108 No target email addresses found. Either select at least
109 one partner or check your ILL partner library records.
111 [% ELSIF error == 'no_library_email' %]
113 Your library has no usable email address. Please set it.
115 [% ELSIF error == 'unkown_error' %]
117 Unknown error processing your request. Contact your administrator.
121 <!-- Start of GENERIC_EMAIL case -->
122 [% IF whole.value.partners %]
123 [% ill_url = "/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=" _ request.illrequest_id %]
124 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
125 <fieldset class="rows">
126 <legend>Interlibrary loan request details</legend>
129 <label for="partner_filter">Filter partner libraries:</label>
130 <input type="text" id="partner_filter" />
133 <label for="partners" class="required">Select partner libraries:</label>
134 <select size="5" multiple="true" id="partners" name="partners" required="required">
135 [% FOREACH partner IN whole.value.partners %]
136 <option value=[% partner.email | html %]>
137 [% partner.branchcode _ " - " _ partner.surname %]
144 <label for="subject" class="required">Subject line:</label>
145 <input type="text" name="subject" id="subject" type="text" value="[% whole.value.draft.subject | html %]" required="required" />
148 <label for="body" class="required">Email text:</label>
149 <textarea name="body" id="body" rows="20" cols="80" required="required">[% whole.value.draft.body | html %]</textarea>
152 <input type="hidden" value="generic_confirm" name="method">
153 <input type="hidden" value="draft" name="stage">
154 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
156 <fieldset class="action">
157 <input type="submit" class="btn btn-default" value="Send email"/>
158 <span><a href="[% ill_url | url %]" title="Return to request details">Cancel</a></span>
162 <fieldset class="rows">
163 <legend>Interlibrary loan request details</legend>
164 <p>No partners have been defined yet. Please create appropriate patron records (by default ILLLIBS category).</p>
165 <p>Be sure to provide email addresses for these patrons.</p>
166 <p><span><a href="[% ill_url | url %]" title="Return to request details">Cancel</a></span></p>
169 <!-- generic_confirm ends here -->
171 [% ELSIF query_type == 'edit_action' %]
172 <form method="POST" action="/cgi-bin/koha/ill/ill-requests.pl">
173 <fieldset class="rows">
174 <legend>Request details</legend>
176 [% type = request.get_type %]
177 <li class="borrowernumber">
178 <label for="borrowernumber">Patron ID:</label>
179 [% request.borrowernumber | html %]
181 <li class="biblio_id">
182 <label for="biblio_id" class="biblio_id">Bibliographic record ID:</label>
183 <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id | html %]">
185 <li class="branchcode">
186 <label for="library" class="branchcode">Library:</label>
187 <select name="branchcode" id="library">
188 [% PROCESS options_for_libraries libraries => Branches.all( selected => request.branchcode ) %]
192 <label class="status">Status:</label>
193 [% stat = request.status %]
194 [% request.capabilities.$stat.name | html %]
197 <label class="updated">Last updated:</label>
198 [% request.updated | $KohaDates with_hours => 1 %]
201 <label class="medium">Request type:</label>
202 [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
205 <label class="cost">Cost:</label>
206 [% IF request.cost %][% request.cost | html %][% ELSE %]<span>N/A</span>[% END %]
208 <li class="price_paid">
209 <label class="price_paid">Price paid:</label>
210 <input name="price_paid" id="price_paid" type="text" value="[% request.price_paid | html %]">
213 <label class="req_id">Request number:</label>
214 [% request.id_prefix _ request.illrequest_id | html %]
216 <li class="notesstaff">
217 <label for="notesstaff" class="notesstaff">Staff notes:</label>
218 <textarea name="notesstaff" id="notesstaff" rows="5">[% request.notesstaff | html %]</textarea>
220 <li class="notesopac">
221 <label for="notesopac" class="notesopac">Opac notes:</label>
222 <textarea name="notesopac" id="notesopac" rows="5">[% request.notesopac | html %]</textarea>
226 <fieldset class="action">
227 <input type="hidden" value="edit_action" name="method">
228 <input type="hidden" value="form" name="stage">
229 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
230 <input type="hidden" value="[% request.borrowernumber | html %]" name="borrowernumber">
231 <input type="submit" value="Submit">
232 <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=[% request.id | html %]">Cancel</a>
236 [% ELSIF query_type == 'delete_confirm' %]
238 <div class="dialog alert">
239 <h3>Are you sure you wish to delete this request?</h3>
240 <form action="/cgi-bin/koha/ill/ill-requests.pl" method="post">
241 <input type="hidden" name="method" value="delete" />
242 <input type="hidden" name="confirmed" value="1" />
243 <input type="hidden" name="illrequest_id" value="[% request.id | html %]" />
244 <button type="submit" class="btn btn-default btn-sm approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
246 <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>
249 [% ELSIF query_type == 'illview' %]
250 [% req_status = request.status %]
253 [% IF error == 'migrate_target' %]
255 The backend you tried to migrate to does not yet support migrations, please try again with an alternative target.
260 <h1>Manage ILL request</h1>
261 <div id="request-toolbar" class="btn-toolbar">
262 <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 %]">
263 <span class="fa fa-pencil"></span>
266 [% FOREACH action IN request.available_actions %]
267 [% IF action.method == 'migrate' %]
268 [% IF backends.size > 2 %]
269 <div class="dropdown btn-group">
270 <button class="btn btn-sm btn-default dropdown-toggle" type="button" id="ill-migrate-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
271 <i class="fa [% action.ui_method_icon | html %]"></i> [% action.ui_method_name | html %] <span class="caret"></span>
273 <ul class="dropdown-menu" aria-labelledby="ill-migrate-dropdown">
274 [% FOREACH backend IN backends %]
275 [% IF backend != request.backend %]
276 <li><a href="/cgi-bin/koha/ill/ill-requests.pl?method=[% action.method | uri %]&illrequest_id=[% request.illrequest_id | uri %]&backend=[% backend | uri %]">[% backend | html %]</a></li>
281 [% ELSIF backends.size == 2 %]
282 [% FOREACH backend IN backends %]
283 [% IF backend != request.backend %]
284 <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 | uri %]&illrequest_id=[% request.illrequest_id | uri %]&backend=[% backend | uri %]">
285 <span class="fa [% action.ui_method_icon | html %]"></span>
286 [% action.ui_method_name | html %]
291 [% ELSIF action.method != 0 %]
292 <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 | uri %]&illrequest_id=[% request.illrequest_id | uri %]">
293 <span class="fa [% action.ui_method_icon | html %]"></span>
294 [% action.ui_method_name | html %]
298 <a title="Display supplier metadata" id="ill-request-display-metadata" class="btn btn-sm btn-default pull-right" href="#">
299 <span class="fa fa-eye"></span>
300 Display supplier metadata
303 <div class="ill-view-panel panel panel-default">
304 <div class="panel-heading">
305 <h3>Request details</h3>
307 <div class="panel-body">
308 <h4>Details from library</h4>
312 <span class="label orderid">Order ID:</span>
313 [% IF request.orderid %][% request.orderid | html %][% ELSE %]<span>N/A</span>[% END %]
315 <li class="borrowernumber">
316 <span class="label borrowernumber">Patron:</span>
317 [% borrowerlink = "/cgi-bin/koha/members/moremember.pl" _ "?borrowernumber=" _ request.patron.borrowernumber %]
318 <a href="[% borrowerlink | url %]" title="View borrower details">
319 [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %]
323 <li class="biblio_id">
324 <span class="label biblio_id">Bibliographic record ID:</span>
325 [% IF request.biblio_id %]
326 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% request.biblio_id | uri %]">[% request.biblio_id | html %]</a>
331 <li class="branchcode">
332 <span class="label branchcode">Library:</span>
333 [% Branches.GetName(request.branchcode) | html %]
336 <span class="label status">Status:</span>
337 [% request.capabilities.$req_status.name | html %]
340 <span class="label updated">Last updated:</span>
341 [% request.updated | $KohaDates with_hours => 1 %]
344 <span class="label medium">Request type:</span>
345 [% type = request.get_type %]
346 [% IF type %][% type | html %][% ELSE %]<span>N/A</span>[% END %]
349 <span class="label cost">Cost:</span>
350 [% IF request.cost %][% request.cost | html %][% ELSE %]<span>N/A</span>[% END %]
352 <li class="price_paid">
353 <span class="label price_paid">Price paid:</span>
354 [% IF request.price_paid %][% request.price_paid | html %][% ELSE %]<span>N/A</span>[% END %]
357 <span class="label req_id">Request number:</span>
358 [% request.id_prefix _ request.illrequest_id | html %]
360 <li class="notesstaff">
361 <span class="label notes_staff">Staff notes:</span>
362 <p>[% request.notesstaff | html %]</p>
364 <li class="notesopac">
365 <span class="label notes_opac">Notes:</span>
366 <p>[% request.notesopac | html %]</p>
371 <h4>Details from supplier ([% request.backend | html %])</h4>
373 [% FOREACH meta IN request.metadata %]
374 <li class="requestmeta-[% meta.key.replace('\s','_') | html %]">
375 <span class="label">[% meta.key | html %]:</span>
376 [% meta.value | html %]
384 <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
385 <div class="modal-dialog">
386 <div class="modal-content">
387 <div class="modal-header">
388 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
389 <h3 id="dataPreviewLabel"> Supplier metadata</h3>
391 <div class="modal-body">
392 <div id="requestattributes">
393 [% FOREACH attr IN request.illrequestattributes %]
394 <div class="requestattr-[% attr.type | html %]">
395 <span class="label">[% attr.type | html %]:</span>
396 [% attr.value | html %]
401 <div class="modal-footer">
402 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
408 <div class="ill-view-panel panel panel-default">
409 <div class="panel-heading">
410 <h3>[% request.illcomments.count | html %] comments</h3>
412 <div class="panel-body">
413 [% IF request.illcomments.count && request.illcomments.count > 0 %]
414 [% FOREACH comment IN request.illcomments %]
415 <div class="rows comment_[% comment.patron.categorycode | html %]">
417 <a href="[% borrowerlink | url %]" title="View borrower details">
418 [% comment.patron.firstname _ " " _ comment.patron.surname _ " [" _ comment.patron.cardnumber _ "]" | html %]</a>
419 [% comment.timestamp | $KohaDates with_hours => 1 %]</h5>
420 <p>[% comment.comment | html %]</p>
425 <h3><a id="toggle_addcomment" href="#">Add comment</a></h3>
426 <div id="addcomment" class="content_hidden">
427 <form class="validated" method="post" action="/cgi-bin/koha/ill/ill-requests.pl">
428 <input type="hidden" value="save_comment" name="method">
429 <input type="hidden" value="[% csrf_token | html %]" name="csrf_token">
430 <input type="hidden" value="[% request.illrequest_id | html %]" name="illrequest_id">
431 <fieldset class="rows">
434 <label class="required" for="comment">Comment: </label>
435 <textarea class="required" required="required" cols="80" rows="10" id="comment" name="comment"></textarea>
436 <span class="required">Required</span>
440 <fieldset class="action">
441 <input type="submit" value="Submit">
449 [% ELSIF query_type == 'illlist' %]
451 <h1>View ILL requests</h1>
453 <h3>Details for all requests</h3>
455 <table id="ill-requests">
457 <tr id="illview-header">
461 <th>Bibliographic record ID</th>
464 <th class="placed"> </th>
465 <th class="placed_formatted">Date placed</th>
466 <th class="updated"> </th>
467 <th class="updated_formatted">Updated on</th>
468 <th>Request number</th>
470 <th class="patron_cardnumber">Cardnumber</th>
471 <th class="actions"></th>
474 <tbody id="illview-body">
479 <!-- Custom Backend Action -->
480 [% PROCESS $whole.template %]
489 [% PROCESS backend_jsinclude %]
493 [% MACRO jsinclude BLOCK %]
494 [% INCLUDE 'datatables.inc' %]
495 [% INCLUDE 'calendar.inc' %]
496 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
498 $(document).ready(function() {
500 // Illview Datatable setup
504 // Filters that are active
505 var activeFilters = {};
507 // Fields we don't want to display
521 // Fields we need to expand (flatten)
528 // This is auto populated
531 // The core fields that should be displayed first
549 // Filterable columns
552 prep: function(tableData, oData) {
554 tableData.forEach(function(row) {
555 var resolvedName = getStatusName(
556 oData[0].capabilities[row.status].name
558 uniques[resolvedName] = 1
560 Object.keys(uniques).sort().forEach(function(unique) {
561 $('#illfilter_status').append(
562 '<option value="' + unique +
563 '">' + unique + '</option>'
567 listener: function() {
569 $('#illfilter_status').change(function() {
570 var sel = $('#illfilter_status option:selected').val();
571 if (sel && sel.length > 0) {
572 activeFilters[me] = function() {
573 table.column(5).search(sel);
576 if (activeFilters.hasOwnProperty(me)) {
577 delete activeFilters[me];
583 $('#illfilter_status').val('');
587 prep: function(tableData, oData) {
589 tableData.forEach(function(row) {
590 uniques[row.library.branchname] = 1
592 Object.keys(uniques).sort().forEach(function(unique) {
593 $('#illfilter_branchname').append(
594 '<option value="' + unique +
595 '">' + unique + '</option>'
599 listener: function() {
600 var me = 'pickupBranch';
601 $('#illfilter_branchname').change(function() {
602 var sel = $('#illfilter_branchname option:selected').val();
603 if (sel && sel.length > 0) {
604 activeFilters[me] = function() {
605 table.column(4).search(sel);
608 if (activeFilters.hasOwnProperty(me)) {
609 delete activeFilters[me];
615 $('#illfilter_branchname').val('');
619 listener: function() {
621 $('#illfilter_barcode').change(function() {
622 var val = $('#illfilter_barcode').val();
623 if (val && val.length > 0) {
624 activeFilters[me] = function() {
625 table.column(12).search(val);
628 if (activeFilters.hasOwnProperty(me)) {
629 delete activeFilters[me];
635 $('#illfilter_barcode').val('');
640 $('#illfilter_datemodified_start, #illfilter_datemodified_end').val('');
645 $('#illfilter_dateplaced_start, #illfilter_dateplaced_end').val('');
650 // Remove any fields we're ignoring
651 var removeIgnore = function(dataObj) {
652 dataObj.forEach(function(thisRow) {
653 ignore.forEach(function(thisIgnore) {
654 if (thisRow.hasOwnProperty(thisIgnore)) {
655 delete thisRow[thisIgnore];
661 // Expand any fields we're expanding
662 var expandExpand = function(row) {
663 expand.forEach(function(thisExpand) {
664 if (row.hasOwnProperty(thisExpand)) {
665 if (!expanded.hasOwnProperty(thisExpand)) {
666 expanded[thisExpand] = [];
668 var expandObj = row[thisExpand];
669 Object.keys(expandObj).forEach(
670 function(thisExpandCol) {
671 var expColName = thisExpand + '_' + thisExpandCol;
672 // Keep a list of fields that have been expanded
673 // so we can create toggle links for them
674 if (expanded[thisExpand].indexOf(expColName) == -1) {
675 expanded[thisExpand].push(expColName);
677 expandObj[expColName] =
678 expandObj[thisExpandCol];
679 delete expandObj[thisExpandCol];
682 $.extend(true, row, expandObj);
683 delete row[thisExpand];
688 // Build a de-duped list of all column names
690 core.map(function(thisCore) {
691 allCols[thisCore] = 1;
694 // Strip the expand prefix if it exists, we do this for display
695 var stripPrefix = function(value) {
696 expand.forEach(function(thisExpand) {
697 var regex = new RegExp(thisExpand + '_', 'g');
698 value = value.replace(regex, '');
703 // Our 'render' function for borrowerlink
704 var createPatronLink = function(data, type, row) {
705 var patronLink = '<a title="' + _("View borrower details") + '" ' +
706 'href="/cgi-bin/koha/members/moremember.pl?' +
707 'borrowernumber='+row.borrowernumber+'">';
708 if ( row.patron_firstname ) {
709 patronLink = patronLink + row.patron_firstname + ' ';
711 patronLink = patronLink + row.patron_surname + '</a>';
715 // Our 'render' function for the library name
716 var createLibrary = function(data, type, row) {
717 return row.library.branchname;
720 // Render function for request ID
721 var createRequestId = function(data, type, row) {
722 return row.id_prefix + row.illrequest_id;
725 // Render function for request status
726 var createStatus = function(data, type, row, meta) {
727 var origData = meta.settings.oInit.originalData;
728 if (origData.length > 0) {
729 var status_name = meta.settings.oInit.originalData[0].capabilities[
732 return getStatusName(status_name);
738 var getStatusName = function(origName) {
741 return _("New request");
743 return _("Requested");
744 case "Requested from partners":
745 return _("Requested from partners");
746 case "Request reverted":
747 return _("Request reverted");
748 case "Queued request":
749 return _("Queued request");
750 case "Cancellation requested":
751 return _("Cancellation requested");
753 return _("Completed");
754 case "Delete request":
755 return _("Delete request");
761 // Render function for creating a row's action link
762 var createActionLink = function(data, type, row) {
763 return '<a class="btn btn-default btn-sm" ' +
764 'href="/cgi-bin/koha/ill/ill-requests.pl?' +
765 'method=illview&illrequest_id=' +
767 '">' + _("Manage request") + '</a>';
770 // Columns that require special treatment
774 func: createActionLink
778 func: createPatronLink
781 name: _("Request number"),
782 func: createRequestId
796 name: _("Updated on"),
799 name: _("Cardnumber")
803 // Toggle request attributes in Illview
804 $('#toggle_requestattributes').on('click', function(e) {
806 $('#requestattributes').toggleClass('content_hidden');
809 // Toggle new comment form in Illview
810 $('#toggle_addcomment').on('click', function(e) {
812 $('#addcomment').toggleClass('content_hidden');
815 // Filter partner list
816 $('#partner_filter').keyup(function() {
817 var needle = $('#partner_filter').val();
818 $('#partners > option').each(function() {
819 var regex = new RegExp(needle, 'i');
821 needle.length == 0 ||
822 $(this).is(':selected') ||
823 $(this).text().match(regex)
832 // Display the modal containing request supplier metadata
833 $('#ill-request-display-metadata').on('click', function(e) {
835 $('#dataPreview').modal({show:true});
838 // Get our data from the API and process it prior to passing
841 '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
843 var data = JSON.parse(ajax.responseText);
844 // Make a copy, we'll be removing columns next and need
845 // to be able to refer to data that has been removed
846 var dataCopy = $.extend(true, [], data);
847 // Remove all columns we're not interested in
848 removeIgnore(dataCopy);
849 // Expand columns that need it and create an array
850 // of all column names
851 $.each(dataCopy, function(k, row) {
855 // Assemble an array of column definitions for passing
858 Object.keys(allCols).forEach(function(thisCol) {
859 // Create the base column object
865 // We may need to process the data going in this
866 // column, so do it if necessary
868 specialCols.hasOwnProperty(thisCol) &&
869 specialCols[thisCol].hasOwnProperty('func')
871 colObj.render = specialCols[thisCol].func;
873 colObj.data = thisCol;
875 colData.push(colObj);
878 // Initialise the datatable
879 table = $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, {
881 { // Last column shouldn't be sortable or searchable
882 'aTargets': [ 'actions' ],
886 { // Hide the two date columns we use just for sorting
887 'aTargets': [ 'placed', 'updated' ],
891 { // When sorting 'placed', we want to use the
892 // unformatted column
893 'aTargets': [ 'placed_formatted'],
896 { // When sorting 'updated', we want to use the
897 // unformatted column
898 'aTargets': [ 'updated_formatted'],
902 'aTargets': [ 'patron_cardnumber' ],
907 'aaSorting': [[ 9, 'desc' ]], // Default sort, updated descending
908 'processing': true, // Display a message when manipulating
909 'sPaginationType': "full_numbers", // Pagination display
910 'deferRender': true, // Improve performance on big datasets
913 'originalData': data, // Enable render functions to access
915 'initComplete': function() {
917 // Prepare any filter elements that need it
918 for (var el in filterable) {
919 if (filterable.hasOwnProperty(el)) {
920 if (filterable[el].hasOwnProperty('prep')) {
921 filterable[el].prep(dataCopy, data);
923 if (filterable[el].hasOwnProperty('listener')) {
924 filterable[el].listener();
932 // Custom date range filtering
933 $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
934 var placedStart = $('#illfilter_dateplaced_start').datepicker('getDate');
935 var placedEnd = $('#illfilter_dateplaced_end').datepicker('getDate');
936 var modifiedStart = $('#illfilter_datemodified_start').datepicker('getDate');
937 var modifiedEnd = $('#illfilter_datemodified_end').datepicker('getDate');
938 var rowPlaced = data[6] ? new Date(data[6]) : null;
939 var rowModified = data[8] ? new Date(data[8]) : null;
940 var placedPassed = true;
941 var modifiedPassed = true;
942 if (placedStart && rowPlaced && rowPlaced < placedStart) {
945 if (placedEnd && rowPlaced && rowPlaced > placedEnd) {
946 placedPassed = false;
948 if (modifiedStart && rowModified && rowModified < modifiedStart) {
949 modifiedPassed = false
951 if (modifiedEnd && rowModified && rowModified > modifiedEnd) {
952 modifiedPassed = false;
955 return placedPassed && modifiedPassed;
962 var clearSearch = function() {
963 table.search('').columns().search('');
965 for (var filter in filterable) {
967 filterable.hasOwnProperty(filter) &&
968 filterable[filter].hasOwnProperty('clear')
970 filterable[filter].clear();
976 // Apply any search filters, or clear any previous
978 $('#illfilter_form').submit(function(event) {
979 event.preventDefault();
980 table.search('').columns().search('');
981 for (var active in activeFilters) {
982 if (activeFilters.hasOwnProperty(active)) {
983 activeFilters[active]();
990 $('#clear_search').click(function() {
998 [% INCLUDE 'intranet-bottom.inc' %]