Browse Source

Bug 27869: let user know something went wrong with csv upload

To test:
-attempt to upload a malformed CSV file
-nothing happens, check the console and see the error: Uncaught TypeError: arrData[(arrData.length - 1)] is undefined
-apply patch
-try again
-now you should at least see a warning that something went wrong
-attempt to upload a good CSV file, it should work

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.05.x
Lucas Gass 2 years ago
committed by Jonathan Druart
parent
commit
5aa24a6a47
  1. 7
      koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt

7
koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt

@ -30,6 +30,7 @@
<div class="import_errors dialog alert" style="display: none;"></div>
</div>
<div id="csv_error" class="alert" style="visibility: hidden;">Something went wrong, check your CSV file.</div>
<div id="instructions">
<fieldset id="file_uploader_help" class="rows">
<legend>Instructions</legend>
@ -217,7 +218,11 @@
// Now that we have our value string, let's add
// it to the data array.
arrData[ arrData.length - 1 ].push( strMatchedValue );
if ( arrData[ arrData.length - 1 ] ) {
arrData[ arrData.length - 1 ].push( strMatchedValue );
} else {
$('#csv_error').css( 'visibility' , 'visible' );
}
}
// Return the parsed data.

Loading…
Cancel
Save