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