From 1eb511def15416f6f0cd0961384895f03e10c822 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 --- 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