Merge pull request #7193 from nupplaphil/bug/uimport_datetime

Fix NULL datetime for uimport/uexport
This commit is contained in:
Hypolite Petovan
2019-05-27 09:13:01 -04:00
committed by GitHub
2 changed files with 41 additions and 2 deletions
+7
View File
@@ -39,14 +39,21 @@ class UserImport
$tableColumns = DBStructure::getColumns($table);
$tcols = [];
$ttype = [];
// get a plain array of column names
foreach ($tableColumns as $tcol) {
$tcols[] = $tcol['Field'];
$ttype[$tcol['Field']] = $tcol['Type'];
}
// remove inexistent columns
foreach ($arr as $icol => $ival) {
if (!in_array($icol, $tcols)) {
unset($arr[$icol]);
continue;
}
if ($ttype[$icol] === 'datetime') {
$arr[$icol] = $ival ?? DBA::NULL_DATETIME;
}
}
}