Compare commits

...

2 Commits

Author SHA1 Message Date
gitea-actions
e74a264b37 chore: bump version to v0.1.65
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s
Build Release Artefact / build (push) Successful in 2m24s
2026-03-25 09:49:32 +00:00
60bb3cf8c4 fix : verrouillage utilisateur + modification de contrat terminé
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
2026-03-25 10:49:20 +01:00
5 changed files with 20 additions and 10 deletions

View File

@@ -1,2 +1,2 @@
parameters: parameters:
app.version: '0.1.64' app.version: '0.1.65'

View File

@@ -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;

View File

@@ -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);

View File

@@ -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(

View File

@@ -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;