Lines 555-561
Link Here
|
555 |
$(document).ready(function(){ |
555 |
$(document).ready(function(){ |
556 |
// keep a copy for re-rendering |
556 |
// keep a copy for re-rendering |
557 |
var $funds_tree = $('#bookfund').html(); |
557 |
var $funds_tree = $('#bookfund').html(); |
558 |
var base_query = { "order_id": {"-in": [[% multiple_orders | html %]]}}; |
558 |
var base_query = { "me.order_id": {"in": [[% multiple_orders | html %]]}}; |
559 |
var pending_orders_url = "/api/v1/acquisitions/orders?only_active=1"; |
559 |
var pending_orders_url = "/api/v1/acquisitions/orders?only_active=1"; |
560 |
var options = { |
560 |
var options = { |
561 |
"ajax": { |
561 |
"ajax": { |
Lines 563-572
Link Here
|
563 |
}, |
563 |
}, |
564 |
"embed": [ |
564 |
"embed": [ |
565 |
"basket", |
565 |
"basket", |
566 |
"biblio.suggestions.suggester", |
566 |
"biblio", |
567 |
"fund.budget", |
567 |
"fund.budget", |
568 |
"items+strings", |
568 |
"items+strings", |
569 |
"creator" |
569 |
"creator", |
|
|
570 |
"suggestions.suggester", |
570 |
], |
571 |
], |
571 |
'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
572 |
'dom': 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
572 |
"columns": [ |
573 |
"columns": [ |
Lines 696-709
Link Here
|
696 |
params['ordernumber'] = row.order_id; |
697 |
params['ordernumber'] = row.order_id; |
697 |
params['booksellerid'] = row.basket.vendor_id; |
698 |
params['booksellerid'] = row.basket.vendor_id; |
698 |
|
699 |
|
699 |
if(row.biblio.suggestions.length && row.biblio.suggestions[0].reason) { |
700 |
if(row.suggestions && row.suggestions[0].reason) { |
700 |
params["suggestionid"] = row.biblio.suggestions[0].suggestion_id; |
701 |
|
|
|
702 |
params["suggestionid"] = row.suggestions[0].suggestion_id; |
701 |
const options = Array.from(document.querySelectorAll('#reason option')); |
703 |
const options = Array.from(document.querySelectorAll('#reason option')); |
702 |
if (options.some(option => option.value === row.biblio.suggestions[0].reason)) { |
704 |
if (options.some(option => option.value === row.suggestions[0].reason)) { |
703 |
params['reason'] = row.biblio.suggestions[0].reason; |
705 |
params['reason'] = row.suggestions[0].reason; |
704 |
} else { |
706 |
} else { |
705 |
params['reason'] = 'other'; |
707 |
params['reason'] = 'other'; |
706 |
params['other_reason'] = row.biblio.suggestions[0].reason; |
708 |
params['other_reason'] = row.suggestions[0].reason; |
707 |
} |
709 |
} |
708 |
} |
710 |
} |
709 |
params['datereceived'] = row.date_received; |
711 |
params['datereceived'] = row.date_received; |
Lines 841-854
Link Here
|
841 |
$("#other_reason").show(); |
843 |
$("#other_reason").show(); |
842 |
$(this).hide(); |
844 |
$(this).hide(); |
843 |
} else { |
845 |
} else { |
844 |
row.biblio.suggestions[0].reason = val; |
846 |
row.suggestions[0].reason = val; |
845 |
} |
847 |
} |
846 |
}); |
848 |
}); |
847 |
|
849 |
|
848 |
$("#order_edit").on("change", "#select-other_reason", function() { |
850 |
$("#order_edit").on("change", "#select-other_reason", function() { |
849 |
var val = $(this).val(); |
851 |
var val = $(this).val(); |
850 |
var row = $("#order_edit").data('row'); |
852 |
var row = $("#order_edit").data('row'); |
851 |
row.biblio.suggestions[0].reason = val; |
853 |
row.suggestions[0].reason = val; |
852 |
}); |
854 |
}); |
853 |
|
855 |
|
854 |
$("#order_edit").on("click", "#other_reason a", function() { |
856 |
$("#order_edit").on("click", "#other_reason a", function() { |
Lines 1136-1166
Link Here
|
1136 |
o.parent().hide(); |
1138 |
o.parent().hide(); |
1137 |
} |
1139 |
} |
1138 |
}); |
1140 |
}); |
1139 |
if(row.biblio.suggestions.length) { |
1141 |
if(row.suggestions) { |
1140 |
$("#suggestion_fieldset").show(); |
1142 |
$("#suggestion_fieldset").show(); |
1141 |
if(row.biblio.suggestions[0].suggester) { |
1143 |
if(row.suggestions[0].suggester) { |
1142 |
$("#biblio_suggestion_suggester").parent().show(); |
1144 |
$("#biblio_suggestion_suggester").parent().show(); |
1143 |
$("#biblio_suggestion_suggester") |
1145 |
$("#biblio_suggestion_suggester") |
1144 |
.html( |
1146 |
.html( |
1145 |
[row.biblio.suggestions[0].suggester.surname, row.biblio.suggestions[0].suggester.firstname] |
1147 |
[row.suggestions[0].suggester.surname, row.suggestions[0].suggester.firstname] |
1146 |
.filter(function(name){ |
1148 |
.filter(function(name){ |
1147 |
return name |
1149 |
return name |
1148 |
}) |
1150 |
}) |
1149 |
.join(', ')+' (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='+row.biblio.suggestions[0].suggestion_id+'&op=show">'+SUGGESTION.format(row.biblio.suggestions[0].suggestion_id)+'</a>)' |
1151 |
.join(', ')+' (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='+row.suggestions[0].suggestion_id+'&op=show">'+SUGGESTION.format(row.suggestions[0].suggestion_id)+'</a>)' |
1150 |
); |
1152 |
); |
1151 |
} else { |
1153 |
} else { |
1152 |
$("#biblio_suggestion_suggester").parent().hide(); |
1154 |
$("#biblio_suggestion_suggester").parent().hide(); |
1153 |
} |
1155 |
} |
1154 |
if(row.biblio.suggestions[0].reason) { |
1156 |
if(row.suggestions[0].reason) { |
1155 |
$("#suggestion_reason").show(); |
1157 |
$("#suggestion_reason").show(); |
1156 |
const options = Array.from(document.querySelectorAll('#reason option')); |
1158 |
const options = Array.from(document.querySelectorAll('#reason option')); |
1157 |
if (options.some(option => option.value === row.biblio.suggestions[0].reason)) { |
1159 |
if (options.some(option => option.value === row.suggestions[0].reason)) { |
1158 |
$("#other_reason a").click(); |
1160 |
$("#other_reason a").click(); |
1159 |
$("#reason").val(row.biblio.suggestions[0].reason); |
1161 |
$("#reason").val(row.suggestions[0].reason); |
1160 |
$("#select-other_reason").val(null); |
1162 |
$("#select-other_reason").val(null); |
1161 |
} else { |
1163 |
} else { |
1162 |
$("#reason").val("other").change(); |
1164 |
$("#reason").val("other").change(); |
1163 |
$("#select-other_reason").val(row.biblio.suggestions[0].reason); |
1165 |
$("#select-other_reason").val(row.suggestions[0].reason); |
1164 |
} |
1166 |
} |
1165 |
|
1167 |
|
1166 |
} else { |
1168 |
} else { |