From b453a9d2b2afe2d9b43ae7e97608f7a6c9314769 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 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 --- koha-tmpl/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.11.0