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:
@@ -15,6 +15,17 @@ use App\Model\Day as BaseDay;
|
||||
final class Day extends BaseDay
|
||||
{
|
||||
private ?WorkingTime $workingTime = null;
|
||||
/** @var array<string, int> */
|
||||
private array $descriptions = [];
|
||||
|
||||
public function isLocked(): bool
|
||||
{
|
||||
if ($this->workingTime !== null && $this->workingTime->isApproved()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getWorkingTime(): ?WorkingTime
|
||||
{
|
||||
@@ -25,4 +36,20 @@ final class Day extends BaseDay
|
||||
{
|
||||
$this->workingTime = $workingTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, int>
|
||||
*/
|
||||
public function getDescriptions(): array
|
||||
{
|
||||
return $this->descriptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Descriptions show up in the approval PDF and maybe in other places as well.
|
||||
*/
|
||||
public function addDescription(string $description, int $duration): void
|
||||
{
|
||||
$this->descriptions[$description] = $duration;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,10 @@ use App\Model\Month as BaseMonth;
|
||||
|
||||
/**
|
||||
* @method array<Day> getDays()
|
||||
* @method Day getDay(\DateTimeInterface $date)
|
||||
*/
|
||||
final class Month extends BaseMonth
|
||||
{
|
||||
private ?bool $locked = null;
|
||||
|
||||
/**
|
||||
* A month is only locked IF every day is approved.
|
||||
* If there is even one day left open, the entire month is not locked.
|
||||
@@ -27,16 +26,13 @@ final class Month extends BaseMonth
|
||||
*/
|
||||
public function isLocked(): bool
|
||||
{
|
||||
if ($this->locked === null) {
|
||||
$this->locked = true;
|
||||
foreach ($this->getDays() as $day) {
|
||||
if ($day->getWorkingTime() !== null && !$day->getWorkingTime()->isApproved()) {
|
||||
$this->locked = false;
|
||||
}
|
||||
foreach ($this->getDays() as $day) {
|
||||
if (!$day->isLocked()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->locked;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getLockDate(): ?\DateTimeInterface
|
||||
|
||||
Reference in New Issue
Block a user