Merge remote-tracking branch 'origin/master' into 709-notification-eval-action

This commit is contained in:
2023-06-13 23:05:51 +02:00
60 changed files with 1859 additions and 170 deletions

View File

@@ -36,5 +36,4 @@ class SynchronizeEntityInfoViewsCommand extends Command
return 0;
}
}

View File

@@ -163,7 +163,6 @@ final class PermissionsGroupController extends AbstractController
*/
public function deleteLinkRoleScopeAction(int $pgid, int $rsid): Response
{
$permissionsGroup = $this->permissionsGroupRepository->find($pgid);
$roleScope = $this->roleScopeRepository->find($rsid);

View File

@@ -141,5 +141,4 @@ final readonly class UserExportController
]
);
}
}

View File

@@ -48,12 +48,19 @@ class Center implements HasCenterInterface
*/
private string $name = '';
/**
* @var Collection<Regroupment>
* @ORM\ManyToMany(targetEntity=Regroupment::class, mappedBy="centers")
*/
private Collection $regroupments;
/**
* Center constructor.
*/
public function __construct()
{
$this->groupCenters = new \Doctrine\Common\Collections\ArrayCollection();
$this->groupCenters = new ArrayCollection();
$this->regroupments = new ArrayCollection();
}
/**
@@ -106,6 +113,14 @@ class Center implements HasCenterInterface
return $this->name;
}
/**
* @return Collection<Regroupment>
*/
public function getRegroupments(): Collection
{
return $this->regroupments;
}
/**
* @param $name
*

View File

@@ -22,11 +22,12 @@ use Doctrine\ORM\Mapping as ORM;
class Regroupment
{
/**
* @var Center
* @ORM\ManyToMany(
* targetEntity=Center::class
* targetEntity=Center::class,
* inversedBy="regroupments"
* )
* @ORM\Id
* @var Collection<Center>
*/
private Collection $centers;
@@ -52,6 +53,26 @@ class Regroupment
$this->centers = new ArrayCollection();
}
public function addCenter(Center $center): self
{
if (!$this->centers->contains($center)) {
$this->centers->add($center);
$center->getRegroupments()->add($this);
}
return $this;
}
public function removeCenter(Center $center): self
{
if ($this->centers->contains($center)) {
$this->centers->removeElement($center);
$center->getRegroupments()->removeElement($this);
}
return $this;
}
public function getCenters(): Collection
{
return $this->centers;

View File

@@ -31,7 +31,7 @@ class RegroupmentType extends AbstractType
->add('centers', EntityType::class, [
'class' => Center::class,
'multiple' => true,
'attr' => ['class' => 'select2'],
'expanded' => true,
])
->add('isActive', CheckboxType::class, [
'label' => 'Actif ?',

View File

@@ -14,6 +14,8 @@ namespace Chill\MainBundle\Repository;
use Chill\MainBundle\Entity\Regroupment;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;
use Doctrine\Persistence\ObjectRepository;
final class RegroupmentRepository implements ObjectRepository
@@ -59,6 +61,30 @@ final class RegroupmentRepository implements ObjectRepository
return $this->repository->findOneBy($criteria, $orderBy);
}
/**
* @throws NonUniqueResultException
* @throws NoResultException
*/
public function findOneByName(string $name): ?Regroupment
{
return $this->repository->createQueryBuilder('r')
->where('LOWER(r.name) = LOWER(:searched)')
->setParameter('searched', $name)
->getQuery()
->getSingleResult();
}
/**
* @return array<Regroupment>
*/
public function findRegroupmentAssociatedToNoCenter(): array
{
return $this->repository->createQueryBuilder('r')
->where('SIZE(r.centers) = 0')
->getQuery()
->getResult();
}
public function getClassName()
{
return Regroupment::class;

View File

@@ -39,8 +39,13 @@
{{ 'This will eventually restrict your possibilities in filtering the data.'|trans }}</p>
<h3 class="m-3">{{ 'Center'|trans }}</h3>
{{ form_widget(form.centers.center) }}
<div class="mb-3 mt-3">
<input id="toggle-check-all" class="btn btn-misc" type= "button" onclick='uncheckAll(this)' value="{{ 'uncheck all centers'|trans|e('html_attr') }}"/>
</div>
{% if form.centers.regroupment is defined %}
<h3 class="m-3">{{ 'Pick aggregated centers'|trans }}</h3>
{{ form_widget(form.centers.regroupment) }}
@@ -53,3 +58,15 @@
</div>
{% endblock content %}
{% block js %}
<script>
const uncheckAll = () => {
const allCenters = document.getElementsByName('centers[center][]');
allCenters.forEach(checkbox => checkbox.checked = false)
}
</script>
{% endblock js %}

View File

@@ -285,6 +285,8 @@ The export will contains only data from the picked centers.: L'export ne contien
This will eventually restrict your possibilities in filtering the data.: Les possibilités de filtrages seront adaptées aux droits de consultation pour les centres choisis.
Go to export options: Vers la préparation de l'export
Pick aggregated centers: Regroupement de centres
uncheck all centers: Désélectionner tous les centres
check all centers: Sélectionner tous les centres
# export creation step 'export' : choose aggregators, filtering and formatter
Formatter: Mise en forme
Choose the formatter: Choisissez le format d'export voulu.