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

@@ -101,4 +101,9 @@ class ActivityService
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');
$validationMessages = $this->validateKimai1Data($options, $users, $customer, $projects, $rates);
$validationMessages = $this->validateKimai1Data($options, $users, $customer, $projects, $activities, $rates);
if (!empty($validationMessages)) {
foreach ($validationMessages as $errorMessage) {
$io->error($errorMessage);
@@ -484,7 +484,7 @@ final class KimaiImporterCommand extends Command
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 = [];
@@ -523,6 +523,14 @@ final class KimaiImporterCommand extends Command
$customerIds = [];
foreach ($customer as $oldCustomer) {
$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) {
@@ -534,6 +542,25 @@ final class KimaiImporterCommand extends Command
$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']) {
@@ -664,6 +691,10 @@ final class KimaiImporterCommand extends Command
foreach ($listeners as $hash => $object) {
if ($object instanceof TimesheetSubscriber) {
$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
{
// https://onlineasciitools.com/convert-ascii-to-utf8
$searchReplace = [
'ä' => 'ä',
'Ä' => 'Ä',
@@ -2025,6 +2057,7 @@ final class KimaiImporterCommand extends Command
'ö' => 'ö',
'Ö' => 'Ö',
'ß' => 'ß',
'⦁' => '-',
];
$tablesColumns = [

View File

@@ -17,11 +17,11 @@ class Constants
/**
* The current release version
*/
public const VERSION = '1.21';
public const VERSION = '1.22.0';
/**
* 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"
*/