mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
csfixes
This commit is contained in:
parent
0854b7fc6a
commit
a986b4ae98
@ -271,7 +271,7 @@ class ActivityType
|
||||
public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
if ($this->socialIssuesVisible !== $this->socialActionsVisible) {
|
||||
if (!($this->socialIssuesVisible === 2 && $this->socialActionsVisible === 1)) {
|
||||
if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) {
|
||||
$context
|
||||
->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value')
|
||||
->atPath('socialActionsVisible')
|
||||
|
@ -76,32 +76,32 @@ class WorkflowStepType extends AbstractType
|
||||
'expanded' => true,
|
||||
'choices' => $choices,
|
||||
'choice_label' => function (Transition $transition) use ($workflow) {
|
||||
$meta = $workflow->getMetadataStore()->getTransitionMetadata($transition);
|
||||
$meta = $workflow->getMetadataStore()->getTransitionMetadata($transition);
|
||||
|
||||
if (array_key_exists('label', $meta)) {
|
||||
return $this->translatableStringHelper->localize($meta['label']);
|
||||
}
|
||||
if (array_key_exists('label', $meta)) {
|
||||
return $this->translatableStringHelper->localize($meta['label']);
|
||||
}
|
||||
|
||||
return $transition->getName();
|
||||
},
|
||||
return $transition->getName();
|
||||
},
|
||||
'choice_attr' => static function (Transition $transition) use ($workflow) {
|
||||
$toFinal = true;
|
||||
$toFinal = true;
|
||||
|
||||
foreach ($transition->getTos() as $to) {
|
||||
$meta = $workflow->getMetadataStore()->getPlaceMetadata($to);
|
||||
foreach ($transition->getTos() as $to) {
|
||||
$meta = $workflow->getMetadataStore()->getPlaceMetadata($to);
|
||||
|
||||
if (
|
||||
if (
|
||||
!array_key_exists('isFinal', $meta) || false === $meta['isFinal']
|
||||
) {
|
||||
$toFinal = false;
|
||||
}
|
||||
$toFinal = false;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'data-is-transition' => 'data-is-transition',
|
||||
'data-to-final' => $toFinal ? '1' : '0',
|
||||
];
|
||||
},
|
||||
return [
|
||||
'data-is-transition' => 'data-is-transition',
|
||||
'data-to-final' => $toFinal ? '1' : '0',
|
||||
];
|
||||
},
|
||||
])
|
||||
->add('future_dest_users', PickUserDynamicType::class, [
|
||||
'label' => 'workflow.dest for next steps',
|
||||
|
@ -44,6 +44,8 @@ class HouseholdCompositionController extends AbstractController
|
||||
|
||||
private HouseholdCompositionRepository $householdCompositionRepository;
|
||||
|
||||
private HouseholdRepository $householdRepository;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
private Security $security;
|
||||
@ -52,8 +54,6 @@ class HouseholdCompositionController extends AbstractController
|
||||
|
||||
private UrlGeneratorInterface $urlGenerator;
|
||||
|
||||
private HouseholdRepository $householdRepository;
|
||||
|
||||
public function __construct(
|
||||
Security $security,
|
||||
HouseholdCompositionRepository $householdCompositionRepository,
|
||||
@ -76,6 +76,58 @@ class HouseholdCompositionController extends AbstractController
|
||||
$this->householdRepository = $householdRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete")
|
||||
*
|
||||
* @param mixed $household_id
|
||||
* @param mixed $composition_id
|
||||
*/
|
||||
public function deleteAction(Request $request, $household_id, $composition_id): Response
|
||||
{
|
||||
$composition = $this->householdCompositionRepository->find($composition_id);
|
||||
$household = $this->householdRepository->find($household_id);
|
||||
|
||||
$this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household);
|
||||
|
||||
if (null === $composition) {
|
||||
throw $this->createNotFoundException('Unable to find composition entity.');
|
||||
}
|
||||
|
||||
$form = $this->createFormBuilder()
|
||||
->setAction($this->generateUrl('chill_person_household_composition_delete', [
|
||||
'composition_id' => $composition_id,
|
||||
'household_id' => $household_id,
|
||||
]))
|
||||
->setMethod('DELETE')
|
||||
->add('submit', SubmitType::class, ['label' => 'Delete'])
|
||||
->getForm();
|
||||
|
||||
if ($request->getMethod() === Request::METHOD_DELETE) {
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
$this->entityManager->remove($composition);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', $this->translator
|
||||
->trans('The composition has been successfully removed.'));
|
||||
|
||||
return $this->redirectToRoute('chill_person_household_composition_index', [
|
||||
'id' => $household_id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'ChillPersonBundle:HouseholdComposition:delete.html.twig',
|
||||
[
|
||||
'household' => $household,
|
||||
'composition' => $composition,
|
||||
'form' => $form->createView(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/person/household/{id}/composition/index", name="chill_person_household_composition_index")
|
||||
*/
|
||||
@ -153,53 +205,4 @@ class HouseholdCompositionController extends AbstractController
|
||||
]
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete")
|
||||
*/
|
||||
public function deleteAction(Request $request, $household_id, $composition_id): Response
|
||||
{
|
||||
$composition = $this->householdCompositionRepository->find($composition_id);
|
||||
$household = $this->householdRepository->find($household_id);
|
||||
|
||||
$this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household);
|
||||
|
||||
if (null === $composition) {
|
||||
throw $this->createNotFoundException('Unable to find composition entity.');
|
||||
}
|
||||
|
||||
$form = $this->createFormBuilder()
|
||||
->setAction($this->generateUrl('chill_person_household_composition_delete', [
|
||||
'composition_id' => $composition_id,
|
||||
'household_id' => $household_id,
|
||||
]))
|
||||
->setMethod('DELETE')
|
||||
->add('submit', SubmitType::class, ['label' => 'Delete'])
|
||||
->getForm();
|
||||
|
||||
if ($request->getMethod() === Request::METHOD_DELETE) {
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
$this->entityManager->remove($composition);
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', $this->translator
|
||||
->trans('The composition has been successfully removed.'));
|
||||
|
||||
return $this->redirectToRoute('chill_person_household_composition_index', [
|
||||
'id' => $household_id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'ChillPersonBundle:HouseholdComposition:delete.html.twig',
|
||||
[
|
||||
'household' => $household,
|
||||
'composition' => $composition,
|
||||
'form' => $form->createView(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ class AccompanyingPeriod implements
|
||||
*
|
||||
* @ORM\Column(type="date")
|
||||
* @Groups({"read", "write", "docgen:read"})
|
||||
* @Assert\LessThan(value= "today", groups={AccompanyingPeriod::STEP_CONFIRMED})
|
||||
* @Assert\LessThan(value="today", groups={AccompanyingPeriod::STEP_CONFIRMED})
|
||||
* @Assert\LessThan(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED})
|
||||
*/
|
||||
private ?DateTime $openingDate = null;
|
||||
|
@ -28,6 +28,11 @@ final class AccompanyingPeriodRepository implements ObjectRepository
|
||||
$this->repository = $entityManager->getRepository(AccompanyingPeriod::class);
|
||||
}
|
||||
|
||||
public function countBy(array $criteria): int
|
||||
{
|
||||
return $this->repository->count($criteria);
|
||||
}
|
||||
|
||||
public function countByRecentUserHistory(User $user, DateTimeImmutable $since): int
|
||||
{
|
||||
$qb = $this->buildQueryByRecentUserHistory($user, $since);
|
||||
@ -35,11 +40,6 @@ final class AccompanyingPeriodRepository implements ObjectRepository
|
||||
return $qb->select('count(a)')->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function countBy(array $criteria): int
|
||||
{
|
||||
return $this->repository->count($criteria);
|
||||
}
|
||||
|
||||
public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder
|
||||
{
|
||||
return $this->repository->createQueryBuilder($alias, $indexBy);
|
||||
|
Loading…
x
Reference in New Issue
Block a user