From 3a3b6ae14c48f21c403c3a8391fd19a53ac1c6d0 Mon Sep 17 00:00:00 2001 From: Jonathan Foucher <jfoucher@gmail.com> Date: Mon, 1 Aug 2022 16:19:51 +0200 Subject: [PATCH] Make collectivity deletion work properly with more cascades and some UI changes. Fixes https://gitlab.adullact.net/soluris/madis/-/issues/532 --- config/domain/user/routes/collectivity.yaml | 10 ++- migrations/Version20220801131224.php | 89 +++++++++++++++++++ migrations/Version20220801135026.php | 73 +++++++++++++++ src/Domain/Documentation/Model/Document.php | 2 +- .../Controller/CollectivityController.php | 43 +++++---- .../ORM/AIPD/Mapping/AnalyseImpact.orm.xml | 8 +- .../Participant.orm.xml | 4 +- .../ConformiteTraitement.orm.xml | 1 - .../ConformiteTraitement/Reponse.orm.xml | 18 ++-- .../ORM/Registry/Mapping/Mesurement.orm.xml | 4 +- .../ORM/Registry/Repository/Contractor.php | 11 +++ .../ORM/Registry/Repository/Mesurement.php | 11 +++ .../ORM/Registry/Repository/Treatment.php | 11 +++ .../Collectivity/delete_processing.html.twig | 45 ++++++---- 14 files changed, 281 insertions(+), 49 deletions(-) create mode 100644 migrations/Version20220801131224.php create mode 100644 migrations/Version20220801135026.php diff --git a/config/domain/user/routes/collectivity.yaml b/config/domain/user/routes/collectivity.yaml index 21eb0ad45..153e3a0eb 100644 --- a/config/domain/user/routes/collectivity.yaml +++ b/config/domain/user/routes/collectivity.yaml @@ -38,12 +38,14 @@ user_collectivity_delete_update_cloned_from: methods: ['POST'] controller: 'App\Domain\User\Controller\CollectivityController:clonedFromOnNullAction' +user_collectivity_delete_process: + path: '/supprimer/{id}/process' + methods: ['POST'] + controller: 'App\Domain\User\Controller\CollectivityController:deleteCollectivityAction' + user_collectivity_delete_related: path: '/supprimer/{id}/{objectType}' methods: ['POST'] controller: 'App\Domain\User\Controller\CollectivityController:deleteRelatedObjectsAction' -user_collectivity_delete_process: - path: '/supprimer/{id}/process' - methods: ['POST'] - controller: 'App\Domain\User\Controller\CollectivityController:deleteCollectivityAction' + diff --git a/migrations/Version20220801131224.php b/migrations/Version20220801131224.php new file mode 100644 index 000000000..f056fe856 --- /dev/null +++ b/migrations/Version20220801131224.php @@ -0,0 +1,89 @@ +<?php + +declare(strict_types=1); + +namespace DoctrineMigrations; + +use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; + +/** + * Auto-generated Migration: Please modify to your needs! + */ +final class Version20220801131224 extends AbstractMigration +{ + public function getDescription() : string + { + return ''; + } + + public function up(Schema $schema) : void + { + // this up() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE aipd_analyse_impact DROP FOREIGN KEY FK_DDAAB0241DE0ECE4'); + $this->addSql('ALTER TABLE aipd_analyse_impact DROP FOREIGN KEY FK_DDAAB02441FBE4EC'); + $this->addSql('ALTER TABLE aipd_analyse_impact DROP FOREIGN KEY FK_DDAAB0246A0D339A'); + $this->addSql('ALTER TABLE aipd_analyse_impact DROP FOREIGN KEY FK_DDAAB024756841F0'); + $this->addSql('ALTER TABLE aipd_analyse_impact ADD CONSTRAINT FK_DDAAB0241DE0ECE4 FOREIGN KEY (avis_responsable_id) REFERENCES aipd_analyse_avis (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE aipd_analyse_impact ADD CONSTRAINT FK_DDAAB02441FBE4EC FOREIGN KEY (avis_dpd_id) REFERENCES aipd_analyse_avis (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE aipd_analyse_impact ADD CONSTRAINT FK_DDAAB0246A0D339A FOREIGN KEY (avis_referent_id) REFERENCES aipd_analyse_avis (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE aipd_analyse_impact ADD CONSTRAINT FK_DDAAB024756841F0 FOREIGN KEY (avis_representant_id) REFERENCES aipd_analyse_avis (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE conformite_traitement_reponse DROP FOREIGN KEY FK_6B4E420CEF983B6'); + $this->addSql('ALTER TABLE conformite_traitement_reponse ADD CONSTRAINT FK_6B4E420CEF983B6 FOREIGN KEY (conformite_traitement_id) REFERENCES conformite_traitement (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection DROP FOREIGN KEY FK_A4EBC0E42EA38911'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection DROP FOREIGN KEY FK_A4EBC0E4CF18BB82'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection ADD CONSTRAINT FK_A4EBC0E42EA38911 FOREIGN KEY (mesurement_id) REFERENCES registry_mesurement (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection ADD CONSTRAINT FK_A4EBC0E4CF18BB82 FOREIGN KEY (reponse_id) REFERENCES conformite_traitement_reponse (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection_not_seen DROP FOREIGN KEY FK_C2CDE0802EA38911'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection_not_seen DROP FOREIGN KEY FK_C2CDE080CF18BB82'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection_not_seen ADD CONSTRAINT FK_C2CDE0802EA38911 FOREIGN KEY (mesurement_id) REFERENCES registry_mesurement (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection_not_seen ADD CONSTRAINT FK_C2CDE080CF18BB82 FOREIGN KEY (reponse_id) REFERENCES conformite_traitement_reponse (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE registry_mesurement DROP FOREIGN KEY FK_9CFD1BFAB2CF0654'); + $this->addSql('ALTER TABLE registry_mesurement ADD CONSTRAINT FK_9CFD1BFAB2CF0654 FOREIGN KEY (cloned_from_id) REFERENCES registry_mesurement (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE mesurement_treatment DROP PRIMARY KEY'); + $this->addSql('ALTER TABLE mesurement_treatment ADD PRIMARY KEY (mesurement_id, treatment_id)'); + $this->addSql('ALTER TABLE mesurement_contractor DROP PRIMARY KEY'); + $this->addSql('ALTER TABLE mesurement_contractor ADD PRIMARY KEY (mesurement_id, contractor_id)'); + $this->addSql('ALTER TABLE mesurement_request DROP PRIMARY KEY'); + $this->addSql('ALTER TABLE mesurement_request ADD PRIMARY KEY (mesurement_id, request_id)'); + $this->addSql('ALTER TABLE mesurement_violation DROP PRIMARY KEY'); + $this->addSql('ALTER TABLE mesurement_violation ADD PRIMARY KEY (mesurement_id, violation_id)'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('ALTER TABLE aipd_analyse_impact DROP FOREIGN KEY FK_DDAAB0246A0D339A'); + $this->addSql('ALTER TABLE aipd_analyse_impact DROP FOREIGN KEY FK_DDAAB02441FBE4EC'); + $this->addSql('ALTER TABLE aipd_analyse_impact DROP FOREIGN KEY FK_DDAAB024756841F0'); + $this->addSql('ALTER TABLE aipd_analyse_impact DROP FOREIGN KEY FK_DDAAB0241DE0ECE4'); + $this->addSql('ALTER TABLE aipd_analyse_impact ADD CONSTRAINT FK_DDAAB0246A0D339A FOREIGN KEY (avis_referent_id) REFERENCES aipd_analyse_avis (id)'); + $this->addSql('ALTER TABLE aipd_analyse_impact ADD CONSTRAINT FK_DDAAB02441FBE4EC FOREIGN KEY (avis_dpd_id) REFERENCES aipd_analyse_avis (id)'); + $this->addSql('ALTER TABLE aipd_analyse_impact ADD CONSTRAINT FK_DDAAB024756841F0 FOREIGN KEY (avis_representant_id) REFERENCES aipd_analyse_avis (id)'); + $this->addSql('ALTER TABLE aipd_analyse_impact ADD CONSTRAINT FK_DDAAB0241DE0ECE4 FOREIGN KEY (avis_responsable_id) REFERENCES aipd_analyse_avis (id)'); + $this->addSql('ALTER TABLE conformite_traitement_reponse DROP FOREIGN KEY FK_6B4E420CEF983B6'); + $this->addSql('ALTER TABLE conformite_traitement_reponse ADD CONSTRAINT FK_6B4E420CEF983B6 FOREIGN KEY (conformite_traitement_id) REFERENCES conformite_traitement (id)'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection DROP FOREIGN KEY FK_A4EBC0E4CF18BB82'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection DROP FOREIGN KEY FK_A4EBC0E42EA38911'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection ADD CONSTRAINT FK_A4EBC0E4CF18BB82 FOREIGN KEY (reponse_id) REFERENCES conformite_traitement_reponse (id)'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection ADD CONSTRAINT FK_A4EBC0E42EA38911 FOREIGN KEY (mesurement_id) REFERENCES registry_mesurement (id)'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection_not_seen DROP FOREIGN KEY FK_C2CDE080CF18BB82'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection_not_seen DROP FOREIGN KEY FK_C2CDE0802EA38911'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection_not_seen ADD CONSTRAINT FK_C2CDE080CF18BB82 FOREIGN KEY (reponse_id) REFERENCES conformite_traitement_reponse (id)'); + $this->addSql('ALTER TABLE conformite_traitement_reponse_action_protection_not_seen ADD CONSTRAINT FK_C2CDE0802EA38911 FOREIGN KEY (mesurement_id) REFERENCES registry_mesurement (id)'); + $this->addSql('ALTER TABLE mesurement_contractor DROP PRIMARY KEY'); + $this->addSql('ALTER TABLE mesurement_contractor ADD PRIMARY KEY (contractor_id, mesurement_id)'); + $this->addSql('ALTER TABLE mesurement_request DROP PRIMARY KEY'); + $this->addSql('ALTER TABLE mesurement_request ADD PRIMARY KEY (request_id, mesurement_id)'); + $this->addSql('ALTER TABLE mesurement_treatment DROP PRIMARY KEY'); + $this->addSql('ALTER TABLE mesurement_treatment ADD PRIMARY KEY (treatment_id, mesurement_id)'); + $this->addSql('ALTER TABLE mesurement_violation DROP PRIMARY KEY'); + $this->addSql('ALTER TABLE mesurement_violation ADD PRIMARY KEY (violation_id, mesurement_id)'); + $this->addSql('ALTER TABLE registry_mesurement DROP FOREIGN KEY FK_9CFD1BFAB2CF0654'); + $this->addSql('ALTER TABLE registry_mesurement ADD CONSTRAINT FK_9CFD1BFAB2CF0654 FOREIGN KEY (cloned_from_id) REFERENCES registry_mesurement (id)'); + } +} diff --git a/migrations/Version20220801135026.php b/migrations/Version20220801135026.php new file mode 100644 index 000000000..8195cd25f --- /dev/null +++ b/migrations/Version20220801135026.php @@ -0,0 +1,73 @@ +<?php + +declare(strict_types=1); + +namespace DoctrineMigrations; + +use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; + +/** + * Auto-generated Migration: Please modify to your needs! + */ +final class Version20220801135026 extends AbstractMigration +{ + public function getDescription() : string + { + return ''; + } + + public function up(Schema $schema) : void + { + // this up() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + $this->addSql('ALTER TABLE registry_conformite_organisation_participant DROP FOREIGN KEY FK_24A83582456C5646'); + $this->addSql('ALTER TABLE registry_conformite_organisation_participant ADD CONSTRAINT FK_24A83582456C5646 FOREIGN KEY (evaluation_id) REFERENCES registry_conformite_organisation_evaluation (id) ON DELETE CASCADE'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('CREATE TABLE test_assoc (treatment_id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', treatment_data_category_code VARCHAR(50) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, PRIMARY KEY(treatment_id, treatment_data_category_code)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); + $this->addSql('CREATE TABLE test_registry (id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', creator_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, goal LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, software VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, legal_basis JSON CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json_array)\', legal_basis_justification LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, concerned_people JSON CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json_array)\', recipient_category LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', delay_number INT DEFAULT NULL, delay_period VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, manager VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, security_access_control_check TINYINT(1) NOT NULL, security_access_control_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, security_tracability_check TINYINT(1) NOT NULL, security_tracability_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, security_saving_check TINYINT(1) NOT NULL, security_saving_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, paper_processing TINYINT(1) NOT NULL, security_update_check TINYINT(1) NOT NULL, security_update_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, security_other_check TINYINT(1) NOT NULL, security_other_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, delay_other_delay TINYINT(1) NOT NULL, delay_comment LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, data_category_other LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, systematic_monitoring TINYINT(1) NOT NULL, large_scale_collection TINYINT(1) NOT NULL, vulnerable_people TINYINT(1) NOT NULL, data_crossing TINYINT(1) NOT NULL, completion INT NOT NULL, template TINYINT(1) NOT NULL, template_identifier INT DEFAULT NULL, data_origin VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, observation LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); + $this->addSql('ALTER TABLE admin_duplicated_object CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE duplication_id duplication_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE duplicat_id duplicat_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE admin_duplication CHANGE source_collectivity_id source_collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE aipd_analyse_avis CHANGE analyse_impact_referent_id analyse_impact_referent_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE analyse_impact_dpd_id analyse_impact_dpd_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE analyse_impact_representant_id analyse_impact_representant_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE analyse_impact_responsable_id analyse_impact_responsable_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE date date DATE DEFAULT \'NULL\', CHANGE detail detail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE aipd_analyse_impact CHANGE avis_referent_id avis_referent_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE avis_dpd_id avis_dpd_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE avis_representant_id avis_representant_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE avis_responsable_id avis_responsable_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE conformite_traitement_id conformite_traitement_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE date_validation date_validation DATE DEFAULT \'NULL\''); + $this->addSql('ALTER TABLE aipd_analyse_mesure_protection CHANGE analyse_impact_id analyse_impact_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE reponse reponse VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE aipd_analyse_question_conformite CHANGE analyse_impact_id analyse_impact_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE reponse_conformite_id reponse_conformite_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE texte_conformite texte_conformite VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE texte_non_conformite_majeure texte_non_conformite_majeure VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE texte_non_conformite_mineure texte_non_conformite_mineure VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE justificatif justificatif VARCHAR(510) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE aipd_analyse_scenario_menace CHANGE analyse_impact_id analyse_impact_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE precisions precisions VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE aipd_critere_principe_fondamental CHANGE analyse_impact_id analyse_impact_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE modele_analyse_id modele_analyse_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE justification justification VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE fichier fichier VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE aipd_modele CHANGE authorized_collectivity_types authorized_collectivity_types JSON CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json_array)\''); + $this->addSql('ALTER TABLE aipd_modele_question_conformite CHANGE modele_analyse_id modele_analyse_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE texte_conformite texte_conformite VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE texte_non_conformite_majeure texte_non_conformite_majeure VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE texte_non_conformite_mineure texte_non_conformite_mineure VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE aipd_modele_scenario_menace CHANGE modele_analyse_id modele_analyse_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE precisions precisions VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE conformite_traitement CHANGE traitement_id traitement_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE creator_id creator_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE conformite_traitement_reponse CHANGE question_id question_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE conformite_traitement_id conformite_traitement_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE document CHANGE creator_id creator_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE size size INT DEFAULT NULL'); + $this->addSql('ALTER TABLE maturity CHANGE domain_id domain_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE survey_id survey_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE maturity_answer CHANGE question_id question_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE survey_id survey_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE maturity_question CHANGE domain_id domain_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE maturity_survey CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE creator_id creator_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE notification CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE read_by_id read_by_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE created_by_id created_by_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE registry_conformite_organisation_conformite CHANGE processus_id processus_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE evaluation_id evaluation_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE conformite conformite DOUBLE PRECISION DEFAULT \'NULL\', CHANGE pilote pilote VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE registry_conformite_organisation_evaluation CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE date date DATE DEFAULT \'NULL\''); + $this->addSql('ALTER TABLE registry_conformite_organisation_participant DROP FOREIGN KEY FK_24A83582456C5646'); + $this->addSql('ALTER TABLE registry_conformite_organisation_participant CHANGE evaluation_id evaluation_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE prenom prenom VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE nom_de_famille nom_de_famille VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE civilite civilite VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE fonction fonction VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE registry_conformite_organisation_participant ADD CONSTRAINT FK_24A83582456C5646 FOREIGN KEY (evaluation_id) REFERENCES registry_conformite_organisation_evaluation (id)'); + $this->addSql('ALTER TABLE registry_conformite_organisation_processus CHANGE description description VARCHAR(512) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE registry_conformite_organisation_question CHANGE processus_id processus_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\''); + $this->addSql('ALTER TABLE registry_conformite_organisation_reponse CHANGE question_id question_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE conformite_id conformite_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE reponse reponse INT DEFAULT NULL, CHANGE reponse_raison reponse_raison VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE registry_contractor CHANGE cloned_from_id cloned_from_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE service_id service_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE creator_id creator_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE referent referent VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE address_line_one address_line_one VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE address_line_two address_line_two VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE address_city address_city VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE address_zip_code address_zip_code VARCHAR(5) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE address_mail address_mail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE address_phone_number address_phone_number VARCHAR(10) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_civility dpo_civility VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_first_name dpo_first_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_last_name dpo_last_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_job dpo_job VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_mail dpo_mail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_phone_number dpo_phone_number VARCHAR(10) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_civility legal_manager_civility VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_first_name legal_manager_first_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_last_name legal_manager_last_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_job legal_manager_job VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_mail legal_manager_mail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_phone_number legal_manager_phone_number VARCHAR(10) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE registry_mesurement CHANGE cloned_from_id cloned_from_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE creator_id creator_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE type type VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE cost cost VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE charge charge VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE status status VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE planification_date planification_date DATE DEFAULT \'NULL\', CHANGE comment comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE priority priority VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE manager manager VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE registry_proof CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE creator_id creator_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE deleted_at deleted_at DATETIME DEFAULT \'NULL\' COMMENT \'(DC2Type:datetime_immutable)\''); + $this->addSql('ALTER TABLE registry_request CHANGE service_id service_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE creator_id creator_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE object object VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE other_object other_object VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE reason reason VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE state state VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE state_rejection_reason state_rejection_reason VARCHAR(2048) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE deleted_at deleted_at DATETIME DEFAULT \'NULL\' COMMENT \'(DC2Type:datetime_immutable)\', CHANGE applicant_civility applicant_civility VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE applicant_first_name applicant_first_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE applicant_last_name applicant_last_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE applicant_address applicant_address VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE applicant_mail applicant_mail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE applicant_phone_number applicant_phone_number VARCHAR(10) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_civility concerned_civility VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_first_name concerned_first_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_last_name concerned_last_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_address concerned_address VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_mail concerned_mail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_phone_number concerned_phone_number VARCHAR(10) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_link_with_applicant concerned_link_with_applicant VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE answer_date answer_date DATE DEFAULT \'NULL\', CHANGE answer_type answer_type VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE registry_service CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE name name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE registry_treatment CHANGE cloned_from_id cloned_from_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE service_id service_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE creator_id creator_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE manager manager VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE software software VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_basis legal_basis JSON CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json_array)\', CHANGE data_origin data_origin VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE template_identifier template_identifier INT DEFAULT NULL, CHANGE author author VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE coordonnees_responsable_traitement coordonnees_responsable_traitement VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE collecting_method collecting_method JSON CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json_array)\', CHANGE estimated_concerned_people estimated_concerned_people INT DEFAULT NULL, CHANGE ultimate_fate ultimate_fate VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE delay_number delay_number INT DEFAULT NULL, CHANGE delay_period delay_period VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE security_access_control_comment security_access_control_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE security_tracability_comment security_tracability_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE security_saving_comment security_saving_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE security_update_comment security_update_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE security_other_comment security_other_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_people_particular_comment concerned_people_particular_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_people_user_comment concerned_people_user_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_people_agent_comment concerned_people_agent_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_people_elected_comment concerned_people_elected_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_people_company_comment concerned_people_company_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_people_partner_comment concerned_people_partner_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE concerned_people_other_comment concerned_people_other_comment VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE registry_violation CHANGE service_id service_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE creator_id creator_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE notification notification VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE notification_details notification_details VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE deleted_at deleted_at DATETIME DEFAULT \'NULL\' COMMENT \'(DC2Type:datetime_immutable)\''); + $this->addSql('ALTER TABLE user_collectivity CHANGE website website VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE is_services_enabled is_services_enabled TINYINT(1) DEFAULT \'NULL\', CHANGE address_line_two address_line_two VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_civility legal_manager_civility VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_first_name legal_manager_first_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_last_name legal_manager_last_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_job legal_manager_job VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_mail legal_manager_mail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE legal_manager_phone_number legal_manager_phone_number VARCHAR(10) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE referent_civility referent_civility VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE referent_first_name referent_first_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE referent_last_name referent_last_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE referent_job referent_job VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE referent_mail referent_mail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE referent_phone_number referent_phone_number VARCHAR(10) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_civility dpo_civility VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_first_name dpo_first_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_last_name dpo_last_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_job dpo_job VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_mail dpo_mail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE dpo_phone_number dpo_phone_number VARCHAR(10) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE it_manager_civility it_manager_civility VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE it_manager_first_name it_manager_first_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE it_manager_last_name it_manager_last_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE it_manager_job it_manager_job VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE it_manager_mail it_manager_mail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE it_manager_phone_number it_manager_phone_number VARCHAR(10) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE user_comite_il_contact CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE contact_civility contact_civility VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE contact_first_name contact_first_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE contact_last_name contact_last_name VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE contact_job contact_job VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE contact_mail contact_mail VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE contact_phone_number contact_phone_number VARCHAR(10) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE user_user CHANGE collectivity_id collectivity_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', CHANGE forget_password_token forget_password_token VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT \'NULL\' COLLATE `utf8mb4_unicode_ci`, CHANGE deleted_at deleted_at DATETIME DEFAULT \'NULL\' COMMENT \'(DC2Type:datetime_immutable)\', CHANGE last_login last_login DATETIME DEFAULT \'NULL\' COMMENT \'(DC2Type:datetime_immutable)\', CHANGE api_authorized api_authorized TINYINT(1) DEFAULT \'NULL\', CHANGE document_view document_view TINYINT(1) DEFAULT \'NULL\''); + } +} diff --git a/src/Domain/Documentation/Model/Document.php b/src/Domain/Documentation/Model/Document.php index 6568613cd..a14705387 100644 --- a/src/Domain/Documentation/Model/Document.php +++ b/src/Domain/Documentation/Model/Document.php @@ -136,7 +136,7 @@ class Document private $favoritedUsers; /** - * @ORM\ManyToOne(targetEntity="App\Domain\User\Model\User") + * @ORM\ManyToOne(targetEntity="App\Domain\User\Model\User", cascade={"persist"}) * @ORM\JoinColumn(onDelete="SET NULL") * * @var User|null diff --git a/src/Domain/User/Controller/CollectivityController.php b/src/Domain/User/Controller/CollectivityController.php index 80b22032e..703d50aae 100644 --- a/src/Domain/User/Controller/CollectivityController.php +++ b/src/Domain/User/Controller/CollectivityController.php @@ -27,6 +27,8 @@ namespace App\Domain\User\Controller; use App\Application\Controller\CRUDController; use App\Application\Symfony\Security\UserProvider; use App\Application\Traits\ServersideDatatablesTrait; +use App\Domain\Registry\Model\Mesurement; +use App\Domain\Registry\Model\Treatment; use App\Domain\Registry\Repository as RegistryRepository; use App\Domain\User\Dictionary\CollectivityTypeDictionary; use App\Domain\User\Dictionary\UserRoleDictionary; @@ -86,6 +88,7 @@ class CollectivityController extends CRUDController UserProvider $userProvider, AuthorizationCheckerInterface $authorizationChecker ) { + parent::__construct($entityManager, $translator, $repository, $pdf, $userProvider, $authorizationChecker); $this->router = $router; $this->security = $security; @@ -251,11 +254,18 @@ class CollectivityController extends CRUDController $deletedTreaments = $this->treatmentRepository->findBy(['collectivity' => $object]); foreach ($deletedTreaments as $deletedTreament) { $stringObjects[] = 'Traitement - ' . $deletedTreament->getName(); + /** + * @var Treatment $deletedTreament + */ + $aipds = $deletedTreament->getConformiteTraitement() ? $deletedTreament->getConformiteTraitement()->getAnalyseImpacts() : []; + foreach ($aipds as $aipd) { + $stringObjects[] = 'AIPD - ' . $aipd->__toString(); + } } $deletedContractors = $this->contractorRepository->findBy(['collectivity' => $object]); foreach ($deletedContractors as $deletedContractor) { - $stringObjects[] = 'Sous-traitent - ' . $deletedContractor->getName(); + $stringObjects[] = 'Sous-traitant - ' . $deletedContractor->getName(); } $deletedProofs = $this->proofRepository->findBy(['collectivity' => $object]); @@ -270,6 +280,12 @@ class CollectivityController extends CRUDController $deletedMesurements = $this->mesurementRepository->findBy(['collectivity' => $object]); foreach ($deletedMesurements as $deletedMesurement) { + /** + * @var Mesurement $deletedMesurement + */ + if ($deletedMesurement->getClonedFrom()) { + $stringObjects[] = 'Action de protection - ' . $deletedMesurement->getClonedFrom()->getName(); + } $stringObjects[] = 'Action de protection - ' . $deletedMesurement->getName(); } @@ -304,20 +320,9 @@ class CollectivityController extends CRUDController throw new NotFoundHttpException("No object found with ID '{$id}'"); } - $clonedTreatments = $this->treatmentRepository->findAllByClonedFromCollectivity($object); - foreach ($clonedTreatments as $clonedTreatment) { - $clonedTreatment->setClonedFrom(null); - } - - $clonedMesurements = $this->mesurementRepository->findAllByClonedFromCollectivity($object); - foreach ($clonedMesurements as $clonedMesurement) { - $clonedMesurement->setClonedFrom(null); - } - - $clonedContractors = $this->contractorRepository->findAllByClonedFromCollectivity($object); - foreach ($clonedContractors as $clonedContractor) { - $clonedContractor->setClonedFrom(null); - } + $this->treatmentRepository->resetClonedFromCollectivity($object); + $this->mesurementRepository->resetClonedFromCollectivity($object); + $this->contractorRepository->resetClonedFromCollectivity($object); $this->entityManager->flush(); @@ -352,6 +357,11 @@ class CollectivityController extends CRUDController $this->entityManager->remove($user); } break; + case 'proofs': + foreach ($this->proofRepository->findBy(['collectivity' => $object]) as $proof) { + $this->entityManager->remove($proof); + } + break; } $this->entityManager->flush(); @@ -365,6 +375,9 @@ class CollectivityController extends CRUDController throw new NotFoundHttpException("No object found with ID '{$id}'"); } + $this->entityManager->remove($object); + $this->entityManager->flush(); + $this->addFlash('success', $this->getFlashbagMessage('success', 'delete', $object)); return $this->redirectToRoute($this->getRouteName('list')); diff --git a/src/Infrastructure/ORM/AIPD/Mapping/AnalyseImpact.orm.xml b/src/Infrastructure/ORM/AIPD/Mapping/AnalyseImpact.orm.xml index 4a324f569..279535095 100644 --- a/src/Infrastructure/ORM/AIPD/Mapping/AnalyseImpact.orm.xml +++ b/src/Infrastructure/ORM/AIPD/Mapping/AnalyseImpact.orm.xml @@ -53,26 +53,26 @@ <one-to-one field="avisReferent" target-entity="App\Domain\AIPD\Model\AnalyseAvis"> <cascade> <cascade-persist/> - <cascade-remove/> </cascade> + <join-column on-delete="CASCADE"/> </one-to-one> <one-to-one field="avisDpd" target-entity="App\Domain\AIPD\Model\AnalyseAvis"> <cascade> <cascade-persist/> - <cascade-remove/> </cascade> + <join-column on-delete="CASCADE"/> </one-to-one> <one-to-one field="avisRepresentant" target-entity="App\Domain\AIPD\Model\AnalyseAvis"> <cascade> <cascade-persist/> - <cascade-remove/> </cascade> + <join-column on-delete="CASCADE"/> </one-to-one> <one-to-one field="avisResponsable" target-entity="App\Domain\AIPD\Model\AnalyseAvis"> <cascade> <cascade-persist/> - <cascade-remove/> </cascade> + <join-column on-delete="CASCADE"/> </one-to-one> </entity> </doctrine-mapping> diff --git a/src/Infrastructure/ORM/Registry/Mapping/ConformiteOrganisation/Participant.orm.xml b/src/Infrastructure/ORM/Registry/Mapping/ConformiteOrganisation/Participant.orm.xml index ba7f90f13..591e743b8 100644 --- a/src/Infrastructure/ORM/Registry/Mapping/ConformiteOrganisation/Participant.orm.xml +++ b/src/Infrastructure/ORM/Registry/Mapping/ConformiteOrganisation/Participant.orm.xml @@ -15,7 +15,9 @@ <field name="civilite" column="civilite" nullable="true"/> <field name="fonction" column="fonction" nullable="true"/> - <many-to-one field="evaluation" target-entity="App\Domain\Registry\Model\ConformiteOrganisation\Evaluation" inversed-by="participants"/> + <many-to-one field="evaluation" target-entity="App\Domain\Registry\Model\ConformiteOrganisation\Evaluation" inversed-by="participants"> + <join-column on-delete="CASCADE" /> + </many-to-one> </entity> diff --git a/src/Infrastructure/ORM/Registry/Mapping/ConformiteTraitement/ConformiteTraitement.orm.xml b/src/Infrastructure/ORM/Registry/Mapping/ConformiteTraitement/ConformiteTraitement.orm.xml index 06dcfc7da..f3bbfed9a 100644 --- a/src/Infrastructure/ORM/Registry/Mapping/ConformiteTraitement/ConformiteTraitement.orm.xml +++ b/src/Infrastructure/ORM/Registry/Mapping/ConformiteTraitement/ConformiteTraitement.orm.xml @@ -22,7 +22,6 @@ <one-to-many field="reponses" target-entity="App\Domain\Registry\Model\ConformiteTraitement\Reponse" mapped-by="conformiteTraitement"> <cascade> <cascade-persist/> - <cascade-remove/> </cascade> </one-to-many> <one-to-many field="analyseImpacts" target-entity="App\Domain\AIPD\Model\AnalyseImpact" mapped-by="conformiteTraitement"> diff --git a/src/Infrastructure/ORM/Registry/Mapping/ConformiteTraitement/Reponse.orm.xml b/src/Infrastructure/ORM/Registry/Mapping/ConformiteTraitement/Reponse.orm.xml index 963db8df3..e445890b6 100644 --- a/src/Infrastructure/ORM/Registry/Mapping/ConformiteTraitement/Reponse.orm.xml +++ b/src/Infrastructure/ORM/Registry/Mapping/ConformiteTraitement/Reponse.orm.xml @@ -13,18 +13,24 @@ <field name="conforme" type="boolean"/> <many-to-one field="question" target-entity="App\Domain\Registry\Model\ConformiteTraitement\Question"/> - <many-to-one field="conformiteTraitement" target-entity="App\Domain\Registry\Model\ConformiteTraitement\ConformiteTraitement" inversed-by="reponses" fetch="EAGER"/> - <one-to-many field="analyseQuestionsConformites" target-entity="App\Domain\AIPD\Model\AnalyseQuestionConformite" mapped-by="reponseConformite"/> + <many-to-one field="conformiteTraitement" target-entity="App\Domain\Registry\Model\ConformiteTraitement\ConformiteTraitement" inversed-by="reponses" fetch="EAGER"> + <join-column on-delete="CASCADE" /> + </many-to-one> + <one-to-many field="analyseQuestionsConformites" target-entity="App\Domain\AIPD\Model\AnalyseQuestionConformite" mapped-by="reponseConformite"> + <cascade> + <cascade-remove/> + </cascade> + </one-to-many> <many-to-many field="actionProtections" target-entity="App\Domain\Registry\Model\Mesurement" inversed-by="conformiteTraitementReponses"> <join-table name="conformite_traitement_reponse_action_protection"> - <join-columns><join-column/></join-columns> - <inverse-join-columns><join-column/></inverse-join-columns> + <join-columns><join-column on-delete="CASCADE"/></join-columns> + <inverse-join-columns><join-column on-delete="CASCADE"/></inverse-join-columns> </join-table> </many-to-many> <many-to-many field="actionProtectionsPlanifiedNotSeens" target-entity="App\Domain\Registry\Model\Mesurement"> <join-table name="conformite_traitement_reponse_action_protection_not_seen"> - <join-columns><join-column/></join-columns> - <inverse-join-columns><join-column/></inverse-join-columns> + <join-columns><join-column on-delete="CASCADE"/></join-columns> + <inverse-join-columns><join-column on-delete="CASCADE"/></inverse-join-columns> </join-table> </many-to-many> </entity> diff --git a/src/Infrastructure/ORM/Registry/Mapping/Mesurement.orm.xml b/src/Infrastructure/ORM/Registry/Mapping/Mesurement.orm.xml index 5879858a8..8c6bc54b8 100644 --- a/src/Infrastructure/ORM/Registry/Mapping/Mesurement.orm.xml +++ b/src/Infrastructure/ORM/Registry/Mapping/Mesurement.orm.xml @@ -26,7 +26,9 @@ <order-by-field name="name"/> </order-by> </many-to-many> - <many-to-one field="clonedFrom" target-entity="App\Domain\Registry\Model\Mesurement"/> + <many-to-one field="clonedFrom" target-entity="App\Domain\Registry\Model\Mesurement"> + <join-column on-delete="CASCADE"/> + </many-to-one> <many-to-many field="treatments" inversed-by="mesurements" target-entity="App\Domain\Registry\Model\Treatment"> <join-table name="mesurement_treatment"> diff --git a/src/Infrastructure/ORM/Registry/Repository/Contractor.php b/src/Infrastructure/ORM/Registry/Repository/Contractor.php index febb70dd6..f89cdf23c 100644 --- a/src/Infrastructure/ORM/Registry/Repository/Contractor.php +++ b/src/Infrastructure/ORM/Registry/Repository/Contractor.php @@ -232,4 +232,15 @@ class Contractor extends CRUDRepository implements Repository\Contractor ->getResult() ; } + + public function resetClonedFromCollectivity(Collectivity $collectivity) + { + $qb = $this->createQueryBuilder(); + + $qb->leftJoin('o.clonedFrom', 'c') + ->andWhere('c.collectivity = :collectivity') + ->setParameter('collectivity', $collectivity); + + $qb->update(['o.clonedFrom' => null]); + } } diff --git a/src/Infrastructure/ORM/Registry/Repository/Mesurement.php b/src/Infrastructure/ORM/Registry/Repository/Mesurement.php index 5370f1bab..3e093efff 100644 --- a/src/Infrastructure/ORM/Registry/Repository/Mesurement.php +++ b/src/Infrastructure/ORM/Registry/Repository/Mesurement.php @@ -398,4 +398,15 @@ class Mesurement extends CRUDRepository implements Repository\Mesurement return $actions_limit; } + + public function resetClonedFromCollectivity(Collectivity $collectivity) + { + $qb = $this->createQueryBuilder(); + + $qb->leftJoin('o.clonedFrom', 'c') + ->andWhere('c.collectivity = :collectivity') + ->setParameter('collectivity', $collectivity); + + $qb->update(['o.clonedFrom' => null]); + } } diff --git a/src/Infrastructure/ORM/Registry/Repository/Treatment.php b/src/Infrastructure/ORM/Registry/Repository/Treatment.php index 0283f426d..83a398f08 100644 --- a/src/Infrastructure/ORM/Registry/Repository/Treatment.php +++ b/src/Infrastructure/ORM/Registry/Repository/Treatment.php @@ -425,6 +425,17 @@ class Treatment extends CRUDRepository implements Repository\Treatment } } + public function resetClonedFromCollectivity(Collectivity $collectivity) + { + $qb = $this->createQueryBuilder(); + + $qb->leftJoin('o.clonedFrom', 'c') + ->andWhere('c.collectivity = :collectivity') + ->setParameter('collectivity', $collectivity); + + $qb->update(['o.clonedFrom' => null]); + } + public function findAllByClonedFromCollectivity(Collectivity $collectivity) { $qb = $this->createQueryBuilder(); diff --git a/templates/User/Collectivity/delete_processing.html.twig b/templates/User/Collectivity/delete_processing.html.twig index 7c4b9adc1..fa13b378b 100644 --- a/templates/User/Collectivity/delete_processing.html.twig +++ b/templates/User/Collectivity/delete_processing.html.twig @@ -44,19 +44,26 @@ <p>Mise à jour des éléments dupliqués <span id="maj_duplicate"></span></p> <p></p> <p id="todelete_list"> - <b>Suppression des éléments rattachés en cours - <ul> - <li>Suppression des traitements <span id="check_treatments"></span></li> - <li>Suppression des actions de protection <span id="check_mesurements"></span></li> - <li>Suppression des sous-traitants <span id="check_contractors"></span></li> - <li>Suppression des utilisateurs <span id="check_users"></span></li> - </ul> - </b> + <b>Suppression des éléments rattachés en cours</b> + <ul> + <li>Suppression des traitements <span id="check_treatments"></span></li> + <li>Suppression des actions de protection <span id="check_mesurements"></span></li> + <li>Suppression des sous-traitants <span id="check_contractors"></span></li> + <li>Suppression des utilisateurs <span id="check_users"></span></li> + <li>Suppression des preuves <span id="check_proofs"></span></li> + </ul> </p> </div> </div> </div> </div> + <div class="row" id="delete_button" style="display:none"> + <div class="col-xs-12"> + <form method="POST" action="{{ path('user_collectivity_delete_process', { 'id': object.id }) }}"> + <button type="submit" class="btn btn-primary">Supprimer la collectivité</button> + </form> + </div> + </div> {% endblock %} {% block javascripts %} @@ -71,7 +78,8 @@ let flashbag = $('#deletion-status-flashbag'); flashbag.hasClass('alert-warning') && flashbag.removeClass('alert-warning'); flashbag.addClass('alert-success'); - flashbag.html('<strong>Suppression effectuée</strong><br/>Vous pouvez dorénavant fermer cette page.'); + flashbag.html('<strong>Suppression des éléments liés effectuée</strong><br/> Vous pouvez maintenant supprimer la collectivité avec le bouton en bas de page.'); + $('#delete_button').show() }; const majCloned = () => { @@ -81,6 +89,7 @@ method: 'POST', success: function(data, textStatuts, jqXHR) { $(`#maj_duplicate`).html('<i class="fa fa-check text-green"></i>'); + deleteTreatments() }, error: function(jqXHR, textStatus, errorThrown) { $(`#todelete_list`).html('<span>Une erreur est survenue lors de la mise à jour des éléments dupliqués depuis les éléments rattachés à la collectivité {{ object }}<i class="fa fa-times text-red">'); @@ -95,6 +104,7 @@ method: 'POST', success: function(data, textStatuts, jqXHR) { $(`#check_treatments`).html('<i class="fa fa-check text-green"></i>'); + deleteMesurements() }, error: function(jqXHR, textStatus, errorThrown) { $(`#todelete_list`).html('<span>{{ 'registry.treatment.show.delete_related_objects_error'|trans({'%relateds%': 'traitements', '%object%': object}) }}<i class="fa fa-times text-red">'); @@ -108,6 +118,7 @@ method: 'POST', success: function(data, textStatuts, jqXHR) { $(`#check_mesurements`).html('<i class="fa fa-check text-green"></i>'); + deleteContractors() }, error: function(jqXHR, textStatus, errorThrown) { $(`#todelete_list`).html('<span>{{ 'registry.treatment.show.delete_related_objects_error'|trans({'%relateds%': 'actions de protection', '%object%': object}) }}<i class="fa fa-times text-red">'); @@ -122,6 +133,7 @@ method: 'POST', success: function(data, textStatuts, jqXHR) { $(`#check_contractors`).html('<i class="fa fa-check text-green"></i>'); + deleteUsers() }, error: function(jqXHR, textStatus, errorThrown) { $(`#todelete_list`).html('<span>{{ 'registry.treatment.show.delete_related_objects_error'|trans({'%relateds%': 'sous-traitants', '%object%': object}) }}<i class="fa fa-times text-red">'); @@ -135,29 +147,30 @@ method: 'POST', success: function(data, textStatuts, jqXHR) { $(`#check_users`).html('<i class="fa fa-check text-green"></i>'); + deleteProofs() }, error: function(jqXHR, textStatus, errorThrown) { $(`#todelete_list`).html('<span>{{ 'registry.treatment.show.delete_related_objects_error'|trans({'%relateds%': 'sous-traitants', '%object%': object}) }}<i class="fa fa-times text-red">'); }, }) } - const deleteCollectivity = () => { - console.log("Delete users"); + const deleteProofs = () => { + console.log("Delete proofs"); return $.ajax({ - url: '{{ path('user_collectivity_delete_process', { 'id': object.id }) }}', + url: '{{ path('user_collectivity_delete_related', { 'id': object.id, 'objectType': 'proofs' }) }}', method: 'POST', success: function(data, textStatuts, jqXHR) { + $(`#check_proofs`).html('<i class="fa fa-check text-green"></i>'); + showEndingFlashbag() }, error: function(jqXHR, textStatus, errorThrown) { - $(`#todelete_list`).html('<span>{{ 'registry.treatment.show.delete_related_objects_error'|trans({'%relateds%': 'sous-traitants', '%object%': object}) }}<i class="fa fa-times text-red">'); + $(`#todelete_list`).html('<span>{{ 'registry.treatment.show.delete_related_objects_error'|trans({'%relateds%': 'Preuves', '%object%': object}) }}<i class="fa fa-times text-red">'); }, }) } $(document).ready(function() { - majCloned().then(deleteTreatments()).then(deleteMesurements()).then(deleteContractors()).then(deleteUsers()).then( - showEndingFlashbag - ); + majCloned(); }); </script> -- GitLab