Lines 5-10
Link Here
|
5 |
[% USE KohaDates %] |
5 |
[% USE KohaDates %] |
6 |
[% SET footerjs = 1 %] |
6 |
[% SET footerjs = 1 %] |
7 |
[% USE AuthorisedValues %] |
7 |
[% USE AuthorisedValues %] |
|
|
8 |
[% USE ColumnsSettings %] |
8 |
|
9 |
|
9 |
[% INCLUDE 'doc-head-open.inc' %] |
10 |
[% INCLUDE 'doc-head-open.inc' %] |
10 |
<title>Koha › ILL requests</title> |
11 |
<title>Koha › ILL requests</title> |
Lines 508-527
Link Here
|
508 |
<table id="ill-requests"> |
509 |
<table id="ill-requests"> |
509 |
<thead> |
510 |
<thead> |
510 |
<tr id="illview-header"> |
511 |
<tr id="illview-header"> |
511 |
<th>Author</th> |
512 |
<th scope="col">Request ID</th> |
512 |
<th>Title</th> |
513 |
<th scope="col">Author</th> |
513 |
<th>Patron</th> |
514 |
<th scope="col">Title</th> |
514 |
<th>Bibliographic record ID</th> |
515 |
<th scope="col">Article title</th> |
515 |
<th>Library</th> |
516 |
<th scope="col">Issue</th> |
516 |
<th>Status</th> |
517 |
<th scope="col">Volume</th> |
517 |
<th class="placed"> </th> |
518 |
<th scope="col">Year</th> |
518 |
<th class="placed_formatted">Date placed</th> |
519 |
<th scope="col">Pages</th> |
519 |
<th class="updated"> </th> |
520 |
<th scope="col">Type</th> |
520 |
<th class="updated_formatted">Updated on</th> |
521 |
<th scope="col">Order ID</th> |
521 |
<th>Request number</th> |
522 |
<th scope="col">Biblio ID</th> |
522 |
<th>Comments</th> |
523 |
<th scope="col">Patron</th> |
523 |
<th class="patron_cardnumber">Cardnumber</th> |
524 |
<th class="patron_cardnumber">Patron barcode</th> |
524 |
<th class="actions"></th> |
525 |
<th scope="col">Branch</th> |
|
|
526 |
<th scope="col">Status</th> |
527 |
<th scope="col" class="placed"> </th> |
528 |
<th scope="col" class="placed_formatted">Placed on</th> |
529 |
<th scope="col">Replied</th> |
530 |
<th scope="col" class="updated"> </th> |
531 |
<th scope="col" class="updated_formatted">Updated on</th> |
532 |
<th scope="col">Completed on</th> |
533 |
<th scope="col">Access URL</th> |
534 |
<th scope="col">Cost</th> |
535 |
<th scope="col">OPAC notes</th> |
536 |
<th scope="col">Staff notes</th> |
537 |
<th scope="col">Backend</th> |
538 |
<th scope="col" class="actions"></th> |
525 |
</tr> |
539 |
</tr> |
526 |
</thead> |
540 |
</thead> |
527 |
<tbody id="illview-body"> |
541 |
<tbody id="illview-body"> |
Lines 545-550
Link Here
|
545 |
|
559 |
|
546 |
[% MACRO jsinclude BLOCK %] |
560 |
[% MACRO jsinclude BLOCK %] |
547 |
[% INCLUDE 'datatables.inc' %] |
561 |
[% INCLUDE 'datatables.inc' %] |
|
|
562 |
[% INCLUDE 'columns_settings.inc' %] |
548 |
[% INCLUDE 'calendar.inc' %] |
563 |
[% INCLUDE 'calendar.inc' %] |
549 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] |
564 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] |
550 |
<script> |
565 |
<script> |
Lines 552-604
Link Here
|
552 |
|
567 |
|
553 |
// Illview Datatable setup |
568 |
// Illview Datatable setup |
554 |
|
569 |
|
|
|
570 |
var columns_settings = [% ColumnsSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %]; |
571 |
|
555 |
var table; |
572 |
var table; |
556 |
|
573 |
|
557 |
// Filters that are active |
574 |
// Filters that are active |
558 |
var activeFilters = {}; |
575 |
var activeFilters = {}; |
559 |
|
576 |
|
560 |
// Fields we don't want to display |
|
|
561 |
var ignore = [ |
562 |
'accessurl', |
563 |
'backend', |
564 |
'branchcode', |
565 |
'completed', |
566 |
'capabilities', |
567 |
'cost', |
568 |
'medium', |
569 |
'notesopac', |
570 |
'notesstaff', |
571 |
'replied' |
572 |
]; |
573 |
|
574 |
// Fields we need to expand (flatten) |
577 |
// Fields we need to expand (flatten) |
575 |
var expand = [ |
578 |
var expand = [ |
576 |
'metadata', |
579 |
'metadata', |
577 |
'patron' |
580 |
'patron', |
|
|
581 |
'library' |
578 |
]; |
582 |
]; |
579 |
|
583 |
|
580 |
// Expanded fields |
584 |
// Expanded fields |
581 |
// This is auto populated |
585 |
// This is auto populated |
582 |
var expanded = {}; |
586 |
var expanded = {}; |
583 |
|
587 |
|
584 |
// The core fields that should be displayed first |
|
|
585 |
var core = [ |
586 |
'metadata_author', |
587 |
'metadata_title', |
588 |
'borrowername', |
589 |
'biblio_id', |
590 |
'library', |
591 |
'status', |
592 |
'placed', |
593 |
'placed_formatted', |
594 |
'updated', |
595 |
'updated_formatted', |
596 |
'illrequest_id', |
597 |
'comments', |
598 |
'patron_cardnumber', |
599 |
'action' |
600 |
]; |
601 |
|
602 |
// Filterable columns |
588 |
// Filterable columns |
603 |
var filterable = { |
589 |
var filterable = { |
604 |
status: { |
590 |
status: { |
Lines 705-721
Link Here
|
705 |
} |
691 |
} |
706 |
}; |
692 |
}; |
707 |
|
693 |
|
708 |
// Remove any fields we're ignoring |
|
|
709 |
var removeIgnore = function(dataObj) { |
710 |
dataObj.forEach(function(thisRow) { |
711 |
ignore.forEach(function(thisIgnore) { |
712 |
if (thisRow.hasOwnProperty(thisIgnore)) { |
713 |
delete thisRow[thisIgnore]; |
714 |
} |
715 |
}); |
716 |
}); |
717 |
}; |
718 |
|
719 |
// Expand any fields we're expanding |
694 |
// Expand any fields we're expanding |
720 |
var expandExpand = function(row) { |
695 |
var expandExpand = function(row) { |
721 |
expand.forEach(function(thisExpand) { |
696 |
expand.forEach(function(thisExpand) { |
Lines 726-732
Link Here
|
726 |
var expandObj = row[thisExpand]; |
701 |
var expandObj = row[thisExpand]; |
727 |
Object.keys(expandObj).forEach( |
702 |
Object.keys(expandObj).forEach( |
728 |
function(thisExpandCol) { |
703 |
function(thisExpandCol) { |
729 |
var expColName = thisExpand + '_' + thisExpandCol; |
704 |
var expColName = thisExpand + '_' + thisExpandCol.replace(/\s/g,'_'); |
730 |
// Keep a list of fields that have been expanded |
705 |
// Keep a list of fields that have been expanded |
731 |
// so we can create toggle links for them |
706 |
// so we can create toggle links for them |
732 |
if (expanded[thisExpand].indexOf(expColName) == -1) { |
707 |
if (expanded[thisExpand].indexOf(expColName) == -1) { |
Lines 743-754
Link Here
|
743 |
}); |
718 |
}); |
744 |
}; |
719 |
}; |
745 |
|
720 |
|
746 |
// Build a de-duped list of all column names |
|
|
747 |
var allCols = {}; |
748 |
core.map(function(thisCore) { |
749 |
allCols[thisCore] = 1; |
750 |
}); |
751 |
|
752 |
// Strip the expand prefix if it exists, we do this for display |
721 |
// Strip the expand prefix if it exists, we do this for display |
753 |
var stripPrefix = function(value) { |
722 |
var stripPrefix = function(value) { |
754 |
expand.forEach(function(thisExpand) { |
723 |
expand.forEach(function(thisExpand) { |
Lines 766-778
Link Here
|
766 |
if ( row.patron_firstname ) { |
735 |
if ( row.patron_firstname ) { |
767 |
patronLink = patronLink + row.patron_firstname + ' '; |
736 |
patronLink = patronLink + row.patron_firstname + ' '; |
768 |
} |
737 |
} |
769 |
patronLink = patronLink + row.patron_surname + '</a>'; |
738 |
patronLink = patronLink + row.patron_surname + |
|
|
739 |
' [' + row.patron_cardnumber + ' ]</a>'; |
770 |
return patronLink; |
740 |
return patronLink; |
771 |
}; |
741 |
}; |
772 |
|
742 |
|
773 |
// Our 'render' function for the library name |
743 |
// Our 'render' function for biblio_id |
774 |
var createLibrary = function(data, type, row) { |
744 |
var createBiblioLink = function(data, type, row) { |
775 |
return row.library.branchname; |
745 |
return (row.biblio_id) ? |
|
|
746 |
'<a title="' + _("View biblio details") + '" ' + |
747 |
'href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + |
748 |
row.biblio_id + '">' + |
749 |
row.biblio_id + |
750 |
'</a>' : ''; |
776 |
}; |
751 |
}; |
777 |
|
752 |
|
778 |
// Render function for request ID |
753 |
// Render function for request ID |
Lines 780-785
Link Here
|
780 |
return row.id_prefix + row.illrequest_id; |
755 |
return row.id_prefix + row.illrequest_id; |
781 |
}; |
756 |
}; |
782 |
|
757 |
|
|
|
758 |
// Render function for type |
759 |
var createType = function(data, type, row) { |
760 |
if (!row.hasOwnProperty('metadata_Type') || !row.metadata_Type) { |
761 |
if (row.hasOwnProperty('medium') && row.medium) { |
762 |
row.metadata_Type = row.medium; |
763 |
} else { |
764 |
row.metadata_Type = null; |
765 |
} |
766 |
} |
767 |
return row.metadata_Type; |
768 |
}; |
769 |
|
783 |
// Render function for request status |
770 |
// Render function for request status |
784 |
var createStatus = function(data, type, row, meta) { |
771 |
var createStatus = function(data, type, row, meta) { |
785 |
if (row.status_alias) { |
772 |
if (row.status_alias) { |
Lines 834-860
Link Here
|
834 |
// Columns that require special treatment |
821 |
// Columns that require special treatment |
835 |
var specialCols = { |
822 |
var specialCols = { |
836 |
action: { |
823 |
action: { |
837 |
name: '', |
|
|
838 |
func: createActionLink |
824 |
func: createActionLink |
839 |
}, |
825 |
}, |
840 |
borrowername: { |
826 |
borrowernumber: { |
841 |
name: _("Patron"), |
|
|
842 |
func: createPatronLink |
827 |
func: createPatronLink |
843 |
}, |
828 |
}, |
844 |
illrequest_id: { |
829 |
illrequest_id: { |
845 |
name: _("Request number"), |
|
|
846 |
func: createRequestId |
830 |
func: createRequestId |
847 |
}, |
831 |
}, |
848 |
status: { |
832 |
status: { |
849 |
name: _("Status"), |
|
|
850 |
func: createStatus |
833 |
func: createStatus |
851 |
}, |
834 |
}, |
852 |
biblio_id: { |
835 |
biblio_id: { |
853 |
name: _("Biblio ID") |
836 |
name: _("Bibliograpic record ID"), |
|
|
837 |
func: createBiblioLink |
854 |
}, |
838 |
}, |
855 |
library: { |
839 |
metadata_Type: { |
856 |
name: _("Library"), |
840 |
func: createType |
857 |
func: createLibrary |
|
|
858 |
}, |
841 |
}, |
859 |
updated: { |
842 |
updated: { |
860 |
name: _("Updated on"), |
843 |
name: _("Updated on"), |
Lines 914-921
Link Here
|
914 |
// Make a copy, we'll be removing columns next and need |
897 |
// Make a copy, we'll be removing columns next and need |
915 |
// to be able to refer to data that has been removed |
898 |
// to be able to refer to data that has been removed |
916 |
var dataCopy = $.extend(true, [], data); |
899 |
var dataCopy = $.extend(true, [], data); |
917 |
// Remove all columns we're not interested in |
|
|
918 |
removeIgnore(dataCopy); |
919 |
// Expand columns that need it and create an array |
900 |
// Expand columns that need it and create an array |
920 |
// of all column names |
901 |
// of all column names |
921 |
$.each(dataCopy, function(k, row) { |
902 |
$.each(dataCopy, function(k, row) { |
Lines 925-952
Link Here
|
925 |
// Assemble an array of column definitions for passing |
906 |
// Assemble an array of column definitions for passing |
926 |
// to datatables |
907 |
// to datatables |
927 |
var colData = []; |
908 |
var colData = []; |
928 |
Object.keys(allCols).forEach(function(thisCol) { |
909 |
columns_settings.forEach(function(thisCol) { |
|
|
910 |
var colName = thisCol.columnname; |
929 |
// Create the base column object |
911 |
// Create the base column object |
930 |
var colObj = { |
912 |
var colObj = $.extend({}, thisCol); |
931 |
name: thisCol, |
913 |
colObj.name = colName; |
932 |
className: thisCol, |
914 |
colObj.className = colName; |
933 |
defaultContent: '' |
915 |
|
934 |
}; |
|
|
935 |
// We may need to process the data going in this |
916 |
// We may need to process the data going in this |
936 |
// column, so do it if necessary |
917 |
// column, so do it if necessary |
937 |
if ( |
918 |
if ( |
938 |
specialCols.hasOwnProperty(thisCol) && |
919 |
specialCols.hasOwnProperty(colName) && |
939 |
specialCols[thisCol].hasOwnProperty('func') |
920 |
specialCols[colName].hasOwnProperty('func') |
940 |
) { |
921 |
) { |
941 |
colObj.render = specialCols[thisCol].func; |
922 |
colObj.render = specialCols[colName].func; |
942 |
} else { |
923 |
} else { |
943 |
colObj.data = thisCol; |
924 |
colObj.data = colName; |
944 |
} |
925 |
} |
|
|
926 |
// Make sure properties that aren't present in the API |
927 |
// response are populated with null to avoid Datatables |
928 |
// choking on their absence |
929 |
dataCopy.forEach(function(thisData) { |
930 |
if (!thisData.hasOwnProperty(colName)) { |
931 |
thisData[colName] = null; |
932 |
} |
933 |
}); |
945 |
colData.push(colObj); |
934 |
colData.push(colObj); |
946 |
}); |
935 |
}); |
947 |
|
936 |
|
948 |
// Initialise the datatable |
937 |
// Initialise the datatable |
949 |
table = $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, { |
938 |
var illTable = KohaTable("ill-requests", { |
950 |
'aoColumnDefs': [ |
939 |
'aoColumnDefs': [ |
951 |
{ // Last column shouldn't be sortable or searchable |
940 |
{ // Last column shouldn't be sortable or searchable |
952 |
'aTargets': [ 'actions' ], |
941 |
'aTargets': [ 'actions' ], |
Lines 997-1003
Link Here
|
997 |
} |
986 |
} |
998 |
|
987 |
|
999 |
} |
988 |
} |
1000 |
})); |
989 |
}, columns_settings); |
1001 |
|
990 |
|
1002 |
// Custom date range filtering |
991 |
// Custom date range filtering |
1003 |
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) { |
992 |
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) { |
1004 |
- |
|
|