bump version 1.22 (#3429)

* adjusted release note template
* stabilize test
* deactivate audit listener, more pre-validation for kimai 1 importer
This commit is contained in:
Kevin Papst
2022-07-22 12:41:49 +02:00
committed by GitHub
parent c0f3f31095
commit ad880b5b97
5 changed files with 58 additions and 15 deletions

View File

@@ -18,8 +18,7 @@ exclude-labels:
- 'wontfix' - 'wontfix'
exclude-contributors: exclude-contributors:
- 'dependabot' - 'dependabot'
- 'weblate' change-template: '- $TITLE (#$NUMBER)'
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
change-title-escapes: '\<*_&`#@' change-title-escapes: '\<*_&`#@'
version-resolver: version-resolver:
major: major:
@@ -35,7 +34,7 @@ version-resolver:
- 'translation' - 'translation'
default: patch default: patch
template: | template: |
[Upgrade Kimai](https://www.kimai.org/documentation/updates.html) - [Install Kimai](https://www.kimai.org/documentation/installation.html) - [Docker](https://tobybatch.github.io/kimai2/) & [Hub](https://hub.docker.com/r/kimai/kimai2) [Upgrade Kimai](https://www.kimai.org/documentation/updates.html) - [Install Kimai](https://www.kimai.org/documentation/installation.html) - [Docker](https://tobybatch.github.io/kimai2/)
**PHP Version compatibility:** **PHP Version compatibility:**
- PHP 7.3 is [end-of-life](https://www.php.net/supported-versions.php): you need to update now - PHP 7.3 is [end-of-life](https://www.php.net/supported-versions.php): you need to update now
@@ -43,4 +42,6 @@ template: |
$CHANGES $CHANGES
Thanks to $CONTRIBUTORS Thanks to all contributors ❤️
Involved in this release: $CONTRIBUTORS

View File

@@ -101,4 +101,9 @@ class ActivityService
return $activity; return $activity;
} }
public function findActivityByName(string $name, ?Project $project = null): ?Activity
{
return $this->repository->findOneBy(['project' => $project, 'name' => $name]);
}
} }

View File

