diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0428f99..4360d41 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
Änderungen
==========
+## v1.11.3 (17.09.2023)
+ * fix csv import
## v1.11.2 (22.07.2023)
* fix warning in profile model used by t3sportstats
diff --git a/Classes/Controller/Competition.php b/Classes/Controller/Competition.php
index 7d89708..75bb4f3 100644
--- a/Classes/Controller/Competition.php
+++ b/Classes/Controller/Competition.php
@@ -49,6 +49,11 @@ class Competition extends BaseModFunc
*/
private $selector;
+ /**
+ * @var DfbSync
+ */
+ private $dfbSync;
+
public $MCONF;
/**
@@ -66,6 +71,11 @@ public function getModuleIdentifier()
return 'cfc_league';
}
+ public function __construct(DfbSync $dfbSync = null)
+ {
+ $this->dfbSync = $dfbSync ?: tx_rnbase::makeInstance(DfbSync::class);
+ }
+
/**
* Verwaltet die Erstellung von Spielplänen von Ligen.
*
@@ -134,8 +144,7 @@ protected function getContent($template, &$configurations, &$formatter, $formToo
break;
case 3:
$funcTemplate = Templates::getSubpart($template, '###FUNC_DFBSYNC###');
- $mod = tx_rnbase::makeInstance(DfbSync::class);
- $funcContent = $mod->main($this->getModule(), $current_league, $funcTemplate);
+ $funcContent = $this->dfbSync->main($this->getModule(), $current_league, $funcTemplate);
break;
}
diff --git a/Classes/Controller/Competition/DfbSync.php b/Classes/Controller/Competition/DfbSync.php
index 5017be9..f5096d5 100644
--- a/Classes/Controller/Competition/DfbSync.php
+++ b/Classes/Controller/Competition/DfbSync.php
@@ -14,7 +14,7 @@
/***************************************************************
* Copyright notice
*
- * (c) 2008-2021 Rene Nitzsche (rene@system25.de)
+ * (c) 2008-2023 Rene Nitzsche (rene@system25.de)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@@ -52,6 +52,16 @@ class DfbSync
protected $uploadedFiles = [];
protected $formTool;
+ /**
+ * @var Synchronizer
+ */
+ private $synchronizer;
+
+ public function __construct(Synchronizer $synchronizer = null)
+ {
+ $this->synchronizer = $synchronizer ?: tx_rnbase::makeInstance(Synchronizer::class);
+ }
+
/**
* Verwaltet die Erstellung von Spielplänen von Ligen.
*
@@ -76,15 +86,14 @@ public function main(IModule $module, $competition, $template)
if (Parameters::getPostOrGetParameter('_upload')) {
if ($this->fileProcessor->internalUploadMap[1]) {
$markerArr['###STATUS_FILE###'] = $this->uploadedFiles[0]->getName();
- /* @var $synch Synchronizer */
- $synch = tx_rnbase::makeInstance(Synchronizer::class);
- $info = $synch->process($this->uploadedFiles[0], $competition);
+ $info = $this->synchronizer->process($this->uploadedFiles[0], $competition);
$markerArr['###STATUS_MATCH_UPDATED###'] = $info['match']['updated'];
$markerArr['###STATUS_MATCH_NEW###'] = $info['match']['new'];
$markerArr['###STATUS_MATCH_SKIPPED###'] = $info['match']['skipped'];
$markerArr['###STATUS_TEAM_NEW###'] = $info['team']['new'];
- $markerArr['###STATUS_TIME###'] = $synch->getStats()['total']['time'];
+ // FIXME: der Service sollte keinen Zustand haben
+ $markerArr['###STATUS_TIME###'] = $this->synchronizer->getStats()['total']['time'];
} else {
$markerArr['###STATUS_FILE###'] = '###LABEL_upload_failureNoFile###';
$markerArr['###STATUS_MATCH_UPDATED###'] = 0;
diff --git a/Classes/Controller/Competition/Teams.php b/Classes/Controller/Competition/Teams.php
index ba6baa7..b88d57c 100644
--- a/Classes/Controller/Competition/Teams.php
+++ b/Classes/Controller/Competition/Teams.php
@@ -118,7 +118,7 @@ protected function showTeamsFromPage($pid, Competition $competition)
$options['orderby']['TEAM.NAME'] = 'asc';
// $options['debug']=1;
$teams = $srv->searchTeams($fields, $options);
- if (!count($teams)) {
+ if ($teams->isEmpty()) {
return '';
}
diff --git a/Classes/Dfb/CsvStructure.php b/Classes/Dfb/CsvStructure.php
index 045c6b9..143c0a1 100644
--- a/Classes/Dfb/CsvStructure.php
+++ b/Classes/Dfb/CsvStructure.php
@@ -7,7 +7,7 @@
/***************************************************************
* Copyright notice
*
- * (c) 2010-2020 Rene Nitzsche (rene@system25.de)
+ * (c) 2010-2023 Rene Nitzsche (rene@system25.de)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@@ -115,6 +115,8 @@ protected function init(array $headers)
self::COL_MATCH_ID => $this->createColData(),
self::COL_STADIUM => $this->createColData(),
self::COL_LEAGUE_IDENT => $this->createColData(),
+ self::COL_POSTPONE_DATE => $this->createColData(),
+ self::COL_POSTPONE_TIME => $this->createColData(),
];
foreach ($this->structure as $field => $data) {
if ($idx = array_search($field, $headers)) {
diff --git a/Classes/Dfb/Synchronizer.php b/Classes/Dfb/Synchronizer.php
index f63c778..14504d9 100644
--- a/Classes/Dfb/Synchronizer.php
+++ b/Classes/Dfb/Synchronizer.php
@@ -6,13 +6,14 @@
use Sys25\RnBase\Utility\Logger;
use Sys25\RnBase\Utility\Strings;
use System25\T3sports\Model\Competition;
+use System25\T3sports\Model\Repository\TeamRepository;
use System25\T3sports\Utility\ServiceRegistry;
use tx_rnbase;
/***************************************************************
* Copyright notice
*
- * (c) 2010-2021 Rene Nitzsche (rene@system25.de)
+ * (c) 2010-2023 Rene Nitzsche (rene@system25.de)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@@ -56,6 +57,13 @@ class Synchronizer
private $pageUid = 0;
+ private $teamRepo;
+
+ public function __construct(TeamRepository $teamRepo = null)
+ {
+ $this->teamRepo = $teamRepo ?: new TeamRepository();
+ }
+
public function process(\TYPO3\CMS\Core\Resource\File $file, Competition $competition)
{
$fileContent = $this->removeBOM($file->getContents());
@@ -65,6 +73,7 @@ public function process(\TYPO3\CMS\Core\Resource\File $file, Competition $compet
$lines = explode("\n", $fileContent);
$headers = array_shift($lines);
$headers = str_getcsv($this->prepareHeaderLine($headers), "\t");
+ /** @var CsvStructure $structure */
$structure = tx_rnbase::makeInstance(CsvStructure::class, $headers);
$start = microtime(true);
@@ -185,16 +194,14 @@ protected function findTeam($extTeam, array &$data, Competition $competition, ar
$uid = 'NEW_'.$extTeamId;
if (!array_key_exists($extTeamId, $this->teamMap)) {
// Das Team ist noch nicht im Cache, also in der DB suchen
- /* @var $teamSrv \tx_cfcleague_services_Teams */
- $teamSrv = ServiceRegistry::getTeamService();
$fields = [];
$fields['TEAM.EXTID'][OP_EQ_NOCASE] = $extTeamId;
$fields['TEAM.PID'][OP_EQ_INT] = $competition->getPid();
$options = ['what' => 'uid'];
- $ret = $teamSrv->searchTeams($fields, $options);
- if (!empty($ret)) {
- $this->teamMap[$extTeamId] = $ret[0]['uid'];
+ $ret = $this->teamRepo->search($fields, $options);
+ if (!$ret->isEmpty()) {
+ $this->teamMap[$extTeamId] = $ret->first()['uid'];
$uid = $this->teamMap[$extTeamId];
} else {
// In uid steht jetzt NEW_
diff --git a/Classes/Service/ProfileService.php b/Classes/Service/ProfileService.php
index 341fc92..1c1e529 100644
--- a/Classes/Service/ProfileService.php
+++ b/Classes/Service/ProfileService.php
@@ -118,8 +118,8 @@ public function checkReferences(Profile $profile)
'operator' => OP_INSET_INT,
];
$result = ServiceRegistry::getTeamService()->searchTeams($fields, $options);
- if (count($result)) {
- $ret['tx_cfcleague_teams'] = $result;
+ if (!$result->isEmpty()) {
+ $ret['tx_cfcleague_teams'] = $result->toArray();
}
$fields = [];
diff --git a/Classes/Service/TeamService.php b/Classes/Service/TeamService.php
index b665f4c..2c60fb1 100644
--- a/Classes/Service/TeamService.php
+++ b/Classes/Service/TeamService.php
@@ -3,6 +3,7 @@
namespace System25\T3sports\Service;
use Sys25\RnBase\Cache\CacheManager;
+use Sys25\RnBase\Domain\Collection\BaseCollection;
use Sys25\RnBase\Domain\Model\MediaModel;
use Sys25\RnBase\Search\SearchBase;
use Sys25\RnBase\Typo3Wrapper\Service\AbstractService;
@@ -136,7 +137,7 @@ public function getTeamNotes(Team $team, $type = false)
* @param Competition $comp
* @param bool $asArray Wenn 1 wird pro Team ein Array mit Name, Kurzname und Flag spielfrei geliefert
*
- * @return array
+ * @return string[]
*/
public function getTeamNames(Competition $comp, $asArray = false)
{
@@ -235,7 +236,7 @@ public function searchTeamNotes($fields, $options)
* @param array $fields
* @param array $options
*
- * @return Team[]
+ * @return BaseCollection
*/
public function searchTeams($fields, $options)
{
diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml
index ecc2034..0150a8f 100644
--- a/Configuration/Services.yaml
+++ b/Configuration/Services.yaml
@@ -10,3 +10,6 @@ services:
System25\T3sports\Service\ProfileService:
public: true
+
+ System25\T3sports\Controller\Competition:
+ public: true
diff --git a/ext_emconf.php b/ext_emconf.php
index 2cd2917..9e36815 100644
--- a/ext_emconf.php
+++ b/ext_emconf.php
@@ -15,7 +15,7 @@
'description' => 'Umfangreiche Extension zur Verwaltung von Sportvereinen und -wettbewerben. Extensive extension to manage sports clubs and competitions. https://github.com/digedag/cfc_league',
'category' => 'module',
'shy' => 0,
- 'version' => '1.11.2',
+ 'version' => '1.11.3',
'dependencies' => 'rn_base',
'module' => 'mod1',
'state' => 'stable',