Compare commits

...

19 Commits

Author SHA1 Message Date
32187cfe06 Merge remote-tracking branch 'origin/testing' into chill_amli 2022-09-29 10:58:05 +02:00
6c0715669e change name of échange to activité for amli 2022-09-21 16:45:20 +02:00
58ec294023 Merge branch 'master' into chill_amli 2022-09-21 15:54:21 +02:00
02b53e23e5 Merge branch '111_exports_suite' into chill_amli 2022-09-12 12:55:43 +02:00
bd45fbc85c merge master into chill amli to have exports 2022-09-12 12:53:26 +02:00
e488d6dadf add CenterResolverDispatcher in construct, was missing 2022-09-12 12:30:57 +02:00
0d35dfc303 Merge branch 'calendar/finalization' into chill_amli 2022-08-29 11:32:46 +02:00
0784b00793 bugfix for person document 2022-08-29 11:30:48 +02:00
b1bfb2dd95 raise the similarity matcher percentage 2022-08-09 12:06:25 +02:00
e42355c0d1 Merge branch 'chill_amli' of https://gitlab.com/Chill-Projet/chill-bundles into chill_amli 2022-07-25 16:04:52 +02:00
941d7b0352 swiftmailer replaced by mailerinterface 2022-07-25 16:04:32 +02:00
0a06118ac3 swiftmailer replaced by mailerinterface 2022-07-25 15:41:44 +02:00
54ffa999d8 comment out temporarily start of extra menu item admin -take up later 2022-06-30 15:42:51 +02:00
034269b87c remove dumps 2022-06-30 15:41:16 +02:00
8844e3e64a fix use import of scope 2022-06-30 15:40:55 +02:00
e2634b0b0f fix right to create person for amli use 2022-06-30 15:29:30 +02:00
ad63df85c7 Merge branch 'master' of https://gitlab.com/Chill-Projet/chill-bundles into chill_amli 2022-06-27 16:45:36 +02:00
f987a6b5e0 modifications to adapt to AMLI 2022-06-14 15:05:09 +02:00
3c685d50dd household composition type added to admin panel 2022-06-14 12:11:29 +02:00
19 changed files with 1417 additions and 70 deletions

View File

@@ -311,6 +311,6 @@ This is the minimal activity data: Activité n°
docgen: docgen:
Activity basic: Echange Activity basic: Echange
A basic context for activity: Contexte pour les échanges A basic context for activity: Contexte pour les activités
Accompanying period with a list of activities: Parcours d'accompagnement avec liste des échanges Accompanying period with a list of activities: Parcours d'accompagnement avec liste des activités
Accompanying period with a list of activities description: Ce contexte reprend les informations du parcours, et tous les échanges pour un parcours. Les échanges ne sont pas filtrés. Accompanying period with a list of activities description: Ce contexte reprend les informations du parcours, et tous les activités pour un parcours. Les activités ne sont pas filtrés.

View File

@@ -231,4 +231,4 @@ This is the minimal activity data: Activité n°
docgen: docgen:
Activity basic: Echange Activity basic: Echange
A basic context for activity: Contexte pour les échanges A basic context for activity: Contexte pour les activités

View File

@@ -178,7 +178,7 @@ class DocumentPersonController extends AbstractController
$documents = $this->personDocumentACLAwareRepository->findByPerson( $documents = $this->personDocumentACLAwareRepository->findByPerson(
$person, $person,
['date' => 'DESC', 'id' => 'DESC'], ['d.date' => 'DESC', 'd.id' => 'DESC'],
$pagination->getItemsPerPage(), $pagination->getItemsPerPage(),
$pagination->getCurrentPageFirstItemNumber() $pagination->getCurrentPageFirstItemNumber()
); );

View File

