{{ form_label(form.address) }}
{{ form_widget(form.address) }}
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form_thirdparty_children.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form_thirdparty_children.html.twig
new file mode 100644
index 000000000..44f4fc153
--- /dev/null
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/_form_thirdparty_children.html.twig
@@ -0,0 +1,35 @@
+
+{% block _third_party_children_entry_widget %}
+
+
+
+ {{ form_widget(form.civility) }}
+ {{ form_errors(form.civility) }}
+ {{ form_label(form.civility) }}
+
+
+ {{ form_widget(form.name) }}
+ {{ form_errors(form.name) }}
+ {{ form_label(form.name) }}
+
+
+ {{ form_widget(form.profession) }}
+ {{ form_errors(form.profession) }}
+ {{ form_label(form.profession) }}
+
+
+
+
+ {{ form_widget(form.telephone) }}
+ {{ form_errors(form.telephone) }}
+ {{ form_label(form.telephone) }}
+
+
+ {{ form_widget(form.email) }}
+ {{ form_errors(form.email) }}
+ {{ form_label(form.email) }}
+
+
+
+{% endblock %}
+
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig
index e59cdb451..25c1779af 100644
--- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/index.html.twig
@@ -57,7 +57,10 @@
{% for tp in third_parties %}
{{ (tp.active ? '' : '')|raw }} |
- {{ tp.name }} |
+
+ {{ tp.name }}
+ {% if tp.isChild %}{{ 'Contact'|trans }}{% endif %}
+ |
{% set types = [] %}
{% for t in tp.types %}
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
@@ -77,12 +80,14 @@
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}
-
-
+
{% endif %}
{% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %}
-
-
+
{% endif %}
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig
index fe326cc0d..a93d2d30b 100644
--- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/new.html.twig
@@ -1,6 +1,7 @@
{% extends "@ChillMain/layout.html.twig" %}
{% set thirdParty = entity %}
+{% form_theme form '@ChillThirdParty/ThirdParty/_form_thirdparty_children.html.twig' %}
{% block title 'Create third party'|trans %}
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig
index 605d91c73..2cdc3d281 100644
--- a/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/views/ThirdParty/update.html.twig
@@ -1,6 +1,7 @@
{% extends "@ChillMain/layout.html.twig" %}
{% set thirdParty = entity %}
+{% form_theme form '@ChillThirdParty/ThirdParty/_form_thirdparty_children.html.twig' %}
{% block title 'Update third party %name%'|trans({ '%name%': thirdParty.name }) %}
diff --git a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php
index b8c3e2827..cef2d562e 100644
--- a/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php
+++ b/src/Bundle/ChillThirdPartyBundle/Serializer/Normalizer/ThirdPartyNormalizer.php
@@ -23,6 +23,8 @@ class ThirdPartyNormalizer implements NormalizerInterface, NormalizerAwareInterf
[ 'address_rendering' => 'short' ]);
$data['phonenumber'] = $thirdParty->getTelephone();
$data['email'] = $thirdParty->getEmail();
+ $data['isChild'] = $thirdParty->isChild();
+ $data['parent'] = $this->normalizer->normalize($thirdParty->getParent(), $format, $context);
return $data;
}
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/translations/messages.fr.yml b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml
index 7878ec196..83131cc23 100644
--- a/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillThirdPartyBundle/translations/messages.fr.yml
@@ -45,6 +45,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é
@@ -58,3 +62,9 @@ No third parties: Aucun tiers
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