-
- {{ 'Update third party %name%'|trans({ '%name%': thirdParty.name }) }}
-
- {{ (thirdParty.active ? 'Active' : 'Inactive')|trans }}
-
-
-
- {% if thirdParty.updatedAt != null %}
- {{ 'thirdparty.UpdatedAt.short'|trans ~ thirdParty.updatedAt|format_date('short') }}
- {% else %}
- {{ 'thirdparty.CreatedAt.short'|trans ~ thirdParty.createdAt|format_date('short') }}
- {% endif %}
- {% if thirdParty.updatedBy != null %}
- {{ 'thirdparty.UpdateBy.short'|trans ~ thirdParty.updatedBy.usernameCanonical }}
- {% endif %}
-
{{ form_start(form) }}
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/view.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/view.html.twig
new file mode 100644
index 000000000..460468e98
--- /dev/null
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/view.html.twig
@@ -0,0 +1,139 @@
+{% extends "@ChillMain/layout.html.twig" %}
+
+{% set thirdParty = entity %}
+{% set title_ = 'Show third party %name%'|trans({'%name%' : thirdParty.name }) %}
+
+{% block title title_ %}
+
+{% block content %}
+
+
+ {% embed '@ChillMain/CRUD/_view_content.html.twig' %}
+ {% block crud_content_header %}
+
+ {{ title_ }}
+
+ {{ (thirdParty.active ? 'Active' : 'Inactive')|trans }}
+
+
+ {% endblock %}
+
+ {% block crud_content_view_details %}
+
+
+ - {{ 'Name'|trans }}
+ -
+ {% if thirdParty.isLeaf == true %}{{ thirdParty.civility }}{% endif %}
+ {{ thirdParty.name }}
+
+
+ {% if thirdParty.kind == 'company' %}
+ - {{ 'thirdparty.NameCompany'|trans }}
+ -
+ {% if thirdParty.nameCompany == null %}
+ {{ 'No nameCompany given'|trans }}
+ {% else %}
+ {{ thirdParty.nameCompany }}
+ {% endif %}
+
+
+ - {{ 'thirdparty.Acronym'|trans }}
+ -
+ {% if thirdParty.acronym == null %}
+ {{ 'No acronym given'|trans }}
+ {% else %}
+ {{ thirdParty.acronym }}
+ {% endif %}
+
+ {% endif %}
+
+ - {{ 'Type'|trans }}
+ {% set types = [] %}
+ {% for t in thirdParty.types %}
+ {% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
+ {% endfor %}
+ -
+ {{ types|join(', ') }}
+
+
+ - {{ 'Phonenumber'|trans }}
+ -
+ {% if thirdParty.telephone == null %}
+ {{ 'No phone given'|trans }}
+ {% else %}
+
+ {{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
+
+ {% endif %}
+
+
+ - {{ 'email'|trans }}
-
+
-
+ {% if thirdParty.email == null %}
+ {{ 'No email given'|trans }}
+ {% else %}
+
+ {{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
+
+ {% endif %}
+
+
+ - {{ 'Address'|trans }}
+ -
+ {% if thirdParty.address == null %}
+ {{ 'No address given'|trans }}
+ {% else %}
+ {{ thirdParty.address|chill_entity_render_box({'with_valid_from': false, 'extended_infos': true }) }}
+ {% endif %}
+
+
+ - {{ 'Comment'|trans }}
+ -
+ {% if thirdParty.comment is not empty %}
+
+ {{ thirdParty.comment|chill_markdown_to_html }}
+
+ {% else %}
+ {{ 'Any comment'|trans }}
+ {% endif %}
+
+
+ {% if thirdParty.kind == 'company' %}
+ - {{ 'Contacts'|trans }}
+ -
+ {% if thirdParty.activeChildren|length == 0 %}
+
{{ 'Any contacts associated'|trans }}
+ {% else %}
+
+ {% for tp in thirdParty.activeChildren %}
+
+ {{ tp|chill_entity_render_box({'render': 'bloc', 'addLink': false}) }}
+
+ {% endfor %}
+
+ {% endif %}
+
+ {% endif %}
+
+ - {{ 'Centers'|trans }}
+ -
+ {% set centers = thirdParty|chill_resolve_center %}
+ {% if centers is iterable %}
+ {{ 'The party is visible in those centers'|trans }} :
+ {{ centers|join(', ') }}
+ {% elseif centers is null %}
+ {{ 'The party is not visible in any center'|trans }}
+ {% else %}
+ {{ 'The party is visible in those centers'|trans }} : {{ centers }}
+ {% endif %}
+
+
+
+ {% endblock %}
+ {% block content_form_actions_delete %}{% endblock %}
+ {% block content_view_actions_duplicate_link %}{% endblock %}
+ {% endembed %}
+
+
+{% endblock %}
diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php
index 29a341b1b..47d5cc6b9 100644
--- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php
+++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php
@@ -20,9 +20,14 @@ class ThirdPartyApiSearch implements SearchApiInterface
return (new SearchApiQuery)
->setSelectKey('tparty')
->setSelectJsonbMetadata("jsonb_build_object('id', tparty.id)")
- ->setSelectPertinence("SIMILARITY(?, LOWER(UNACCENT(tparty.name)))", [ $pattern ])
+ ->setSelectPertinence("GREATEST(".
+ "STRICT_WORD_SIMILARITY(LOWER(UNACCENT(?)), tparty.canonicalized),".
+ "(tparty.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%')::int".
+ ")", [ $pattern, $pattern ])
->setFromClause('chill_3party.third_party AS tparty')
- ->setWhereClause('SIMILARITY(LOWER(UNACCENT(?)), LOWER(UNACCENT(tparty.name))) > 0.20', [ $pattern ])
+ ->setWhereClause("tparty.active IS TRUE ".
+ "AND (LOWER(UNACCENT(?)) <<% tparty.canonicalized OR ".
+ "tparty.canonicalized LIKE '%' || LOWER(UNACCENT(?)) || '%')", [ $pattern, $pattern ])
;
}
@@ -33,7 +38,7 @@ class ThirdPartyApiSearch implements SearchApiInterface
public function prepare(array $metadatas): void
{
-
+
}
public function supportsResult(string $key, array $metadatas): bool
diff --git a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php
index b8c3e2827..d821011e5 100644
--- a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php
+++ b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php
@@ -3,6 +3,7 @@
namespace Chill\ThirdPartyBundle\Serializer\Normalizer;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
+use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -12,17 +13,27 @@ class ThirdPartyNormalizer implements NormalizerInterface, NormalizerAwareInterf
{
use NormalizerAwareTrait;
+ private ThirdPartyRender $thirdPartyRender;
+
+ public function __construct(ThirdPartyRender $thirdPartyRender)
+ {
+ $this->thirdPartyRender = $thirdPartyRender;
+ }
+
public function normalize($thirdParty, string $format = null, array $context = [])
{
/** @var $thirdParty ThirdParty */
$data['type'] = 'thirdparty';
- // TODO should be replaced by a "render entity"
- $data['text'] = $thirdParty->getName();
+ $data['text'] = $this->thirdPartyRender->renderString($thirdParty, []);
$data['id'] = $thirdParty->getId();
+ $data['kind'] = $thirdParty->getKind();
$data['address'] = $this->normalizer->normalize($thirdParty->getAddress(), $format,
[ 'address_rendering' => 'short' ]);
$data['phonenumber'] = $thirdParty->getTelephone();
$data['email'] = $thirdParty->getEmail();
+ $data['isChild'] = $thirdParty->isChild();
+ $data['parent'] = $this->normalizer->normalize($thirdParty->getParent(), $format, $context);
+ $data['civility'] = $this->normalizer->normalize($thirdParty->getCivility(), $format, $context);
return $data;
}
diff --git a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php
index 80450f7bb..db53108d4 100644
--- a/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php
+++ b/src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php
@@ -21,6 +21,7 @@
namespace Chill\ThirdPartyBundle\Templating\Entity;
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
+use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Symfony\Component\Templating\EngineInterface;
@@ -32,10 +33,15 @@ class ThirdPartyRender extends AbstractChillEntityRender
{
protected EngineInterface $engine;
+ protected TranslatableStringHelper $translatableStringHelper;
- public function __construct(EngineInterface $engine)
+ public function __construct(
+ EngineInterface $engine,
+ TranslatableStringHelper $translatableStringHelper
+ )
{
$this->engine = $engine;
+ $this->translatableStringHelper = $translatableStringHelper;
}
/**
@@ -55,6 +61,7 @@ class ThirdPartyRender extends AbstractChillEntityRender
'hLevel' => $options['hLevel'] ?? 3,
'customButtons' => $options['customButtons'] ?? [],
'customArea' => $options['customArea'] ?? [],
+ 'showContacts' => $options['showContacts'] ?? [],
];
return
@@ -75,7 +82,18 @@ class ThirdPartyRender extends AbstractChillEntityRender
*/
public function renderString($entity, array $options): string
{
- return $entity->getName();
+ if ($entity->getCivility() !== NULL) {
+ $civility = $this->translatableStringHelper
+ ->localize($entity->getCivility()->getAbbreviation()).' ';
+ } else {
+ $civility = '';
+ }
+ if (!empty($entity->getAcronym())) {
+ $acronym = ' ('.$entity->getAcronym().')';
+ } else {
+ $acronym = '';
+ }
+ return $civility.$entity->getName().$acronym;
}
public function supports($entity, array $options): bool
diff --git a/src/Bundle/ChillThirdPartyBundle/chill.webpack.config.js b/src/Bundle/ChillThirdPartyBundle/chill.webpack.config.js
index a31f8c5fc..c508cbc0c 100644
--- a/src/Bundle/ChillThirdPartyBundle/chill.webpack.config.js
+++ b/src/Bundle/ChillThirdPartyBundle/chill.webpack.config.js
@@ -1,9 +1,12 @@
module.exports = function(encore, entries)
{
- entries.push(__dirname + '/Resources/public/chill/index.js');
-
// Aliases are used when webpack is trying to resolve modules path
encore.addAliases({
ChillThirdPartyAssets: __dirname + '/Resources/public'
});
+
+ encore.addEntry(
+ 'page_3party_3party_index',
+ __dirname + '/Resources/public/page/index/index.js'
+ );
};
diff --git a/src/Bundle/ChillThirdPartyBundle/config/services.yaml b/src/Bundle/ChillThirdPartyBundle/config/services.yaml
index 438ed3ff0..8f9420a67 100644
--- a/src/Bundle/ChillThirdPartyBundle/config/services.yaml
+++ b/src/Bundle/ChillThirdPartyBundle/config/services.yaml
@@ -6,8 +6,3 @@ services:
tags:
- { name: 'serializer.normalizer', priority: 64 }
- Chill\ThirdPartyBundle\Repository\:
- autowire: true
- resource: '../Repository/'
- tags:
- - { name: 'doctrine.repository_service' }
diff --git a/src/Bundle/ChillThirdPartyBundle/config/services/controller.yaml b/src/Bundle/ChillThirdPartyBundle/config/services/controller.yaml
index 14742d406..f10b58314 100644
--- a/src/Bundle/ChillThirdPartyBundle/config/services/controller.yaml
+++ b/src/Bundle/ChillThirdPartyBundle/config/services/controller.yaml
@@ -1,7 +1,5 @@
services:
- Chill\ThirdPartyBundle\Controller\ThirdPartyController:
- arguments:
- $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
- $translator: '@Symfony\Component\Translation\TranslatorInterface'
- $paginatorFactory: '@Chill\MainBundle\Pagination\PaginatorFactory'
- tags: ['controller.service_arguments']
\ No newline at end of file
+ Chill\ThirdPartyBundle\Controller\:
+ resource: './../Controller'
+ autowire: true
+ autoconfigure: true
diff --git a/src/Bundle/ChillThirdPartyBundle/config/services/fixtures.yaml b/src/Bundle/ChillThirdPartyBundle/config/services/fixtures.yaml
index 33583f1aa..40f663e6d 100644
--- a/src/Bundle/ChillThirdPartyBundle/config/services/fixtures.yaml
+++ b/src/Bundle/ChillThirdPartyBundle/config/services/fixtures.yaml
@@ -4,10 +4,6 @@ services:
tags:
- { 'name': doctrine.fixture.orm }
- Chill\ThirdPartyBundle\DataFixtures\ORM\LoadThirdPartyCivility:
- tags:
- - { 'name': doctrine.fixture.orm }
-
Chill\ThirdPartyBundle\DataFixtures\ORM\LoadThirdPartyCategory:
tags:
- { 'name': doctrine.fixture.orm }
diff --git a/src/Bundle/ChillThirdPartyBundle/config/services/repository.yaml b/src/Bundle/ChillThirdPartyBundle/config/services/repository.yaml
new file mode 100644
index 000000000..9d04f86b2
--- /dev/null
+++ b/src/Bundle/ChillThirdPartyBundle/config/services/repository.yaml
@@ -0,0 +1,8 @@
+---
+services:
+ Chill\ThirdPartyBundle\Repository\:
+ autowire: true
+ autoconfigure: true
+ resource: '../Repository/'
+
+ Chill\ThirdPartyBundle\Repository\ThirdPartyACLAwareRepositoryInterface: '@Chill\ThirdPartyBundle\Repository\ThirdPartyACLAwareRepository'
diff --git a/src/Bundle/ChillThirdPartyBundle/config/services/templating.yaml b/src/Bundle/ChillThirdPartyBundle/config/services/templating.yaml
index 6b12d3aa0..0e5a26df2 100644
--- a/src/Bundle/ChillThirdPartyBundle/config/services/templating.yaml
+++ b/src/Bundle/ChillThirdPartyBundle/config/services/templating.yaml
@@ -1,6 +1,6 @@
services:
Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender:
- arguments:
- $engine: '@Symfony\Component\Templating\EngineInterface'
+ autowire: true
+ autoconfigure: true
tags:
- 'chill.render_entity'
diff --git a/src/Bundle/ChillThirdPartyBundle/migrations/Version20211006200924.php b/src/Bundle/ChillThirdPartyBundle/migrations/Version20211006200924.php
new file mode 100644
index 000000000..d35552604
--- /dev/null
+++ b/src/Bundle/ChillThirdPartyBundle/migrations/Version20211006200924.php
@@ -0,0 +1,37 @@
+addSql('ALTER TABLE chill_3party.third_party ADD created_by INT DEFAULT NULL');
+ $this->addSql('ALTER TABLE chill_3party.third_party ALTER created_at TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
+ $this->addSql('ALTER TABLE chill_3party.third_party ALTER created_at DROP DEFAULT');
+ $this->addSql('ALTER TABLE chill_3party.third_party ALTER updated_at TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
+ $this->addSql('ALTER TABLE chill_3party.third_party ALTER updated_at DROP DEFAULT');
+ $this->addSql('COMMENT ON COLUMN chill_3party.third_party.created_at IS \'(DC2Type:datetime_immutable)\'');
+ $this->addSql('COMMENT ON COLUMN chill_3party.third_party.updated_at IS \'(DC2Type:datetime_immutable)\'');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467BDE12AB56 FOREIGN KEY (created_by) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
+ $this->addSql('CREATE INDEX IDX_D952467BDE12AB56 ON chill_3party.third_party (created_by)');
+ }
+
+ public function down(Schema $schema): void
+ {
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP created_by');
+ }
+}
diff --git a/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007150459.php b/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007150459.php
new file mode 100644
index 000000000..fb4f9bed1
--- /dev/null
+++ b/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007150459.php
@@ -0,0 +1,69 @@
+addSql('DROP INDEX chill_3party.uniq_d952467b384d4799');
+ $this->addSql('DROP INDEX chill_3party.uniq_d952467bba930d69');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD civility_id INT DEFAULT NULL');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD profession_id INT DEFAULT NULL');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD kind VARCHAR(20) NOT NULL DEFAULT \'\'');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD canonicalized TEXT NOT NULL DEFAULT \'\'');
+ $this->addSql('CREATE TEMPORARY TABLE civility_migration AS SELECT * FROM chill_3party.party_civility');
+ $this->addSql('ALTER TABLE civility_migration ADD COLUMN new_id INT DEFAULT NULL');
+ $this->addSql('UPDATE civility_migration SET new_id = nextval(\'chill_main_civility_id_seq\')');
+ $this->addSql('
+ INSERT INTO chill_main_civility (id, name, abbreviation, active)
+ SELECT new_id, name, \'{}\'::json, active from civility_migration
+ ');
+ $this->addSql('UPDATE chill_3party.third_party SET civility_id = new_id
+ FROM civility_migration WHERE civility_migration.id = third_party.civility');
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT fk_d952467b384d4799');
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT fk_d952467bba930d69');
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP civility');
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP profession');
+ $this->addSql('DROP SEQUENCE chill_3party.party_civility_id_seq CASCADE');
+ $this->addSql('DROP TABLE chill_3party.party_civility');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467B23D6A298 FOREIGN KEY (civility_id) REFERENCES chill_main_civility (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467BFDEF8996 FOREIGN KEY (profession_id) REFERENCES chill_3party.party_profession (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
+ $this->addSql('CREATE INDEX IDX_D952467B23D6A298 ON chill_3party.third_party (civility_id)');
+ $this->addSql('CREATE INDEX IDX_D952467BFDEF8996 ON chill_3party.third_party (profession_id)');
+ }
+
+ public function down(Schema $schema): void
+ {
+ $this->throwIrreversibleMigrationException('Reversible migration not implemented');
+
+ // for reference:
+ $this->addSql('CREATE SEQUENCE chill_3party.party_civility_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
+ $this->addSql('CREATE TABLE chill_3party.party_civility (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B23D6A298');
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467BFDEF8996');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD civility INT DEFAULT NULL');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD profession INT DEFAULT NULL');
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP civility_id');
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP profession_id');
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP kind');
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP canonicalized');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT fk_d952467b384d4799 FOREIGN KEY (civility) REFERENCES chill_3party.party_civility (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
+ $this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT fk_d952467bba930d69 FOREIGN KEY (profession) REFERENCES chill_3party.party_profession (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
+ $this->addSql('CREATE UNIQUE INDEX uniq_d952467b384d4799 ON chill_3party.third_party (civility)');
+ $this->addSql('CREATE UNIQUE INDEX uniq_d952467bba930d69 ON chill_3party.third_party (profession)');
+ }
+}
diff --git a/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007165001.php b/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007165001.php
new file mode 100644
index 000000000..f58fa1a79
--- /dev/null
+++ b/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007165001.php
@@ -0,0 +1,86 @@
+addSql("
+ UPDATE chill_3party.third_party
+ SET canonicalized =
+ UNACCENT(
+ LOWER(
+ name ||
+ CASE WHEN COALESCE(name_company, '') <> '' THEN ' ' ELSE '' END ||
+ COALESCE(name_company, '') ||
+ CASE WHEN COALESCE(acronym, '') <> '' THEN ' ' ELSE '' END ||
+ COALESCE(acronym, '')
+ )
+ )
+ ");
+ $this->addSql("
+ CREATE OR REPLACE FUNCTION chill_3party.canonicalize() RETURNS TRIGGER
+ LANGUAGE plpgsql
+ AS
+ $$
+ BEGIN
+ NEW.canonicalized =
+ UNACCENT(
+ LOWER(
+ NEW.name ||
+ CASE WHEN COALESCE(NEW.name_company, '') <> '' THEN ' ' ELSE '' END ||
+ COALESCE(NEW.name_company, '') ||
+ CASE WHEN COALESCE(NEW.acronym, '') <> '' THEN ' ' ELSE '' END ||
+ COALESCE(NEW.acronym, '')
+ )
+ )
+ ;
+
+ return NEW;
+ END
+ $$
+ ");
+ $this->addSql("
+ CREATE TRIGGER canonicalize_fullname_on_insert
+ BEFORE INSERT
+ ON chill_3party.third_party
+ FOR EACH ROW
+ EXECUTE procedure chill_3party.canonicalize();
+ ");
+ $this->addSql("
+ CREATE TRIGGER canonicalize_fullname_on_update
+ BEFORE UPDATE
+ ON chill_3party.third_party
+ FOR EACH ROW
+ EXECUTE procedure chill_3party.canonicalize();
+ ");
+ $this->addSql("
+ CREATE INDEX chill_custom_canonicalized_trgm_idx_gist
+ ON chill_3party.third_party USING GIST (canonicalized gist_trgm_ops) WHERE active IS TRUE
+ ");
+ }
+
+ public function down(Schema $schema): void
+ {
+ $this->addSql('DROP TRIGGER canonicalize_fullname_on_update ON chill_3party.third_party');
+ $this->addSql('DROP TRIGGER canonicalize_fullname_on_insert ON chill_3party.third_party');
+ $this->addSql('DROP FUNCTION chill_3party.canonicalize()');
+ $this->addSql("
+ DROP INDEX chill_3party.chill_custom_canonicalized_trgm_idx_gist
+ ");
+ }
+}
diff --git a/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007194942.php b/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007194942.php
new file mode 100644
index 000000000..7a6f5fb76
--- /dev/null
+++ b/src/Bundle/ChillThirdPartyBundle/migrations/Version20211007194942.php
@@ -0,0 +1,29 @@
+addSql('ALTER TABLE chill_3party.third_party ADD contact_data_anonymous BOOLEAN DEFAULT \'false\' NOT NULL;');
+ }
+
+ public function down(Schema $schema): void
+ {
+ $this->addSql('ALTER TABLE chill_3party.third_party DROP contact_data_anonymous');
+ }
+}
diff --git a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml
index 7878ec196..604eafbad 100644
--- a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml
@@ -29,6 +29,17 @@ thirdparty.UpdateBy.short: ' par '
thirdparty.CreatedAt.long: Date de création
thirdparty.UpdatedAt.long: Date de la dernière modification
thirdparty.UpdateBy.long: Utilisateur qui a effectué la dernière modification
+thirdparty.A company: Une institution
+thirdparty.company: Institution
+thirdparty.A contact: Une personne physique
+thirdparty.contact: Personne physique
+thirdparty.a_company_explanation: >-
+ Les institutions peuvent compter un ou plusieurs contacts, interne à l'instution. Il est également possible de
+ leur associer un acronyme, et le nom d'un service.
+thirdparty.a_contact_explanation: >-
+ Les personnes physiques ne disposent pas d'acronyme, de service, ou de contacts sous-jacents.
+thirdparty.Which kind of third party ?: Quel type de tiers souhaitez-vous créer ?
+thirdparty.Contact data are confidential: Données de contact confidentielles
New third party: Ajouter un nouveau tiers
Show third party %name%: Tiers "%name%"
@@ -45,6 +56,10 @@ Inactive, not shown to users: Inactif, invisible pour les utilisateurs
Inactive: Inactif
not shown to users: invisible pour les utilisateurs
Show thirdparty: Voir le tiers
+Add a contact: Ajouter un contact
+Remove a contact: Supprimer
+Contacts: Contacts
+Any contact: Aucun contact
No nameCompany given: Aucune raison sociale renseignée
No acronym given: Aucun sigle renseigné
@@ -52,9 +67,16 @@ No phone given: Aucun téléphone renseigné
No email given: Aucune adresse courriel renseignée
The party is visible in those centers: Le tiers est visible dans ces centres
+The party is not visible in any center: Le tiers n'est associé à aucun centre
No third parties: Aucun tiers
# ROLES
CHILL_3PARTY_3PARTY_CREATE: Ajouter un Tiers
CHILL_3PARTY_3PARTY_SHOW: Voir un Tiers
CHILL_3PARTY_3PARTY_UPDATE: Modifier un Tiers
+
+# crud:
+crud:
+ 3party_3party:
+ index:
+ add_new: Créer