@@ -78,6 +78,11 @@ class PersonDocumentType extends AbstractType
]); ]);
if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) { if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) {
/* dump($isScopeConcerned);
dump($this->parameterBag->get('chill_main')['acl']['form_show_scopes']);
dump($this->centerResolverDispatcher)*/
$builder->add('scope', ScopePickerType::class, [ $builder->add('scope', ScopePickerType::class, [
'center' => $this->centerResolverDispatcher->resolveCenter($document), 'center' => $this->centerResolverDispatcher->resolveCenter($document),
'role' => $options['role'], 'role' => $options['role'],

View File

@@ -13,8 +13,9 @@ namespace Chill\MainBundle\Notification;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Swift_Mailer;
use Swift_Message; use Swift_Message;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Environment; use Twig\Environment;
@@ -29,40 +30,19 @@ use function call_user_func;
*/ */
class Mailer class Mailer
{ {
/** protected MailerInterface $forcedMailer;
* @var Swift_Mailer
*/
protected $forcedMailer;
/** protected LoggerInterface $logger;
* @var LoggerInterface
*/
protected $logger;
/** protected MailerInterface $mailer;
* @var Swift_Mailer
*/
protected $mailer;
/** protected array $routeParameters;
* @var array
*/
protected $routeParameters;
/** protected RouterInterface $router;
* @var RouterInterface
*/
protected $router;
/** protected TranslatorInterface $translator;
* @var TranslatorInterface
*/
protected $translator;
/** protected Environment $twig;
* @var \Twig\Environment
*/
protected $twig;
/** /**
* Mailer constructor. * Mailer constructor.
@@ -72,7 +52,7 @@ class Mailer
public function __construct( public function __construct(
LoggerInterface $logger, LoggerInterface $logger,
Environment $twig, Environment $twig,
Swift_Mailer $mailer, MailerInterface $mailer,
// due to bug https://github.com/symfony/swiftmailer-bundle/issues/127 // due to bug https://github.com/symfony/swiftmailer-bundle/issues/127
// \Swift_Transport $mailerTransporter, // \Swift_Transport $mailerTransporter,
RouterInterface $router, RouterInterface $router,
@@ -120,12 +100,12 @@ class Mailer
* *
* @throws \Symfony\Component\Mailer\Exception\TransportExceptionInterface * @throws \Symfony\Component\Mailer\Exception\TransportExceptionInterface
*/ */
public function sendMessage(Swift_Message $message, $force) public function sendMessage(Email $email, $force)
{ {
if ($force) { if ($force) {
$this->forcedMailer->send($message); $this->forcedMailer->send($email);
} else { } else {
$this->mailer->send($message); $this->mailer->send($email);
} }
} }
@@ -146,7 +126,7 @@ class Mailer
$force = false $force = false
) { ) {
$fromEmail = $this->routeParameters['from_email']; $fromEmail = $this->routeParameters['from_email'];
$fromName = $this->routeParameters['from_name']; // $fromName = $this->routeParameters['from_name'];
$to = $recipient instanceof User ? $recipient->getEmail() : $recipient; $to = $recipient instanceof User ? $recipient->getEmail() : $recipient;
$subjectI18n = $this->translator->trans( $subjectI18n = $this->translator->trans(
@@ -155,12 +135,13 @@ class Mailer
$subject[2] ?? null $subject[2] ?? null
); );
$message = (new Swift_Message($subjectI18n)) $message = (new Email());
->setFrom($fromEmail, $fromName) $message->subject($subjectI18n);
->setTo($to); $message->to($to);
$message->from($fromEmail);
foreach ($bodies as $contentType => $content) { foreach ($bodies as $contentType => $content) {
$message->setBody($content, $contentType); $message->text($content);
} }
if (null !== $callback) { if (null !== $callback) {

View File

@@ -1 +1 @@
<img class="logo" src="{{ asset('build/images/logo-chill-outil-accompagnement_white.png') }}"> <img class="logo" src="{{ asset('build/images/achille.png') }}" style="width: 544px; margin-bottom: 2rem;">

View File

@@ -49,6 +49,6 @@
{{ include('@ChillMain/Login/_footer.html.twig') }} {{ include('@ChillMain/Login/_footer.html.twig') }}
</div> </div>
{{ encore_entry_script_tags('page_login') }} {# {{ encore_entry_script_tags('page_login') }} #}
</body> </body>
</html> </html>

View File

@@ -12,7 +12,7 @@ services:
arguments: arguments:
$logger: '@Psr\Log\LoggerInterface' $logger: '@Psr\Log\LoggerInterface'
$twig: '@Twig\Environment' $twig: '@Twig\Environment'
$mailer: '@swiftmailer.mailer.default' $mailer: '@Symfony\Component\Mailer\MailerInterface'
# $mailerTransporter: '@swiftmailer.transport' # $mailerTransporter: '@swiftmailer.transport'
$router: '@Symfony\Component\Routing\RouterInterface' $router: '@Symfony\Component\Routing\RouterInterface'
$translator: '@Symfony\Contracts\Translation\TranslatorInterface' $translator: '@Symfony\Contracts\Translation\TranslatorInterface'

View File

@@ -27,7 +27,7 @@ final class Version20180905101426 extends AbstractMigration
public function up(Schema $schema): void public function up(Schema $schema): void
{ {
$this->addSql('ALTER TABLE permission_groups ADD flags JSONB DEFAULT \'[]\' NOT NULL'); // $this->addSql('ALTER TABLE permission_groups ADD flags JSONB DEFAULT \'[]\' NOT NULL');
$this->addSql('ALTER TABLE group_centers ALTER permissionsgroup_id DROP NOT NULL'); $this->addSql('ALTER TABLE group_centers ALTER permissionsgroup_id DROP NOT NULL');
} }
} }

View File

@@ -0,0 +1,26 @@
<?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\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
class HouseholdCompositionCRUDController extends CRUDController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.id', 'ASC');
return parent::orderQuery($action, $query, $request, $paginator);
}
}

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Controller; namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Household\HouseholdMember; use Chill\PersonBundle\Entity\Household\HouseholdMember;
@@ -20,6 +21,7 @@ use Chill\PersonBundle\Form\PersonType;
use Chill\PersonBundle\Privacy\PrivacyEvent; use Chill\PersonBundle\Privacy\PrivacyEvent;
use Chill\PersonBundle\Repository\PersonRepository; use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Search\SimilarPersonMatcher; use Chill\PersonBundle\Search\SimilarPersonMatcher;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use DateTimeImmutable; use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@@ -44,6 +46,8 @@ use function is_array;
final class PersonController extends AbstractController final class PersonController extends AbstractController
{ {
private AuthorizationHelperInterface $authorizationHelper;
/** /**
* @var ConfigPersonAltNamesHelper * @var ConfigPersonAltNamesHelper
*/ */
@@ -85,6 +89,7 @@ final class PersonController extends AbstractController
private $validator; private $validator;
public function __construct( public function __construct(
AuthorizationHelperInterface $authorizationHelper,
SimilarPersonMatcher $similarPersonMatcher, SimilarPersonMatcher $similarPersonMatcher,
TranslatorInterface $translator, TranslatorInterface $translator,
EventDispatcherInterface $eventDispatcher, EventDispatcherInterface $eventDispatcher,
@@ -95,6 +100,7 @@ final class PersonController extends AbstractController
EntityManagerInterface $em, EntityManagerInterface $em,
Security $security Security $security
) { ) {
$this->authorizationHelper = $authorizationHelper;
$this->similarPersonMatcher = $similarPersonMatcher; $this->similarPersonMatcher = $similarPersonMatcher;
$this->translator = $translator; $this->translator = $translator;
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
@@ -211,15 +217,10 @@ final class PersonController extends AbstractController
{ {
$person = new Person(); $person = new Person();
if ( $centers = $this->authorizationHelper->getReachableCenters($this->getUser(), PersonVoter::CREATE);
1 === count($this->security->getUser()
->getGroupCenters()) if (1 === count($centers)) {
) { $person->setCenter($centers[0]);
$person->setCenter(
$this->security->getUser()
->getGroupCenters()[0]
->getCenter()
);
} }
$form = $this->createForm(CreationPersonType::class, $person) $form = $this->createForm(CreationPersonType::class, $person)
@@ -246,6 +247,8 @@ final class PersonController extends AbstractController
false === $this->isLastPostDataChanges($form, $request, true) false === $this->isLastPostDataChanges($form, $request, true)
|| count($alternatePersons) === 0 || count($alternatePersons) === 0
) { ) {
$this->denyAccessUnlessGranted(PersonVoter::CREATE, $person);
$this->em->persist($person); $this->em->persist($person);
$this->em->flush(); $this->em->flush();

View File

@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Form;
use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Chill\PersonBundle\Entity\Household\HouseholdCompositionType; use Chill\PersonBundle\Entity\Household\HouseholdCompositionType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -0,0 +1,41 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>{{ 'Id'|trans }}</th>
<th>{{ 'Label'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.label|localize_translatable_string }}</td>
<td style="text-align:center;">
{%- if entity.active -%}
<i class="fa fa-check-square-o"></i>
{%- else -%}
<i class="fa fa-square-o"></i>
{%- endif -%}
</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_person_household_composition_type_edit', { 'id': entity.id }) }}" class="btn btn-edit"></a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -0,0 +1,12 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -27,15 +27,9 @@ class SimilarPersonMatcher
public const SIMILAR_SEARCH_ORDER_BY_SIMILARITY = 'similarity'; public const SIMILAR_SEARCH_ORDER_BY_SIMILARITY = 'similarity';
/** protected AuthorizationHelper $authorizationHelper;
* @var AuthorizationHelper
*/
protected $authorizationHelper;
/** protected EntityManagerInterface $em;
* @var EntityManagerInterface
*/
protected $em;
protected PersonNotDuplicateRepository $personNotDuplicateRepository; protected PersonNotDuplicateRepository $personNotDuplicateRepository;
@@ -62,7 +56,7 @@ class SimilarPersonMatcher
public function matchPerson( public function matchPerson(
Person $person, Person $person,
float $precision = 0.15, float $precision = 0.35,
string $orderBy = self::SIMILAR_SEARCH_ORDER_BY_SIMILARITY, string $orderBy = self::SIMILAR_SEARCH_ORDER_BY_SIMILARITY,
bool $addYearComparison = false bool $addYearComparison = false
) { ) {

View File

@@ -223,5 +223,6 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
} }
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token); return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
} }
} }

View File

@@ -54,9 +54,9 @@ final class Version20220215135509 extends AbstractMigration implements Container
$this->addSql( $this->addSql(
'UPDATE chill_person_person SET ' . 'UPDATE chill_person_person SET ' .
$this->buildMigrationPhonenumberClause($carrier_code, 'phonenumber') . $this->buildMigrationPhonenumberClause($carrier_code, 'phonenumber') .
', ' . ', ' .
$this->buildMigrationPhoneNumberClause($carrier_code, 'mobilenumber') $this->buildMigrationPhoneNumberClause($carrier_code, 'mobilenumber')
); );
$this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber TYPE TEXT'); $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber TYPE TEXT');
@@ -66,7 +66,7 @@ final class Version20220215135509 extends AbstractMigration implements Container
$this->addSql( $this->addSql(
'UPDATE chill_person_phone SET ' . 'UPDATE chill_person_phone SET ' .
$this->buildMigrationPhoneNumberClause($carrier_code, 'phonenumber') $this->buildMigrationPhoneNumberClause($carrier_code, 'phonenumber')
); );
} }