Release 2.0.15 (#3970)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user