From 5aa24a6a479bd2066499d115f33004885264e3ee Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 4 Mar 2021 19:37:10 +0000 Subject: [PATCH] Bug 27869: let user know something went wrong with csv upload MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart --- .../intranet-tmpl/prog/en/modules/tools/quotes-upload.tt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt index 867a3628c3..6ef7bbb862 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt @@ -30,6 +30,7 @@ +
Instructions @@ -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. -- 2.39.5