Lines 1-4
Link Here
|
1 |
(function () { |
1 |
(function () { |
|
|
2 |
// Bail if there aren't any metadata enrichment plugins installed |
3 |
if (typeof metadata_enrichment_services === 'undefined') { |
4 |
console.log('No metadata enrichment plugins found.') |
5 |
return; |
6 |
} |
7 |
|
2 |
window.addEventListener('load', onload); |
8 |
window.addEventListener('load', onload); |
3 |
|
9 |
|
4 |
// Delay between API requests |
10 |
// Delay between API requests |
Lines 7-13
Link Here
|
7 |
// Elements we work frequently with |
13 |
// Elements we work frequently with |
8 |
var textarea = document.getElementById("identifiers_input"); |
14 |
var textarea = document.getElementById("identifiers_input"); |
9 |
var nameInput = document.getElementById("name"); |
15 |
var nameInput = document.getElementById("name"); |
10 |
var cardnumberInput = document.getElementById("cardnumber"); |
16 |
var cardnumberInput = document.getElementById("batchcardnumber"); |
11 |
var branchcodeSelect = document.getElementById("branchcode"); |
17 |
var branchcodeSelect = document.getElementById("branchcode"); |
12 |
var processButton = document.getElementById("process_button"); |
18 |
var processButton = document.getElementById("process_button"); |
13 |
var createButton = document.getElementById("button_create_batch"); |
19 |
var createButton = document.getElementById("button_create_batch"); |
Lines 21-27
Link Here
|
21 |
var createRequestsButton = document.getElementById('create-requests-button'); |
27 |
var createRequestsButton = document.getElementById('create-requests-button'); |
22 |
var statusesSelect = document.getElementById('statuscode'); |
28 |
var statusesSelect = document.getElementById('statuscode'); |
23 |
|
29 |
|
24 |
|
|
|
25 |
// We need a data structure keyed on identifier type, which tells us how to parse that |
30 |
// We need a data structure keyed on identifier type, which tells us how to parse that |
26 |
// identifier type and what services can get its metadata. We receive an array of |
31 |
// identifier type and what services can get its metadata. We receive an array of |
27 |
// available services |
32 |
// available services |
Lines 299-304
Link Here
|
299 |
tableContent.data = tableContent.data.map(function (row) { |
304 |
tableContent.data = tableContent.data.map(function (row) { |
300 |
if (row.value === identifier) { |
305 |
if (row.value === identifier) { |
301 |
row.requestId = data.illrequest_id; |
306 |
row.requestId = data.illrequest_id; |
|
|
307 |
row.requestStatus = data.status; |
302 |
} |
308 |
} |
303 |
return row; |
309 |
return row; |
304 |
}); |
310 |
}); |
Lines 893-898
Link Here
|
893 |
return data.requestId || '-'; |
899 |
return data.requestId || '-'; |
894 |
} |
900 |
} |
895 |
|
901 |
|
|
|
902 |
function createRequestStatus(x, y, data) { |
903 |
return data.requestStatus || '-'; |
904 |
} |
905 |
|
896 |
function buildTable(identifiers) { |
906 |
function buildTable(identifiers) { |
897 |
table = KohaTable('identifier-table', { |
907 |
table = KohaTable('identifier-table', { |
898 |
processing: true, |
908 |
processing: true, |
Lines 918-926
Link Here
|
918 |
}, |
928 |
}, |
919 |
{ |
929 |
{ |
920 |
data: 'requestId', |
930 |
data: 'requestId', |
921 |
width: '13%', |
931 |
width: '6.5%', |
922 |
render: createRequestId |
932 |
render: createRequestId |
923 |
}, |
933 |
}, |
|
|
934 |
{ |
935 |
data: 'requestStatus', |
936 |
width: '6.5%', |
937 |
render: createRequestStatus |
938 |
}, |
924 |
{ |
939 |
{ |
925 |
width: '18%', |
940 |
width: '18%', |
926 |
render: createActions, |
941 |
render: createActions, |
Lines 1021-1043
Link Here
|
1021 |
} |
1036 |
} |
1022 |
|
1037 |
|
1023 |
function patronAutocomplete() { |
1038 |
function patronAutocomplete() { |
1024 |
// Add autocomplete for patron selection |
1039 |
patron_autocomplete( |
1025 |
$('#batch-form #cardnumber').autocomplete({ |
1040 |
$('#batch-form #batchcardnumber'), |
1026 |
appendTo: '#batch-form', |
1041 |
{ |
1027 |
source: "/cgi-bin/koha/circ/ysearch.pl", |
1042 |
'on-select-callback': function( event, ui ) { |
1028 |
minLength: 3, |
1043 |
$("#batch-form #batchcardnumber").val( ui.item.cardnumber ); |
1029 |
select: function (event, ui) { |
|
|
1030 |
var field = ui.item.cardnumber; |
1031 |
$('#batch-form #cardnumber').val(field) |
1032 |
return false; |
1044 |
return false; |
|
|
1045 |
} |
1033 |
} |
1046 |
} |
1034 |
}) |
1047 |
); |
1035 |
.data("ui-autocomplete")._renderItem = function (ul, item) { |
|
|
1036 |
return $("<li></li>") |
1037 |
.data("ui-autocomplete-item", item) |
1038 |
.append("<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>") |
1039 |
.appendTo(ul); |
1040 |
}; |
1041 |
}; |
1048 |
}; |
1042 |
|
1049 |
|
1043 |
function createPatronLink() { |
1050 |
function createPatronLink() { |
1044 |
- |
|
|