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:
Michael Kuhn
2025-02-28 15:37:35 +01:00
parent 8f41e128d0
commit 817092288e

View File

@ -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 {