mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 01:08:26 +00:00 
			
		
		
		
	Compare commits
	
		
			19 Commits
		
	
	
		
			create-adm
			...
			chill_amli
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 32187cfe06 | |||
| 6c0715669e | |||
| 58ec294023 | |||
| 02b53e23e5 | |||
| bd45fbc85c | |||
| e488d6dadf | |||
| 0d35dfc303 | |||
| 0784b00793 | |||
| b1bfb2dd95 | |||
| e42355c0d1 | |||
| 941d7b0352 | |||
| 0a06118ac3 | |||
| 54ffa999d8 | |||
| 034269b87c | |||
| 8844e3e64a | |||
| e2634b0b0f | |||
| ad63df85c7 | |||
| f987a6b5e0 | |||
| 3c685d50dd | 
| @@ -311,6 +311,6 @@ This is the minimal activity data: Activité n° | ||||
|  | ||||
| docgen: | ||||
|     Activity basic: Echange | ||||
|     A basic context for activity: Contexte pour les échanges | ||||
|     Accompanying period with a list of activities: Parcours d'accompagnement avec liste des échanges | ||||
|     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. | ||||
|     A basic context for activity: Contexte pour les activités | ||||
|     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 activités pour un parcours. Les activités ne sont pas filtrés. | ||||
|   | ||||
| @@ -231,4 +231,4 @@ This is the minimal activity data: Activité n° | ||||
|  | ||||
| docgen: | ||||
|     Activity basic: Echange | ||||
|     A basic context for activity: Contexte pour les échanges | ||||
|     A basic context for activity: Contexte pour les activités | ||||
|   | ||||
| @@ -178,7 +178,7 @@ class DocumentPersonController extends AbstractController | ||||
|  | ||||
|         $documents = $this->personDocumentACLAwareRepository->findByPerson( | ||||
|             $person, | ||||
|             ['date' => 'DESC', 'id' => 'DESC'], | ||||
|             ['d.date' => 'DESC', 'd.id' => 'DESC'], | ||||
|             $pagination->getItemsPerPage(), | ||||
|             $pagination->getCurrentPageFirstItemNumber() | ||||
|         ); | ||||
|   | ||||
| @@ -78,6 +78,11 @@ class PersonDocumentType extends AbstractType | ||||
|             ]); | ||||
|  | ||||
|         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, [ | ||||
|                 'center' => $this->centerResolverDispatcher->resolveCenter($document), | ||||
|                 'role' => $options['role'], | ||||
|   | ||||
| @@ -13,8 +13,9 @@ namespace Chill\MainBundle\Notification; | ||||
|  | ||||
| use Chill\MainBundle\Entity\User; | ||||
| use Psr\Log\LoggerInterface; | ||||
| use Swift_Mailer; | ||||
| use Swift_Message; | ||||
| use Symfony\Component\Mailer\MailerInterface; | ||||
| use Symfony\Component\Mime\Email; | ||||
| use Symfony\Component\Routing\RouterInterface; | ||||
| use Symfony\Contracts\Translation\TranslatorInterface; | ||||
| use Twig\Environment; | ||||
| @@ -29,40 +30,19 @@ use function call_user_func; | ||||
|  */ | ||||
| class Mailer | ||||
| { | ||||
|     /** | ||||
|      * @var Swift_Mailer | ||||
|      */ | ||||
|     protected $forcedMailer; | ||||
|     protected MailerInterface $forcedMailer; | ||||
|  | ||||
|     /** | ||||
|      * @var LoggerInterface | ||||
|      */ | ||||
|     protected $logger; | ||||
|     protected LoggerInterface $logger; | ||||
|  | ||||
|     /** | ||||
|      * @var Swift_Mailer | ||||
|      */ | ||||
|     protected $mailer; | ||||
|     protected MailerInterface $mailer; | ||||
|  | ||||
|     /** | ||||
|      * @var array | ||||
|      */ | ||||
|     protected $routeParameters; | ||||
|     protected array $routeParameters; | ||||
|  | ||||
|     /** | ||||
|      * @var RouterInterface | ||||
|      */ | ||||
|     protected $router; | ||||
|     protected RouterInterface $router; | ||||
|  | ||||
|     /** | ||||
|      * @var TranslatorInterface | ||||
|      */ | ||||
|     protected $translator; | ||||
|     protected TranslatorInterface $translator; | ||||
|  | ||||
|     /** | ||||
|      * @var \Twig\Environment | ||||
|      */ | ||||
|     protected $twig; | ||||
|     protected Environment $twig; | ||||
|  | ||||
|     /** | ||||
|      * Mailer constructor. | ||||
| @@ -72,7 +52,7 @@ class Mailer | ||||
|     public function __construct( | ||||
|         LoggerInterface $logger, | ||||
|         Environment $twig, | ||||
|         Swift_Mailer $mailer, | ||||
|         MailerInterface $mailer, | ||||
|         // due to bug https://github.com/symfony/swiftmailer-bundle/issues/127 | ||||
|         // \Swift_Transport $mailerTransporter, | ||||
|         RouterInterface $router, | ||||
| @@ -120,12 +100,12 @@ class Mailer | ||||
|      * | ||||
|      * @throws \Symfony\Component\Mailer\Exception\TransportExceptionInterface | ||||
|      */ | ||||
|     public function sendMessage(Swift_Message $message, $force) | ||||
|     public function sendMessage(Email $email, $force) | ||||
|     { | ||||
|         if ($force) { | ||||
|             $this->forcedMailer->send($message); | ||||
|             $this->forcedMailer->send($email); | ||||
|         } else { | ||||
|             $this->mailer->send($message); | ||||
|             $this->mailer->send($email); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -146,7 +126,7 @@ class Mailer | ||||
|         $force = false | ||||
|     ) { | ||||
|         $fromEmail = $this->routeParameters['from_email']; | ||||
|         $fromName = $this->routeParameters['from_name']; | ||||
|         // $fromName = $this->routeParameters['from_name']; | ||||
|         $to = $recipient instanceof User ? $recipient->getEmail() : $recipient; | ||||
|  | ||||
|         $subjectI18n = $this->translator->trans( | ||||
| @@ -155,12 +135,13 @@ class Mailer | ||||
|             $subject[2] ?? null | ||||
|         ); | ||||
|  | ||||
|         $message = (new Swift_Message($subjectI18n)) | ||||
|             ->setFrom($fromEmail, $fromName) | ||||
|             ->setTo($to); | ||||
|         $message = (new Email()); | ||||
|         $message->subject($subjectI18n); | ||||
|         $message->to($to); | ||||
|         $message->from($fromEmail); | ||||
|  | ||||
|         foreach ($bodies as $contentType => $content) { | ||||
|             $message->setBody($content, $contentType); | ||||
|             $message->text($content); | ||||
|         } | ||||
|  | ||||
|         if (null !== $callback) { | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -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;"> | ||||
| @@ -49,6 +49,6 @@ | ||||
|             {{ include('@ChillMain/Login/_footer.html.twig') }} | ||||
|         </div> | ||||
|  | ||||
|         {{ encore_entry_script_tags('page_login') }} | ||||
|         {# {{ encore_entry_script_tags('page_login') }} #} | ||||
|     </body> | ||||
| </html> | ||||
|   | ||||
| @@ -12,7 +12,7 @@ services: | ||||
|         arguments: | ||||
|             $logger: '@Psr\Log\LoggerInterface' | ||||
|             $twig: '@Twig\Environment' | ||||
|             $mailer: '@swiftmailer.mailer.default' | ||||
|             $mailer: '@Symfony\Component\Mailer\MailerInterface' | ||||
|             # $mailerTransporter: '@swiftmailer.transport' | ||||
|             $router: '@Symfony\Component\Routing\RouterInterface' | ||||
|             $translator: '@Symfony\Contracts\Translation\TranslatorInterface' | ||||
|   | ||||
| @@ -27,7 +27,7 @@ final class Version20180905101426 extends AbstractMigration | ||||
|  | ||||
|     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'); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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); | ||||
|     } | ||||
| } | ||||
| @@ -11,6 +11,7 @@ declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\PersonBundle\Controller; | ||||
|  | ||||
| use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface; | ||||
| use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; | ||||
| use Chill\PersonBundle\Entity\Household\Household; | ||||
| use Chill\PersonBundle\Entity\Household\HouseholdMember; | ||||
| @@ -20,6 +21,7 @@ use Chill\PersonBundle\Form\PersonType; | ||||
| use Chill\PersonBundle\Privacy\PrivacyEvent; | ||||
| use Chill\PersonBundle\Repository\PersonRepository; | ||||
| use Chill\PersonBundle\Search\SimilarPersonMatcher; | ||||
| use Chill\PersonBundle\Security\Authorization\PersonVoter; | ||||
| use DateTimeImmutable; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use Psr\Log\LoggerInterface; | ||||
| @@ -44,6 +46,8 @@ use function is_array; | ||||
|  | ||||
| final class PersonController extends AbstractController | ||||
| { | ||||
|     private AuthorizationHelperInterface $authorizationHelper; | ||||
|  | ||||
|     /** | ||||
|      * @var ConfigPersonAltNamesHelper | ||||
|      */ | ||||
| @@ -85,6 +89,7 @@ final class PersonController extends AbstractController | ||||
|     private $validator; | ||||
|  | ||||
|     public function __construct( | ||||
|         AuthorizationHelperInterface $authorizationHelper, | ||||
|         SimilarPersonMatcher $similarPersonMatcher, | ||||
|         TranslatorInterface $translator, | ||||
|         EventDispatcherInterface $eventDispatcher, | ||||
| @@ -95,6 +100,7 @@ final class PersonController extends AbstractController | ||||
|         EntityManagerInterface $em, | ||||
|         Security $security | ||||
|     ) { | ||||
|         $this->authorizationHelper = $authorizationHelper; | ||||
|         $this->similarPersonMatcher = $similarPersonMatcher; | ||||
|         $this->translator = $translator; | ||||
|         $this->eventDispatcher = $eventDispatcher; | ||||
| @@ -211,15 +217,10 @@ final class PersonController extends AbstractController | ||||
|     { | ||||
|         $person = new Person(); | ||||
|  | ||||
|         if ( | ||||
|             1 === count($this->security->getUser() | ||||
|                 ->getGroupCenters()) | ||||
|         ) { | ||||
|             $person->setCenter( | ||||
|                 $this->security->getUser() | ||||
|                     ->getGroupCenters()[0] | ||||
|                     ->getCenter() | ||||
|             ); | ||||
|         $centers = $this->authorizationHelper->getReachableCenters($this->getUser(), PersonVoter::CREATE); | ||||
|  | ||||
|         if (1 === count($centers)) { | ||||
|             $person->setCenter($centers[0]); | ||||
|         } | ||||
|  | ||||
|         $form = $this->createForm(CreationPersonType::class, $person) | ||||
| @@ -246,6 +247,8 @@ final class PersonController extends AbstractController | ||||
|                 false === $this->isLastPostDataChanges($form, $request, true) | ||||
|                 || count($alternatePersons) === 0 | ||||
|             ) { | ||||
|                 $this->denyAccessUnlessGranted(PersonVoter::CREATE, $person); | ||||
|                  | ||||
|                 $this->em->persist($person); | ||||
|  | ||||
|                 $this->em->flush(); | ||||
|   | ||||
| @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Form; | ||||
| use Chill\MainBundle\Form\Type\TranslatableStringFormType; | ||||
| use Chill\PersonBundle\Entity\Household\HouseholdCompositionType; | ||||
| 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\FormBuilderInterface; | ||||
| use Symfony\Component\OptionsResolver\OptionsResolver; | ||||
|   | ||||
| @@ -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 %} | ||||
| @@ -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> </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 %} | ||||
| @@ -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 %} | ||||
|  | ||||
| @@ -27,15 +27,9 @@ class SimilarPersonMatcher | ||||
|  | ||||
|     public const SIMILAR_SEARCH_ORDER_BY_SIMILARITY = 'similarity'; | ||||
|  | ||||
|     /** | ||||
|      * @var AuthorizationHelper | ||||
|      */ | ||||
|     protected $authorizationHelper; | ||||
|     protected AuthorizationHelper $authorizationHelper; | ||||
|  | ||||
|     /** | ||||
|      * @var EntityManagerInterface | ||||
|      */ | ||||
|     protected $em; | ||||
|     protected EntityManagerInterface $em; | ||||
|  | ||||
|     protected PersonNotDuplicateRepository $personNotDuplicateRepository; | ||||
|  | ||||
| @@ -62,7 +56,7 @@ class SimilarPersonMatcher | ||||
|  | ||||
|     public function matchPerson( | ||||
|         Person $person, | ||||
|         float $precision = 0.15, | ||||
|         float $precision = 0.35, | ||||
|         string $orderBy = self::SIMILAR_SEARCH_ORDER_BY_SIMILARITY, | ||||
|         bool $addYearComparison = false | ||||
|     ) { | ||||
|   | ||||
| @@ -223,5 +223,6 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH | ||||
|         } | ||||
|  | ||||
|         return $this->voterHelper->voteOnAttribute($attribute, $subject, $token); | ||||
|  | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -54,9 +54,9 @@ final class Version20220215135509 extends AbstractMigration implements Container | ||||
|  | ||||
|         $this->addSql( | ||||
|             'UPDATE chill_person_person SET ' . | ||||
|             $this->buildMigrationPhonenumberClause($carrier_code, 'phonenumber') . | ||||
|             ', ' . | ||||
|             $this->buildMigrationPhoneNumberClause($carrier_code, 'mobilenumber') | ||||
|                 $this->buildMigrationPhonenumberClause($carrier_code, 'phonenumber') . | ||||
|                 ', ' . | ||||
|                 $this->buildMigrationPhoneNumberClause($carrier_code, 'mobilenumber') | ||||
|         ); | ||||
|  | ||||
|         $this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber TYPE TEXT'); | ||||
| @@ -66,7 +66,7 @@ final class Version20220215135509 extends AbstractMigration implements Container | ||||
|  | ||||
|         $this->addSql( | ||||
|             'UPDATE chill_person_phone SET ' . | ||||
|             $this->buildMigrationPhoneNumberClause($carrier_code, 'phonenumber') | ||||
|                 $this->buildMigrationPhoneNumberClause($carrier_code, 'phonenumber') | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user