View | Details | Raw Unified | Return to bug 36831
Collapse All | Expand All

(-)a/Koha/REST/V1/ERM/EHoldings/Titles/Local.pm (-10 / +5 lines)
Lines 25-32 use Koha::BackgroundJob::ImportKBARTFile; Link Here
25
25
26
use Scalar::Util qw( blessed );
26
use Scalar::Util qw( blessed );
27
use Try::Tiny    qw( catch try );
27
use Try::Tiny    qw( catch try );
28
use MIME::Base64 qw( decode_base64 encode_base64 );
29
use POSIX        qw( floor );
30
use Text::CSV_XS;
28
use Text::CSV_XS;
31
29
32
=head1 API
30
=head1 API
Lines 282-296 sub import_from_kbart_file { Link Here
282
        my @invalid_columns;
280
        my @invalid_columns;
283
        my $max_allowed_packet = C4::Context->dbh->selectrow_array(q{SELECT @@max_allowed_packet});
281
        my $max_allowed_packet = C4::Context->dbh->selectrow_array(q{SELECT @@max_allowed_packet});
284
282
285
        # Check if file is in TSV or CSV format and send an error back if not
283
        my ( $column_headers, $rows, $error ) = Koha::BackgroundJob::ImportKBARTFile::read_file($file);
286
        if ( $file->{filename} !~ /\.csv$/ && $file->{filename} !~ /\.tsv$/ ) {
287
            return $c->render(
288
                status  => 201,
289
                openapi => { invalid_filetype => 1 }
290
            );
291
        }
292
284
293
        my ( $column_headers, $rows ) = Koha::BackgroundJob::ImportKBARTFile::read_file($file);
285
        return $c->render(
286
            status  => 201,
287
            openapi => { invalid_filetype => 1 }
288
        ) if $error eq 'unknown_delimiter';
294
289
295
        # Check that the column headers in the file match the standardised KBART phase II columns
290
        # Check that the column headers in the file match the standardised KBART phase II columns
296
        # If not, return a warning
291
        # If not, return a warning
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesKBARTImport.vue (-17 / +1 lines)
Lines 2-22 Link Here
2
    <h2>{{ $__("Import from a KBART file") }}</h2>
2
    <h2>{{ $__("Import from a KBART file") }}</h2>
3
    <div class="page-section" id="files">
3
    <div class="page-section" id="files">
4
        <form @submit="addDocument($event)" class="file_upload">
4
        <form @submit="addDocument($event)" class="file_upload">
5
            <h3>{{ $__("Requirements:") }}</h3>
6
            <ul style="margin-bottom: 1.5em">
7
                <li>{{ $__("The file must be in TSV or CSV format") }}</li>
8
                <li>
9
                    {{
10
                        $__(
11
                            "The file should not contain any additional information / header rows, e.g. a file with a single title would be structured as follows:"
12
                        )
13
                    }}
14
                    <ol>
15
                        <li>{{ $__("Column headings row") }}</li>
16
                        <li>{{ $__("Title data row") }}</li>
17
                    </ol>
18
                </li>
19
            </ul>
20
            <fieldset class="rows" id="package_list">
5
            <fieldset class="rows" id="package_list">
21
                <h3>{{ $__("Select file for upload") }}:</h3>
6
                <h3>{{ $__("Select file for upload") }}:</h3>
22
                <ol>
7
                <ol>
Lines 173-179 export default { Link Here
173
                    }
158
                    }
174
                    if (success.invalid_filetype) {
159
                    if (success.invalid_filetype) {
175
                        message += `<p>${this.$__(
160
                        message += `<p>${this.$__(
176
                            "The file must be in .tsv or .csv format, please convert your file and try again."
161
                            "Could not detect whether the file is TSV or CSV, please check the file."
177
                        )}</p>`
162
                        )}</p>`
178
                        setWarning(message)
163
                        setWarning(message)
179
                    }
164
                    }
180
- 

Return to bug 36831