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