Release 2.0.26 (#4087)

- setting "rounding days" not required
- developer: added user pref for public holiday group (to be used by plugins)
- developer: added WorkingTimeYearEvent (to be used by plugins)
- user pref: cleanup work contract form and support more fields (to be used by plugins)
- code cleanup
- bump theme and composer packages
This commit is contained in:
Kevin Papst
2023-06-09 16:29:19 +02:00
committed by GitHub
parent 0663995d06
commit 6e781b59e2
22 changed files with 241 additions and 167 deletions

View File

@@ -239,7 +239,7 @@ class Timesheet implements EntityWithMetaFields, ExportableItem
* Make sure begin and end date have the correct timezone.
* This will be called once for each item after being loaded from the database.
*/
protected function localizeDates()
protected function localizeDates(): void
{
if ($this->localized) {
return;
@@ -432,7 +432,7 @@ class Timesheet implements EntityWithMetaFields, ExportableItem
/**
* @param Tag $tag
*/
public function removeTag(Tag $tag)
public function removeTag(Tag $tag): void
{
if (!$this->tags->contains($tag)) {
return;
@@ -453,11 +453,14 @@ class Timesheet implements EntityWithMetaFields, ExportableItem
*/
public function getTagsAsArray(): array
{
/** @var array<Tag> $tags */
$tags = $this->getTags()->toArray();
return array_map(
function (Tag $element) {
return $element->getName();
function ($element) {
return (string) $element->getName();
},
$this->getTags()->toArray()
$tags
);
}

View File

@@ -1174,6 +1174,13 @@ class User implements UserInterface, EquatableInterface, ThemeUserInterface, Pas
return (int) $this->getPreferenceValue(UserPreference::WORK_HOURS_SUNDAY, 0);
}
public function getPublicHolidayGroup(): null|string
{
$group = $this->getPreferenceValue(UserPreference::PUBLIC_HOLIDAY_GROUP);
return $group === null ? $group : (string) $group;
}
public function getHolidaysPerYear(): int
{
return (int) $this->getPreferenceValue(UserPreference::HOLIDAYS_PER_YEAR, 0);
@@ -1214,6 +1221,11 @@ class User implements UserInterface, EquatableInterface, ThemeUserInterface, Pas
$this->setPreferenceValue(UserPreference::WORK_HOURS_SUNDAY, $seconds);
}
public function setPublicHolidayGroup(null|string $group = null): void
{
$this->setPreferenceValue(UserPreference::PUBLIC_HOLIDAY_GROUP, $group);
}
public function setHolidaysPerYear(int $holidays): void
{
$this->setPreferenceValue(UserPreference::HOLIDAYS_PER_YEAR, $holidays);

View File

@@ -38,6 +38,7 @@ class UserPreference
public const WORK_HOURS_FRIDAY = 'work_friday';
public const WORK_HOURS_SATURDAY = 'work_saturday';
public const WORK_HOURS_SUNDAY = 'work_sunday';
public const PUBLIC_HOLIDAY_GROUP = 'public_holiday_group';
public const HOLIDAYS_PER_YEAR = 'holidays';
#[ORM\Id]