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