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