Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e74a264b37 | ||
| 60bb3cf8c4 |
@@ -1,2 +1,2 @@
|
||||
parameters:
|
||||
app.version: '0.1.64'
|
||||
app.version: '0.1.65'
|
||||
|
||||
@@ -19,6 +19,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
@@ -86,6 +87,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
|
||||
#[ORM\Column(type: 'boolean', options: ['default' => false])]
|
||||
#[Groups(['user:read', 'user:write'])]
|
||||
#[SerializedName('isLocked')]
|
||||
private bool $isLocked = false;
|
||||
|
||||
/**
|
||||
@@ -208,6 +210,8 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
#[Groups(['user:read'])]
|
||||
#[SerializedName('isLocked')]
|
||||
public function isLocked(): bool
|
||||
{
|
||||
return $this->isLocked;
|
||||
|
||||
@@ -45,18 +45,21 @@ final readonly class EmployeeContractPeriodManager implements EmployeeContractPe
|
||||
?EmployeeContractPeriod $todayPeriod,
|
||||
DateTimeImmutable $requestedEndDate,
|
||||
bool $paidLeaveSettled,
|
||||
?string $comment = null
|
||||
?string $comment = null,
|
||||
bool $isAlreadyEnded = false
|
||||
): void {
|
||||
if (null === $todayPeriod) {
|
||||
throw new UnprocessableEntityHttpException('No active contract period to close.');
|
||||
}
|
||||
|
||||
$this->periodValidator->assertCloseEndDateCanBeApplied(
|
||||
$todayPeriod->getStartDate(),
|
||||
$todayPeriod->getEndDate(),
|
||||
$requestedEndDate,
|
||||
$todayPeriod->getContractNatureEnum()
|
||||
);
|
||||
if (!$isAlreadyEnded) {
|
||||
$this->periodValidator->assertCloseEndDateCanBeApplied(
|
||||
$todayPeriod->getStartDate(),
|
||||
$todayPeriod->getEndDate(),
|
||||
$requestedEndDate,
|
||||
$todayPeriod->getContractNatureEnum()
|
||||
);
|
||||
}
|
||||
|
||||
$todayPeriod->setEndDate($requestedEndDate);
|
||||
$todayPeriod->setPaidLeaveSettled($paidLeaveSettled);
|
||||
|
||||
@@ -25,7 +25,8 @@ interface EmployeeContractPeriodManagerInterface
|
||||
?EmployeeContractPeriod $todayPeriod,
|
||||
DateTimeImmutable $requestedEndDate,
|
||||
bool $paidLeaveSettled,
|
||||
?string $comment = null
|
||||
?string $comment = null,
|
||||
bool $isAlreadyEnded = false
|
||||
): void;
|
||||
|
||||
public function createNextPeriod(
|
||||
|
||||
@@ -92,11 +92,13 @@ final readonly class EmployeeWriteProcessor implements ProcessorInterface
|
||||
if (null === $requestedEndDate) {
|
||||
throw new UnprocessableEntityHttpException('contractEndDate is required for close-only request.');
|
||||
}
|
||||
$isAlreadyEnded = null === $todayPeriod;
|
||||
$this->periodManager->closeCurrentPeriod(
|
||||
$effectivePeriod,
|
||||
$requestedEndDate,
|
||||
$changeRequest->contractPaidLeaveSettled ?? false,
|
||||
$changeRequest->contractComment
|
||||
$changeRequest->contractComment,
|
||||
$isAlreadyEnded
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
Reference in New Issue
Block a user