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 499-518
Link Here
|
499 |
<table id="ill-requests"> |
500 |
<table id="ill-requests"> |
500 |
<thead> |
501 |
<thead> |
501 |
<tr id="illview-header"> |
502 |
<tr id="illview-header"> |
502 |
<th>Author</th> |
503 |
<th scope="col">Request ID</th> |
503 |
<th>Title</th> |
504 |
<th scope="col">Author</th> |
504 |
<th>Patron</th> |
505 |
<th scope="col">Title</th> |
505 |
<th>Bibliographic record ID</th> |
506 |
<th scope="col">Article title</th> |
506 |
<th>Library</th> |
507 |
<th scope="col">Issue</th> |
507 |
<th>Status</th> |
508 |
<th scope="col">Volume</th> |
508 |
<th class="placed"> </th> |
509 |
<th scope="col">Year</th> |
509 |
<th class="placed_formatted">Date placed</th> |
510 |
<th scope="col">Pages</th> |
510 |
<th class="updated"> </th> |
511 |
<th scope="col">Type</th> |
511 |
<th class="updated_formatted">Updated on</th> |
512 |
<th scope="col">Order ID</th> |
512 |
<th>Request number</th> |
513 |
<th scope="col">Biblio ID</th> |
513 |
<th>Comments</th> |
514 |
<th scope="col">Patron</th> |
514 |
<th class="patron_cardnumber">Patron barcode</th> |
515 |
<th class="patron_cardnumber">Patron barcode</th> |
515 |
<th class="actions"></th> |
516 |
<th scope="col">Branch</th> |
|
|
517 |
<th scope="col">Status</th> |
518 |
<th scope="col" class="placed"> </th> |
519 |
<th scope="col" class="placed_formatted">Placed on</th> |
520 |
<th scope="col">Replied</th> |
521 |
<th scope="col" class="updated"> </th> |
522 |
<th scope="col" class="updated_formatted">Updated on</th> |
523 |
<th scope="col">Completed on</th> |
524 |
<th scope="col">Access URL</th> |
525 |
<th scope="col">Cost</th> |
526 |
<th scope="col">OPAC notes</th> |
527 |
<th scope="col">Staff notes</th> |
528 |
<th scope="col">Backend</th> |
529 |
<th scope="col" class="actions"></th> |
516 |
</tr> |
530 |
</tr> |
517 |
</thead> |
531 |
</thead> |
518 |
<tbody id="illview-body"> |
532 |
<tbody id="illview-body"> |
Lines 536-541
Link Here
|
536 |
|
550 |
|
537 |
[% MACRO jsinclude BLOCK %] |
551 |
[% MACRO jsinclude BLOCK %] |
538 |
[% INCLUDE 'datatables.inc' %] |
552 |
[% INCLUDE 'datatables.inc' %] |
|
|
553 |
[% INCLUDE 'columns_settings.inc' %] |
539 |
[% INCLUDE 'calendar.inc' %] |
554 |
[% INCLUDE 'calendar.inc' %] |
540 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] |
555 |
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] |
541 |
<script> |
556 |
<script> |
Lines 543-595
Link Here
|
543 |
|
558 |
|
544 |
// Illview Datatable setup |
559 |
// Illview Datatable setup |
545 |
|
560 |
|
|
|
561 |
var columns_settings = [% ColumnsSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %]; |
562 |
|
546 |
var table; |
563 |
var table; |
547 |
|
564 |
|
548 |
// Filters that are active |
565 |
// Filters that are active |
549 |
var activeFilters = {}; |
566 |
var activeFilters = {}; |
550 |
|
567 |
|
551 |
// Fields we don't want to display |
|
|
552 |
var ignore = [ |
553 |
'accessurl', |
554 |
'backend', |
555 |
'branchcode', |
556 |
'completed', |
557 |
'capabilities', |
558 |
'cost', |
559 |
'medium', |
560 |
'notesopac', |
561 |
'notesstaff', |
562 |
'replied' |
563 |
]; |
564 |
|
565 |
// Fields we need to expand (flatten) |
568 |
// Fields we need to expand (flatten) |
566 |
var expand = [ |
569 |
var expand = [ |
567 |
'metadata', |
570 |
'metadata', |
568 |
'patron' |
571 |
'patron', |
|
|
572 |
'library' |
569 |
]; |
573 |
]; |
570 |
|
574 |
|
571 |
// Expanded fields |
575 |
// Expanded fields |
572 |
// This is auto populated |
576 |
// This is auto populated |
573 |
var expanded = {}; |
577 |
var expanded = {}; |
574 |
|
578 |
|
575 |
// The core fields that should be displayed first |
|
|
576 |
var core = [ |
577 |
'metadata_author', |
578 |
'metadata_title', |
579 |
'borrowername', |
580 |
'biblio_id', |
581 |
'library', |
582 |
'status', |
583 |
'placed', |
584 |
'placed_formatted', |
585 |
'updated', |
586 |
'updated_formatted', |
587 |
'illrequest_id', |
588 |
'comments', |
589 |
'patron_cardnumber', |
590 |
'action' |
591 |
]; |
592 |
|
593 |
// Filterable columns |
579 |
// Filterable columns |
594 |
var filterable = { |
580 |
var filterable = { |
595 |
status: { |
581 |
status: { |
Lines 691-707
Link Here
|
691 |
} |
677 |
} |
692 |
}; |
678 |
}; |
693 |
|
679 |
|
694 |
// Remove any fields we're ignoring |
|
|
695 |
var removeIgnore = function(dataObj) { |
696 |
dataObj.forEach(function(thisRow) { |
697 |
ignore.forEach(function(thisIgnore) { |
698 |
if (thisRow.hasOwnProperty(thisIgnore)) { |
699 |
delete thisRow[thisIgnore]; |
700 |
} |
701 |
}); |
702 |
}); |
703 |
}; |
704 |
|
705 |
// Expand any fields we're expanding |
680 |
// Expand any fields we're expanding |
706 |
var expandExpand = function(row) { |
681 |
var expandExpand = function(row) { |
707 |
expand.forEach(function(thisExpand) { |
682 |
expand.forEach(function(thisExpand) { |
Lines 712-718
Link Here
|
712 |
var expandObj = row[thisExpand]; |
687 |
var expandObj = row[thisExpand]; |
713 |
Object.keys(expandObj).forEach( |
688 |
Object.keys(expandObj).forEach( |
714 |
function(thisExpandCol) { |
689 |
function(thisExpandCol) { |
715 |
var expColName = thisExpand + '_' + thisExpandCol; |
690 |
var expColName = thisExpand + '_' + thisExpandCol.replace(/\s/g,'_'); |
716 |
// Keep a list of fields that have been expanded |
691 |
// Keep a list of fields that have been expanded |
717 |
// so we can create toggle links for them |
692 |
// so we can create toggle links for them |
718 |
if (expanded[thisExpand].indexOf(expColName) == -1) { |
693 |
if (expanded[thisExpand].indexOf(expColName) == -1) { |
Lines 729-740
Link Here
|
729 |
}); |
704 |
}); |
730 |
}; |
705 |
}; |
731 |
|
706 |
|
732 |
// Build a de-duped list of all column names |
|
|
733 |
var allCols = {}; |
734 |
core.map(function(thisCore) { |
735 |
allCols[thisCore] = 1; |
736 |
}); |
737 |
|
738 |
// Strip the expand prefix if it exists, we do this for display |
707 |
// Strip the expand prefix if it exists, we do this for display |
739 |
var stripPrefix = function(value) { |
708 |
var stripPrefix = function(value) { |
740 |
expand.forEach(function(thisExpand) { |
709 |
expand.forEach(function(thisExpand) { |
Lines 752-764
Link Here
|
752 |
if ( row.patron_firstname ) { |
721 |
if ( row.patron_firstname ) { |
753 |
patronLink = patronLink + row.patron_firstname + ' '; |
722 |
patronLink = patronLink + row.patron_firstname + ' '; |
754 |
} |
723 |
} |
755 |
patronLink = patronLink + row.patron_surname + '</a>'; |
724 |
patronLink = patronLink + row.patron_surname + |
|
|
725 |
' [' + row.patron_cardnumber + ' ]</a>'; |
756 |
return patronLink; |
726 |
return patronLink; |
757 |
}; |
727 |
}; |
758 |
|
728 |
|
759 |
// Our 'render' function for the library name |
729 |
// Our 'render' function for biblio_id |
760 |
var createLibrary = function(data, type, row) { |
730 |
var createBiblioLink = function(data, type, row) { |
761 |
return row.library.branchname; |
731 |
return (row.biblio_id) ? |
|
|
732 |
'<a title="' + _("View biblio details") + '" ' + |
733 |
'href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + |
734 |
row.biblio_id + '">' + |
735 |
row.biblio_id + |
736 |
'</a>' : ''; |
762 |
}; |
737 |
}; |
763 |
|
738 |
|
764 |
// Render function for request ID |
739 |
// Render function for request ID |
Lines 766-771
Link Here
|
766 |
return row.id_prefix + row.illrequest_id; |
741 |
return row.id_prefix + row.illrequest_id; |
767 |
}; |
742 |
}; |
768 |
|
743 |
|
|
|
744 |
// Render function for type |
745 |
var createType = function(data, type, row) { |
746 |
if (!row.hasOwnProperty('metadata_Type') || !row.metadata_Type) { |
747 |
if (row.hasOwnProperty('medium') && row.medium) { |
748 |
row.metadata_Type = row.medium; |
749 |
} else { |
750 |
row.metadata_Type = null; |
751 |
} |
752 |
} |
753 |
return row.metadata_Type; |
754 |
}; |
755 |
|
769 |
// Render function for request status |
756 |
// Render function for request status |
770 |
var createStatus = function(data, type, row, meta) { |
757 |
var createStatus = function(data, type, row, meta) { |
771 |
if (row.status_alias) { |
758 |
if (row.status_alias) { |
Lines 820-846
Link Here
|
820 |
// Columns that require special treatment |
807 |
// Columns that require special treatment |
821 |
var specialCols = { |
808 |
var specialCols = { |
822 |
action: { |
809 |
action: { |
823 |
name: '', |
|
|
824 |
func: createActionLink |
810 |
func: createActionLink |
825 |
}, |
811 |
}, |
826 |
borrowername: { |
812 |
borrowernumber: { |
827 |
name: _("Patron"), |
|
|
828 |
func: createPatronLink |
813 |
func: createPatronLink |
829 |
}, |
814 |
}, |
830 |
illrequest_id: { |
815 |
illrequest_id: { |
831 |
name: _("Request number"), |
|
|
832 |
func: createRequestId |
816 |
func: createRequestId |
833 |
}, |
817 |
}, |
834 |
status: { |
818 |
status: { |
835 |
name: _("Status"), |
|
|
836 |
func: createStatus |
819 |
func: createStatus |
837 |
}, |
820 |
}, |
838 |
biblio_id: { |
821 |
biblio_id: { |
839 |
name: _("Biblio ID") |
822 |
name: _("Bibliograpic record ID"), |
|
|
823 |
func: createBiblioLink |
840 |
}, |
824 |
}, |
841 |
library: { |
825 |
metadata_Type: { |
842 |
name: _("Library"), |
826 |
func: createType |
843 |
func: createLibrary |
|
|
844 |
}, |
827 |
}, |
845 |
updated: { |
828 |
updated: { |
846 |
name: _("Updated on"), |
829 |
name: _("Updated on"), |
Lines 900-907
Link Here
|
900 |
// Make a copy, we'll be removing columns next and need |
883 |
// Make a copy, we'll be removing columns next and need |
901 |
// to be able to refer to data that has been removed |
884 |
// to be able to refer to data that has been removed |
902 |
var dataCopy = $.extend(true, [], data); |
885 |
var dataCopy = $.extend(true, [], data); |
903 |
// Remove all columns we're not interested in |
|
|
904 |
removeIgnore(dataCopy); |
905 |
// Expand columns that need it and create an array |
886 |
// Expand columns that need it and create an array |
906 |
// of all column names |
887 |
// of all column names |
907 |
$.each(dataCopy, function(k, row) { |
888 |
$.each(dataCopy, function(k, row) { |
Lines 911-938
Link Here
|
911 |
// Assemble an array of column definitions for passing |
892 |
// Assemble an array of column definitions for passing |
912 |
// to datatables |
893 |
// to datatables |
913 |
var colData = []; |
894 |
var colData = []; |
914 |
Object.keys(allCols).forEach(function(thisCol) { |
895 |
columns_settings.forEach(function(thisCol) { |
|
|
896 |
var colName = thisCol.columnname; |
915 |
// Create the base column object |
897 |
// Create the base column object |
916 |
var colObj = { |
898 |
var colObj = $.extend({}, thisCol); |
917 |
name: thisCol, |
899 |
colObj.name = colName; |
918 |
className: thisCol, |
900 |
colObj.className = colName; |
919 |
defaultContent: '' |
901 |
|
920 |
}; |
|
|
921 |
// We may need to process the data going in this |
902 |
// We may need to process the data going in this |
922 |
// column, so do it if necessary |
903 |
// column, so do it if necessary |
923 |
if ( |
904 |
if ( |
924 |
specialCols.hasOwnProperty(thisCol) && |
905 |
specialCols.hasOwnProperty(colName) && |
925 |
specialCols[thisCol].hasOwnProperty('func') |
906 |
specialCols[colName].hasOwnProperty('func') |
926 |
) { |
907 |
) { |
927 |
colObj.render = specialCols[thisCol].func; |
908 |
colObj.render = specialCols[colName].func; |
928 |
} else { |
909 |
} else { |
929 |
colObj.data = thisCol; |
910 |
colObj.data = colName; |
930 |
} |
911 |
} |
|
|
912 |
// Make sure properties that aren't present in the API |
913 |
// response are populated with null to avoid Datatables |
914 |
// choking on their absence |
915 |
dataCopy.forEach(function(thisData) { |
916 |
if (!thisData.hasOwnProperty(colName)) { |
917 |
thisData[colName] = null; |
918 |
} |
919 |
}); |
931 |
colData.push(colObj); |
920 |
colData.push(colObj); |
932 |
}); |
921 |
}); |
933 |
|
922 |
|
934 |
// Initialise the datatable |
923 |
// Initialise the datatable |
935 |
table = $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, { |
924 |
var illTable = KohaTable("ill-requests", { |
936 |
'aoColumnDefs': [ |
925 |
'aoColumnDefs': [ |
937 |
{ // Last column shouldn't be sortable or searchable |
926 |
{ // Last column shouldn't be sortable or searchable |
938 |
'aTargets': [ 'actions' ], |
927 |
'aTargets': [ 'actions' ], |
Lines 983-989
Link Here
|
983 |
} |
972 |
} |
984 |
|
973 |
|
985 |
} |
974 |
} |
986 |
})); |
975 |
}, columns_settings); |
987 |
|
976 |
|
988 |
// Custom date range filtering |
977 |
// Custom date range filtering |
989 |
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) { |
978 |
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) { |
990 |
- |
|
|