mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch '162-change-job-on-course-when-reassigning-user' into 'master'
Reassign list: when reassigning course, the job associated to the period... Closes #162 See merge request Chill-Projet/chill-bundles!596
This commit is contained in:
commit
a625260c36
6
.changes/unreleased/Feature-20230928-145628.yaml
Normal file
6
.changes/unreleased/Feature-20230928-145628.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
kind: Feature
|
||||
body: 'Reassigning list: when reassigning courses to a new user, the job associated
|
||||
with the course become the one of the new user (if any)'
|
||||
time: 2023-09-28T14:56:28.69132294+02:00
|
||||
custom:
|
||||
Issue: "162"
|
@ -100,7 +100,7 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
|
||||
$total = $this->accompanyingPeriodACLAwareRepository->countByUserAndPostalCodesOpenedAccompanyingPeriod($userFrom, $postalCodes);
|
||||
$paginator = $this->paginatorFactory->create($total);
|
||||
$paginator->setItemsPerPage(50);
|
||||
$paginator->setItemsPerPage(100);
|
||||
$periods = $this->accompanyingPeriodACLAwareRepository
|
||||
->findByUserAndPostalCodesOpenedAccompanyingPeriod(
|
||||
$userFrom,
|
||||
@ -123,6 +123,7 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
|
||||
if ($assignForm->isSubmitted() && $assignForm->isValid()) {
|
||||
$assignPeriodIds = json_decode($assignForm->get('periods')->getData(), true, 512, JSON_THROW_ON_ERROR);
|
||||
/** @var User $userTo */
|
||||
$userTo = $assignForm->get('userTo')->getData();
|
||||
$userFrom = $assignForm->get('userFrom')->getData();
|
||||
|
||||
@ -131,6 +132,10 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
|
||||
if ($period->getUser() === $userFrom) {
|
||||
$period->setUser($userTo, true);
|
||||
|
||||
if (null !== $userTo->getUserJob() && $period->getJob() !== $userTo->getUserJob()) {
|
||||
$period->setJob($userTo->getUserJob());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user