Merge branch 'release/2021.01-03'
This commit is contained in:
+11
-7
@@ -2,21 +2,25 @@
|
|||||||
|
|
||||||
namespace EP\EpProducts\Backend;
|
namespace EP\EpProducts\Backend;
|
||||||
|
|
||||||
|
use EP\EpProducts\Service\ImportTimestampService;
|
||||||
use TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem as CoreSystemInformationToolbarItem;
|
use TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem as CoreSystemInformationToolbarItem;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
||||||
|
|
||||||
class SystemInformationToolbarItemExtension
|
class SystemInformationToolbarItemExtension
|
||||||
{
|
{
|
||||||
public function addBpnImportInformation(CoreSystemInformationToolbarItem $systemInformation)
|
public function addBpnImportInformation(CoreSystemInformationToolbarItem $systemInformation)
|
||||||
{
|
{
|
||||||
$updatedTimestampPath = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport/.lastupdate');
|
$timestampService = new ImportTimestampService();
|
||||||
if ($updatedTimestampPath && file_exists($updatedTimestampPath)) {
|
$productDataUpdatedTimestamp = $timestampService->readImportTimestamp('fileadmin/products_import.info');
|
||||||
$updatedTimestamp = file_get_contents($updatedTimestampPath);
|
$contingentsDataUpdatedTimestamp = $timestampService->readImportTimestamp('fileadmin/contingents_import.info');
|
||||||
}
|
|
||||||
|
|
||||||
$systemInformation->addSystemInformation(
|
$systemInformation->addSystemInformation(
|
||||||
'Letzer XML Abruf',
|
'Letzer Produktdaten-Import',
|
||||||
$updatedTimestamp ?: '-',
|
$productDataUpdatedTimestamp ? $productDataUpdatedTimestamp->format('d.m.y H:i:s') : '-',
|
||||||
|
'ep-logo'
|
||||||
|
);
|
||||||
|
$systemInformation->addSystemInformation(
|
||||||
|
'Letzer Kontingente Import',
|
||||||
|
$contingentsDataUpdatedTimestamp ? $contingentsDataUpdatedTimestamp->format('d.m.y H:i:s') : '-',
|
||||||
'ep-logo'
|
'ep-logo'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,10 +68,6 @@ class BackendController extends ActionController
|
|||||||
* @var ContingentImportService
|
* @var ContingentImportService
|
||||||
*/
|
*/
|
||||||
protected $contingentImportService;
|
protected $contingentImportService;
|
||||||
/**
|
|
||||||
* @var ImportTimestampService
|
|
||||||
*/
|
|
||||||
private $importTimestampService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param DateImportService $dateImportService
|
* @param DateImportService $dateImportService
|
||||||
@@ -84,8 +80,7 @@ class BackendController extends ActionController
|
|||||||
DateImportService $dateImportService,
|
DateImportService $dateImportService,
|
||||||
ContingentImportService $contingentImportService,
|
ContingentImportService $contingentImportService,
|
||||||
SnowreportImportService $snowreportService,
|
SnowreportImportService $snowreportService,
|
||||||
LogService $logService,
|
LogService $logService
|
||||||
ImportTimestampService $importTimestampService
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -94,40 +89,17 @@ class BackendController extends ActionController
|
|||||||
$this->contingentImportService = $contingentImportService;
|
$this->contingentImportService = $contingentImportService;
|
||||||
$this->snowreportImportService = $snowreportService;
|
$this->snowreportImportService = $snowreportService;
|
||||||
$this->logService = $logService;
|
$this->logService = $logService;
|
||||||
$this->importTimestampService = $importTimestampService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$updatedTimestamp = $this->importTimestampService->readImportTimestamp('fileadmin/products_import.info');
|
$timestampService = new ImportTimestampService();
|
||||||
|
|
||||||
$this->view->assign('updatedTimestamp', $updatedTimestamp);
|
$productDataUpdatedTimestamp = $timestampService->readImportTimestamp('fileadmin/products_import.info');
|
||||||
}
|
$contingentsDataUpdatedTimestamp = $timestampService->readImportTimestamp('fileadmin/contingents_import.info');
|
||||||
|
|
||||||
public function importProductsAction()
|
$this->view->assign('productDataUpdatedTimestamp', $productDataUpdatedTimestamp);
|
||||||
{
|
$this->view->assign('contingentsDataUpdatedTimestamp', $contingentsDataUpdatedTimestamp);
|
||||||
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport');
|
|
||||||
if ($this->dateImportService->checkActiveUpload($path)) {
|
|
||||||
$this->addFlashMessage(
|
|
||||||
'Datenexport aus BusProNet aktiv. Import nicht möglich.',
|
|
||||||
'Import fehlgeschlagen',
|
|
||||||
AbstractMessage::WARNING
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$dateCount = $this->dateImportService->import($path);
|
|
||||||
$this->addFlashMessage($dateCount . ' Termine importiert', 'Import abgechlossen', AbstractMessage::OK);
|
|
||||||
$resellerPageUid = $this->settings['resellerExportPageUid'];
|
|
||||||
$this->cacheService->clearPageCache($resellerPageUid);
|
|
||||||
}
|
|
||||||
$this->redirect('index');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function importContingentsAction()
|
|
||||||
{
|
|
||||||
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexportzimmer');
|
|
||||||
$count = $this->contingentImportService->import($path);
|
|
||||||
$this->addFlashMessage($count . ' Datensätze importiert', 'Import abgechlossen', AbstractMessage::OK);
|
|
||||||
$this->redirect('index');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function importSnowReportAction()
|
public function importSnowReportAction()
|
||||||
|
|||||||
@@ -57,19 +57,14 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac
|
|||||||
* @var Connection
|
* @var Connection
|
||||||
*/
|
*/
|
||||||
protected $db;
|
protected $db;
|
||||||
/**
|
|
||||||
* @var ImportTimestampService
|
|
||||||
*/
|
|
||||||
private $importTimestampService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ConfigurationManagerInterface $manager
|
* @param ConfigurationManagerInterface $manager
|
||||||
* @throws \Doctrine\DBAL\DBALException
|
* @throws \Doctrine\DBAL\DBALException
|
||||||
*/
|
*/
|
||||||
public function __construct(ConfigurationManagerInterface $manager, ImportTimestampService $importTimestampService)
|
public function __construct(ConfigurationManagerInterface $manager)
|
||||||
{
|
{
|
||||||
$this->configurationManager = $manager;
|
$this->configurationManager = $manager;
|
||||||
$this->importTimestampService = $importTimestampService;
|
|
||||||
|
|
||||||
$settings = GeneralUtility::removeDotsFromTS(
|
$settings = GeneralUtility::removeDotsFromTS(
|
||||||
$this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
|
$this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
|
||||||
@@ -100,7 +95,9 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac
|
|||||||
|
|
||||||
public function isImportRequired(): bool
|
public function isImportRequired(): bool
|
||||||
{
|
{
|
||||||
return $this->importTimestampService->isImportRequired(
|
$timestampService = new ImportTimestampService();
|
||||||
|
|
||||||
|
return $timestampService->isImportRequired(
|
||||||
'fileadmin/xmlexportzimmer/uebertragung.info',
|
'fileadmin/xmlexportzimmer/uebertragung.info',
|
||||||
'fileadmin/contingents_import.info'
|
'fileadmin/contingents_import.info'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -85,11 +85,6 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
|||||||
*/
|
*/
|
||||||
protected $cacheService;
|
protected $cacheService;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ImportTimestampService
|
|
||||||
*/
|
|
||||||
private $importTimestampService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
@@ -101,15 +96,9 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
|||||||
* @param ConfigurationManagerInterface $configurationManager
|
* @param ConfigurationManagerInterface $configurationManager
|
||||||
* @param CacheService $cacheService
|
* @param CacheService $cacheService
|
||||||
*/
|
*/
|
||||||
public function __construct
|
public function __construct(ConfigurationManagerInterface $configurationManager, CacheService $cacheService) {
|
||||||
(
|
|
||||||
ConfigurationManagerInterface $configurationManager,
|
|
||||||
CacheService $cacheService,
|
|
||||||
ImportTimestampService $importTimestampService
|
|
||||||
) {
|
|
||||||
$this->configurationManager = $configurationManager;
|
$this->configurationManager = $configurationManager;
|
||||||
$this->cacheService = $cacheService;
|
$this->cacheService = $cacheService;
|
||||||
$this->importTimestampService = $importTimestampService;
|
|
||||||
|
|
||||||
$settings = GeneralUtility::removeDotsFromTS(
|
$settings = GeneralUtility::removeDotsFromTS(
|
||||||
$this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
|
$this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
|
||||||
@@ -145,7 +134,9 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
|||||||
|
|
||||||
public function isImportRequired(): bool
|
public function isImportRequired(): bool
|
||||||
{
|
{
|
||||||
return $this->importTimestampService->isImportRequired(
|
$timestampService = new ImportTimestampService();
|
||||||
|
|
||||||
|
return $timestampService->isImportRequired(
|
||||||
'fileadmin/xmlexport/uebertragung.info',
|
'fileadmin/xmlexport/uebertragung.info',
|
||||||
'fileadmin/products_import.info'
|
'fileadmin/products_import.info'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,21 +7,23 @@
|
|||||||
<f:section name="Main">
|
<f:section name="Main">
|
||||||
<h1>E&P Funktionen</h1>
|
<h1>E&P Funktionen</h1>
|
||||||
<f:flashMessages />
|
<f:flashMessages />
|
||||||
<p>
|
<div class="panel panel-default">
|
||||||
<strong>Letzter automatischer XML Import: {f:if(condition: updatedTimestamp, then: '{updatedTimestamp -> f:format.date(format: \'d.m.Y H:i:s\')}', else: '-')}</strong>
|
<div class="panel-heading">
|
||||||
</p>
|
<h3 class="panel-title">BusPro Daten</h3>
|
||||||
<p>
|
</div>
|
||||||
<f:link.action action="importProducts" class="btn btn-default">
|
<div class="panel-body">
|
||||||
<core:icon identifier="actions-refresh"/>
|
<p>
|
||||||
Produktdaten aus BusProNet importieren
|
<strong>Letzter Produktdaten-Import: {f:if(condition: productDataUpdatedTimestamp, then: '{productDataUpdatedTimestamp -> f:format.date(format: \'d.m.Y H:i:s\')}', else: '-')}</strong>
|
||||||
</f:link.action>
|
</p>
|
||||||
</p>
|
<p>
|
||||||
<p>
|
<strong>Letzter Kontingente-Import: {f:if(condition: contingentsDataUpdatedTimestamp, then: '{contingentsDataUpdatedTimestamp -> f:format.date(format: \'d.m.Y H:i:s\')}', else: '-')}</strong>
|
||||||
<f:link.action action="importContingents" class="btn btn-default">
|
</p>
|
||||||
<core:icon identifier="actions-refresh"/>
|
<p>
|
||||||
Kontingentdaten aus BusProNet importieren
|
<strong>Hinweis:</strong> TYPO3 prüft alle 15 Minuten, ob ein XML Upload aus BusPro erfolgt ist (automatisch
|
||||||
</f:link.action>
|
oder manuell) und führt sofort einen Import durch falls erforderlich.
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<p>
|
<p>
|
||||||
<f:link.action action="importSnowReport" class="btn btn-default">
|
<f:link.action action="importSnowReport" class="btn btn-default">
|
||||||
<core:icon identifier="actions-refresh"/>
|
<core:icon identifier="actions-refresh"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user