Release 1.19.2 (#3244)

This commit is contained in:
Kevin Papst
2022-04-05 00:59:13 +02:00
committed by GitHub
parent 966701f94e
commit f2a8cf0930
5 changed files with 47 additions and 36 deletions

View File

@@ -78,7 +78,7 @@ The best way to start is to [open a new issue](https://github.com/kevinpapst/kim
In case you want to contribute, but you wouldn't know how, here are some suggestions:
- Spread the word: More user means more people testing and contributing to Kimai - which in turn means better stability and more and better features. Please vote for Kimai on platforms lie Slant, Product Hunt, Softpedia or AlternativeTo, you can tweet about it, share it on LinkedIn, reddit or any of your favorite social media platforms. Every little bit helps!
- Spread the word: More user means more people testing and contributing to Kimai - which in turn means better stability and more and better features. Please vote for Kimai on platforms like Slant, Product Hunt, Softpedia or AlternativeTo, you can tweet about it, share it on LinkedIn, reddit or any of your favorite social media platforms. Every bit helps!
- Answer questions: You know the answer to another user's problem? Share your knowledge!
- Make a feature request: Something can be done better? Something essential missing? Let us know!
- Report bugs

View File

@@ -54,39 +54,13 @@ trait StringAccessibleConfigTrait
return;
}
// this foreach should be replaced by a better piece of code,
// especially the pointers could be a problem in the future
foreach ($this->getConfigurations($this->repository) as $configuration) {
$temp = explode('.', $configuration->getName());
$this->setConfiguration($temp, $configuration->getValue());
$this->set($configuration->getName(), $configuration->getValue());
}
$this->initialized = true;
}
private function setConfiguration(array $keys, ?string $value): void
{
$array = &$this->settings;
if ($keys[0] === $this->getPrefix()) {
$keys = \array_slice($keys, 1);
}
foreach ($keys as $key2) {
if (!\array_key_exists($key2, $array)) {
$array[$key2] = $value;
continue;
}
if (\is_array($array[$key2])) {
$array = &$array[$key2];
} elseif (\is_bool($array[$key2])) {
$array[$key2] = (bool) $value;
} elseif (\is_int($array[$key2])) {
$array[$key2] = (int) $value;
} else {
$array[$key2] = $value;
}
}
}
/**
* @return string
*/
@@ -186,7 +160,7 @@ trait StringAccessibleConfigTrait
*/
public function offsetSet($offset, $value)
{
$this->setConfiguration(explode('.', $offset), $value);
$this->set($offset, $value);
}
/**
@@ -197,4 +171,43 @@ trait StringAccessibleConfigTrait
{
throw new \BadMethodCallException('SystemBundleConfiguration does not support offsetUnset()');
}
/**
* Set an array item to a given value using "dot" notation.
*
* If no key is given to the method, the entire array will be replaced.
*
* @see https://github.com/divineomega/array_undot
* @param string $key
* @param mixed $value
*
* @return array
*/
private function set(string $key, $value): array
{
$array = &$this->settings;
$keys = explode('.', $key);
while (\count($keys) > 1) {
$key = array_shift($keys);
if (!isset($array[$key]) || !\is_array($array[$key])) {
$array[$key] = [];
}
$array = &$array[$key];
}
$k = array_shift($keys);
if (\array_key_exists($k, $array)) {
if (\is_bool($array[$k])) {
$value = (bool) $value;
} elseif (\is_int($array[$k])) {
$value = (int) $value;
}
}
$array[$k] = $value;
return $array;
}
}

View File

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

View File

@@ -38,7 +38,6 @@ class TimesheetFixtures extends Fixture implements FixtureGroupInterface
public const MIN_TIMESHEETS_PER_USER = 50;
public const MAX_TIMESHEETS_PER_USER = 500;
public const MAX_TIMESHEETS_TOTAL = 200;
public const MAX_RUNNING_TIMESHEETS_PER_USER = 1;
public const MIN_MINUTES_PER_ENTRY = 15;
public const MAX_MINUTES_PER_ENTRY = 840; // 14h
public const MAX_DESCRIPTION_LENGTH = 200;
@@ -87,7 +86,7 @@ class TimesheetFixtures extends Fixture implements FixtureGroupInterface
if ($i % 3 === 0) {
$description = $faker->realText($faker->numberBetween(10, self::MAX_DESCRIPTION_LENGTH));
} elseif ($i % 7 === 0) {
$description = substr($faker->text, 0, self::MAX_DESCRIPTION_LENGTH);
$description = substr($faker->text(), 0, self::MAX_DESCRIPTION_LENGTH);
}
$entry = $this->createTimesheetEntry(
@@ -109,8 +108,7 @@ class TimesheetFixtures extends Fixture implements FixtureGroupInterface
}
// create active recordings for test user
$activeEntries = rand(0, self::MAX_RUNNING_TIMESHEETS_PER_USER);
for ($i = 0; $i < $activeEntries; $i++) {
if (rand(0, 10) >= 5) {
$entry = $this->createTimesheetEntry(
$user,
$activities[array_rand($activities)],

View File

@@ -82,7 +82,7 @@ class ProjectType extends AbstractType
$name = $this->getPattern();
$name = str_replace(self::PATTERN_NAME, $project->getName(), $name);
$name = str_replace(self::PATTERN_COMMENT, $project->getComment() ?? '', $name);
$name = str_replace(self::PATTERN_ORDERNUMBER, $project->getOrderNumber(), $name);
$name = str_replace(self::PATTERN_ORDERNUMBER, $project->getOrderNumber() ?? '', $name);
$name = str_replace(self::PATTERN_START, $start, $name);
$name = str_replace(self::PATTERN_END, $end, $name);