diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8dd9bbbe2..da7489015 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,10 @@ and this project adheres to
## Unreleased
+* [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472)
+* [person] Add url in accompanying period work evaluations entity and form (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/476)
+* [person] Add document generation in admin and in person/{id}/document (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/464)
+* [activity] do not override location if already exist (when validating new activity) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/470)
* [parcours] Toggle emergency/intensity only by referrer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/442)
* [docstore] Add an API entrypoint for StoredObject (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466)
* [person] Add the possibility of uploading existing documents to AccPeriodWorkEvaluationDocument (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466)
@@ -19,7 +23,7 @@ and this project adheres to
* [Person/Household list] when listing other simultaneous members of an household, exclude the members on person, not on members (avoid to show two membersship with the same person)
* [draft periods] add a delete button (if acl granted) on each draft period listed on draft period page (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/463)
* [Person] Display suffixText in RenderPerson, PersonText.vue, RenderPersonBox.vue (was made for displaying "enfant confie") (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/441)
-* [person] residential address: show residential address or info in PersonRenderBox, refactor Residential Address (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/439)
+* [person] residential address: show residential address or info in PersonRenderBox, refactor Residential Address (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/439)
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
* [documents] Improve flex-table item-col placement when long buttons and long metadata
* [thirdparty] Fix display of multiple contact badges so they wrap onto next line (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/482)
@@ -27,6 +31,13 @@ and this project adheres to
* [parcours] Fix edit of both thirdparty and contact name (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/474)
* [template] do not list inactive templates (for doc generator)
* [household] bugfix if position of member is null, renderbox no longer throws an error (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/480)
+* [parcours] location cannot be removed if linked to a user (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/478)
+* [person] email added to twig personRenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/490)
+* [person] Add link to current household in person banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/484)
+* [person] Change 'personne' with 'usager' and '&' with 'ET' (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/499)
+* [thirdparty] Add parameter condition to display centers or not (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/500)
+* [phonenumber] Remove placeholder in phonenumber field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/496)
+* [contact] add contact button color changed plus the pipe at the side removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/506)
## Test releases
diff --git a/phpstan-types.neon b/phpstan-types.neon
index ed2de3c91..ddde5cc03 100644
--- a/phpstan-types.neon
+++ b/phpstan-types.neon
@@ -350,11 +350,6 @@ parameters:
count: 6
path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php
- -
- message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
- count: 2
- path: src/Bundle/ChillPersonBundle/Entity/PersonPhone.php
-
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.locations.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.locations.js
index 311bdc219..6125140a5 100644
--- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.locations.js
+++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.locations.js
@@ -110,10 +110,8 @@ export default function prepareLocations(store) {
console.log('default loation id', window.default_location_id);
if (window.default_location_id) {
for (let group of store.state.availableLocations) {
- console.log(group);
let location = group.locations.find((l) => l.id === window.default_location_id);
- console.log(location);
- if (location !== undefined) {
+ if (location !== undefined & store.state.activity.location === null) {
store.dispatch('updateLocation', location);
break;
}
diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
index 81a34d47d..051497b69 100644
--- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
@@ -76,7 +76,7 @@ activity:
Insert a document: Insérer un document
Remove a document: Supprimer le document
comment: Commentaire
-No documents: Pas de documents
+No documents: Aucun document
#timeline
'%user% has done an %activity_type%': '%user% a effectué une activité de type "%activity_type%"'
diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php
index 2aff33af0..000fcb03a 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php
@@ -207,21 +207,21 @@ final class DocGeneratorTemplateController extends AbstractController
$context instanceof DocGeneratorContextWithPublicFormInterface
&& $context->hasPublicForm($template, $entity) || $isTest
) {
- if ($context instanceof DocGeneratorContextWithPublicFormInterface) {
+ if ($context instanceof DocGeneratorContextWithPublicFormInterface && $context->hasPublicForm($template, $entity)) {
$builder = $this->createFormBuilder(
array_merge(
$context->getFormData($template, $entity),
$isTest ? ['test_file' => null] : []
)
);
+
+ $context->buildPublicForm($builder, $template, $entity);
} else {
$builder = $this->createFormBuilder(
['test_file' => null]
);
}
- $context->buildPublicForm($builder, $template, $entity);
-
if ($isTest) {
$builder->add('test_file', FileType::class, [
'label' => 'Template file',
diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php
index 199f88c60..ae8db17f6 100644
--- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php
+++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php
@@ -21,6 +21,8 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
use DateTime;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\Form\Extension\Core\Type\FormType;
+use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
@@ -59,21 +61,37 @@ class DocumentAccompanyingCourseController extends AbstractController
}
/**
- * @Route("/{id}", name="accompanying_course_document_delete", methods="DELETE")
+ * @Route("/{id}/delete", name="chill_docstore_accompanying_course_document_delete")
*/
public function delete(Request $request, AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response
{
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::DELETE, $document);
- if ($this->isCsrfTokenValid('delete' . $document->getId(), $request->request->get('_token'))) {
- $em = $this->getDoctrine()->getManager();
- $em->remove($document);
- $em->flush();
+ $form = $this->createForm(FormType::class);
+ $form->add('submit', SubmitType::class, ['label' => 'Delete']);
+
+ $form->handleRequest($request);
+
+ if ($form->isSubmitted() && $form->isValid()) {
+ $this->getDoctrine()->getManager()->remove($document);
+ $this->getDoctrine()->getManager()->flush();
+
+ $this->addFlash('success', $this->translator->trans('The document is successfully removed'));
+
+ if ($request->query->has('returnPath')) {
+ return $this->redirect($request->query->get('returnPath'));
+ }
+
+ return $this->redirectToRoute('accompanying_course_document_index', ['course' => $course->getId()]);
}
- return $this->redirectToRoute(
- 'accompanying_course_document_index',
- ['accompanyingCourse' => $course->getId()]
+ return $this->render(
+ 'ChillDocStoreBundle:AccompanyingCourseDocument:delete.html.twig',
+ [
+ 'document' => $document,
+ 'delete_form' => $form->createView(),
+ 'accompanyingCourse' => $course,
+ ]
);
}
diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
index fcb3a4958..42e49ad3c 100644
--- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
+++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
@@ -14,6 +14,7 @@ namespace Chill\DocStoreBundle\Controller;
use Chill\DocStoreBundle\Entity\PersonDocument;
use Chill\DocStoreBundle\Form\PersonDocumentType;
use Chill\DocStoreBundle\Repository\PersonDocumentACLAwareRepositoryInterface;
+use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\PersonBundle\Entity\Person;
@@ -22,6 +23,8 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
use DateTime;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\Form\Extension\Core\Type\FormType;
+use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
@@ -64,22 +67,37 @@ class DocumentPersonController extends AbstractController
}
/**
- * @Route("/{id}", name="person_document_delete", methods="DELETE")
+ * @Route("/{id}/delete", name="chill_docstore_person_document_delete")
*/
public function delete(Request $request, Person $person, PersonDocument $document): Response
{
- $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
- $this->denyAccessUnlessGranted('CHILL_PERSON_DOCUMENT_DELETE', $document);
+ $this->denyAccessUnlessGranted(PersonDocumentVoter::DELETE, $document);
- if ($this->isCsrfTokenValid('delete' . $document->getId(), $request->request->get('_token'))) {
- $em = $this->getDoctrine()->getManager();
- $em->remove($document);
- $em->flush();
+ $form = $this->createForm(FormType::class);
+ $form->add('submit', SubmitType::class, ['label' => 'Delete']);
+
+ $form->handleRequest($request);
+
+ if ($form->isSubmitted() && $form->isValid()) {
+ $this->getDoctrine()->getManager()->remove($document);
+ $this->getDoctrine()->getManager()->flush();
+
+ $this->addFlash('success', $this->translator->trans('The document is successfully removed'));
+
+ if ($request->query->has('returnPath')) {
+ return $this->redirect($request->query->get('returnPath'));
+ }
+
+ return $this->redirectToRoute('person_document_index', ['person' => $person->getId()]);
}
- return $this->redirectToRoute(
- 'person_document_index',
- ['person' => $person->getId()]
+ return $this->render(
+ 'ChillDocStoreBundle:PersonDocument:delete.html.twig',
+ [
+ 'document' => $document,
+ 'delete_form' => $form->createView(),
+ 'person' => $person,
+ ]
);
}
@@ -98,7 +116,6 @@ class DocumentPersonController extends AbstractController
PersonDocumentType::class,
$document,
[
- 'center' => $document->getCenter(),
'role' => 'CHILL_PERSON_DOCUMENT_UPDATE',
]
);
@@ -199,7 +216,6 @@ class DocumentPersonController extends AbstractController
$document->setDate(new DateTime('Now'));
$form = $this->createForm(PersonDocumentType::class, $document, [
- 'center' => $document->getCenter(),
'role' => 'CHILL_PERSON_DOCUMENT_CREATE',
]);
$form->handleRequest($request);
diff --git a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php
index bcbd4d707..41dc73154 100644
--- a/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php
+++ b/src/Bundle/ChillDocStoreBundle/Form/PersonDocumentType.php
@@ -13,15 +13,13 @@ namespace Chill\DocStoreBundle\Form;
use Chill\DocStoreBundle\Entity\Document;
use Chill\DocStoreBundle\Entity\PersonDocument;
-use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\ChillTextareaType;
use Chill\MainBundle\Form\Type\ScopePickerType;
-use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
+use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
use Chill\MainBundle\Security\Resolver\ScopeResolverDispatcher;
-use Chill\MainBundle\Templating\TranslatableStringHelper;
+use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Doctrine\ORM\EntityRepository;
-use Doctrine\Persistence\ObjectManager;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\AbstractType;
@@ -31,34 +29,16 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class PersonDocumentType extends AbstractType
{
- /**
- * @var AuthorizationHelper
- */
- protected $authorizationHelper;
-
- /**
- * @var ObjectManager
- */
- protected $om;
-
- /**
- * @var TranslatableStringHelper
- */
- protected $translatableStringHelper;
-
- /**
- * the user running this form.
- *
- * @var User
- */
- protected $user;
+ private CenterResolverDispatcher $centerResolverDispatcher;
private ParameterBagInterface $parameterBag;
private ScopeResolverDispatcher $scopeResolverDispatcher;
+ private TranslatableStringHelperInterface $translatableStringHelper;
+
public function __construct(
- TranslatableStringHelper $translatableStringHelper,
+ TranslatableStringHelperInterface $translatableStringHelper,
ScopeResolverDispatcher $scopeResolverDispatcher,
ParameterBagInterface $parameterBag
) {
@@ -96,7 +76,7 @@ class PersonDocumentType extends AbstractType
if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) {
$builder->add('scope', ScopePickerType::class, [
- 'center' => $options['center'],
+ 'center' => $this->centerResolverDispatcher->resolveCenter($document),
'role' => $options['role'],
]);
}
@@ -108,8 +88,7 @@ class PersonDocumentType extends AbstractType
'data_class' => Document::class,
]);
- $resolver->setRequired(['role', 'center'])
- ->setAllowedTypes('role', ['string'])
- ->setAllowedTypes('center', [\Chill\MainBundle\Entity\Center::class]);
+ $resolver->setRequired(['role'])
+ ->setAllowedTypes('role', ['string']);
}
}
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_delete_form.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_delete_form.html.twig
deleted file mode 100644
index 90ee734e0..000000000
--- a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/_delete_form.html.twig
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/delete.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/delete.html.twig
new file mode 100644
index 000000000..a6679829b
--- /dev/null
+++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/delete.html.twig
@@ -0,0 +1,43 @@
+{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
+
+{% set activeRouteKey = '' %}
+
+{% block title %}{{ 'Delete document ?' }}{% endblock %}
+
+{% block docdescription %}
+
+ {{ 'Title'|trans }}
+ {{ document.title }}
+
+ {% if document.scope is not null %}
+ {{ 'Scope' | trans }}
+ {{ document.scope.name | localize_translatable_string }}
+ {% endif %}
+
+ {{ 'Category'|trans }}
+ {{ document.category.name|localize_translatable_string }}
+
+ {{ 'Description' | trans }}
+
+ {% if document.description is empty %}
+ {{ 'Any description'|trans }}
+ {% else %}
+
+ {{ document.description|chill_markdown_to_html }}
+
+ {% endif %}
+
+
+{% endblock %}
+
+{% block content %}
+{{ include('@ChillMain/Util/confirmation_template.html.twig',
+ {
+ 'title' : 'Delete document ?'|trans,
+ 'display_content' : block('docdescription'),
+ 'confirm_question' : 'Are you sure you want to remove this document ?'|trans,
+ 'cancel_route' : 'accompanying_course_document_index',
+ 'cancel_parameters' : {'course' : accompanyingCourse.id, 'id': document.id},
+ 'form' : delete_form
+ } ) }}
+{% endblock %}
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig
index d7a5325cf..0ca5661fc 100644
--- a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig
+++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/edit.html.twig
@@ -25,8 +25,13 @@
{{ 'Back to the list' | trans }}
-
- {{ 'Edit'|trans }}
+ {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_DELETE', document) %}
+
+
+
+ {% endif %}
+
+ {{ 'Edit'|trans }}
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig
index 1e4fdb8e6..45ed3988b 100644
--- a/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig
+++ b/src/Bundle/ChillDocStoreBundle/Resources/views/AccompanyingCourseDocument/show.html.twig
@@ -49,12 +49,9 @@
{{ 'Back to the list' | trans }}
-
- {{ m.download_button(document.object, document.title) }}
-
- {% if chill_document_is_editable(document.object) %}
-
- {{ document.object|chill_document_edit_button }}
+ {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_DELETE', document) %}
+
+
{% endif %}
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
@@ -63,6 +60,14 @@
class="btn btn-edit" title="{{ 'Edit attributes' | trans }}">
{% endif %}
+
+ {{ m.download_button(document.object, document.title) }}
+
+ {% if chill_document_is_editable(document.object) %}
+
+ {{ document.object|chill_document_edit_button }}
+
+ {% endif %}
{% set workflows_frame = chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) %}
{% if workflows_frame is not empty %}
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/List/list_item.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/List/list_item.html.twig
index 5ce03091b..8fbc3fa5c 100644
--- a/src/Bundle/ChillDocStoreBundle/Resources/views/List/list_item.html.twig
+++ b/src/Bundle/ChillDocStoreBundle/Resources/views/List/list_item.html.twig
@@ -44,6 +44,16 @@
{% if document.course is defined %}
+ {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_DELETE', document) %}
+
+
+
+ {% endif %}
+ {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
+
+
+
+ {% endif %}
{% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %}
{{ m.download_button(document.object, document.title) }}
@@ -52,15 +62,20 @@
{% endif %}
- {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %}
-
-
-
- {% endif %}
{{ chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) }}
{% else %}
+ {% if is_granted('CHILL_PERSON_DOCUMENT_DELETE', document) %}
+
+
+
+ {% endif %}
+ {% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
+
+
+
+ {% endif %}
{% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %}
{{ m.download_button(document.object, document.title) }}
@@ -69,13 +84,8 @@
{% endif %}
- {% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %}
-
-
-
- {% endif %}
{% endif %}
-
+
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/delete.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/delete.html.twig
new file mode 100644
index 000000000..e3f6687fd
--- /dev/null
+++ b/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/delete.html.twig
@@ -0,0 +1,43 @@
+{% extends "@ChillPerson/Person/layout.html.twig" %}
+
+{% set activeRouteKey = '' %}
+
+{% block title %}{{ 'Delete document ?' }}{% endblock %}
+
+{% block docdescription %}
+
+ {{ 'Title'|trans }}
+ {{ document.title }}
+
+ {% if document.scope is not null %}
+ {{ 'Scope' | trans }}
+ {{ document.scope.name | localize_translatable_string }}
+ {% endif %}
+
+ {{ 'Category'|trans }}
+ {{ document.category.name|localize_translatable_string }}
+
+ {{ 'Description' | trans }}
+
+ {% if document.description is empty %}
+ {{ 'Any description'|trans }}
+ {% else %}
+
+ {{ document.description|chill_markdown_to_html }}
+
+ {% endif %}
+
+
+{% endblock %}
+
+{% block personcontent %}
+{{ include('@ChillMain/Util/confirmation_template.html.twig',
+ {
+ 'title' : 'Delete document ?'|trans,
+ 'display_content' : block('docdescription'),
+ 'confirm_question' : 'Are you sure you want to remove this document ?'|trans,
+ 'cancel_route' : 'person_document_index',
+ 'cancel_parameters' : {'person' : person.id, 'id': document.id},
+ 'form' : delete_form
+ } ) }}
+{% endblock %}
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/edit.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/edit.html.twig
index 7533f1120..4a9eab8e3 100644
--- a/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/edit.html.twig
+++ b/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/edit.html.twig
@@ -36,20 +36,20 @@
{{ form_row(form.description) }}
{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}
-
+
{{ form_end(form) }}
diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/index.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/index.html.twig
index b3d2baab6..e63538c22 100644
--- a/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/index.html.twig
+++ b/src/Bundle/ChillDocStoreBundle/Resources/views/PersonDocument/index.html.twig
@@ -26,7 +26,17 @@
{% endblock %}
{% block js %}
+ {{ parent() }}
{{ encore_entry_script_tags('mod_async_upload') }}
+ {{ encore_entry_script_tags('mod_docgen_picktemplate') }}
+ {{ encore_entry_script_tags('mod_entity_workflow_pick') }}
+{% endblock %}
+
+{% block css %}
+ {{ parent() }}
+ {{ encore_entry_link_tags('mod_async_upload') }}
+ {{ encore_entry_link_tags('mod_docgen_picktemplate') }}
+ {{ encore_entry_link_tags('mod_entity_workflow_pick') }}
{% endblock %}
{% block personcontent %}
@@ -46,6 +56,8 @@
{{ chill_pagination(pagination) }}
+
+
{% if is_granted('CHILL_PERSON_DOCUMENT_CREATE', person) %}
{% endif %}
- {# {{ include('ChillDocStoreBundle:PersonDocument:_delete_form.html.twig') }} #}
+
+ {{ m.download_button(document.object, document.title) }}
+
+
+ {% if chill_document_is_editable(document.object) %}
+
+ {{ document.object|chill_document_edit_button }}
+
+ {% endif %}
+
+ {# {{ include('ChillDocStoreBundle:PersonDocument:_delete_form.html.twig') }} #}
{% endblock %}
diff --git a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php
index e3cc9c408..3d7b95c61 100644
--- a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php
+++ b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php
@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\DocStoreBundle\Workflow;
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
+use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
@@ -36,6 +37,13 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler
$this->translator = $translator;
}
+ public function getDeletionRoles(): array
+ {
+ return [
+ AccompanyingCourseDocumentVoter::DELETE,
+ ];
+ }
+
public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array
{
$course = $this->getRelatedEntity($entityWorkflow)
@@ -66,6 +74,18 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler
return $this->repository->find($entityWorkflow->getRelatedEntityId());
}
+ /**
+ * @param AccompanyingCourseDocument $object
+ *
+ * @return array[]
+ */
+ public function getRelatedObjects(object $object): array
+ {
+ return [
+ ['entityClass' => AccompanyingCourseDocument::class, 'entityId' => $object->getId()],
+ ];
+ }
+
public function getRoleShow(EntityWorkflow $entityWorkflow): ?string
{
return null;
@@ -84,6 +104,11 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler
];
}
+ public function isObjectSupported(object $object): bool
+ {
+ return $object instanceof AccompanyingCourseDocument;
+ }
+
public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool
{
return $entityWorkflow->getRelatedEntityClass() === AccompanyingCourseDocument::class;
diff --git a/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml b/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml
index f438731d4..009f4d987 100644
--- a/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillDocStoreBundle/translations/messages.fr.yml
@@ -19,6 +19,12 @@ The document is successfully registered: Le document est enregistré
The document is successfully updated: Le document est mis à jour
Any description: Aucune description
+# delete
+Delete document ?: Supprimer le document ?
+Are you sure you want to remove this document ?: Êtes-vous sûr·e de vouloir supprimer ce document ?
+The document is successfully removed: Le document a été supprimé
+
+
# dropzone upload
File too big: Fichier trop volumineux
Drop your file or click here: Cliquez ici ou faites glissez votre nouveau fichier dans cette zone
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php
index 5ad7348ee..09668f0e3 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php
@@ -256,6 +256,13 @@ class ChillMainExtension extends Extension implements
'channels' => ['chill'],
]);
+ $container->prependExtensionConfig('security', [
+ 'access_decision_manager' => [
+ 'strategy' => 'unanimous',
+ 'allow_if_all_abstain' => false,
+ ],
+ ]);
+
//add crud api
$this->prependCruds($container);
}
diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php
index 9de76e039..b978173d9 100644
--- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php
+++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php
@@ -192,7 +192,7 @@ class EntityWorkflowStep
* You should **not** rely on this method to get all users which are able to
* apply a transition on this step. Use @see{EntityWorkflowStep::getAllDestUser} instead.
*/
- public function getDestUser(): collection
+ public function getDestUser(): Collection
{
return $this->destUser;
}
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php b/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php
index 547782943..2580058e8 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php
@@ -16,9 +16,7 @@ use libphonenumber\PhoneNumberUtil;
use Misd\PhoneNumberBundle\Form\Type\PhoneNumberType;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\AbstractType;
-use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use function array_key_exists;
class ChillPhoneNumberType extends AbstractType
{
@@ -37,21 +35,7 @@ class ChillPhoneNumberType extends AbstractType
$resolver
->setDefault('default_region', $this->defaultCarrierCode)
->setDefault('format', PhoneNumberFormat::NATIONAL)
- ->setDefault('type', \libphonenumber\PhoneNumberType::FIXED_LINE_OR_MOBILE)
- ->setNormalizer('attr', function (Options $options, $value) {
- if (array_key_exists('placeholder', $value)) {
- return $value;
- }
-
- $examplePhoneNumber = $this->phoneNumberUtil->getExampleNumberForType($this->defaultCarrierCode, $options['type']);
-
- return array_merge(
- $value,
- [
- 'placeholder' => PhoneNumberUtil::getInstance()->format($examplePhoneNumber, $options['format']),
- ]
- );
- });
+ ->setDefault('type', \libphonenumber\PhoneNumberType::FIXED_LINE_OR_MOBILE);
}
public function getParent()
diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php b/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php
index eeab9c38d..1ed67d967 100644
--- a/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php
+++ b/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php
@@ -27,7 +27,7 @@ interface PhoneNumberHelperInterface
/**
* Get type (mobile, landline, ...) for phone number.
*/
- public function getType(string $phonenumber): string;
+ public function getType(PhoneNumber $phonenumber): string;
/**
* Return true if the validation is configured and available.
diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php
index c73b3dc95..22f580d78 100644
--- a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php
+++ b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php
@@ -17,6 +17,7 @@ use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\ServerException;
use libphonenumber\NumberParseException;
use libphonenumber\PhoneNumber;
+use libphonenumber\PhoneNumberType;
use libphonenumber\PhoneNumberUtil;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Log\LoggerInterface;
@@ -86,9 +87,19 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface
/**
* Get type (mobile, landline, ...) for phone number.
*/
- public function getType(string $phonenumber): string
+ public function getType(PhoneNumber $phonenumber): string
{
- return $this->performTwilioLookup($phonenumber) ?? 'unknown';
+ switch ($this->phoneNumberUtil->getNumberType($phonenumber)) {
+ case PhoneNumberType::MOBILE:
+ return 'mobile';
+
+ case PhoneNumberType::FIXED_LINE:
+ case PhoneNumberType::VOIP:
+ return 'landline';
+
+ default:
+ return 'landline';
+ }
}
/**
diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php
index ab58801fc..a73da74b0 100644
--- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php
+++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php
@@ -55,6 +55,30 @@ class EntityWorkflowRepository implements ObjectRepository
return (int) $qb->getQuery()->getSingleScalarResult();
}
+ public function countRelatedWorkflows(array $relateds): int
+ {
+ $qb = $this->repository->createQueryBuilder('w');
+
+ $orX = $qb->expr()->orX();
+ $i = 0;
+
+ foreach ($relateds as $related) {
+ $orX->add(
+ $qb->expr()->andX(
+ $qb->expr()->eq('w.relatedEntityClass', ':entity_class_' . $i),
+ $qb->expr()->eq('w.relatedEntityId', ':entity_id_' . $i)
+ )
+ );
+ $qb
+ ->setParameter('entity_class_' . $i, $related['entityClass'])
+ ->setParameter('entity_id_' . $i, $related['entityId']);
+ ++$i;
+ }
+ $qb->where($orX);
+
+ return $qb->select('COUNT(w)')->getQuery()->getSingleScalarResult();
+ }
+
public function find($id): ?EntityWorkflow
{
return $this->repository->find($id);
diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss
index 3a9b6df80..248b32cfc 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss
+++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss
@@ -25,7 +25,7 @@ $chill-theme-buttons: (
"notify": $chill-blue,
"search": $gray-300,
"unlink": $chill-red,
- "tpchild": $chill-pink,
+ "tpchild": $chill-green,
);
@each $button, $color in $chill-theme-buttons {
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig
index 6fb3fe2ff..a62f37e0a 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig
@@ -9,6 +9,12 @@
{{ 'Le'|trans ~ ' : ' }}
{{ step.previous.transitionAt|format_datetime('short', 'short') }}
+
+ {{ 'workflow.For'|trans ~ ' : ' }}
+
+ {% for d in step.destUser %}{{ d|chill_entity_render_string }}{% if not loop.last %}, {% endif %}{% endfor %}
+
+
{% else %}
{{ 'workflow.Created by'|trans ~ ' : ' }}
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php
new file mode 100644
index 000000000..079c43c3b
--- /dev/null
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php
@@ -0,0 +1,65 @@
+handlers = $handlers;
+ $this->entityWorkflowRepository = $entityWorkflowRepository;
+ }
+
+ protected function supports($attribute, $subject)
+ {
+ if (!is_object($subject)) {
+ return false;
+ }
+
+ foreach ($this->handlers as $handler) {
+ if ($handler->isObjectSupported($subject)
+ && in_array($attribute, $handler->getDeletionRoles($subject), true)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
+ {
+ foreach ($this->handlers as $handler) {
+ if ($handler->isObjectSupported($subject)) {
+ return 0 === $this->entityWorkflowRepository->countRelatedWorkflows(
+ $handler->getRelatedObjects($subject)
+ );
+ }
+ }
+
+ throw new RuntimeException('no handlers found');
+ }
+}
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php
index 78e8729be..ccb48c160 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php
@@ -113,6 +113,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw
[
'postcode' => $helper->normalize(self::NULL_POSTCODE_COUNTRY, $format, $context),
'country' => $helper->normalize(self::NULL_POSTCODE_COUNTRY, $format, $context),
+ 'lines' => [],
]
);
}
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php
index cb59e6421..3562c1361 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php
@@ -40,6 +40,10 @@ class PhonenumberNormalizer implements NormalizerInterface, DenormalizerInterfac
*/
public function denormalize($data, $type, $format = null, array $context = [])
{
+ if ('' === trim($data)) {
+ return null;
+ }
+
try {
return $this->phoneNumberUtil->parse($data, $this->defaultCarrierCode);
} catch (NumberParseException $e) {
diff --git a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php
index 9620f7cb9..267b2a70b 100644
--- a/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php
+++ b/src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.php
@@ -43,7 +43,7 @@ final class ValidPhonenumber extends ConstraintValidator
return;
}
- if ('' === $value) {
+ if (null === $value) {
return;
}
diff --git a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowHandlerInterface.php b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowHandlerInterface.php
index 93ba4351e..b63546742 100644
--- a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowHandlerInterface.php
+++ b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowHandlerInterface.php
@@ -15,12 +15,19 @@ use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
interface EntityWorkflowHandlerInterface
{
+ /**
+ * @return array|string[]
+ */
+ public function getDeletionRoles(): array;
+
public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array;
public function getEntityTitle(EntityWorkflow $entityWorkflow, array $options = []): string;
public function getRelatedEntity(EntityWorkflow $entityWorkflow): ?object;
+ public function getRelatedObjects(object $object): array;
+
/**
* Return a string representing the role required for seeing the workflow.
*
@@ -33,6 +40,8 @@ interface EntityWorkflowHandlerInterface
public function getTemplateData(EntityWorkflow $entityWorkflow, array $options = []): array;
+ public function isObjectSupported(object $object): bool;
+
public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool;
public function supportsFreeze(EntityWorkflow $entityWorkflow, array $options = []): bool;
diff --git a/src/Bundle/ChillMainBundle/config/services/security.yaml b/src/Bundle/ChillMainBundle/config/services/security.yaml
index b884a92fc..3347871e3 100644
--- a/src/Bundle/ChillMainBundle/config/services/security.yaml
+++ b/src/Bundle/ChillMainBundle/config/services/security.yaml
@@ -75,3 +75,9 @@ services:
$locker: '@Chill\MainBundle\Security\PasswordRecover\PasswordRecoverLocker'
tags:
- { name: security.voter }
+
+ Chill\MainBundle\Security\Authorization\WorkflowEntityDeletionVoter:
+ autoconfigure: true
+ autowire: true
+ arguments:
+ $handlers: !tagged_iterator chill_main.workflow_handler
diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml
index e907f187f..685a0c373 100644
--- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml
@@ -413,6 +413,7 @@ workflow:
Previous workflow without reaction help: Liste des workflows où vous avez été cité comme pouvant réagir à une étape, mais où un autre utilisateur a exécuté une action avant vous.
Previous transitionned: Anciens workflows
Previous workflow transitionned help: Workflows où vous avez exécuté une action.
+ For: Pour
Subscribe final: Recevoir une notification à l'étape finale
diff --git a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php
index f77a4150c..bdc6c1b5e 100644
--- a/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/ResidentialAddressController.php
@@ -13,7 +13,7 @@ namespace Chill\PersonBundle\Controller;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\Person\ResidentialAddress;
-use Chill\PersonBundle\Form\Type\ResidentialAddressType;
+use Chill\PersonBundle\Form\ResidentialAddressType;
use Chill\PersonBundle\Repository\ResidentialAddressRepository;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php b/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php
index cb82f766a..bfa3760fa 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Person/ResidentialAddress.php
@@ -18,8 +18,8 @@ use Chill\PersonBundle\Repository\ResidentialAddressRepository;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
-use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\Context;
+use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=ResidentialAddressRepository::class)
@@ -49,7 +49,7 @@ class ResidentialAddress
* @ORM\ManyToOne(targetEntity=Person::class)
* @ORM\JoinColumn(nullable=true)
* @Groups({"read"})
- * @Context(normalizationContext={"groups"={"minimal"}})
+ * @Context(normalizationContext={"groups": {"minimal"}})
*/
private ?Person $hostPerson = null;
diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php b/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php
index 400e39c88..7f0e28ddb 100644
--- a/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php
+++ b/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php
@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
+use libphonenumber\PhoneNumber;
/**
* Person Phones.
@@ -51,9 +52,9 @@ class PersonPhone
private Person $person;
/**
- * @ORM\Column(type="text", length=40, nullable=false)
+ * @ORM\Column(type="phone_number", nullable=false)
*/
- private string $phonenumber = '';
+ private ?PhoneNumber $phonenumber = null;
/**
* @ORM\Column(type="text", length=40, nullable=true)
@@ -85,7 +86,7 @@ class PersonPhone
return $this->person;
}
- public function getPhonenumber(): string
+ public function getPhonenumber(): ?PhoneNumber
{
return $this->phonenumber;
}
@@ -97,7 +98,8 @@ class PersonPhone
public function isEmpty(): bool
{
- return empty($this->getDescription()) && empty($this->getPhonenumber());
+ return ('' === $this->getDescription() || null === $this->getDescription())
+ && null === $this->getPhonenumber();
}
public function setDate(DateTime $date): void
@@ -115,7 +117,7 @@ class PersonPhone
$this->person = $person;
}
- public function setPhonenumber(string $phonenumber): void
+ public function setPhonenumber(?PhoneNumber $phonenumber): void
{
$this->phonenumber = $phonenumber;
}
diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php
index 1350ae6d8..9349c335e 100644
--- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php
+++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php
@@ -62,6 +62,12 @@ class Evaluation
*/
private array $title = [];
+ /**
+ * @ORM\Column(type="text", nullable=true)
+ * @Serializer\Groups({"read", "docgen:read"})
+ */
+ private ?string $url = null;
+
public function __construct()
{
$this->socialActions = new ArrayCollection();
@@ -101,6 +107,11 @@ class Evaluation
return $this->title;
}
+ public function getUrl(): ?string
+ {
+ return $this->url;
+ }
+
public function removeSocialAction(SocialAction $socialAction): self
{
if ($this->socialActions->contains($socialAction)) {
@@ -130,4 +141,11 @@ class Evaluation
return $this;
}
+
+ public function setUrl(?string $url): self
+ {
+ $this->url = $url;
+
+ return $this;
+ }
}
diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php
index acc65c6ac..68ebd3ef4 100644
--- a/src/Bundle/ChillPersonBundle/Form/PersonType.php
+++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php
@@ -27,6 +27,7 @@ use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\PersonPhone;
use Chill\PersonBundle\Form\Type\GenderType;
use Chill\PersonBundle\Form\Type\PersonAltNameType;
+use Chill\PersonBundle\Form\Type\PersonPhoneType;
use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\AbstractType;
@@ -158,7 +159,7 @@ class PersonType extends AbstractType
}
$builder->add('otherPhoneNumbers', ChillCollectionType::class, [
- 'entry_type' => ChillPhoneNumberType::class,
+ 'entry_type' => PersonPhoneType::class,
'button_add_label' => 'Add new phone',
'button_remove_label' => 'Remove phone',
'required' => false,
diff --git a/src/Bundle/ChillPersonBundle/Form/ResidentialAddressType.php b/src/Bundle/ChillPersonBundle/Form/ResidentialAddressType.php
index b34395daf..8efcf091a 100644
--- a/src/Bundle/ChillPersonBundle/Form/ResidentialAddressType.php
+++ b/src/Bundle/ChillPersonBundle/Form/ResidentialAddressType.php
@@ -9,11 +9,12 @@
declare(strict_types=1);
-namespace Chill\PersonBundle\Form\Type;
+namespace Chill\PersonBundle\Form;
use Chill\MainBundle\Form\Type\CommentType;
use Chill\MainBundle\Form\Type\PickAddressType;
use Chill\PersonBundle\Entity\Person\ResidentialAddress;
+use Chill\PersonBundle\Form\Type\PickPersonDynamicType;
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php
index 00243349f..3b1de28c7 100644
--- a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php
+++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php
@@ -11,11 +11,11 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Form\Type;
+use Chill\MainBundle\Form\Type\ChillPhoneNumberType;
use Chill\MainBundle\Phonenumber\PhonenumberHelper;
use Chill\PersonBundle\Entity\PersonPhone;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType;
-use Symfony\Component\Form\Extension\Core\Type\TelType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
@@ -36,7 +36,7 @@ class PersonPhoneType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
- $builder->add('phonenumber', TelType::class, [
+ $builder->add('phonenumber', ChillPhoneNumberType::class, [
'label' => 'Other phonenumber',
'required' => true,
]);
diff --git a/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php b/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php
index b5d64a31a..4e6131de0 100644
--- a/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php
@@ -32,26 +32,11 @@ class ResidentialAddressRepository extends ServiceEntityRepository
parent::__construct($registry, ResidentialAddress::class);
}
- /**
- * @param Person $person
- * @param DateTimeImmutable|null $at
- * @return array|ResidentialAddress[]|null
- */
- public function findCurrentResidentialAddressByPerson(Person $person, ?DateTimeImmutable $at = null): array
- {
- return $this->buildQueryFindCurrentResidentialAddresses($person, $at)
- ->select('ra')
- ->getQuery()
- ->getResult();
- }
-
public function buildQueryFindCurrentResidentialAddresses(Person $person, ?DateTimeImmutable $at = null): QueryBuilder
{
$date = null === $at ? new DateTimeImmutable('today') : $at;
$qb = $this->createQueryBuilder('ra');
-
-
$dateFilter = $qb->expr()->andX(
$qb->expr()->lte('ra.startDate', ':dateIn'),
$qb->expr()->orX(
@@ -69,6 +54,17 @@ class ResidentialAddressRepository extends ServiceEntityRepository
return $qb;
}
+ /**
+ * @return array|ResidentialAddress[]|null
+ */
+ public function findCurrentResidentialAddressByPerson(Person $person, ?DateTimeImmutable $at = null): array
+ {
+ return $this->buildQueryFindCurrentResidentialAddresses($person, $at)
+ ->select('ra')
+ ->getQuery()
+ ->getResult();
+ }
+
// /**
// * @return ResidentialAddress[] Returns an array of ResidentialAddress objects
// */
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss
index 30eadc7b1..92542f178 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss
+++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss
@@ -37,57 +37,68 @@ div.banner {
margin-right: 1em;
}
}
+ .household-link {
+ border: 1px solid white;
+ padding: .05rem .3rem;
+ border-radius: 5px;
+ color: white;
+ cursor: pointer;
+ &:hover {
+ background-color: white;
+ color: $chill-person-context
+ }
+ }
}
}
div.person-view {
- figure.person-details {
- h2 {
- font-family: 'Open Sans';
- font-weight: 600;
- margin-bottom: 0.3em;
- font-variant: small-caps;
- }
- dl {
- margin-top: 0.3em;
- }
- dt {
- font-family: 'Open Sans';
- font-weight: 600;
- }
- dd {
- margin-left: 0;
- }
- /*
- a.sc-button { background-color: $black; padding-top: 0.2em; padding-bottom: 0.2em; }
- */
- }
- /* custom fields on the home page */
- div.custom-fields {
- figure.person-details {
- display: flex;
- flex-flow: row wrap;
- div.cf_title_box:nth-child(4n+1) h2 {
- @extend .chill-red !optional;
- }
- div.cf_title_box:nth-child(4n+2) h2 {
- @extend .chill-green !optional;
- }
- div.cf_title_box:nth-child(4n+3) h2 {
- @extend .chill-orange !optional;
- }
- div.cf_title_box:nth-child(4n+4) h2 {
- @extend .chill-blue !optional;
- }
- div.cf_title_box:nth-child(2n+1) {
- width: 50%;
- margin-right: 40px;
- }
- div.cf_title_box:nth-child(2n+2) {
- width: calc(50% - 40px);
- }
- }
- }
+ figure.person-details {
+ h2 {
+ font-family: 'Open Sans';
+ font-weight: 600;
+ margin-bottom: 0.3em;
+ font-variant: small-caps;
+ }
+ dl {
+ margin-top: 0.3em;
+ }
+ dt {
+ font-family: 'Open Sans';
+ font-weight: 600;
+ }
+ dd {
+ margin-left: 0;
+ }
+ /*
+ a.sc-button { background-color: $black; padding-top: 0.2em; padding-bottom: 0.2em; }
+ */
+ }
+ /* custom fields on the home page */
+ div.custom-fields {
+ figure.person-details {
+ display: flex;
+ flex-flow: row wrap;
+ div.cf_title_box:nth-child(4n+1) h2 {
+ @extend .chill-red !optional;
+ }
+ div.cf_title_box:nth-child(4n+2) h2 {
+ @extend .chill-green !optional;
+ }
+ div.cf_title_box:nth-child(4n+3) h2 {
+ @extend .chill-orange !optional;
+ }
+ div.cf_title_box:nth-child(4n+4) h2 {
+ @extend .chill-blue !optional;
+ }
+ div.cf_title_box:nth-child(2n+1) {
+ width: 50%;
+ margin-right: 40px;
+ }
+ div.cf_title_box:nth-child(2n+2) {
+ width: calc(50% - 40px);
+ }
+ }
+ }
}
/*
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/mod/AccompanyingPeriod/setReferrer.js b/src/Bundle/ChillPersonBundle/Resources/public/mod/AccompanyingPeriod/setReferrer.js
index b73c0afea..939075380 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/mod/AccompanyingPeriod/setReferrer.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/mod/AccompanyingPeriod/setReferrer.js
@@ -19,22 +19,21 @@ import {fetchResults} from 'ChillMainAssets/lib/api/apiMethods.js';
*/
document.querySelectorAll('[data-set-referrer-app]').forEach(function (el) {
- let
- periodId = Number.parseInt(el.dataset.setReferrerAccompanyingPeriodId);
-
+ const periodId = Number.parseInt(el.dataset.setReferrerAccompanyingPeriodId);
+ const jobId = Number.parseInt(el.dataset.setReferrerJobId);
const url = `/api/1.0/person/accompanying-course/${periodId}/referrers-suggested.json`;
fetchResults(url).then(suggested => {
-
+ const filteredSuggested = suggested.filter((s) => s.user_job ? s.user_job.id === jobId : false);
const app = createApp({
components: {
SetReferrer,
},
template:
- ' ',
+ ' ',
data() {
return {
- periodId, suggested, original: suggested,
+ periodId, filteredSuggested, original: filteredSuggested,
}
},
methods: {
@@ -56,7 +55,7 @@ document.querySelectorAll('[data-set-referrer-app]').forEach(function (el) {
label.textContent = ref.text;
label.classList.remove('chill-no-data-statement');
- this.suggested = this.original.filter(user => user.id !== ref.id);
+ this.filteredSuggested = this.original.filter(user => user.id !== ref.id);
}
}
});
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue
index e32f9b05e..42f974dd1 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue
@@ -59,14 +59,6 @@
ref="addAddress">
-
-
- {{ $t('action.remove') }}
-
-
@@ -180,22 +172,6 @@ export default {
}
this.$store.commit('setAddressContext', context);
},
- removeAddress() {
- let payload = {
- target: this.context.target.name,
- targetId: this.context.target.id,
- locationStatusTo: 'none'
- };
- //console.log('remove address');
- this.$store.dispatch('updateLocation', payload)
- .catch(({name, violations}) => {
- if (name === 'ValidationException' || name === 'AccessException') {
- violations.forEach((violation) => this.$toast.open({message: violation}));
- } else {
- this.$toast.open({message: 'An error occurred'})
- }
- });
- },
displayErrors() {
return this.$refs.addAddress.errorMsg;
},
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue
index 8d897da13..37321e0bb 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue
@@ -170,7 +170,9 @@ export default {
console.log('data', payload.data)
body.name = payload.data.name;
body.email = payload.data.email;
- body.telephone = payload.data.phonenumber;
+ body.telephone = payload.data.telephone;
+ body.civility = payload.data.civility;
+ body.profession = payload.data.profession;
body.address = payload.data.address ? { id: payload.data.address.address_id } : null;
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue
index 579d0b306..8ea3ecec2 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue
@@ -5,6 +5,11 @@
{{ evaluation.evaluation.title.fr }}
+
+
@@ -21,7 +26,7 @@
>
-
+
@@ -93,6 +98,19 @@ export default {
pickedEvaluations() {
return this.$store.state.evaluationsPicked;
},
+ canDelete() {
+ if (this.evaluation.workflows.length > 0) {
+ return false;
+ }
+
+ for (let doc of this.evaluation.documents) {
+ if (doc.workflows.length > 0) {
+ return false;
+ }
+ }
+
+ return true;
+ },
},
methods: {
removeEvaluation(e) {
@@ -128,4 +146,11 @@ export default {
}
}
}
+ div.item-url {
+ i {
+ color: unset!important;
+ margin-left: 1rem;
+ margin-right: 0.5rem;
+ }
+ }
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
index b077cfefa..24e1c202f 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
@@ -101,7 +101,7 @@
-
+
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue
index 3d3675c73..38418f305 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AccompanyingPeriod/SetReferrer.vue
@@ -1,12 +1,12 @@
- {{ r.text }}
+ {{ r.text }}