mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-11 17:25:02 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
f3cc4a89af | |||
703f5dc32d | |||
b870e71f77 | |||
a7e278204f
|
4
.changes/v4.0.1.md
Normal file
4
.changes/v4.0.1.md
Normal file
@@ -0,0 +1,4 @@
|
||||
## v4.0.1 - 2025-07-08
|
||||
### Fixed
|
||||
* Fix package.json for compilation
|
||||
|
4
.changes/v4.0.2.md
Normal file
4
.changes/v4.0.2.md
Normal file
@@ -0,0 +1,4 @@
|
||||
## v4.0.2 - 2025-07-09
|
||||
### Fixed
|
||||
* Fix add missing translation
|
||||
* Fix the transfer of evaluations and documents during of accompanyingperiodwork
|
10
CHANGELOG.md
10
CHANGELOG.md
@@ -6,6 +6,16 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||
|
||||
|
||||
## v4.0.2 - 2025-07-09
|
||||
### Fixed
|
||||
* Fix add missing translation
|
||||
* Fix the transfer of evaluations and documents during of accompanyingperiodwork
|
||||
|
||||
## v4.0.1 - 2025-07-08
|
||||
### Fixed
|
||||
* Fix package.json for compilation
|
||||
|
||||
|
||||
## v4.0.0 - 2025-07-08
|
||||
### Feature
|
||||
* ([#359](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/359)) Allow the merge of two accompanying period works
|
||||
|
@@ -17,9 +17,9 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
/**
|
||||
* Service for merging two AccompanyingPeriodWork entities into a single entity.
|
||||
*/
|
||||
class AccompanyingPeriodWorkMergeService
|
||||
readonly class AccompanyingPeriodWorkMergeService
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $em) {}
|
||||
public function __construct(private EntityManagerInterface $em) {}
|
||||
|
||||
/**
|
||||
* Merges two AccompanyingPeriodWork entities into one by transferring relevant data and removing the obsolete entity.
|
||||
@@ -35,8 +35,9 @@ class AccompanyingPeriodWorkMergeService
|
||||
$this->alterStartDate($toKeep, $toDelete);
|
||||
$this->alterEndDate($toKeep, $toDelete);
|
||||
$this->concatenateComments($toKeep, $toDelete);
|
||||
$this->transferEvaluationsSQL($toKeep, $toDelete);
|
||||
$this->transferWorkflowsSQL($toKeep, $toDelete);
|
||||
$this->updateReferencesSQL($toKeep, $toDelete);
|
||||
$this->updateReferences($toKeep, $toDelete);
|
||||
$entityManager->remove($toDelete);
|
||||
});
|
||||
|
||||
@@ -54,6 +55,16 @@ class AccompanyingPeriodWorkMergeService
|
||||
);
|
||||
}
|
||||
|
||||
private function transferEvaluationsSQL(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): void
|
||||
{
|
||||
$this->em->getConnection()->executeQuery(
|
||||
"UPDATE chill_person_accompanying_period_work_evaluation cpapwe
|
||||
SET accompanyingperiodwork_id = :toKeepId
|
||||
WHERE cpapwe.accompanyingperiodwork_id = :toDeleteId",
|
||||
['toKeepId' => $toKeep->getId(), 'toDeleteId' => $toDelete->getId()]
|
||||
);
|
||||
}
|
||||
|
||||
private function alterStartDate(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): void
|
||||
{
|
||||
$startDate = min($toKeep->getStartDate(), $toDelete->getStartDate());
|
||||
@@ -74,16 +85,17 @@ class AccompanyingPeriodWorkMergeService
|
||||
|
||||
private function concatenateComments(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): void
|
||||
{
|
||||
$toKeep->setNote($toKeep->getNote()."\n\n-----------------\n\n".$toDelete->getNote());
|
||||
$toKeep->getPrivateComment()->concatenateComments($toDelete->getPrivateComment());
|
||||
}
|
||||
|
||||
private function updateReferencesSQL(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): void
|
||||
{
|
||||
foreach ($toDelete->getAccompanyingPeriodWorkEvaluations() as $evaluation) {
|
||||
$toKeep->addAccompanyingPeriodWorkEvaluation($evaluation);
|
||||
if ($toDelete->getNote() !== '') {
|
||||
$toKeep->setNote($toKeep->getNote()."\n\n-----------------\n\n".$toDelete->getNote());
|
||||
}
|
||||
|
||||
if (count($toDelete->getPrivateComment()->getComments()) > 0) {
|
||||
$toKeep->getPrivateComment()->concatenateComments($toDelete->getPrivateComment());
|
||||
}
|
||||
}
|
||||
|
||||
private function updateReferences(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): void
|
||||
{
|
||||
foreach ($toDelete->getReferrers() as $referrer) {
|
||||
// we only keep the current referrer
|
||||
$toKeep->addReferrer($referrer);
|
||||
|
@@ -1513,6 +1513,7 @@ acpw_duplicate:
|
||||
to keep: Action d'accompagnement à conserver
|
||||
to delete: Action d'accompagnement à supprimer
|
||||
Successfully merged: Action d'accompagnement fusionnée avec succès.
|
||||
You cannot merge a accompanying period work with itself. Please choose a different one: Vous ne pouvez pas fusionner un action d'accompagnement avec lui-même. Veuillez en choisir un autre.
|
||||
|
||||
my_parcours_filters:
|
||||
referrer_parcours_and_acpw: Agent traitant ou réferent
|
||||
|
Reference in New Issue
Block a user