Release 2.0.15 (#3970)

This commit is contained in:
Kevin Papst
2023-04-16 00:44:00 +02:00
committed by GitHub
parent ecd8ee85f3
commit 046ed313c9
42 changed files with 796 additions and 935 deletions

View File

@@ -25,7 +25,7 @@ final class ExportToolbarForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$this->addSearchTermInputField($builder);
$this->addDateRange($builder, ['timezone' => $options['timezone']], false, true);
$this->addDateRange($builder, ['timezone' => $options['timezone']]);
$this->addCustomerMultiChoice($builder, ['start_date_param' => null, 'end_date_param' => null, 'ignore_date' => true], true);
$this->addProjectMultiChoice($builder, ['ignore_date' => true], true, true);
$this->addActivitySelect($builder, [], true, true, false);

View File

@@ -26,7 +26,7 @@ final class InvoiceToolbarForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$this->addSearchTermInputField($builder);
$this->addDateRange($builder, ['timezone' => $options['timezone']], false, true);
$this->addDateRange($builder, ['timezone' => $options['timezone']]);
$this->addCustomerMultiChoice($builder, ['start_date_param' => null, 'end_date_param' => null, 'ignore_date' => true], true);
$this->addProjectMultiChoice($builder, ['ignore_date' => true], true, true);
$this->addActivitySelect($builder, [], true, true, false);

View File

@@ -155,10 +155,10 @@ trait ToolbarFormTrait
]);
}
protected function addDateRange(FormBuilderInterface $builder, array $options, bool $allowEmpty = true, bool $required = false): void
protected function addDateRange(FormBuilderInterface $builder, array $options, bool $allowEmpty = true): void
{
$params = [
'required' => $required,
'required' => !$allowEmpty,
'allow_empty' => $allowEmpty,
];

View File

@@ -134,6 +134,10 @@ final class DateRangeType extends AbstractType
return $range;
}
if ($dates === null) {
throw new TransformationFailedException('Date range missing');
}
if (preg_match($pattern, $dates) !== 1) {
throw new TransformationFailedException('Invalid date range given');
}

View File

@@ -76,9 +76,20 @@ final class TagsSelectType extends AbstractType
$foundTagNames[] = $tag->getName();
}
/** @var array<string> $newNames */
$newNames = array_diff($newNames, $foundTagNames);
foreach ($newNames as $name) {
/** @var array<string> $newNamesCreate */
$newNamesCreate = array_udiff($newNames, $foundTagNames, function (mixed $userTag, mixed $existingTag) {
if (!\is_string($userTag) || !\is_string($existingTag)) {
return -1;
}
if (mb_strtolower($userTag) === mb_strtolower($existingTag)) {
return 0;
}
return strcmp($userTag, $existingTag);
});
foreach ($newNamesCreate as $name) {
$tag = new Tag();
$tag->setName(mb_substr($name, 0, 100));
$this->tagRepository->saveTag($tag);