mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'signature-app-master' into 'master'
Fixes for signature See merge request Chill-Projet/chill-bundles!755
This commit is contained in:
commit
f90fae4e14
@ -59,9 +59,7 @@ class NotificationToUserGroupsOnTransitionTest extends KernelTestCase
|
||||
public function testOnCompletedSendNotificationToUserGroupWithEmailAddress(): void
|
||||
{
|
||||
$entityWorkflow = new EntityWorkflow();
|
||||
$reflection = new \ReflectionClass($entityWorkflow);
|
||||
$idProperty = $reflection->getProperty('id');
|
||||
$idProperty->setValue($entityWorkflow, 1);
|
||||
$this->em->persist($entityWorkflow);
|
||||
|
||||
$entityWorkflow->setWorkflowName('dummy');
|
||||
$dto = new WorkflowTransitionContextDTO($entityWorkflow);
|
||||
@ -69,11 +67,7 @@ class NotificationToUserGroupsOnTransitionTest extends KernelTestCase
|
||||
$ug->setEmail('test@email.com')->setLabel(['fr' => 'test group']);
|
||||
|
||||
$mailer = $this->prophesize(MailerInterface::class);
|
||||
$sendMethod = $mailer->send(Argument::that(function (RawMessage $message) use ($entityWorkflow): bool {
|
||||
// we need to set an id to the current step of the entity workflow
|
||||
$this->em->persist($entityWorkflow);
|
||||
$this->em->persist($entityWorkflow->getCurrentStep());
|
||||
|
||||
$sendMethod = $mailer->send(Argument::that(function (RawMessage $message): bool {
|
||||
if (!$message instanceof TemplatedEmail) {
|
||||
return false;
|
||||
}
|
||||
@ -140,7 +134,7 @@ class NotificationToUserGroupsOnTransitionTest extends KernelTestCase
|
||||
}
|
||||
});
|
||||
|
||||
$notificationEventSubscriber = new NotificationToUserGroupsOnTransition($this->twig, $metadataExtractor, $registry, $mailer);
|
||||
$notificationEventSubscriber = new NotificationToUserGroupsOnTransition($this->twig, $metadataExtractor, $registry, $mailer, $this->em);
|
||||
$eventDispatcher->addSubscriber($notificationEventSubscriber);
|
||||
|
||||
return $registry;
|
||||
|
@ -14,6 +14,7 @@ namespace Chill\MainBundle\Workflow\EventSubscriber;
|
||||
use Chill\MainBundle\Entity\Notification;
|
||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
||||
use Chill\MainBundle\Workflow\Helper\MetadataExtractor;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Mailer\MailerInterface;
|
||||
@ -27,6 +28,7 @@ final readonly class NotificationToUserGroupsOnTransition implements EventSubscr
|
||||
private MetadataExtractor $metadataExtractor,
|
||||
private Registry $registry,
|
||||
private MailerInterface $mailer,
|
||||
private EntityManagerInterface $entityManager,
|
||||
) {}
|
||||
|
||||
public static function getSubscribedEvents(): array
|
||||
@ -61,6 +63,12 @@ final readonly class NotificationToUserGroupsOnTransition implements EventSubscr
|
||||
$this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName())
|
||||
);
|
||||
|
||||
$currentStep = $entityWorkflow->getCurrentStep();
|
||||
if (!$this->entityManager->contains($currentStep)) {
|
||||
// this is necessary to generate an id for the step
|
||||
$this->entityManager->persist($currentStep);
|
||||
}
|
||||
|
||||
// send to groups
|
||||
foreach ($entityWorkflow->getCurrentStep()->getDestUserGroups() as $userGroup) {
|
||||
if (!$userGroup->hasEmail()) {
|
||||
|
@ -296,7 +296,6 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
/**
|
||||
* The date of the last marital status change of the person.
|
||||
*/
|
||||
#[Assert\Date]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
|
||||
private ?\DateTime $maritalStatusDate = null;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user