Release 2.29 (#5325)
* bump composer packages * fixes #5329 quotes for ANSI_MODE * improve year selection * improve year selection via dropdown * added range selector in month-picker * fix week number if week starts with sunday * fix first day of month in URL * predefined options for week chooser * z-index issue with sticky table header * replace duplicated translations * add logout button to allow user switch without having to re-login in "remember me" login * new flag to detect if invoice entry is a fixed rate * improve export column lengths
This commit is contained in:
@@ -28,7 +28,7 @@ final class Configuration
|
||||
*/
|
||||
private array $constraints = [];
|
||||
|
||||
public function __construct(private string $name)
|
||||
public function __construct(private readonly string $name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -28,22 +28,41 @@ final class MonthPickerType extends AbstractType
|
||||
'widget' => 'single_text',
|
||||
'html5' => false,
|
||||
'format' => DateType::HTML5_FORMAT,
|
||||
'start_date' => new \DateTime(),
|
||||
'start_date' => new \DateTimeImmutable(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||
{
|
||||
/** @var \DateTime|null $date */
|
||||
if (!$options['start_date'] instanceof \DateTimeInterface) {
|
||||
throw new \InvalidArgumentException('Start date needs to be a DateTime object');
|
||||
}
|
||||
|
||||
/** @var \DateTimeInterface|null $date */
|
||||
$date = $form->getData();
|
||||
|
||||
if (null === $date) {
|
||||
/** @var \DateTimeImmutable $date */
|
||||
$date = $options['start_date'];
|
||||
}
|
||||
|
||||
$date = \DateTimeImmutable::createFromInterface($date);
|
||||
$start = \DateTimeImmutable::createFromInterface($options['start_date']);
|
||||
$start = $start->setDate((int) $start->format('Y'), (int) $start->format('m'), 1);
|
||||
|
||||
$range = [];
|
||||
$end = $start->modify('-2 year');
|
||||
$end = $end->setDate((int) $end->format('Y'), 1, 1);
|
||||
$i = 1;
|
||||
while ($i++ < 36 && $end <= $start) {
|
||||
$range[] = $start;
|
||||
$start = $start->modify('- 1 month');
|
||||
}
|
||||
|
||||
$view->vars['month'] = $date;
|
||||
$view->vars['previousMonth'] = (clone $date)->modify('-1 month');
|
||||
$view->vars['nextMonth'] = (clone $date)->modify('+1 month');
|
||||
$view->vars['range'] = $range;
|
||||
$view->vars['previousMonth'] = $date->modify('-1 month');
|
||||
$view->vars['nextMonth'] = $date->modify('+1 month');
|
||||
}
|
||||
|
||||
public function getParent(): string
|
||||
|
||||
@@ -34,6 +34,10 @@ final class WeekPickerType extends AbstractType
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||
{
|
||||
if (!$options['start_date'] instanceof \DateTimeInterface) {
|
||||
throw new \InvalidArgumentException('Start date needs to be a DateTime object');
|
||||
}
|
||||
|
||||
/** @var \DateTimeInterface|null $date */
|
||||
$date = $form->getData();
|
||||
|
||||
@@ -42,11 +46,31 @@ final class WeekPickerType extends AbstractType
|
||||
$date = $options['start_date'];
|
||||
}
|
||||
|
||||
$date = \DateTime::createFromInterface($date);
|
||||
$date = \DateTimeImmutable::createFromInterface($date);
|
||||
$start = \DateTimeImmutable::createFromInterface($options['start_date']);
|
||||
|
||||
$view->vars['week'] = $date;
|
||||
$view->vars['previousWeek'] = (clone $date)->modify('-1 week');
|
||||
$view->vars['nextWeek'] = (clone $date)->modify('+1 week');
|
||||
$week = $date;
|
||||
if ($date->format('N') === '7') {
|
||||
$week = $date->modify('+1 day');
|
||||
}
|
||||
if ($start->format('N') === '7') {
|
||||
$start = $start->modify('+1 day');
|
||||
}
|
||||
|
||||
$range = [];
|
||||
$end = $start->modify('-1 year');
|
||||
$end = $end->setDate((int) $end->format('Y'), 1, 1);
|
||||
$i = 1;
|
||||
while ($i++ < 106 && $end <= $start) {
|
||||
$range[] = $start;
|
||||
$start = $start->modify('- 1 week');
|
||||
}
|
||||
|
||||
$view->vars['range'] = $range;
|
||||
$view->vars['weekNumber'] = $week->format('W');
|
||||
$view->vars['week'] = $week;
|
||||
$view->vars['previousWeek'] = $week->modify('-1 week');
|
||||
$view->vars['nextWeek'] = $week->modify('+1 week');
|
||||
}
|
||||
|
||||
public function getParent(): string
|
||||
|
||||
@@ -29,7 +29,6 @@ final class YearPickerType extends AbstractType
|
||||
'html5' => false,
|
||||
'format' => DateType::HTML5_FORMAT,
|
||||
'start_date' => new \DateTimeImmutable(),
|
||||
'show_range' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -43,12 +42,19 @@ final class YearPickerType extends AbstractType
|
||||
$date = $options['start_date'];
|
||||
}
|
||||
|
||||
$date = \DateTime::createFromInterface($date);
|
||||
$date = \DateTimeImmutable::createFromInterface($date);
|
||||
|
||||
$range = [];
|
||||
$start = new \DateTimeImmutable();
|
||||
$start = $start->setDate((int) $start->format('Y'), (int) $date->format('m'), (int) $date->format('d'));
|
||||
for ($i = 0; $i < 6; $i++) {
|
||||
$range[] = $start->modify('-' . $i . ' year');
|
||||
}
|
||||
|
||||
$view->vars['year'] = $date;
|
||||
$view->vars['show_range'] = $options['show_range'];
|
||||
$view->vars['previousYear'] = (clone $date)->modify('-1 year');
|
||||
$view->vars['nextYear'] = (clone $date)->modify('+1 year');
|
||||
$view->vars['range'] = $range;
|
||||
$view->vars['previousYear'] = $date->modify('-1 year');
|
||||
$view->vars['nextYear'] = $date->modify('+1 year');
|
||||
}
|
||||
|
||||
public function getParent(): string
|
||||
|
||||
Reference in New Issue
Block a user