From d7903d34f0fc00eae6b352386b1c569a168a7aca Mon Sep 17 00:00:00 2001 From: Abhimanyu Kumar Date: Sat, 23 Mar 2019 18:34:03 +0530 Subject: [PATCH] MDL-64959 uploaduser: remove leading/trailing spaces from CSV headings Earlier while uploading users via CSV, if any leading or trailing space was there in headings of CSV file then error was displayed which will be difficult for a non-technical person to understand. After this patch, leading and trailing spaces from headings will be trimmed automatically. --- admin/tool/uploaduser/locallib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/admin/tool/uploaduser/locallib.php b/admin/tool/uploaduser/locallib.php index ae3dfe38880..f6eeccecc98 100644 --- a/admin/tool/uploaduser/locallib.php +++ b/admin/tool/uploaduser/locallib.php @@ -183,6 +183,7 @@ function uu_validate_user_upload_columns(csv_import_reader $cir, $stdfields, $pr $processed = array(); foreach ($columns as $key=>$unused) { $field = $columns[$key]; + $field = trim($field); $lcfield = core_text::strtolower($field); if (in_array($field, $stdfields) or in_array($lcfield, $stdfields)) { // standard fields are only lowercase