diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 85c3d476c..ddf7fccbe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,6 +29,7 @@ variables: REDIS_URL: redis://redis:6379 # change vendor dir to make the app install into tests/apps COMPOSER_VENDOR_DIR: tests/app/vendor + DEFAULT_CARRIER_CODE: BE stages: - Composer install @@ -78,6 +79,7 @@ psalm_tests: image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4 script: - bin/grumphp run --tasks=psalm + allow_failure: true artifacts: expire_in: 30 min paths: diff --git a/CHANGELOG.md b/CHANGELOG.md index 7168e027f..a38f2ea47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ and this project adheres to * [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) * [person] Add title to AccPeriodWorkEvaluationDocument (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/466) @@ -20,6 +21,13 @@ 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) +* [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) +* [confidential] Fix position of toggle button so it does not cover text nor fall outside of box (no issue) +* [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) ## Test releases @@ -35,7 +43,6 @@ and this project adheres to * [person]: AddPersons: add suggestion of name when creating new person or thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422) * [main] Address: fix small bug: when modifying an address without street (isNoAddress), also check errors if street is an empty string as back-end change null value to empty string for street (and streetNumber) * [main] Address: stronger client-side validation of addresses (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/449) -* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345) * [person] accompanying course: filter suggested entities by open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/415) [activity] can click through the cross icon for removing person in concerned group (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476) [activity] correct associated persons by considering only open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476) @@ -49,10 +56,9 @@ and this project adheres to * [thirdparty_contact]: in search results the 'qualité' is displayed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/465) * [bug]: fix confidential toggle of address in thirdpartyrenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/460) + ## Test releases * Creation of PickCivilityType, and implementation in PersonType and ThirdpartyType -* [renderbox]: Fix display of address (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/462) -* [renderbox]: Add email in personRenderBox, this was not yet displayed. ### test release 2022-02-14 @@ -69,6 +75,7 @@ and this project adheres to * [parcours]: Mes parcours brouillon added to user menu (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/440) * [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414) * [person]: style fix in parcours listing per person. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/432) +* [parcours]: Only the referrer can toggle the intensity of the parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/442) * [household]: display address of current household (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/415) * ajoute un ordre dans les localisation (api) * [pick entity]: fix translations in modal (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/419) @@ -317,6 +324,7 @@ and this project adheres to * add an endpoint for checking permissions. See https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/232 * [activity] for a new activity: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties * [calendar] for a new rdv: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties +* [period] Validation added when period is confidential and confirmed -> user cannot be null. ## Test releases diff --git a/composer b/composer new file mode 100755 index 000000000..0e7ab8212 Binary files /dev/null and b/composer differ diff --git a/composer.json b/composer.json index 2223f65c0..c96738df8 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "league/csv": "^9.7.1", "nyholm/psr7": "^1.4", "ocramius/package-versions": "^1.10", + "odolbeau/phone-number-bundle": "^3.6", "phpoffice/phpspreadsheet": "^1.16", "ramsey/uuid-doctrine": "^1.7", "sensio/framework-extra-bundle": "^5.5", diff --git a/phpstan-types.neon b/phpstan-types.neon index 2cc55255a..ed2de3c91 100644 --- a/phpstan-types.neon +++ b/phpstan-types.neon @@ -295,11 +295,6 @@ parameters: count: 3 path: src/Bundle/ChillMainBundle/Form/Type/DataTransformer/DateIntervalTransformer.php - - - message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Form/Type/DataTransformer/ObjectToIdTransformer.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 2 @@ -325,11 +320,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Timeline/TimelineBuilder.php - - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Validation/Validator/ValidPhonenumber.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/Repository/DocGeneratorTemplateRepository.php b/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php index 5d99efa94..a0ab109fb 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php +++ b/src/Bundle/ChillDocGeneratorBundle/Repository/DocGeneratorTemplateRepository.php @@ -70,6 +70,7 @@ final class DocGeneratorTemplateRepository implements ObjectRepository $builder ->where('t.entity LIKE :entity') + ->andWhere($builder->expr()->eq('t.active', "'TRUE'")) ->setParameter('entity', addslashes($entity)); return $builder 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 }} -
  • - + {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_DELETE', document) %} +
  • + +
  • + {% endif %} +
  • +
  • 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 44bcf5cbc..8fbc3fa5c 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/List/list_item.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/List/list_item.html.twig @@ -24,8 +24,8 @@
    {% if document.date is not null %} -
    - {{ document.createdAt|format_date('short') }} +
    + {{ document.date|format_date('short') }}
    {% endif %}
    @@ -42,41 +42,50 @@
    {{ mmm.createdBy(document) }}
    -
    -
      - {% if document.course is defined %} - {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS', document) %} -
    • - {{ m.download_button(document.object, document.title) }} -
    • -
    • - -
    • - {% endif %} - {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE', document) %} -
    • - -
    • - {% endif %} -
    • - {{ chill_entity_workflow_list('Chill\\DocStoreBundle\\Entity\\AccompanyingCourseDocument', document.id) }} +
        + {% if document.course is defined %} + {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_DELETE', document) %} +
      • +
      • - {% else %} - {% if is_granted('CHILL_PERSON_DOCUMENT_SEE_DETAILS', document) %} -
      • - {{ m.download_button(document.object, document.title) }} -
      • -
      • - -
      • - {% endif %} - {% if is_granted('CHILL_PERSON_DOCUMENT_UPDATE', document) %} -
      • - -
      • - {% endif %} {% 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) }} +
  • +
  • + +
  • + {% 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) }} +
  • +
  • + +
  • + {% 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 }) }} -