@@ -386,7 +386,7 @@ final class KimaiImporterCommand extends Command
} }
$io->success('Fetched Kimai v1 data, validating now'); $io->success('Fetched Kimai v1 data, validating now');
$validationMessages = $this->validateKimai1Data($options, $users, $customer, $projects, $rates); $validationMessages = $this->validateKimai1Data($options, $users, $customer, $projects, $activities, $rates);
if (!empty($validationMessages)) { if (!empty($validationMessages)) {
foreach ($validationMessages as $errorMessage) { foreach ($validationMessages as $errorMessage) {
$io->error($errorMessage); $io->error($errorMessage);
@@ -484,7 +484,7 @@ final class KimaiImporterCommand extends Command
return 0; return 0;
} }
private function validateKimai1Data(array $options, array $users, array $customer, array $projects, array $rates): array private function validateKimai1Data(array $options, array $users, array $customer, array $projects, array $activities, array $rates): array
{ {
$validationMessages = []; $validationMessages = [];
@@ -523,6 +523,14 @@ final class KimaiImporterCommand extends Command
$customerIds = []; $customerIds = [];
foreach ($customer as $oldCustomer) { foreach ($customer as $oldCustomer) {
$customerIds[] = $oldCustomer['customerID']; $customerIds[] = $oldCustomer['customerID'];
if (($customerNameLength = mb_strlen($oldCustomer['name'])) > 150) {
$validationMessages[] = sprintf(
'Customer name "%s" (ID %s) is too long. Max. 150 character are allowed, found %s.',
$oldCustomer['name'],
$oldCustomer['customerID'],
$customerNameLength
);
}
} }
foreach ($projects as $oldProject) { foreach ($projects as $oldProject) {
@@ -534,6 +542,25 @@ final class KimaiImporterCommand extends Command
$oldProject['customerID'] $oldProject['customerID']
); );
} }
if (($projectNameLength = mb_strlen($oldProject['name'])) > 150) {
$validationMessages[] = sprintf(
'Project name "%s" (ID %s) is too long. Max. 150 character are allowed, found %s.',
$oldProject['name'],
$oldProject['projectID'],
$projectNameLength
);
}
}
foreach ($activities as $oldActivity) {
if (($activityNameLength = mb_strlen($oldActivity['name'])) > 150) {
$validationMessages[] = sprintf(
'Activity name "%s" (ID %s) is too long. Max. 150 character are allowed, found %s.',
$oldActivity['name'],
$oldActivity['activityID'],
$activityNameLength
);
}
} }
if (!$options['skip-error-rates']) { if (!$options['skip-error-rates']) {
@@ -664,6 +691,10 @@ final class KimaiImporterCommand extends Command
foreach ($listeners as $hash => $object) { foreach ($listeners as $hash => $object) {
if ($object instanceof TimesheetSubscriber) { if ($object instanceof TimesheetSubscriber) {
$connection->getEventManager()->removeEventListener([$event], $object); $connection->getEventManager()->removeEventListener([$event], $object);
/* @phpstan-ignore-next-line */
} elseif ($object instanceof \KimaiPlugin\AuditTrailBundle\Doctrine\MetadataSubscriber) {
// deactivate audit plugin listener
$connection->getEventManager()->removeEventListener([$event], $object);
} }
} }
} }
@@ -2017,6 +2048,7 @@ final class KimaiImporterCommand extends Command
private function fixEncoding(): void private function fixEncoding(): void
{ {
// https://onlineasciitools.com/convert-ascii-to-utf8
$searchReplace = [ $searchReplace = [
'ä' => 'ä', 'ä' => 'ä',
'Ä' => 'Ä', 'Ä' => 'Ä',
@@ -2025,6 +2057,7 @@ final class KimaiImporterCommand extends Command
'ö' => 'ö', 'ö' => 'ö',
'Ö' => 'Ö', 'Ö' => 'Ö',
'ß' => 'ß', 'ß' => 'ß',
'⦁' => '-',
]; ];
$tablesColumns = [ $tablesColumns = [

View File

@@ -17,11 +17,11 @@ class Constants
/** /**
* The current release version * The current release version
*/ */
public const VERSION = '1.21'; public const VERSION = '1.22.0';
/** /**
* The current release: major * 10000 + minor * 100 + patch * The current release: major * 10000 + minor * 100 + patch
*/ */
public const VERSION_ID = 12100; public const VERSION_ID = 12200;
/** /**
* The current release status, either "stable" or "dev" * The current release status, either "stable" or "dev"
*/ */

View File

@@ -126,11 +126,13 @@ class LocaleFormatExtensionsTest extends TestCase
public function getDateShortData() public function getDateShortData()
{ {
$timezone = new \DateTimeZone('Europe/Vienna');
return [ return [
['en', new \DateTime('7 January 2010'), '2010-01-07'], ['en', new \DateTime('7 January 2010', $timezone), '2010-01-07'],
['en', new \DateTime('2016-06-23'), '2016-06-23'], ['en', new \DateTime('2016-06-23', $timezone), '2016-06-23'],
['de', new \DateTime('1980-12-14'), '14.12.1980'], ['de', new \DateTime('1980-12-14', $timezone), '14.12.1980'],
['ru', new \DateTime('1980-12-14'), '14.12.1980'], ['ru', new \DateTime('1980-12-14', $timezone), '14.12.1980'],
['ru', '1980-12-14', '14.12.1980'], ['ru', '1980-12-14', '14.12.1980'],
['ru', 1.2345, 1.2345], ['ru', 1.2345, 1.2345],
]; ];
@@ -153,9 +155,11 @@ class LocaleFormatExtensionsTest extends TestCase
public function getDateTimeData() public function getDateTimeData()
{ {
$timezone = new \DateTimeZone('Europe/Vienna');
return [ return [
['en', new \DateTime('7 January 2010'), '2010-01-07 12:01 AM'], ['en', new \DateTime('7 January 2010', $timezone), '2010-01-07 12:01 AM'],
['de', (new \DateTime('1980-12-14'))->setTime(13, 27, 55), '14.12.1980 13:27:55'], ['de', (new \DateTime('1980-12-14', $timezone))->setTime(13, 27, 55), '14.12.1980 13:27:55'],
['de', '1980-12-14 13:27:55', '14.12.1980 13:27:55'], ['de', '1980-12-14 13:27:55', '14.12.1980 13:27:55'],
['de', 1.2345, 1.2345], ['de', 1.2345, 1.2345],
]; ];