mirror of
https://github.com/nextcloud/tables.git
synced 2025-08-16 15:17:20 +00:00
fix(Import): Fix DateTime subtype checks
Trying to import a table with dates resulted in the following error: ``` Cannot use object of type OCA\Tables\Db\Column as array in file '.../tables/lib/Service/ImportService.php' line 171 ``` Signed-off-by: Michael Kuhn <michael.kuhn@ovgu.de>
This commit is contained in:
@ -168,12 +168,16 @@ class ImportService extends SuperService {
|
||||
|| (is_array($columns[$colIndex])
|
||||
&& $columns[$colIndex]['type'] === Column::TYPE_DATETIME)
|
||||
) {
|
||||
if (isset($columns[$colIndex]['subtype'])
|
||||
&& $columns[$colIndex]['subtype'] === Column::SUBTYPE_DATETIME_DATE
|
||||
if (
|
||||
($column && $column->getSubtype() === Column::SUBTYPE_DATETIME_DATE)
|
||||
|| (is_array($columns[$colIndex])
|
||||
&& $columns[$colIndex]['subtype'] === Column::SUBTYPE_DATETIME_DATE)
|
||||
) {
|
||||
$format = 'Y-m-d';
|
||||
} elseif (isset($columns[$colIndex]['subtype'])
|
||||
&& $columns[$colIndex]['subtype'] === Column::SUBTYPE_DATETIME_TIME
|
||||
} elseif (
|
||||
($column && $column->getSubtype() === Column::SUBTYPE_DATETIME_TIME)
|
||||
|| (is_array($columns[$colIndex])
|
||||
&& $columns[$colIndex]['subtype'] === Column::SUBTYPE_DATETIME_TIME)
|
||||
) {
|
||||
$format = 'H:i';
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user