mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 22:04:23 +00:00
Merge branch 'deselect-checkbox-exports' into 'master'
Add button to deselect all centers in export See merge request Chill-Projet/chill-bundles!544
This commit is contained in:
commit
977299192f
@ -36,5 +36,4 @@ class SynchronizeEntityInfoViewsCommand extends Command
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,6 @@ final class PermissionsGroupController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function deleteLinkRoleScopeAction(int $pgid, int $rsid): Response
|
public function deleteLinkRoleScopeAction(int $pgid, int $rsid): Response
|
||||||
{
|
{
|
||||||
|
|
||||||
$permissionsGroup = $this->permissionsGroupRepository->find($pgid);
|
$permissionsGroup = $this->permissionsGroupRepository->find($pgid);
|
||||||
$roleScope = $this->roleScopeRepository->find($rsid);
|
$roleScope = $this->roleScopeRepository->find($rsid);
|
||||||
|
|
||||||
|
@ -141,5 +141,4 @@ final readonly class UserExportController
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,13 @@
|
|||||||
{{ 'This will eventually restrict your possibilities in filtering the data.'|trans }}</p>
|
{{ 'This will eventually restrict your possibilities in filtering the data.'|trans }}</p>
|
||||||
|
|
||||||
<h3 class="m-3">{{ 'Center'|trans }}</h3>
|
<h3 class="m-3">{{ 'Center'|trans }}</h3>
|
||||||
|
|
||||||
{{ form_widget(form.centers.center) }}
|
{{ 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 %}
|
{% if form.centers.regroupment is defined %}
|
||||||
<h3 class="m-3">{{ 'Pick aggregated centers'|trans }}</h3>
|
<h3 class="m-3">{{ 'Pick aggregated centers'|trans }}</h3>
|
||||||
{{ form_widget(form.centers.regroupment) }}
|
{{ form_widget(form.centers.regroupment) }}
|
||||||
@ -53,3 +58,15 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const uncheckAll = () => {
|
||||||
|
const allCenters = document.getElementsByName('centers[center][]');
|
||||||
|
|
||||||
|
allCenters.forEach(checkbox => checkbox.checked = false)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{% endblock js %}
|
||||||
|
@ -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.
|
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
|
Go to export options: Vers la préparation de l'export
|
||||||
Pick aggregated centers: Regroupement de centres
|
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
|
# export creation step 'export' : choose aggregators, filtering and formatter
|
||||||
Formatter: Mise en forme
|
Formatter: Mise en forme
|
||||||
Choose the formatter: Choisissez le format d'export voulu.
|
Choose the formatter: Choisissez le format d'export voulu.
|
||||||
|
@ -34,5 +34,4 @@ class AccompanyingPeriodStepChangeMessageHandler implements MessageHandlerInterf
|
|||||||
|
|
||||||
($this->changer)($period, $message->getTransition());
|
($this->changer)($period, $message->getTransition());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,5 +84,4 @@ class AccompanyingPeriodStepChangeRequestor
|
|||||||
$this->messageBus->dispatch(new AccompanyingPeriodStepChangeRequestMessage($accompanyingPeriodId, 'mark_active'));
|
$this->messageBus->dispatch(new AccompanyingPeriodStepChangeRequestMessage($accompanyingPeriodId, 'mark_active'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,11 @@ namespace Chill\PersonBundle\Actions\Remove;
|
|||||||
|
|
||||||
use Chill\PersonBundle\Actions\ActionEvent;
|
use Chill\PersonBundle\Actions\ActionEvent;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||||
|
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||||
|
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\PersonBundle\Entity\Relationships\Relationship;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
@ -42,7 +46,7 @@ class PersonMove
|
|||||||
protected $eventDispatcher;
|
protected $eventDispatcher;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManagerInterface $em,
|
EntityManagerInterface $em,
|
||||||
EventDispatcherInterface $eventDispatcher
|
EventDispatcherInterface $eventDispatcher
|
||||||
) {
|
) {
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
@ -84,8 +88,11 @@ class PersonMove
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($metadata->getAssociationMappings() as $field => $mapping) {
|
foreach ($metadata->getAssociationMappings() as $field => $mapping) {
|
||||||
if (Person::class === $mapping['targetEntity']) {
|
if (in_array($mapping['sourceEntity'], $this->getIgnoredEntities(), true)) {
|
||||||
if (in_array($metadata->getName(), $toDelete, true)) {
|
continue;
|
||||||
|
}
|
||||||
|
if (Person::class === $mapping['targetEntity'] and true === $mapping['isOwningSide']) {
|
||||||
|
if (in_array($mapping['sourceEntity'], $toDelete, true)) {
|
||||||
$sql = $this->createDeleteSQL($metadata, $from, $field);
|
$sql = $this->createDeleteSQL($metadata, $from, $field);
|
||||||
$event = new ActionEvent(
|
$event = new ActionEvent(
|
||||||
$from->getId(),
|
$from->getId(),
|
||||||
@ -120,7 +127,7 @@ class PersonMove
|
|||||||
return $sqls;
|
return $sqls;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createDeleteSQL(ClassMetadata $metadata, Person $from, $field): string
|
private function createDeleteSQL(ClassMetadata $metadata, Person $from, $field): string
|
||||||
{
|
{
|
||||||
$mapping = $metadata->getAssociationMapping($field);
|
$mapping = $metadata->getAssociationMapping($field);
|
||||||
|
|
||||||
@ -137,26 +144,41 @@ class PersonMove
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createMoveSQL(ClassMetadata $metadata, Person $from, Person $to, $field): string
|
private function createMoveSQL(ClassMetadata $metadata, Person $from, Person $to, $field): string
|
||||||
{
|
{
|
||||||
$mapping = $metadata->getAssociationMapping($field);
|
$mapping = $metadata->getAssociationMapping($field);
|
||||||
|
|
||||||
// Set part of the query, aka <here> in "UPDATE table SET <here> "
|
// Set part of the query, aka <here> in "UPDATE table SET <here> "
|
||||||
$sets = [];
|
$sets = [];
|
||||||
|
|
||||||
foreach ($mapping['joinColumns'] as $columns) {
|
|
||||||
$sets[] = sprintf('%s = %d', $columns['name'], $to->getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
$conditions = [];
|
$conditions = [];
|
||||||
|
$tableName = '';
|
||||||
|
|
||||||
foreach ($mapping['joinColumns'] as $columns) {
|
if (array_key_exists('joinTable', $mapping)) {
|
||||||
$conditions[] = sprintf('%s = %d', $columns['name'], $from->getId());
|
$tableName = (null !== ($mapping['joinTable']['schema'] ?? null) ? $mapping['joinTable']['schema'] . '.' : '')
|
||||||
|
. $mapping['joinTable']['name'];
|
||||||
|
|
||||||
|
foreach ($mapping['joinTable']['inverseJoinColumns'] as $columns) {
|
||||||
|
$sets[] = sprintf('%s = %d', $columns['name'], $to->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($mapping['joinTable']['inverseJoinColumns'] as $columns) {
|
||||||
|
$conditions[] = sprintf('%s = %d', $columns['name'], $from->getId());
|
||||||
|
}
|
||||||
|
} elseif (array_key_exists('joinColumns', $mapping)) {
|
||||||
|
$tableName = $this->getTableName($metadata);
|
||||||
|
foreach ($mapping['joinColumns'] as $columns) {
|
||||||
|
$sets[] = sprintf('%s = %d', $columns['name'], $to->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($mapping['joinColumns'] as $columns) {
|
||||||
|
$conditions[] = sprintf('%s = %d', $columns['name'], $from->getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'UPDATE %s SET %s WHERE %s',
|
'UPDATE %s SET %s WHERE %s',
|
||||||
$this->getTableName($metadata),
|
$tableName,
|
||||||
implode(' ', $sets),
|
implode(' ', $sets),
|
||||||
implode(' AND ', $conditions)
|
implode(' AND ', $conditions)
|
||||||
);
|
);
|
||||||
@ -166,10 +188,23 @@ class PersonMove
|
|||||||
* return an array of classes where entities should be deleted
|
* return an array of classes where entities should be deleted
|
||||||
* instead of moved.
|
* instead of moved.
|
||||||
*/
|
*/
|
||||||
protected function getDeleteEntities(): array
|
private function getDeleteEntities(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
AccompanyingPeriod::class,
|
Person\PersonCenterHistory::class,
|
||||||
|
HouseholdMember::class,
|
||||||
|
AccompanyingPeriodParticipation::class,
|
||||||
|
AccompanyingPeriod\AccompanyingPeriodWork::class,
|
||||||
|
Relationship::class
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getIgnoredEntities(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Person\PersonCurrentAddress::class,
|
||||||
|
PersonHouseholdAddress::class,
|
||||||
|
Person\PersonCenterCurrent::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ class PersonDuplicateController extends Controller
|
|||||||
);
|
);
|
||||||
|
|
||||||
$duplicatePersons = $this->similarPersonMatcher->
|
$duplicatePersons = $this->similarPersonMatcher->
|
||||||
matchPerson($person, $personNotDuplicateRepository, 0.5, SimilarPersonMatcher::SIMILAR_SEARCH_ORDER_BY_ALPHABETICAL);
|
matchPerson($person, 0.5, SimilarPersonMatcher::SIMILAR_SEARCH_ORDER_BY_ALPHABETICAL, false);
|
||||||
|
|
||||||
$notDuplicatePersons = $personNotDuplicateRepository->findNotDuplicatePerson($person);
|
$notDuplicatePersons = $personNotDuplicateRepository->findNotDuplicatePerson($person);
|
||||||
|
|
||||||
@ -264,14 +264,14 @@ class PersonDuplicateController extends Controller
|
|||||||
|
|
||||||
$nb_activity = $em->getRepository(Activity::class)->findBy(['person' => $id]);
|
$nb_activity = $em->getRepository(Activity::class)->findBy(['person' => $id]);
|
||||||
$nb_document = $em->getRepository(PersonDocument::class)->findBy(['person' => $id]);
|
$nb_document = $em->getRepository(PersonDocument::class)->findBy(['person' => $id]);
|
||||||
$nb_event = $em->getRepository(Participation::class)->findBy(['person' => $id]);
|
// $nb_event = $em->getRepository(Participation::class)->findBy(['person' => $id]);
|
||||||
$nb_task = $em->getRepository(SingleTask::class)->countByParameters(['person' => $id]);
|
$nb_task = $em->getRepository(SingleTask::class)->countByParameters(['person' => $id]);
|
||||||
$person = $em->getRepository(Person::class)->findOneBy(['id' => $id]);
|
$person = $em->getRepository(Person::class)->findOneBy(['id' => $id]);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'nb_activity' => count($nb_activity),
|
'nb_activity' => count($nb_activity),
|
||||||
'nb_document' => count($nb_document),
|
'nb_document' => count($nb_document),
|
||||||
'nb_event' => count($nb_event),
|
// 'nb_event' => count($nb_event),
|
||||||
'nb_task' => $nb_task,
|
'nb_task' => $nb_task,
|
||||||
'nb_addresses' => count($person->getAddresses()),
|
'nb_addresses' => count($person->getAddresses()),
|
||||||
];
|
];
|
||||||
|
@ -107,7 +107,6 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface
|
|||||||
return $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.household.' . $key);
|
return $this->aggregateStringHelper->getLabelMulti($key, $values, 'export.list.household.' . $key);
|
||||||
|
|
||||||
case 'compositionType':
|
case 'compositionType':
|
||||||
//dump($values);
|
|
||||||
return $this->translatableStringHelper->getLabel($key, $values, 'export.list.household.' . $key);
|
return $this->translatableStringHelper->getLabel($key, $values, 'export.list.household.' . $key);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
|||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Repository\ResidentialAddressRepository;
|
use Chill\PersonBundle\Repository\ResidentialAddressRepository;
|
||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use Knp\Menu\MenuItem;
|
use Knp\Menu\MenuItem;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
@ -106,17 +107,19 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
->setExtras([
|
->setExtras([
|
||||||
'order' => 99999,
|
'order' => 99999,
|
||||||
]);
|
]);
|
||||||
/*
|
|
||||||
$menu->addChild($this->translator->trans('Person duplicate'), [
|
if ($this->security->isGranted(PersonVoter::DUPLICATE, $parameters['person'])) {
|
||||||
'route' => 'chill_person_duplicate_view',
|
$menu->addChild($this->translator->trans('Person duplicate'), [
|
||||||
'routeParameters' => [
|
'route' => 'chill_person_duplicate_view',
|
||||||
'person_id' => $parameters['person']->getId(),
|
'routeParameters' => [
|
||||||
],
|
'person_id' => $parameters['person']->getId(),
|
||||||
])
|
],
|
||||||
->setExtras([
|
])
|
||||||
'order' => 99999,
|
->setExtras([
|
||||||
]);
|
'order' => 99999,
|
||||||
*/
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
'visible' === $this->showAccompanyingPeriod
|
'visible' === $this->showAccompanyingPeriod
|
||||||
&& $this->security->isGranted(AccompanyingPeriodVoter::SEE, $parameters['person'])
|
&& $this->security->isGranted(AccompanyingPeriodVoter::SEE, $parameters['person'])
|
||||||
|
@ -89,5 +89,4 @@ readonly class AccompanyingPeriodInfoRepository implements AccompanyingPeriodInf
|
|||||||
{
|
{
|
||||||
return AccompanyingPeriodInfo::class;
|
return AccompanyingPeriodInfo::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
<li><b>{{ person.counters.nb_activity }}</b> {{ (person.counters.nb_activity > 1)? 'échanges' : 'échange' }}</li>
|
<li><b>{{ person.counters.nb_activity }}</b> {{ (person.counters.nb_activity > 1)? 'échanges' : 'échange' }}</li>
|
||||||
<li><b>{{ person.counters.nb_task }}</b> {{ (person.counters.nb_task > 1)? 'tâches' : 'tâche' }}</li>
|
<li><b>{{ person.counters.nb_task }}</b> {{ (person.counters.nb_task > 1)? 'tâches' : 'tâche' }}</li>
|
||||||
<li><b>{{ person.counters.nb_document }}</b> {{ (person.counters.nb_document > 1)? 'documents' : 'document' }}</li>
|
<li><b>{{ person.counters.nb_document }}</b> {{ (person.counters.nb_document > 1)? 'documents' : 'document' }}</li>
|
||||||
<li><b>{{ person.counters.nb_event }}</b> {{ (person.counters.nb_event > 1)? 'événements' : 'événement' }}</li>
|
{# <li><b>{{ person.counters.nb_event }}</b> {{ (person.counters.nb_event > 1)? 'événements' : 'événement' }}</li>#}
|
||||||
<li><b>{{ person.counters.nb_addresses }}</b> {{ (person.counters.nb_addresses > 1)? 'adresses' : 'adresse' }}</li>
|
<li><b>{{ person.counters.nb_addresses }}</b> {{ (person.counters.nb_addresses > 1)? 'adresses' : 'adresse' }}</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<h1>{{ 'Merge duplicate persons folders'|trans }}</h1>
|
<h1>{{ 'Merge duplicate persons folders'|trans }}</h1>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-11">
|
||||||
<p><b>{{ 'Old person'|trans }}</b>:
|
<p><b>{{ 'Old person'|trans }}</b>:
|
||||||
{{ 'Old person explain'|trans }}
|
{{ 'Old person explain'|trans }}
|
||||||
</p>
|
</p>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-11">
|
||||||
<p><b>{{ 'New person'|trans }}</b>:
|
<p><b>{{ 'New person'|trans }}</b>:
|
||||||
{{ 'New person explain'|trans }}
|
{{ 'New person explain'|trans }}
|
||||||
</p>
|
</p>
|
||||||
@ -63,10 +63,10 @@
|
|||||||
|
|
||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
|
|
||||||
<div class="col-md-4 centered">
|
<div class="col-md-12 centered">
|
||||||
|
|
||||||
<div class="container-fluid" style="padding-top: 1em;">
|
<div class="container-fluid" style="padding-top: 1em;">
|
||||||
<div class="col-1 clear" style="padding-top: 10px;">
|
<div class="clear" style="padding-top: 10px;">
|
||||||
{{ form_widget(form.confirm) }}
|
{{ form_widget(form.confirm) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-11">
|
<div class="col-11">
|
||||||
|
@ -51,5 +51,4 @@ class AccompanyingPeriodStepChangeCronjobTest extends TestCase
|
|||||||
// can not run: not enough elapsed time
|
// can not run: not enough elapsed time
|
||||||
yield ['2023-01-15T01:00:00+02:00', new \DateTimeImmutable('2023-01-15T00:30:00+02:00'), false];
|
yield ['2023-01-15T01:00:00+02:00', new \DateTimeImmutable('2023-01-15T00:30:00+02:00'), false];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -78,17 +78,13 @@ final class SocialWorkTypeFilterTest extends AbstractFilterTest
|
|||||||
$goals = array_unique($goals);
|
$goals = array_unique($goals);
|
||||||
$results = array_unique($results);
|
$results = array_unique($results);
|
||||||
|
|
||||||
$data = [
|
return [
|
||||||
[
|
[
|
||||||
'actionType' => implode(',', $actions),
|
'actionType' => implode(',', $actions),
|
||||||
'goal' => implode(',', $goals),
|
'goal' => implode(',', $goals),
|
||||||
'result' => implode(',', $results),
|
'result' => implode(',', $results),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
/// TODO ne fonctionne pas
|
|
||||||
var_dump($data);
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryBuilders(): array
|
public function getQueryBuilders(): array
|
||||||
|
Loading…
x
Reference in New Issue
Block a user