mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge remote-tracking branch 'origin/master' into issue568_agents_traitants
This commit is contained in:
commit
d155c76013
21
CHANGELOG.md
21
CHANGELOG.md
@ -11,16 +11,33 @@ and this project adheres to
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
|
* [Datepickers] datepickers fixed when using keyboard to enter date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/545)
|
||||||
|
* [social_action] Display 'agents traitants' in parcours resumé and social action list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/568)
|
||||||
|
|
||||||
|
## Test releases
|
||||||
|
|
||||||
|
### 2021-04-24
|
||||||
|
|
||||||
|
* [notification email on course designation] allow raw string in email content generation
|
||||||
|
* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
|
||||||
|
* [Documents] Change wording 'créer' to 'enregistrer' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/634)
|
||||||
|
* [Parcours]: The number of 'mes parcours' displayed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/572)
|
||||||
|
* [Hompage_widget]: Renaming of tabs and removal of social actions tab (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/570)
|
||||||
|
* [activity]: Ignore thirdparties when creating a social action via an activity (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/573)
|
||||||
|
* [parcours]: change wording of warning message and button when user is not associated to a household yet (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/590#note_918370943)
|
||||||
|
* [Accompanying period work evaluations] list documents associated to a work by creation date, and then by id, from the most recent to older
|
||||||
|
* [Course comment] add validationConstraint NotNull and NotBlank on comment content, to avoid sql error
|
||||||
|
* [Notifications] delay the sending of notificaiton to kernel.terminate
|
||||||
|
* [Notifications / Period user change] fix the sending of notification when user changes
|
||||||
* [Activity form] invert 'incoming' and 'receiving' in Activity form
|
* [Activity form] invert 'incoming' and 'receiving' in Activity form
|
||||||
* [Activity form] keep the same order for 'attendee' field in new and edit form
|
* [Activity form] keep the same order for 'attendee' field in new and edit form
|
||||||
* [list with period] use "sameas" test operator to introduce requestor in list
|
* [list with period] use "sameas" test operator to introduce requestor in list
|
||||||
* [notification email on course designation] allow raw string in email content generation
|
* [notification email on course designation] allow raw string in email content generation
|
||||||
* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
|
* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
|
||||||
* [social_action] Display 'agents traitants' in parcours resumé and social action list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/568)
|
|
||||||
|
|
||||||
## Test releases
|
|
||||||
|
|
||||||
### 2021-04-13
|
### 2021-04-13
|
||||||
|
|
||||||
* [person] household address: add a form for editing the validFrom date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/541)
|
* [person] household address: add a form for editing the validFrom date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/541)
|
||||||
* [person] householdmemberseditor: fix composition type bug in select form (vuejs) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/543)
|
* [person] householdmemberseditor: fix composition type bug in select form (vuejs) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/543)
|
||||||
* [docgen] add more persons choices in docgen for course: amongst requestor (if person), resources of course (if person), and PersonResource (if person);
|
* [docgen] add more persons choices in docgen for course: amongst requestor (if person), resources of course (if person), and PersonResource (if person);
|
||||||
|
@ -66,9 +66,6 @@ class ActivityEntityListener
|
|||||||
$newAction->addPerson($person);
|
$newAction->addPerson($person);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($associatedThirdparties as $thirdparty) {
|
|
||||||
$newAction->setHandlingThierparty($thirdparty);
|
|
||||||
}
|
|
||||||
$this->em->persist($newAction);
|
$this->em->persist($newAction);
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="create">
|
<li class="create">
|
||||||
<button class="btn btn-create">{{ 'Create'|trans }}</button>
|
<button class="btn btn-save">{{ 'Save'|trans }}</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="create">
|
<li class="create">
|
||||||
<button class="btn btn-create">{{ 'Create'|trans }}</button>
|
<button class="btn btn-save">{{ 'Save'|trans }}</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification\EventListener;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Notification\NotificationPersisterInterface;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Symfony\Component\HttpKernel\Event\TerminateEvent;
|
||||||
|
use function count;
|
||||||
|
|
||||||
|
class PersistNotificationOnTerminateEventSubscriber implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
private NotificationPersisterInterface $persister;
|
||||||
|
|
||||||
|
public function __construct(EntityManagerInterface $em, NotificationPersisterInterface $persister)
|
||||||
|
{
|
||||||
|
$this->em = $em;
|
||||||
|
$this->persister = $persister;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'kernel.terminate' => [
|
||||||
|
['onKernelTerminate', 1024], // we must ensure that the priority is before sending email
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onKernelTerminate(TerminateEvent $event): void
|
||||||
|
{
|
||||||
|
if ($event->isMasterRequest()) {
|
||||||
|
$this->persistNotifications();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function persistNotifications(): void
|
||||||
|
{
|
||||||
|
if (0 < count($this->persister->getWaitingNotifications())) {
|
||||||
|
foreach ($this->persister->getWaitingNotifications() as $notification) {
|
||||||
|
$this->em->persist($notification);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->em->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Notification;
|
||||||
|
|
||||||
|
class NotificationPersister implements NotificationPersisterInterface
|
||||||
|
{
|
||||||
|
private array $waitingNotifications = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array|Notification[]
|
||||||
|
*/
|
||||||
|
public function getWaitingNotifications(): array
|
||||||
|
{
|
||||||
|
return $this->waitingNotifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function persist(Notification $notification): void
|
||||||
|
{
|
||||||
|
$this->waitingNotifications[] = $notification;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Notification;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Notification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store the notification.
|
||||||
|
*
|
||||||
|
* Those notification will be stored into database by the kernel. This
|
||||||
|
* will also ensure that this happens outside of regular operations
|
||||||
|
* operated by the entity manager.
|
||||||
|
*/
|
||||||
|
interface NotificationPersisterInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return array|Notification[]
|
||||||
|
*/
|
||||||
|
public function getWaitingNotifications(): array;
|
||||||
|
|
||||||
|
public function persist(Notification $notification): void;
|
||||||
|
}
|
@ -25,14 +25,14 @@
|
|||||||
{{ $t('my_accompanying_courses.tab') }}
|
{{ $t('my_accompanying_courses.tab') }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<!-- <li class="nav-item">
|
||||||
<a class="nav-link"
|
<a class="nav-link"
|
||||||
:class="{'active': activeTab === 'MyWorks'}"
|
:class="{'active': activeTab === 'MyWorks'}"
|
||||||
@click="selectTab('MyWorks')">
|
@click="selectTab('MyWorks')">
|
||||||
{{ $t('my_works.tab') }}
|
{{ $t('my_works.tab') }}
|
||||||
<tab-counter :count="state.works.count"></tab-counter>
|
<tab-counter :count="state.works.count"></tab-counter>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li> -->
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link"
|
<a class="nav-link"
|
||||||
:class="{'active': activeTab === 'MyEvaluations'}"
|
:class="{'active': activeTab === 'MyEvaluations'}"
|
||||||
@ -135,7 +135,7 @@ export default {
|
|||||||
for (const m of [
|
for (const m of [
|
||||||
'MyNotifications',
|
'MyNotifications',
|
||||||
'MyAccompanyingCourses',
|
'MyAccompanyingCourses',
|
||||||
'MyWorks',
|
// 'MyWorks',
|
||||||
'MyEvaluations',
|
'MyEvaluations',
|
||||||
'MyTasks',
|
'MyTasks',
|
||||||
'MyWorkflows',
|
'MyWorkflows',
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// CURRENTLY NOT IN USE
|
||||||
<template>
|
<template>
|
||||||
<div class="accompanying_course_work">
|
<div class="accompanying_course_work">
|
||||||
<div class="alert alert-light">{{ $t('my_works.description') }}</div>
|
<div class="alert alert-light">{{ $t('my_works.description') }}</div>
|
||||||
|
@ -15,11 +15,11 @@ const appMessages = {
|
|||||||
description_warning: "Liste des tâches auxquelles je suis assigné et dont la date d'échéance est dépassée.",
|
description_warning: "Liste des tâches auxquelles je suis assigné et dont la date d'échéance est dépassée.",
|
||||||
},
|
},
|
||||||
my_accompanying_courses: {
|
my_accompanying_courses: {
|
||||||
tab: "Mes parcours",
|
tab: "Mes nouveaux parcours",
|
||||||
description: "Liste des parcours d'accompagnement que l'on vient de m'attribuer.",
|
description: "Liste des parcours d'accompagnement que l'on vient de m'attribuer depuis moins de 15 jours.",
|
||||||
},
|
},
|
||||||
my_notifications: {
|
my_notifications: {
|
||||||
tab: "Mes notifications",
|
tab: "Mes nouvelles notifications",
|
||||||
description: "Liste des notifications reçues et non lues.",
|
description: "Liste des notifications reçues et non lues.",
|
||||||
},
|
},
|
||||||
my_workflows: {
|
my_workflows: {
|
||||||
|
@ -13,7 +13,7 @@ const isEmpty = (obj) => {
|
|||||||
const store = createStore({
|
const store = createStore({
|
||||||
strict: debug,
|
strict: debug,
|
||||||
state: {
|
state: {
|
||||||
works: {},
|
// works: {},
|
||||||
evaluations: {},
|
evaluations: {},
|
||||||
tasks: {
|
tasks: {
|
||||||
warning: {},
|
warning: {},
|
||||||
@ -26,9 +26,9 @@ const store = createStore({
|
|||||||
loading: false
|
loading: false
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
isWorksLoaded(state) {
|
// isWorksLoaded(state) {
|
||||||
return !isEmpty(state.works);
|
// return !isEmpty(state.works);
|
||||||
},
|
// },
|
||||||
isEvaluationsLoaded(state) {
|
isEvaluationsLoaded(state) {
|
||||||
return !isEmpty(state.evaluations);
|
return !isEmpty(state.evaluations);
|
||||||
},
|
},
|
||||||
@ -49,7 +49,7 @@ const store = createStore({
|
|||||||
},
|
},
|
||||||
counter(state) {
|
counter(state) {
|
||||||
return {
|
return {
|
||||||
works: state.works.count,
|
// works: state.works.count,
|
||||||
evaluations: state.evaluations.count,
|
evaluations: state.evaluations.count,
|
||||||
tasksWarning: state.tasks.warning.count,
|
tasksWarning: state.tasks.warning.count,
|
||||||
tasksAlert: state.tasks.alert.count,
|
tasksAlert: state.tasks.alert.count,
|
||||||
@ -60,10 +60,10 @@ const store = createStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
addWorks(state, works) {
|
// addWorks(state, works) {
|
||||||
//console.log('addWorks', works);
|
// //console.log('addWorks', works);
|
||||||
state.works = works;
|
// state.works = works;
|
||||||
},
|
// },
|
||||||
addEvaluations(state, evaluations) {
|
addEvaluations(state, evaluations) {
|
||||||
//console.log('addEvaluations', evaluations);
|
//console.log('addEvaluations', evaluations);
|
||||||
state.evaluations = evaluations;
|
state.evaluations = evaluations;
|
||||||
@ -99,22 +99,22 @@ const store = createStore({
|
|||||||
switch (tab) {
|
switch (tab) {
|
||||||
case 'MyCustoms':
|
case 'MyCustoms':
|
||||||
break;
|
break;
|
||||||
case 'MyWorks':
|
// case 'MyWorks':
|
||||||
if (!getters.isWorksLoaded) {
|
// if (!getters.isWorksLoaded) {
|
||||||
commit('setLoading', true);
|
// commit('setLoading', true);
|
||||||
const url = `/api/1.0/person/accompanying-period/work/my-near-end${'?'+ param}`;
|
// const url = `/api/1.0/person/accompanying-period/work/my-near-end${'?'+ param}`;
|
||||||
makeFetch('GET', url)
|
// makeFetch('GET', url)
|
||||||
.then((response) => {
|
// .then((response) => {
|
||||||
commit('addWorks', response);
|
// commit('addWorks', response);
|
||||||
commit('setLoading', false);
|
// commit('setLoading', false);
|
||||||
})
|
// })
|
||||||
.catch((error) => {
|
// .catch((error) => {
|
||||||
commit('catchError', error);
|
// commit('catchError', error);
|
||||||
throw error;
|
// throw error;
|
||||||
})
|
// })
|
||||||
;
|
// ;
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
case 'MyEvaluations':
|
case 'MyEvaluations':
|
||||||
if (!getters.isEvaluationsLoaded) {
|
if (!getters.isEvaluationsLoaded) {
|
||||||
commit('setLoading', true);
|
commit('setLoading', true);
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Notification\EventListener;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\Notification;
|
||||||
|
use Chill\MainBundle\Notification\EventListener\PersistNotificationOnTerminateEventSubscriber;
|
||||||
|
use Chill\MainBundle\Notification\NotificationPersister;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Prophecy\Argument;
|
||||||
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
|
use Symfony\Component\HttpKernel\Event\TerminateEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class PersistNotificationOnTerminateEventSubscriberTest extends TestCase
|
||||||
|
{
|
||||||
|
use ProphecyTrait;
|
||||||
|
|
||||||
|
public function testNotificationIsPersisted()
|
||||||
|
{
|
||||||
|
$persister = new NotificationPersister();
|
||||||
|
$em = $this->prophesize(EntityManagerInterface::class);
|
||||||
|
$em->persist(Argument::type(Notification::class))->shouldBeCalledTimes(1);
|
||||||
|
$em->flush()->shouldBeCalledTimes(1);
|
||||||
|
$event = $this->prophesize(TerminateEvent::class);
|
||||||
|
$event->isMasterRequest()->willReturn(true);
|
||||||
|
|
||||||
|
$eventSubscriber = new PersistNotificationOnTerminateEventSubscriber($em->reveal(), $persister);
|
||||||
|
|
||||||
|
$notification = new Notification();
|
||||||
|
$persister->persist($notification);
|
||||||
|
|
||||||
|
$eventSubscriber->onKernelTerminate($event->reveal());
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,11 @@ services:
|
|||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
|
|
||||||
|
Chill\MainBundle\Notification\:
|
||||||
|
resource: ../../Notification/
|
||||||
|
autoconfigure: true
|
||||||
|
autowire: true
|
||||||
|
|
||||||
Chill\MainBundle\Notification\Mailer:
|
Chill\MainBundle\Notification\Mailer:
|
||||||
arguments:
|
arguments:
|
||||||
$logger: '@Psr\Log\LoggerInterface'
|
$logger: '@Psr\Log\LoggerInterface'
|
||||||
@ -17,12 +22,6 @@ services:
|
|||||||
arguments:
|
arguments:
|
||||||
$handlers: !tagged_iterator chill_main.notification_handler
|
$handlers: !tagged_iterator chill_main.notification_handler
|
||||||
|
|
||||||
Chill\MainBundle\Notification\NotificationPresence: ~
|
|
||||||
|
|
||||||
Chill\MainBundle\Notification\Templating\NotificationTwigExtension: ~
|
|
||||||
|
|
||||||
Chill\MainBundle\Notification\Templating\NotificationTwigExtensionRuntime: ~
|
|
||||||
|
|
||||||
Chill\MainBundle\Notification\Counter\NotificationByUserCounter:
|
Chill\MainBundle\Notification\Counter\NotificationByUserCounter:
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
autowire: true
|
autowire: true
|
||||||
|
@ -13,10 +13,10 @@ namespace Chill\PersonBundle\AccompanyingPeriod\Events;
|
|||||||
|
|
||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
use Chill\MainBundle\Entity\Notification;
|
use Chill\MainBundle\Entity\Notification;
|
||||||
|
use Chill\MainBundle\Notification\NotificationPersisterInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Event\Person\PersonAddressMoveEvent;
|
use Chill\PersonBundle\Event\Person\PersonAddressMoveEvent;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
use Symfony\Component\Templating\EngineInterface;
|
use Symfony\Component\Templating\EngineInterface;
|
||||||
@ -26,7 +26,7 @@ class PersonAddressMoveEventSubscriber implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
private EngineInterface $engine;
|
private EngineInterface $engine;
|
||||||
|
|
||||||
private EntityManagerInterface $entityManager;
|
private NotificationPersisterInterface $notificationPersister;
|
||||||
|
|
||||||
private Security $security;
|
private Security $security;
|
||||||
|
|
||||||
@ -34,12 +34,12 @@ class PersonAddressMoveEventSubscriber implements EventSubscriberInterface
|
|||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EngineInterface $engine,
|
EngineInterface $engine,
|
||||||
EntityManagerInterface $entityManager,
|
NotificationPersisterInterface $notificationPersister,
|
||||||
Security $security,
|
Security $security,
|
||||||
TranslatorInterface $translator
|
TranslatorInterface $translator
|
||||||
) {
|
) {
|
||||||
$this->engine = $engine;
|
$this->engine = $engine;
|
||||||
$this->entityManager = $entityManager;
|
$this->notificationPersister = $notificationPersister;
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ class PersonAddressMoveEventSubscriber implements EventSubscriberInterface
|
|||||||
'period' => $period,
|
'period' => $period,
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$this->entityManager->persist($notification);
|
$this->notificationPersister->persist($notification);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ namespace Chill\PersonBundle\AccompanyingPeriod\Events;
|
|||||||
|
|
||||||
use Chill\MainBundle\Entity\Notification;
|
use Chill\MainBundle\Entity\Notification;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Chill\MainBundle\Notification\NotificationPersisterInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Doctrine\Persistence\Event\LifecycleEventArgs;
|
use Doctrine\Persistence\Event\LifecycleEventArgs;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
@ -24,20 +24,20 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class UserRefEventSubscriber implements EventSubscriberInterface
|
class UserRefEventSubscriber implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
private EngineInterface $engine;
|
private EngineInterface $engine;
|
||||||
|
|
||||||
|
private NotificationPersisterInterface $notificationPersister;
|
||||||
|
|
||||||
private Security $security;
|
private Security $security;
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
private TranslatorInterface $translator;
|
||||||
|
|
||||||
public function __construct(Security $security, TranslatorInterface $translator, EngineInterface $engine, EntityManagerInterface $em)
|
public function __construct(Security $security, TranslatorInterface $translator, EngineInterface $engine, NotificationPersisterInterface $notificationPersister)
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->engine = $engine;
|
$this->engine = $engine;
|
||||||
$this->em = $em;
|
$this->notificationPersister = $notificationPersister;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSubscribedEvents()
|
public static function getSubscribedEvents()
|
||||||
@ -58,16 +58,13 @@ class UserRefEventSubscriber implements EventSubscriberInterface
|
|||||||
|
|
||||||
public function postUpdate(AccompanyingPeriod $period, LifecycleEventArgs $args): void
|
public function postUpdate(AccompanyingPeriod $period, LifecycleEventArgs $args): void
|
||||||
{
|
{
|
||||||
if ($period->hasPreviousUser()
|
if ($period->isChangedUser()
|
||||||
&& $period->getUser() !== $this->security->getUser()
|
&& $period->getUser() !== $this->security->getUser()
|
||||||
&& null !== $period->getUser()
|
&& null !== $period->getUser()
|
||||||
&& $period->getStep() !== AccompanyingPeriod::STEP_DRAFT
|
&& $period->getStep() !== AccompanyingPeriod::STEP_DRAFT
|
||||||
) {
|
) {
|
||||||
$this->generateNotificationToUser($period);
|
$this->generateNotificationToUser($period);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we are just out of a flush operation. Launch a new one
|
|
||||||
$this->em->flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateNotificationToUser(AccompanyingPeriod $period)
|
private function generateNotificationToUser(AccompanyingPeriod $period)
|
||||||
@ -89,7 +86,7 @@ class UserRefEventSubscriber implements EventSubscriberInterface
|
|||||||
))
|
))
|
||||||
->addAddressee($period->getUser());
|
->addAddressee($period->getUser());
|
||||||
|
|
||||||
$this->em->persist($notification);
|
$this->notificationPersister->persist($notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function onPeriodConfirmed(AccompanyingPeriod $period)
|
private function onPeriodConfirmed(AccompanyingPeriod $period)
|
||||||
|
@ -102,7 +102,6 @@ class HouseholdApiController extends ApiController
|
|||||||
$event
|
$event
|
||||||
->setPreviousAddress($household->getPreviousAddressOf($address))
|
->setPreviousAddress($household->getPreviousAddressOf($address))
|
||||||
->setNextAddress($address);
|
->setNextAddress($address);
|
||||||
dump($event);
|
|
||||||
$this->eventDispatcher->dispatch($event);
|
$this->eventDispatcher->dispatch($event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,6 +361,8 @@ class AccompanyingPeriod implements
|
|||||||
*/
|
*/
|
||||||
private Collection $userHistories;
|
private Collection $userHistories;
|
||||||
|
|
||||||
|
private bool $userIsChanged = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary field, which is filled when the user is changed.
|
* Temporary field, which is filled when the user is changed.
|
||||||
*
|
*
|
||||||
@ -978,6 +980,11 @@ class AccompanyingPeriod implements
|
|||||||
return null !== $this->userPrevious;
|
return null !== $this->userPrevious;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isChangedUser(): bool
|
||||||
|
{
|
||||||
|
return $this->userIsChanged && $this->user !== $this->userPrevious;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the closing date is after the opening date.
|
* Returns true if the closing date is after the opening date.
|
||||||
*/
|
*/
|
||||||
@ -1103,6 +1110,14 @@ class AccompanyingPeriod implements
|
|||||||
$this->setStep(AccompanyingPeriod::STEP_CONFIRMED);
|
$this->setStep(AccompanyingPeriod::STEP_CONFIRMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function resetPreviousUser(): self
|
||||||
|
{
|
||||||
|
$this->userPrevious = null;
|
||||||
|
$this->userIsChanged = false;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Groups({"write"})
|
* @Groups({"write"})
|
||||||
*/
|
*/
|
||||||
@ -1329,6 +1344,7 @@ class AccompanyingPeriod implements
|
|||||||
{
|
{
|
||||||
if ($this->user !== $user) {
|
if ($this->user !== $user) {
|
||||||
$this->userPrevious = $this->user;
|
$this->userPrevious = $this->user;
|
||||||
|
$this->userIsChanged = true;
|
||||||
|
|
||||||
foreach ($this->userHistories as $history) {
|
foreach ($this->userHistories as $history) {
|
||||||
if (null === $history->getEndDate()) {
|
if (null === $history->getEndDate()) {
|
||||||
|
@ -77,6 +77,7 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
|
|||||||
* cascade={"remove", "persist"},
|
* cascade={"remove", "persist"},
|
||||||
* orphanRemoval=true
|
* orphanRemoval=true
|
||||||
* )
|
* )
|
||||||
|
* @ORM\OrderBy({"createdAt": "DESC", "id": "DESC"})
|
||||||
* @Serializer\Groups({"read"})
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private Collection $documents;
|
private Collection $documents;
|
||||||
|
@ -19,6 +19,7 @@ use DateTimeInterface;
|
|||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||||
use Symfony\Component\Serializer\Annotation\Groups;
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
@ -40,6 +41,8 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
* @Groups({"read", "write"})
|
* @Groups({"read", "write"})
|
||||||
|
* @Assert\NotBlank
|
||||||
|
* @Assert\NotNull
|
||||||
*/
|
*/
|
||||||
private $content;
|
private $content;
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@
|
|||||||
</h2>
|
</h2>
|
||||||
<div>
|
<div>
|
||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
<label class="col-form-label col-sm-4">{{ $t('startdate.date') }}</label>
|
<div class="col-sm-12 date-update">
|
||||||
<div class="col-sm-8">
|
<input class="form-control" type="date" id="startDate" v-model="startDateInput">
|
||||||
<input class="form-control" type="date" v-model="startDate" @change="updateStartDate" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -17,30 +16,54 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { datetimeToISO, dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js';
|
import { dateToISO, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js';
|
||||||
import { mapState, mapGetters } from 'vuex';
|
import { mapState } from 'vuex';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'startDate',
|
name: 'startDate',
|
||||||
methods: {
|
data() {
|
||||||
updateStartDate(event) {
|
return {
|
||||||
const date = event.target.value;
|
lastRecordedDate: null
|
||||||
// console.log(date)
|
}
|
||||||
this.$store.dispatch('updateStartDate', date)
|
|
||||||
.catch(({name, violations}) => {
|
|
||||||
if (name === 'ValidationException' || name === 'AccessException') {
|
|
||||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
|
||||||
} else {
|
|
||||||
this.$toast.open({message: 'An error occurred'})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
startDate: state => dateToISO(ISOToDatetime(state.accompanyingCourse.openingDate.datetime))
|
startDate: state => dateToISO(ISOToDatetime(state.accompanyingCourse.openingDate.datetime))
|
||||||
})
|
}),
|
||||||
|
startDateInput: {
|
||||||
|
get() {
|
||||||
|
return this.startDate;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.lastRecordedDate = value;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log('timeout finished')
|
||||||
|
if (this.lastRecordedDate === value) {
|
||||||
|
console.log('last recorded', this.lastRecordedDate, 'value', value)
|
||||||
|
this.$store.dispatch('updateStartDate', value)
|
||||||
|
.catch(({name, violations}) => {
|
||||||
|
if (name === 'ValidationException' || name === 'AccessException') {
|
||||||
|
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||||
|
} else {
|
||||||
|
this.$toast.open({message: 'An error occurred'})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.date-update {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
&-btn {
|
||||||
|
margin-left: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -59,8 +59,8 @@ const appMessages = {
|
|||||||
ok: "Oui, l'usager quitte le parcours",
|
ok: "Oui, l'usager quitte le parcours",
|
||||||
show_household_number: "Voir le ménage (n° {id})",
|
show_household_number: "Voir le ménage (n° {id})",
|
||||||
show_household: "Voir le ménage",
|
show_household: "Voir le ménage",
|
||||||
person_without_household_warning: "Certaines usagers n'appartiennent actuellement à aucun ménage. Renseignez leur appartenance dès que possible.",
|
person_without_household_warning: "Certaines usagers n'appartiennent actuellement à aucun ménage. Veuillez les associer à un ménage dès que possible.",
|
||||||
update_household: "Renseigner l'appartenance",
|
update_household: "Associer à un ménage",
|
||||||
participation_not_valid: "Sélectionnez ou créez au minimum 1 usager",
|
participation_not_valid: "Sélectionnez ou créez au minimum 1 usager",
|
||||||
},
|
},
|
||||||
requestor: {
|
requestor: {
|
||||||
@ -153,7 +153,7 @@ const appMessages = {
|
|||||||
},
|
},
|
||||||
startdate: {
|
startdate: {
|
||||||
change: "Date d'ouverture",
|
change: "Date d'ouverture",
|
||||||
date: "Date d'ouverture",
|
// update: "La nouvelle date d'ouverture a été enregistrée"
|
||||||
},
|
},
|
||||||
// catch errors
|
// catch errors
|
||||||
'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.",
|
'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.",
|
||||||
|
@ -322,7 +322,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateStartDate(state, date) {
|
updateStartDate(state, date) {
|
||||||
console.log('new state date', date)
|
|
||||||
state.accompanyingCourse.openingDate = date;
|
state.accompanyingCourse.openingDate = date;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -814,11 +813,9 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
updateStartDate({commit}, payload) {
|
updateStartDate({commit}, payload) {
|
||||||
console.log('payload', payload)
|
|
||||||
const date = ISOToDate(payload);
|
|
||||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||||
const body = { type: "accompanying_period", openingDate: { datetime: datetimeToISO(date) }};
|
const date = payload === null || payload === '' ? null : { datetime: datetimeToISO(ISOToDate(payload)) }
|
||||||
console.log('body', body)
|
const body = { type: "accompanying_period", openingDate: date};
|
||||||
return makeFetch('PATCH', url, body)
|
return makeFetch('PATCH', url, body)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
commit('updateStartDate', response.openingDate);
|
commit('updateStartDate', response.openingDate);
|
||||||
|
@ -227,19 +227,18 @@ export default {
|
|||||||
},
|
},
|
||||||
startDate: {
|
startDate: {
|
||||||
get() {
|
get() {
|
||||||
let d = this.$store.state.startDate;
|
return this.$store.state.startDate;
|
||||||
return dateToISO(d);
|
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$store.commit('setStartDate', ISOToDate(value));
|
this.$store.commit('setStartDate', value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
endDate: {
|
endDate: {
|
||||||
get() {
|
get() {
|
||||||
return dateToISO(this.$store.state.endDate);
|
return this.$store.state.endDate;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$store.commit('setEndDate', ISOToDate(value));
|
this.$store.commit('setEndDate', value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setSocialIssue: {
|
setSocialIssue: {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import { createStore } from 'vuex';
|
import { createStore } from 'vuex';
|
||||||
import { datetimeToISO } from 'ChillMainAssets/chill/js/date.js';
|
import { datetimeToISO, dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js';
|
||||||
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
|
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
|
||||||
// import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
// import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
||||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||||
@ -20,7 +20,7 @@ const store = createStore({
|
|||||||
.map(p => p.person),
|
.map(p => p.person),
|
||||||
personsReachables: window.accompanyingCourse.participations.filter(p => p.endDate == null)
|
personsReachables: window.accompanyingCourse.participations.filter(p => p.endDate == null)
|
||||||
.map(p => p.person),
|
.map(p => p.person),
|
||||||
startDate: new Date(),
|
startDate: dateToISO(new Date()),
|
||||||
endDate: null,
|
endDate: null,
|
||||||
isLoadingSocialActions: false,
|
isLoadingSocialActions: false,
|
||||||
isPostingWork: false,
|
isPostingWork: false,
|
||||||
@ -47,7 +47,7 @@ const store = createStore({
|
|||||||
id: state.socialActionPicked.id
|
id: state.socialActionPicked.id
|
||||||
},
|
},
|
||||||
startDate: {
|
startDate: {
|
||||||
datetime: datetimeToISO(state.startDate)
|
datetime: datetimeToISO(ISOToDate(state.startDate))
|
||||||
},
|
},
|
||||||
persons: []
|
persons: []
|
||||||
};
|
};
|
||||||
@ -61,7 +61,7 @@ const store = createStore({
|
|||||||
|
|
||||||
if (null !== state.endDate) {
|
if (null !== state.endDate) {
|
||||||
payload.endDate = {
|
payload.endDate = {
|
||||||
datetime: datetimeToISO(state.endDate)
|
datetime: datetimeToISO(ISOToDate(state.endDate))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +111,7 @@ const store = createStore({
|
|||||||
state.startDate = date;
|
state.startDate = date;
|
||||||
},
|
},
|
||||||
setEndDate(state, date) {
|
setEndDate(state, date) {
|
||||||
|
console.log(date)
|
||||||
state.endDate = date;
|
state.endDate = date;
|
||||||
},
|
},
|
||||||
setPersonsPickedIds(state, ids) {
|
setPersonsPickedIds(state, ids) {
|
||||||
|
@ -439,18 +439,18 @@ export default {
|
|||||||
]),
|
]),
|
||||||
startDate: {
|
startDate: {
|
||||||
get() {
|
get() {
|
||||||
return dateToISO(this.$store.state.startDate);
|
return this.$store.state.startDate;
|
||||||
},
|
},
|
||||||
set(v) {
|
set(v) {
|
||||||
this.$store.commit('setStartDate', ISOToDate(v));
|
this.$store.commit('setStartDate', v);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
endDate: {
|
endDate: {
|
||||||
get() {
|
get() {
|
||||||
return dateToISO(this.$store.state.endDate);
|
return this.$store.state.endDate;
|
||||||
},
|
},
|
||||||
set(v) {
|
set(v) {
|
||||||
this.$store.commit('setEndDate', ISOToDate(v));
|
this.$store.commit('setEndDate', v);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
note: {
|
note: {
|
||||||
@ -521,12 +521,12 @@ export default {
|
|||||||
this.$store.commit('removeReferrer', u);
|
this.$store.commit('removeReferrer', u);
|
||||||
},
|
},
|
||||||
goToGenerateWorkflow({link}) {
|
goToGenerateWorkflow({link}) {
|
||||||
console.log('save before leave to generate workflow')
|
// console.log('save before leave to generate workflow')
|
||||||
const callback = (data) => {
|
const callback = (data) => {
|
||||||
window.location.assign(link);
|
window.location.assign(link);
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.$store.dispatch('submit', callback)
|
return this.$store.dispatch('submit', callback)
|
||||||
.catch(e => { console.log(e); throw e; });
|
.catch(e => { console.log(e); throw e; });
|
||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
|
@ -298,38 +298,39 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
'isPosting'
|
'isPosting'
|
||||||
]),
|
]),
|
||||||
getTemplatesAvailables() {
|
getTemplatesAvailables() {
|
||||||
return this.$store.getters.getTemplatesAvailablesForEvaluation(this.evaluation.evaluation);
|
return this.$store.getters.getTemplatesAvailablesForEvaluation(this.evaluation.evaluation);
|
||||||
},
|
},
|
||||||
canGenerate() {
|
canGenerate() {
|
||||||
return !this.$store.state.isPosting && this.template !== null;
|
return !this.$store.state.isPosting && this.template !== null;
|
||||||
},
|
},
|
||||||
startDate: {
|
startDate: {
|
||||||
get() {
|
get() {
|
||||||
return dateToISO(this.evaluation.startDate);
|
console.log('evaluation', this.evaluation);
|
||||||
},
|
return this.evaluation.startDate;
|
||||||
set(v) {
|
},
|
||||||
this.$store.commit('setEvaluationStartDate', { key: this.evaluation.key, date: ISOToDate(v) });
|
set(v) {
|
||||||
}
|
this.$store.commit('setEvaluationStartDate', { key: this.evaluation.key, date: v });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
endDate: {
|
endDate: {
|
||||||
get() {
|
get() {
|
||||||
return dateToISO(this.evaluation.endDate);
|
return this.evaluation.endDate;
|
||||||
},
|
},
|
||||||
set(v) {
|
set(v) {
|
||||||
this.$store.commit('setEvaluationEndDate', { key: this.evaluation.key, date: ISOToDate(v) });
|
this.$store.commit('setEvaluationEndDate', { key: this.evaluation.key, date: v });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
maxDate: {
|
maxDate: {
|
||||||
get() {
|
get() {
|
||||||
return dateToISO(this.evaluation.maxDate);
|
return this.evaluation.maxDate;
|
||||||
},
|
},
|
||||||
set(v) {
|
set(v) {
|
||||||
this.$store.commit('setEvaluationMaxDate', { key: this.evaluation.key, date: ISOToDate(v) });
|
this.$store.commit('setEvaluationMaxDate', { key: this.evaluation.key, date: v });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
warningInterval: {
|
warningInterval: {
|
||||||
get() { return this.evaluation.warningInterval; },
|
get() { return this.evaluation.warningInterval; },
|
||||||
@ -344,7 +345,7 @@ export default {
|
|||||||
ISOToDatetime,
|
ISOToDatetime,
|
||||||
canEditDocument(document) {
|
canEditDocument(document) {
|
||||||
return 'storedObject' in document ?
|
return 'storedObject' in document ?
|
||||||
this.mime.includes(document.storedObject.type) && document.storedObject.keyInfos.length === 0 : false;
|
this.mime.includes(document.storedObject.type) && document.storedObject.keyInfos.length === 0 : false;
|
||||||
},
|
},
|
||||||
listAllStatus() {
|
listAllStatus() {
|
||||||
console.log('load all status');
|
console.log('load all status');
|
||||||
@ -360,16 +361,16 @@ export default {
|
|||||||
},
|
},
|
||||||
buildEditLink(storedObject) {
|
buildEditLink(storedObject) {
|
||||||
return `/wopi/edit/${storedObject.uuid}?returnPath=` + encodeURIComponent(
|
return `/wopi/edit/${storedObject.uuid}?returnPath=` + encodeURIComponent(
|
||||||
window.location.pathname + window.location.search + window.location.hash);
|
window.location.pathname + window.location.search + window.location.hash);
|
||||||
},
|
},
|
||||||
submitBeforeGenerate({template}) {
|
submitBeforeGenerate({template}) {
|
||||||
const callback = (data) => {
|
const callback = (data) => {
|
||||||
let evaluationId = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key).id;
|
let evaluationId = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key).id;
|
||||||
|
|
||||||
window.location.assign(buildLink(template, evaluationId, 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation'));
|
window.location.assign(buildLink(template, evaluationId, 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation'));
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.$store.dispatch('submit', callback).catch(e => { console.log(e); throw e; });
|
return this.$store.dispatch('submit', callback).catch(e => { console.log(e); throw e; });
|
||||||
},
|
},
|
||||||
onInputDocumentTitle(event) {
|
onInputDocumentTitle(event) {
|
||||||
const id = Number(event.target.id);
|
const id = Number(event.target.id);
|
||||||
@ -395,20 +396,20 @@ export default {
|
|||||||
},
|
},
|
||||||
removeDocument(document) {
|
removeDocument(document) {
|
||||||
if (window.confirm("Êtes-vous sûr·e de vouloir supprimer le document qui a pour titre \"" + document.title +"\" ?")) {
|
if (window.confirm("Êtes-vous sûr·e de vouloir supprimer le document qui a pour titre \"" + document.title +"\" ?")) {
|
||||||
this.$store.commit('removeDocument', {key: this.evaluation.key, document: document});
|
this.$store.commit('removeDocument', {key: this.evaluation.key, document: document});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
goToGenerateWorkflowEvaluationDocument({event, link, workflowName, payload}) {
|
goToGenerateWorkflowEvaluationDocument({event, link, workflowName, payload}) {
|
||||||
const callback = (data) => {
|
const callback = (data) => {
|
||||||
let evaluation = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key);
|
let evaluation = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key);
|
||||||
let updatedDocument = evaluation.documents.find(d => d.key === payload.doc.key);
|
let updatedDocument = evaluation.documents.find(d => d.key === payload.doc.key);
|
||||||
window.location.assign(buildLinkCreate(workflowName,
|
window.location.assign(buildLinkCreate(workflowName,
|
||||||
'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument', updatedDocument.id));
|
'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument', updatedDocument.id));
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.$store.dispatch('submit', callback)
|
return this.$store.dispatch('submit', callback)
|
||||||
.catch(e => { console.log(e); throw e; });
|
.catch(e => { console.log(e); throw e; });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createStore } from 'vuex';
|
import { createStore } from 'vuex';
|
||||||
import { datetimeToISO, ISOToDatetime, intervalDaysToISO, intervalISOToDays } from 'ChillMainAssets/chill/js/date.js';
|
import { dateToISO, ISOToDate, datetimeToISO, ISOToDatetime, intervalDaysToISO, intervalISOToDays } from 'ChillMainAssets/chill/js/date.js';
|
||||||
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
|
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
|
||||||
import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
||||||
import { fetchResults, makeFetch } from 'ChillMainAssets/lib/api/apiMethods.js';
|
import { fetchResults, makeFetch } from 'ChillMainAssets/lib/api/apiMethods.js';
|
||||||
@ -13,9 +13,9 @@ const store = createStore({
|
|||||||
state: {
|
state: {
|
||||||
work: window.accompanyingCourseWork,
|
work: window.accompanyingCourseWork,
|
||||||
startDate: window.accompanyingCourseWork.startDate !== null ?
|
startDate: window.accompanyingCourseWork.startDate !== null ?
|
||||||
ISOToDatetime(window.accompanyingCourseWork.startDate.datetime) : null,
|
dateToISO(new Date(window.accompanyingCourseWork.startDate.datetime)) : null,
|
||||||
endDate: window.accompanyingCourseWork.endDate !== null ?
|
endDate: window.accompanyingCourseWork.endDate !== null ?
|
||||||
ISOToDatetime(window.accompanyingCourseWork.endDate.datetime) : null,
|
dateToISO(new Date(window.accompanyingCourseWork.endDate.datetime)) : null,
|
||||||
note: window.accompanyingCourseWork.note,
|
note: window.accompanyingCourseWork.note,
|
||||||
goalsPicked: window.accompanyingCourseWork.goals,
|
goalsPicked: window.accompanyingCourseWork.goals,
|
||||||
goalsForAction: [],
|
goalsForAction: [],
|
||||||
@ -69,14 +69,15 @@ const store = createStore({
|
|||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
buildPayload(state) {
|
buildPayload(state) {
|
||||||
|
console.log('end date', state.endDate);
|
||||||
return {
|
return {
|
||||||
type: 'accompanying_period_work',
|
type: 'accompanying_period_work',
|
||||||
id: state.work.id,
|
id: state.work.id,
|
||||||
startDate: state.startDate === null ? null : {
|
startDate: state.startDate === null || state.startDate === '' ? null : {
|
||||||
datetime: datetimeToISO(state.startDate)
|
datetime: datetimeToISO(ISOToDate(state.startDate))
|
||||||
},
|
},
|
||||||
endDate: state.endDate === null ? null : {
|
endDate: state.endDate === null || state.endDate === '' ? null : {
|
||||||
datetime: datetimeToISO(state.endDate)
|
datetime: datetimeToISO(ISOToDate(state.endDate))
|
||||||
},
|
},
|
||||||
note: state.note,
|
note: state.note,
|
||||||
persons: state.personsPicked.map(p => ({id: p.id, type: p.type})),
|
persons: state.personsPicked.map(p => ({id: p.id, type: p.type})),
|
||||||
@ -110,9 +111,9 @@ const store = createStore({
|
|||||||
id: e.evaluation.id,
|
id: e.evaluation.id,
|
||||||
type: e.evaluation.type
|
type: e.evaluation.type
|
||||||
},
|
},
|
||||||
startDate: e.startDate !== null ? { datetime: datetimeToISO(e.startDate) } : null,
|
startDate: e.startDate === null || e.startDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.startDate)) },
|
||||||
endDate: e.endDate !== null ? { datetime: datetimeToISO(e.endDate) } : null,
|
endDate: e.endDate === null || e.endDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.endDate)) },
|
||||||
maxDate: e.maxDate !== null ? { datetime: datetimeToISO(e.maxDate) } : null,
|
maxDate: e.maxDate === null || e.maxDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.maxDate)) },
|
||||||
warningInterval: intervalDaysToISO(e.warningInterval),
|
warningInterval: intervalDaysToISO(e.warningInterval),
|
||||||
comment: e.comment,
|
comment: e.comment,
|
||||||
documents: e.documents
|
documents: e.documents
|
||||||
@ -132,9 +133,9 @@ const store = createStore({
|
|||||||
var k = Object.assign(e, {
|
var k = Object.assign(e, {
|
||||||
key: index,
|
key: index,
|
||||||
editEvaluation: false,
|
editEvaluation: false,
|
||||||
startDate: e.startDate !== null ? ISOToDatetime(e.startDate.datetime) : null,
|
startDate: e.startDate !== null ? dateToISO(new Date(e.startDate.datetime)) : null,
|
||||||
endDate: e.endDate !== null ? ISOToDatetime(e.endDate.datetime) : null,
|
endDate: e.endDate !== null ? dateToISO(new Date(e.endDate.datetime)) : null,
|
||||||
maxDate: e.maxDate !== null ? ISOToDatetime(e.maxDate.datetime) : null,
|
maxDate: e.maxDate !== null ? dateToISO(new Date(e.maxDate.datetime)) : null,
|
||||||
warningInterval: e.warningInterval !== null ? intervalISOToDays(e.warningInterval) : null,
|
warningInterval: e.warningInterval !== null ? intervalISOToDays(e.warningInterval) : null,
|
||||||
documents: e.documents.map((d, docIndex) => {
|
documents: e.documents.map((d, docIndex) => {
|
||||||
return Object.assign(d, {
|
return Object.assign(d, {
|
||||||
@ -264,6 +265,7 @@ const store = createStore({
|
|||||||
.startDate = date;
|
.startDate = date;
|
||||||
},
|
},
|
||||||
setEvaluationEndDate(state, {key, date}) {
|
setEvaluationEndDate(state, {key, date}) {
|
||||||
|
console.log('commit date', date)
|
||||||
state.evaluationsPicked.find(e => e.key === key)
|
state.evaluationsPicked.find(e => e.key === key)
|
||||||
.endDate = date;
|
.endDate = date;
|
||||||
},
|
},
|
||||||
|
@ -66,18 +66,19 @@ export default {
|
|||||||
},
|
},
|
||||||
startDate: {
|
startDate: {
|
||||||
get() {
|
get() {
|
||||||
return [
|
return this.$store.state.startDate;
|
||||||
this.$store.state.startDate.getFullYear(),
|
// return [
|
||||||
(this.$store.state.startDate.getMonth() + 1).toString().padStart(2, '0'),
|
// this.$store.state.startDate.getFullYear(),
|
||||||
this.$store.state.startDate.getDate().toString().padStart(2, '0')
|
// (this.$store.state.startDate.getMonth() + 1).toString().padStart(2, '0'),
|
||||||
].join('-');
|
// this.$store.state.startDate.getDate().toString().padStart(2, '0')
|
||||||
|
// ].join('-');
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
let
|
// let
|
||||||
[year, month, day] = value.split('-'),
|
// [year, month, day] = value.split('-'),
|
||||||
dValue = new Date(year, month-1, day);
|
// dValue = new Date(year, month-1, day);
|
||||||
|
|
||||||
this.$store.dispatch('setStartDate', dValue);
|
this.$store.dispatch('setStartDate', value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import { createStore } from 'vuex';
|
|||||||
import { householdMove, fetchHouseholdSuggestionByAccompanyingPeriod, fetchAddressSuggestionByPerson} from './../api.js';
|
import { householdMove, fetchHouseholdSuggestionByAccompanyingPeriod, fetchAddressSuggestionByPerson} from './../api.js';
|
||||||
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js'
|
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js'
|
||||||
import { fetchHouseholdByAddressReference } from 'ChillPersonAssets/lib/household.js';
|
import { fetchHouseholdByAddressReference } from 'ChillPersonAssets/lib/household.js';
|
||||||
import { datetimeToISO } from 'ChillMainAssets/chill/js/date.js';
|
import { datetimeToISO, dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date.js';
|
||||||
|
|
||||||
const debug = process.env.NODE_ENV !== 'production';
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ const store = createStore({
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}),
|
}),
|
||||||
startDate: new Date(),
|
startDate: dateToISO(new Date()),
|
||||||
/**
|
/**
|
||||||
* Indicates if the destination is:
|
* Indicates if the destination is:
|
||||||
*
|
*
|
||||||
@ -278,7 +278,7 @@ const store = createStore({
|
|||||||
type: conc.person.type
|
type: conc.person.type
|
||||||
},
|
},
|
||||||
start_date: {
|
start_date: {
|
||||||
datetime: datetimeToISO(state.startDate)
|
datetime: state.startDate === null || state.startDate === '' ? null : datetimeToISO(ISOToDate(state.startDate))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ const store = createStore({
|
|||||||
},
|
},
|
||||||
number_of_children: state.numberOfChildren,
|
number_of_children: state.numberOfChildren,
|
||||||
start_date: {
|
start_date: {
|
||||||
datetime: datetimeToISO(state.startDate),
|
datetime: datetimeToISO(ISOToDate(state.startDate)),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
{{ form_errors(form) }}
|
{{ form_errors(form) }}
|
||||||
|
{{ form_errors(form.content) }}
|
||||||
{{ form_widget(form.content) }}
|
{{ form_widget(form.content) }}
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<h1>{{ 'My accompanying periods'|trans }}</h1>
|
<h1>{{ 'My accompanying periods'|trans }}</h1>
|
||||||
|
|
||||||
|
<p>{{ 'Number of periods'|trans }}: <span class="badge rounded-pill bg-primary">{{ pagination.totalItems }}</span></p>
|
||||||
|
|
||||||
<div class="flex-table accompanyingcourse-list">
|
<div class="flex-table accompanyingcourse-list">
|
||||||
{% for period in accompanyingPeriods %}
|
{% for period in accompanyingPeriods %}
|
||||||
{% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %}
|
{% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %}
|
||||||
|
@ -14,6 +14,8 @@ namespace AccompanyingPeriod\Events;
|
|||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
use Chill\MainBundle\Entity\Notification;
|
use Chill\MainBundle\Entity\Notification;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Chill\MainBundle\Notification\NotificationPersister;
|
||||||
|
use Chill\MainBundle\Notification\NotificationPersisterInterface;
|
||||||
use Chill\PersonBundle\AccompanyingPeriod\Events\PersonAddressMoveEventSubscriber;
|
use Chill\PersonBundle\AccompanyingPeriod\Events\PersonAddressMoveEventSubscriber;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Household\Household;
|
use Chill\PersonBundle\Entity\Household\Household;
|
||||||
@ -22,7 +24,6 @@ use Chill\PersonBundle\Entity\Person;
|
|||||||
use Chill\PersonBundle\Event\Person\PersonAddressMoveEvent;
|
use Chill\PersonBundle\Event\Person\PersonAddressMoveEvent;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
@ -73,9 +74,9 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
|||||||
->setPreviousMembership($previousMembership)
|
->setPreviousMembership($previousMembership)
|
||||||
->setNextMembership($nextMembership);
|
->setNextMembership($nextMembership);
|
||||||
|
|
||||||
$em = $this->prophesize(EntityManagerInterface::class);
|
$notificationPersister = $this->prophesize(NotificationPersisterInterface::class);
|
||||||
$em->persist(Argument::type(Notification::class))->shouldNotBeCalled();
|
$notificationPersister->persist(Argument::type(Notification::class))->shouldNotBeCalled();
|
||||||
$eventSubscriber = $this->buildSubscriber(null, $em->reveal(), null, null);
|
$eventSubscriber = $this->buildSubscriber(null, $notificationPersister->reveal(), null, null);
|
||||||
|
|
||||||
$eventSubscriber->resetPeriodLocation($event);
|
$eventSubscriber->resetPeriodLocation($event);
|
||||||
}
|
}
|
||||||
@ -115,9 +116,9 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
|||||||
->setPreviousMembership($previousMembership)
|
->setPreviousMembership($previousMembership)
|
||||||
->setNextMembership($nextMembership);
|
->setNextMembership($nextMembership);
|
||||||
|
|
||||||
$em = $this->prophesize(EntityManagerInterface::class);
|
$notificationPersister = $this->prophesize(NotificationPersisterInterface::class);
|
||||||
$em->persist(Argument::type(Notification::class))->shouldBeCalledTimes(1);
|
$notificationPersister->persist(Argument::type(Notification::class))->shouldBeCalledTimes(1);
|
||||||
$eventSubscriber = $this->buildSubscriber(null, $em->reveal(), null, null);
|
$eventSubscriber = $this->buildSubscriber(null, $notificationPersister->reveal(), null, null);
|
||||||
|
|
||||||
$eventSubscriber->resetPeriodLocation($event);
|
$eventSubscriber->resetPeriodLocation($event);
|
||||||
|
|
||||||
@ -160,9 +161,9 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
|||||||
->setPreviousMembership($previousMembership)
|
->setPreviousMembership($previousMembership)
|
||||||
->setNextMembership($nextMembership);
|
->setNextMembership($nextMembership);
|
||||||
|
|
||||||
$em = $this->prophesize(EntityManagerInterface::class);
|
$notificationPersister = $this->prophesize(NotificationPersisterInterface::class);
|
||||||
$em->persist(Argument::type(Notification::class))->shouldBeCalled(1);
|
$notificationPersister->persist(Argument::type(Notification::class))->shouldBeCalled(1);
|
||||||
$eventSubscriber = $this->buildSubscriber(null, $em->reveal(), null, null);
|
$eventSubscriber = $this->buildSubscriber(null, $notificationPersister->reveal(), null, null);
|
||||||
|
|
||||||
$eventSubscriber->resetPeriodLocation($event);
|
$eventSubscriber->resetPeriodLocation($event);
|
||||||
|
|
||||||
@ -195,9 +196,9 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
|||||||
$event
|
$event
|
||||||
->setPreviousMembership($previousMembership);
|
->setPreviousMembership($previousMembership);
|
||||||
|
|
||||||
$em = $this->prophesize(EntityManagerInterface::class);
|
$notificationPersister = $this->prophesize(NotificationPersisterInterface::class);
|
||||||
$em->persist(Argument::type(Notification::class))->shouldBeCalledTimes(1);
|
$notificationPersister->persist(Argument::type(Notification::class))->shouldBeCalledTimes(1);
|
||||||
$eventSubscriber = $this->buildSubscriber(null, $em->reveal(), null, null);
|
$eventSubscriber = $this->buildSubscriber(null, $notificationPersister->reveal(), null, null);
|
||||||
|
|
||||||
$eventSubscriber->resetPeriodLocation($event);
|
$eventSubscriber->resetPeriodLocation($event);
|
||||||
|
|
||||||
@ -235,9 +236,9 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
|||||||
->setPreviousAddress($household->getPreviousAddressOf($newAddress))
|
->setPreviousAddress($household->getPreviousAddressOf($newAddress))
|
||||||
->setNextAddress($newAddress);
|
->setNextAddress($newAddress);
|
||||||
|
|
||||||
$em = $this->prophesize(EntityManagerInterface::class);
|
$notificationPersister = $this->prophesize(NotificationPersisterInterface::class);
|
||||||
$em->persist(Argument::type(Notification::class))->shouldBeCalledTimes(1);
|
$notificationPersister->persist(Argument::type(Notification::class))->shouldBeCalledTimes(1);
|
||||||
$eventSubscriber = $this->buildSubscriber(null, $em->reveal(), null, null);
|
$eventSubscriber = $this->buildSubscriber(null, $notificationPersister->reveal(), null, null);
|
||||||
|
|
||||||
$eventSubscriber->resetPeriodLocation($event);
|
$eventSubscriber->resetPeriodLocation($event);
|
||||||
|
|
||||||
@ -247,7 +248,7 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
|||||||
|
|
||||||
private function buildSubscriber(
|
private function buildSubscriber(
|
||||||
?EngineInterface $engine = null,
|
?EngineInterface $engine = null,
|
||||||
?EntityManagerInterface $entityManager = null,
|
?NotificationPersisterInterface $notificationPersister = null,
|
||||||
?Security $security = null,
|
?Security $security = null,
|
||||||
?TranslatorInterface $translator = null
|
?TranslatorInterface $translator = null
|
||||||
): PersonAddressMoveEventSubscriber {
|
): PersonAddressMoveEventSubscriber {
|
||||||
@ -267,14 +268,13 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
|
|||||||
$engine = $double->reveal();
|
$engine = $double->reveal();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $entityManager) {
|
if (null === $notificationPersister) {
|
||||||
$double = $this->prophesize(EntityManagerInterface::class);
|
$notificationPersister = new NotificationPersister();
|
||||||
$entityManager = $double->reveal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PersonAddressMoveEventSubscriber(
|
return new PersonAddressMoveEventSubscriber(
|
||||||
$engine,
|
$engine,
|
||||||
$entityManager,
|
$notificationPersister,
|
||||||
$security,
|
$security,
|
||||||
$translator
|
$translator
|
||||||
);
|
);
|
||||||
|
@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Tests\Entity;
|
|||||||
|
|
||||||
use ArrayIterator;
|
use ArrayIterator;
|
||||||
use Chill\MainBundle\Entity\Address;
|
use Chill\MainBundle\Entity\Address;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||||
@ -62,6 +63,29 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
|||||||
$this->assertFalse($period->isClosingAfterOpening());
|
$this->assertFalse($period->isClosingAfterOpening());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testHasChangedUser()
|
||||||
|
{
|
||||||
|
$period = new AccompanyingPeriod();
|
||||||
|
|
||||||
|
$this->assertFalse($period->isChangedUser());
|
||||||
|
$this->assertFalse($period->hasPreviousUser());
|
||||||
|
|
||||||
|
$period->setUser($user1 = new User());
|
||||||
|
|
||||||
|
$this->assertTrue($period->isChangedUser());
|
||||||
|
$this->assertFalse($period->hasPreviousUser());
|
||||||
|
|
||||||
|
$period->resetPreviousUser();
|
||||||
|
$this->assertFalse($period->isChangedUser());
|
||||||
|
$this->assertFalse($period->hasPreviousUser());
|
||||||
|
|
||||||
|
$period->setUser($user2 = new User());
|
||||||
|
|
||||||
|
$this->assertTrue($period->isChangedUser());
|
||||||
|
$this->assertTrue($period->hasPreviousUser());
|
||||||
|
$this->assertSame($user1, $period->getPreviousUser());
|
||||||
|
}
|
||||||
|
|
||||||
public function testHistoryLocation()
|
public function testHistoryLocation()
|
||||||
{
|
{
|
||||||
$period = new AccompanyingPeriod();
|
$period = new AccompanyingPeriod();
|
||||||
|
@ -581,6 +581,7 @@ Linked evaluations: Évaluations associées
|
|||||||
# Accompanying period per user
|
# Accompanying period per user
|
||||||
My accompanying periods: Mes parcours
|
My accompanying periods: Mes parcours
|
||||||
My accompanying periods in draft: Mes parcours brouillons
|
My accompanying periods in draft: Mes parcours brouillons
|
||||||
|
Number of periods: Nombre de parcours
|
||||||
|
|
||||||
workflow:
|
workflow:
|
||||||
Doc for evaluation (n°%eval%): Document de l'évaluation n°%eval%
|
Doc for evaluation (n°%eval%): Document de l'évaluation n°%eval%
|
||||||
|
Loading…
x
Reference in New Issue
Block a user