diff --git a/Classes/Domain/Model/Backend/ImportConfiguration.php b/Classes/Domain/Model/Backend/ImportConfiguration.php index 3fcc810..270cedc 100644 --- a/Classes/Domain/Model/Backend/ImportConfiguration.php +++ b/Classes/Domain/Model/Backend/ImportConfiguration.php @@ -26,6 +26,7 @@ namespace WerkraumMedia\ThueCat\Domain\Model\Backend; use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference; use WerkraumMedia\ThueCat\Domain\Import\ImportConfiguration as ImportConfigurationInterface; use WerkraumMedia\ThueCat\Domain\Import\ResolveForeignReference; @@ -52,6 +53,11 @@ class ImportConfiguration extends AbstractEntity implements ImportConfigurationI */ protected $tstamp = null; + /** + * @var ObjectStorage + */ + protected $logs; + /** * @var string[]|null */ @@ -62,6 +68,11 @@ class ImportConfiguration extends AbstractEntity implements ImportConfigurationI */ protected $allowedTypes = []; + public function __construct() + { + $this->logs = new ObjectStorage(); + } + public function getTitle(): string { return $this->title; @@ -82,6 +93,17 @@ class ImportConfiguration extends AbstractEntity implements ImportConfigurationI return $this->tstamp; } + public function getLastImported(): ?\DateTimeImmutable + { + $positionOfLastLog = count($this->logs) - 1; + $lastImport = $this->logs->offsetGet((string) $positionOfLastLog); + if (!$lastImport instanceof ImportLog) { + return null; + } + + return $lastImport->getCreated(); + } + public function getStoragePid(): int { if ($this->configuration === '') { diff --git a/Configuration/TCA/tx_thuecat_import_configuration.php b/Configuration/TCA/tx_thuecat_import_configuration.php index 05186b5..3867b78 100644 --- a/Configuration/TCA/tx_thuecat_import_configuration.php +++ b/Configuration/TCA/tx_thuecat_import_configuration.php @@ -68,6 +68,15 @@ return (static function (string $extensionKey, string $tableName) { 'readOnly' => true, ], ], + // Configured for usage within Extbase, not TCA itself + 'logs' => [ + 'config' => [ + 'type' => 'inline', + 'foreign_table' => 'tx_thuecat_import_log', + 'foreign_field' => 'configuration', + 'readOnly' => true, + ], + ], ], 'types' => [ '0' => [ diff --git a/Documentation/Changelog/1.3.0.rst b/Documentation/Changelog/1.3.0.rst index 5b3b5f8..c1b7831 100644 --- a/Documentation/Changelog/1.3.0.rst +++ b/Documentation/Changelog/1.3.0.rst @@ -9,7 +9,9 @@ Nothing Features -------- -Add support for TYPO3 v11 and PHP 8.0 + 8.1. +* Add support for TYPO3 v11 and PHP 8.0 + 8.1. + +* Last import date is now shown within backend module beside each import configuration. Fixes ----- @@ -34,9 +36,9 @@ Fixes Tasks ----- -Removed API Key from site configuration. -The key was already moved to extension configuration as documented. -Still we extended the site configuration, which is now cleaned up, see: https://github.com/werkraum-media/thuecat/issues/55 +* Removed API Key from site configuration. + The key was already moved to extension configuration as documented. + Still we extended the site configuration, which is now cleaned up, see: https://github.com/werkraum-media/thuecat/issues/55 Deprecation ----------- diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 2b98390..9775c60 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -46,6 +46,12 @@ Last changed + + Last imported + + + Never + create the first to get started.]]> diff --git a/Resources/Private/Templates/Backend/Overview/Index.html b/Resources/Private/Templates/Backend/Overview/Index.html index 2dd223e..e88e28e 100644 --- a/Resources/Private/Templates/Backend/Overview/Index.html +++ b/Resources/Private/Templates/Backend/Overview/Index.html @@ -55,6 +55,7 @@ {f:translate(id: 'module.importConfigurations.title')} {f:translate(id: 'module.importConfigurations.lastChanged')} + {f:translate(id: 'module.importConfigurations.lastImported')} {f:translate(id: 'module.actions')} @@ -63,6 +64,16 @@ {importConfiguration.title} {importConfiguration.lastChanged -> f:format.date(format: 'd.m.Y H:i')} + + + + {importConfiguration.lastImported -> f:format.date(format: 'd.m.Y H:i')} + + + {f:translate(id: 'module.importConfigurations.lastImported.never')} + + +