From 5bfbec5521845bb1c29abc22fbd6f7432f8ff36b Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Wed, 6 Aug 2014 10:58:59 +0800 Subject: [PATCH] MDL-46600 core_grades: made it explicit in the error message that a failed grade import means nothing was imported. --- grade/import/csv/index.php | 8 +++++--- lang/en/grades.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/grade/import/csv/index.php b/grade/import/csv/index.php index 57f0cbb1253..5a0dcdd2dda 100644 --- a/grade/import/csv/index.php +++ b/grade/import/csv/index.php @@ -299,7 +299,7 @@ if ($formdata = $mform2->get_data()) { // had to pick mapping $status = false; import_cleanup($importcode); - echo $OUTPUT->notification(get_string('importfailed', 'grades')); + // Relying on the default import failed message below. break 3; } @@ -320,7 +320,7 @@ if ($formdata = $mform2->get_data()) { // had to pick mapping $status = false; import_cleanup($importcode); - echo $OUTPUT->notification(get_string('importfailed', 'grades')); + // Relying on the default import failed message below. break 3; } @@ -445,9 +445,11 @@ if ($formdata = $mform2->get_data()) { /// at this stage if things are all ok, we commit the changes from temp table if ($status) { grade_import_commit($course->id, $importcode); + } else { + echo $OUTPUT->notification(get_string('importfailed', 'grades')); } } else { // If data hasn't been submitted then display the data mapping form. $mform2->display(); echo $OUTPUT->footer(); -} \ No newline at end of file +} diff --git a/lang/en/grades.php b/lang/en/grades.php index 9ea00eb48e2..13c3132c6ed 100644 --- a/lang/en/grades.php +++ b/lang/en/grades.php @@ -351,7 +351,7 @@ $string['import'] = 'Import'; $string['importcsv'] = 'Import CSV'; $string['importcustom'] = 'Import as custom outcomes (only this course)'; $string['importerror'] = 'An error occurred, this script wasn\'t called with the right parameters.'; -$string['importfailed'] = 'Import failed'; +$string['importfailed'] = 'Import failed. No data was imported.'; $string['importfeedback'] = 'Import feedback'; $string['importfile'] = 'Import file'; $string['importfilemissing'] = 'No file was received, go back to the form and make sure to upload a valid file.';