From a2071fbf7c3ae5bdca98d4ae16b6105e4419d261 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Thu, 14 Nov 2013 15:55:00 +0800 Subject: [PATCH] MDL-42850 administration: Updated bulk user upload errors to be more descriptive. --- admin/tool/uploaduser/index.php | 7 +++---- lang/en/error.php | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/admin/tool/uploaduser/index.php b/admin/tool/uploaduser/index.php index 82f7ccc8362..568844a580a 100644 --- a/admin/tool/uploaduser/index.php +++ b/admin/tool/uploaduser/index.php @@ -123,12 +123,11 @@ if (empty($iid)) { $content = $mform1->get_file_content('userfile'); $readcount = $cir->load_csv_content($content, $formdata->encoding, $formdata->delimiter_name); + $csvloaderror = $cir->get_error(); unset($content); - if ($readcount === false) { - print_error('csvloaderror', '', $returnurl); - } else if ($readcount == 0) { - print_error('csvemptyfile', 'error', $returnurl); + if (!is_null($csvloaderror)) { + print_error('csvloaderror', '', $returnurl, $csvloaderror); } // test if columns ok $filecolumns = uu_validate_user_upload_columns($cir, $STD_FIELDS, $PRF_FIELDS, $returnurl); diff --git a/lang/en/error.php b/lang/en/error.php index 7232e304b18..2739a36d9db 100644 --- a/lang/en/error.php +++ b/lang/en/error.php @@ -186,7 +186,7 @@ $string['csvemptyfile'] = 'The CSV file is empty'; $string['csvfewcolumns'] = 'Not enough columns, please verify the delimiter setting'; $string['csvinvalidcols'] = 'Invalid CSV file: First line must include "Header Fields" and the file must be type of
"Expanded Fields/Comma Separated"
or
"Expanded Fields with CAVV Result Code/Comma Separated"'; $string['csvinvalidcolsnum'] = 'Invalid CSV file - each line must include 49 or 70 fields'; -$string['csvloaderror'] = 'Error occur during loading CSV file!'; +$string['csvloaderror'] = 'An error occurred while loading the CSV file: {$a}'; $string['csvweirdcolumns'] = 'Invalid CSV file format - number of columns is not constant!'; $string['dbconnectionfailed'] = '

Error: Database connection failed

It is possible that the database is overloaded or otherwise not running properly.