@@ -, +, @@
- Stage a record for import, notice that the "View batch" link appears
- Add order to basket from a new file, select a file and import
---
.../prog/en/modules/tools/stage-marc-import.tt | 16 +++++++++++++---
koha-tmpl/intranet-tmpl/prog/js/job_progess.js | 5 +++--
2 files changed, 16 insertions(+), 5 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt
@@ -79,6 +79,7 @@
The job has been enqueued! It will be processed as soon as possible.
[% INCLUDE "job_progress.inc" job_id=job_id %]
View detail of the enqueued job
+
[% ELSE %]
Stage MARC records for import
@@ -105,8 +106,7 @@
Upload progress:
-
+
0%
@@ -428,7 +428,17 @@
})
});
[% IF job_enqueued %]
- updateProgress([% job_id | html %]);
+ updateProgress([% job_id | html %], function(){
+ $.getJSON('/api/v1/jobs/[% job_id | html %]', function(job){
+ let import_batch_id = job.data.report.import_batch_id;
+ $('
%s
'.format(import_batch_id, _("View batch"))).appendTo("#job_callback");
+ let basket_id = job.data.report.basket_id;
+ let vendor_id = job.data.report.vendor_id;
+ if ( basket_id && vendor_id ) {
+ $('
%s
'.format(import_batch_id, basket_id, vendor_id, _("Add staged files to basket"))).appendTo("#job_callback");
+ }
+ });
+ });
[% END %]
});
--- a/koha-tmpl/intranet-tmpl/prog/js/job_progess.js
+++ a/koha-tmpl/intranet-tmpl/prog/js/job_progess.js
@@ -1,4 +1,4 @@
-function updateProgress(job_id) {
+function updateProgress(job_id, callback) {
$.getJSON('/api/v1/jobs/' + job_id, function(job){
let recheck = true;
@@ -19,6 +19,7 @@ function updateProgress(job_id) {
$('#progress-bar-' + job_id).addClass("progress-bar-success");
$('#progress-bar-' + job_id).attr('aria-valuenow', 100).css("width", "100%");
recheck = false;
+ callback();
} else if ( job.status == "failed" ) {
$('#job-percent-' + job_id).text(0);
$('#job-status-' + job_id).text(JOB_PROGRESS_FAILED);
@@ -28,7 +29,7 @@ function updateProgress(job_id) {
}
if ( recheck ) {
- setTimeout(function(){updateProgress(job_id)}, 1 * 1000);
+ setTimeout(function(){updateProgress(job_id, callback)}, 1 * 1000);
}
});
}
--