From 2e4d0c9700ae0c4b098e88c8d7bcdfeb82d52d32 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Mon, 18 Nov 2024 11:49:01 +0000 Subject: [PATCH] Bug 38466: Fix error messages in KBART import Content-Type: text/plain; charset=utf-8 Test plan: 1) Download the file attached to this bug and save it as a .txt file 2) In the ERM module, create a local package 3) Go to the local titles page and click Import from KBART file 4) Select your package and the saved file and click import 5) The import will fail with just a console error 6) Apply patch and run a restart_all and a yarn js:build 7) Repeat step 4, it should now display an error saying the file must be either TSV or CSV 8) Convert the file to either of those two formats and repeat step 4 9) The file should now import successfully, with a message saying that there is an additional column "bestppn" that will not be imported Signed-off-by: msaby Signed-off-by: Marcel de Rooy --- Koha/REST/V1/ERM/EHoldings/Titles/Local.pm | 2 +- .../vue/components/ERM/EHoldingsLocalTitlesKBARTImport.vue | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm b/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm index c45d4d6914..ac8818afe5 100644 --- a/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm +++ b/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm @@ -285,7 +285,7 @@ sub import_from_kbart_file { if ( $file->{filename} !~ /\.csv$/ && $file->{filename} !~ /\.tsv$/ ) { return $c->render( status => 201, - openapi => { invalid_filetype => 1 } + openapi => { warnings => { invalid_filetype => 1 } } ); } diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesKBARTImport.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesKBARTImport.vue index 5049bf9cb0..d2d18bb194 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesKBARTImport.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesKBARTImport.vue @@ -86,9 +86,10 @@ import { ref, inject } from "vue" export default { setup() { - const { setMessage } = inject("mainStore") + const { setMessage, setWarning } = inject("mainStore") return { setMessage, + setWarning, } }, data() { @@ -171,11 +172,11 @@ export default { )}

` this.setMessage(message, true) } - if (success.invalid_filetype) { + if (success.warnings.invalid_filetype) { message += `

${this.$__( "The file must be in .tsv or .csv format, please convert your file and try again." )}

` - setWarning(message) + this.setWarning(message) } }, error => {} -- 2.39.5