Bugzilla – Attachment 170551 Details for
Bug 36831
Add support for .txt files to the KBART import tool
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36831: Allow for multiple file types
Bug-36831-Allow-for-multiple-file-types.patch (text/plain), 3.94 KB, created by
Matt Blenkinsop
on 2024-08-21 10:17:20 UTC
(
hide
)
Description:
Bug 36831: Allow for multiple file types
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2024-08-21 10:17:20 UTC
Size:
3.94 KB
patch
obsolete
>From d82458fc5d9b2b0807e4b31b533bdde433b3ed8a Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Wed, 3 Jul 2024 09:52:45 +0000 >Subject: [PATCH] Bug 36831: Allow for multiple file types > >This patch allows the KBART import tool to accept different filetypes and then work out whether they are CSV or TSV files. > >Test plan: >1) Try to import the file attached to the bug using the KBART import tool (E-resource management > eHoldings > Local > Titles > Import from a KBART file) >2) It should return an error saying that the file must be .csv or .tsv >3) Apply patch >4) yarn build >5) restart_all >6) Repeat step 1 >7) The file should now successfully import >--- > Koha/REST/V1/ERM/EHoldings/Titles/Local.pm | 13 +++++-------- > .../ERM/EHoldingsLocalTitlesKBARTImport.vue | 17 +---------------- > 2 files changed, 6 insertions(+), 24 deletions(-) > >diff --git a/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm b/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm >index c45d4d69140..20edd57df98 100644 >--- a/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm >+++ b/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm >@@ -281,15 +281,12 @@ sub import_from_kbart_file { > my @invalid_columns; > my $max_allowed_packet = C4::Context->dbh->selectrow_array(q{SELECT @@max_allowed_packet}); > >- # Check if file is in TSV or CSV format and send an error back if not >- if ( $file->{filename} !~ /\.csv$/ && $file->{filename} !~ /\.tsv$/ ) { >- return $c->render( >- status => 201, >- openapi => { invalid_filetype => 1 } >- ); >- } >+ my ( $column_headers, $rows, $error ) = Koha::BackgroundJob::ImportKBARTFile::read_file($file); > >- my ( $column_headers, $rows ) = Koha::BackgroundJob::ImportKBARTFile::read_file($file); >+ return $c->render( >+ status => 201, >+ openapi => { invalid_filetype => 1 } >+ ) if $error eq 'unknown_delimiter'; > > # Check that the column headers in the file match the standardised KBART phase II columns > # If not, return a warning >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 5049bf9cb09..5cb0081f6e4 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 >@@ -2,21 +2,6 @@ > <h2>{{ $__("Import from a KBART file") }}</h2> > <div class="page-section" id="files"> > <form @submit="addDocument($event)" class="file_upload"> >- <h3>{{ $__("Requirements:") }}</h3> >- <ul style="margin-bottom: 1.5em"> >- <li>{{ $__("The file must be in TSV or CSV format") }}</li> >- <li> >- {{ >- $__( >- "The file should not contain any additional information / header rows, e.g. a file with a single title would be structured as follows:" >- ) >- }} >- <ol> >- <li>{{ $__("Column headings row") }}</li> >- <li>{{ $__("Title data row") }}</li> >- </ol> >- </li> >- </ul> > <fieldset class="rows" id="package_list"> > <h3>{{ $__("Select file for upload") }}:</h3> > <ol> >@@ -173,7 +158,7 @@ export default { > } > if (success.invalid_filetype) { > message += `<p>${this.$__( >- "The file must be in .tsv or .csv format, please convert your file and try again." >+ "Could not detect whether the file is TSV or CSV, please check the file." > )}</p>` > setWarning(message) > } >-- >2.39.3 (Apple Git-146)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36831
:
166958
|
166959
|
166960
|
166961
|
166989
|
166990
|
166991
|
168431
|
168432
|
168433
|
168434
|
170549
|
170550
|
170551
|
170552
|
170562
|
170563
|
170564
|
170565