Merge branch 'develop'

This commit is contained in:
Björn Fromme
2021-06-08 18:02:55 +02:00
2 changed files with 29 additions and 14 deletions
@@ -122,7 +122,7 @@ class SnowreportImportService implements SingletonInterface
$xmlContent = file_get_contents($file);
$xmlData = simplexml_load_string($xmlContent);
$snowReportStoragePid = SettingsUtility::get('snowReportStoragePid');
$snowReportStoragePid = $this->getStoragePid();
foreach ($xmlData->schneemeldung as $reportXml)
{
@@ -202,7 +202,7 @@ class SnowreportImportService implements SingletonInterface
*/
public function importWebcamData(\SimpleXMLElement $xml, Snowreport $snowreport)
{
$snowReportStoragePid = SettingsUtility::get('snowReportStoragePid');
$snowReportStoragePid = $this->getStoragePid();
foreach ($xml->children() as $item)
{
$include = (string) $item->aktuell === 'true';
@@ -243,7 +243,7 @@ class SnowreportImportService implements SingletonInterface
->select('vendor_uid')
->from($table)
->execute()
->fetchAll()
->fetchAllAssociative()
;
$currentUids = array_map(function ($row) {
@@ -282,4 +282,10 @@ class SnowreportImportService implements SingletonInterface
@rename($backupPath, $path);
}
public function getStoragePid()
{
$settingsUtility = new SettingsUtility();
return $settingsUtility->get('snowReportStoragePid');
}
}
@@ -34,23 +34,32 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
class SettingsUtility
{
/**
* @var array
*/
protected $settings = [];
public function __construct()
{
/** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$configurationManager = $objectManager->get(ConfigurationManager::class);
$settings = GeneralUtility::removeDotsFromTS(
$configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
);
$this->settings = $settings['plugin']['tx_epproducts']['settings'];
}
/**
* @param string $key
* @return string|array
*/
static public function get($key = null)
public function get($key = null)
{
/** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$configurationManager = $objectManager->get(ConfigurationManager::class);
$settings = GeneralUtility::removeDotsFromTS($configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT));
if ($key !== null && array_key_exists($key, $settings['plugin']['tx_epproducts']['settings'])) {
return $settings['plugin']['tx_epproducts']['settings'][$key];
if ($key !== null && array_key_exists($key, $this->settings)) {
return $this->settings[$key];
}
return $settings['plugin']['tx_epproducts']['settings'];
return $this->settings;
}
}
}