From 524daa895234a276ce2dfaf3103719786b1240b5 Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Fri, 6 Nov 2020 10:28:44 +0100 Subject: [PATCH] FEAT #15350 TIME 0:25 update sql for new version --- README.md | 8 ++--- sql/data_fr.sql | 4 --- sql/delete_all_ressources.sql | 16 +++++++++ sql/m2m_contacts_samples.sql | 36 +++++-------------- sql/reinit_sequences.sql | 5 ++- src/app/group/controllers/GroupController.php | 1 - src/app/user/controllers/UserController.php | 2 +- 7 files changed, 32 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index b3229a378e7..9afb845ce7e 100755 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ # Maarch Courrier Gestionnaire Électronique de Correspondances – Libre et Open Source – -**Dernière version stable V20.03** +**Dernière version stable V20.10** Démonstration : http://demo.maarchcourrier.com/ @@ -24,19 +24,19 @@ Documentation : https://docs.maarch.org/ * Apache2.x * PostgreSQL >= 9.6 -* PHP 7.2. 7.3, 7.4 +* PHP 7.3, 7.4 * Extensions PHP (adaptées à votre version de PHP) : PHP-[XSL](http://php.net/manual/en/book.xsl.php), PHP-[XML-RPC](http://php.net/manual/en/book.xmlrpc.php), PHP-[Gettext](http://php.net/manual/en/b$ * [ImageMagick](http://imagemagick.org/), avec PHP-[ImageMagick](http://php.net/manual/en/book.imagick.php) * [Ghostscript](https://www.ghostscript.com/) * [wkhtmltopdf et wkhtmltoimage](http://wkhtmltopdf.org/downloads.html) * [LibreOffice](http://libreoffice.org/) pour la conversion de documents * [unoconv](https://packages.debian.org/jessie/unoconv) pour la conversion de documents -* Java Runtime Environment >= 7 +* Java Runtime Environment >= 8 ### Recommandations pour le php.ini -error_reporting = E_ALL & ~E_NOTICE +error_reporting = E_ALL & ~E_NOTICE display_errors = On ## Le coin des developpeurs diff --git a/sql/data_fr.sql b/sql/data_fr.sql index c4d09f0a32e..34a8f54ba94 100755 --- a/sql/data_fr.sql +++ b/sql/data_fr.sql @@ -1004,11 +1004,7 @@ INSERT INTO status_images (image_name) VALUES ('fa-lightbulb'); --PARAMETERS ------------ TRUNCATE TABLE parameters; -INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('apa_reservation_batch', NULL, 1, NULL); -INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('workbatch_rec', '', 1, NULL); -INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('folder_id_increment', '', 200, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('work_batch_autoimport_id', NULL, 1, NULL); -INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('postindexing_workbatch', NULL, 1, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('database_version', '20.10.1', NULL, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('user_quota', '', 0, NULL); INSERT INTO parameters (id, description, param_value_string, param_value_int, param_value_date) VALUES ('defaultDepartment', 'Département par défaut sélectionné dans les autocomplétions de la Base Adresse Nationale', NULL, 75, NULL); diff --git a/sql/delete_all_ressources.sql b/sql/delete_all_ressources.sql index 40ebb80266b..6730adc7737 100755 --- a/sql/delete_all_ressources.sql +++ b/sql/delete_all_ressources.sql @@ -58,6 +58,22 @@ ALTER SEQUENCE acknowledgement_receipts_id_seq restart WITH 1; TRUNCATE TABLE emails; ALTER SEQUENCE emails_id_seq restart WITH 1; +TRUNCATE TABLE registered_mail_resources; +ALTER SEQUENCE registered_mail_resources_id_seq restart WITH 1; + +TRUNCATE TABLE resource_contacts; +ALTER SEQUENCE resource_contacts_id_seq restart WITH 1; + +TRUNCATE TABLE resources_folders; +ALTER SEQUENCE resources_folders_id_seq restart WITH 1; + +TRUNCATE TABLE unit_identifier; + +TRUNCATE TABLE users_followed_resources; +ALTER SEQUENCE users_followed_resources_id_seq restart WITH 1; + +TRUNCATE TABLE message_exchange; + TRUNCATE TABLE shippings; ALTER SEQUENCE shippings_id_seq restart WITH 1; diff --git a/sql/m2m_contacts_samples.sql b/sql/m2m_contacts_samples.sql index 9e41c07cbc0..fa465f3a371 100644 --- a/sql/m2m_contacts_samples.sql +++ b/sql/m2m_contacts_samples.sql @@ -1,5 +1,5 @@ DELETE FROM usergroups WHERE group_id = 'MAARCHTOGEC'; -INSERT INTO usergroups (group_id,group_desc,enabled) VALUES ('MAARCHTOGEC', 'Envoi dématérialisé','Y'); +INSERT INTO usergroups (group_id,group_desc) VALUES ('MAARCHTOGEC', 'Envoi dématérialisé'); DELETE FROM usergroups_services WHERE group_id = 'MAARCHTOGEC'; INSERT INTO usergroups_services (group_id, service_id) VALUES ('MAARCHTOGEC', 'manage_numeric_package'); @@ -7,34 +7,16 @@ DELETE FROM security WHERE group_id = 'MAARCHTOGEC'; INSERT INTO security (group_id, coll_id, where_clause, maarch_comment) VALUES ('MAARCHTOGEC', 'letterbox_coll', '1=0', 'Aucun courrier'); DELETE FROM users WHERE user_id = 'cchaplin'; -INSERT INTO users (user_id, password, firstname, lastname, mail, enabled, status, mode) VALUES ('cchaplin', '$2y$10$C.QSslBKD3yNMfRPuZfcaubFwPKiCkqqOUyAdOr5FSGKPaePwuEjG', 'Jean', 'WEBSERVICE', 'info@maarch.org', 'Y', 'OK', 'rest'); -DELETE FROM usergroup_content WHERE user_id = 'cchaplin'; -INSERT INTO usergroup_content (user_id, group_id, role) VALUES ('cchaplin', 'MAARCHTOGEC', ''); +INSERT INTO users (user_id, password, firstname, lastname, mail, status, mode) VALUES ('cchaplin', '$2y$10$C.QSslBKD3yNMfRPuZfcaubFwPKiCkqqOUyAdOr5FSGKPaePwuEjG', 'Jean', 'WEBSERVICE', 'info@maarch.org', 'OK', 'rest'); +DELETE FROM usergroup_content WHERE user_id = 24; +INSERT INTO usergroup_content (user_id, group_id, role) VALUES (24, 11, ''); + +DELETE FROM contacts where id >= 1000000; -DELETE FROM contacts_v2 where contact_id >= 1000000; -DELETE FROM contact_addresses where id >= 1000000; -DELETE FROM contact_communication where contact_id >= 1000000; -- INSTANCE A -INSERT INTO contacts_v2 (contact_id, contact_type, is_corporate_person, is_external_contact, society, user_id, entity_id, creation_date) VALUES -(1000000, 102, 'Y', 'Y', 'Custom 1', 'cchaplin', 'COU', '2019-03-28 21:43:54.97424'); -INSERT INTO contact_addresses (id, contact_id, contact_purpose_id, user_id, entity_id, external_id) -VALUES (1000000, 1000000, 1, 'cchaplin', 'COU', '{"m2m": "org_custom_1"}'); -INSERT INTO contact_communication (contact_id, type, value) -VALUES (1000000, 'url', 'http://cchaplin:maarch@127.0.0.1/MaarchCourrier/cs_custom_1/'); --- INSTANCE B -INSERT INTO contacts_v2 (contact_id, contact_type, is_corporate_person, is_external_contact, society, user_id, entity_id, creation_date) VALUES -(1000001, 102, 'Y', 'Y', 'Custom 2', 'cchaplin', 'COU', '2019-03-28 21:43:54.97424'); -INSERT INTO contact_addresses (id, contact_id, contact_purpose_id, user_id, entity_id, external_id) -VALUES (1000001, 1000001, 1, 'cchaplin', 'COU', '{"m2m": "org_custom_2"}'); -INSERT INTO contact_communication (contact_id, type, value) -VALUES (1000001, 'url', 'http://cchaplin:maarch@127.0.0.1/MaarchCourrier/cs_custom_2/'); --- INSTANCE C -INSERT INTO contacts_v2 (contact_id, contact_type, is_corporate_person, is_external_contact, society, user_id, entity_id, creation_date) VALUES -(1000002, 102, 'Y', 'Y', 'Custom 3', 'cchaplin', 'COU', '2019-03-28 21:43:54.97424'); -INSERT INTO contact_addresses (id, contact_id, contact_purpose_id, user_id, entity_id, external_id) -VALUES (1000002, 1000002, 1, 'cchaplin', 'COU', '{"m2m": "org_custom_2"}'); -INSERT INTO contact_communication (contact_id, type, value) -VALUES (1000002, 'url', 'http://cchaplin:maarch@127.0.0.1/MaarchCourrier/cs_custom_3/'); +INSERT INTO contacts VALUES (1000000, 'title1', 'Custom 1', 'Custom 1', 'Custom 1', NULL, NULL, '13', 'RUE LA PREFECTURE', NULL, NULL, '99000', 'MAARCH LES BAINS', NULL, NULL, NULL, '{"url": "http://cchaplin:maarch@127.0.0.1/MaarchCourrier/cs_custom_1/"}', NULL, 21, '2018-04-18 12:43:54.97424', '2020-03-24 15:06:58.16582', true, NULL, '{"m2m": "org_custom_1"}'); +INSERT INTO contacts VALUES (1000001, 'title1', 'Custom 2', 'Custom 2', 'Custom 2', NULL, NULL, '13', 'RUE LA PREFECTURE', NULL, NULL, '99000', 'MAARCH LES BAINS', NULL, NULL, NULL, '{"url": "http://cchaplin:maarch@127.0.0.1/MaarchCourrier/cs_custom_2/"}', NULL, 21, '2018-04-18 12:43:54.97424', '2020-03-24 15:06:58.16582', true, NULL, '{"m2m": "org_custom_2"}'); +INSERT INTO contacts VALUES (1000002, 'title1', 'Custom 3', 'Custom 3', 'Custom 3', NULL, NULL, '13', 'RUE LA PREFECTURE', NULL, NULL, '99000', 'MAARCH LES BAINS', NULL, NULL, NULL, '{"url": "http://cchaplin:maarch@127.0.0.1/MaarchCourrier/cs_custom_3/"}', NULL, 21, '2018-04-18 12:43:54.97424', '2020-03-24 15:06:58.16582', true, NULL, '{"m2m": "org_custom_3"}'); DO $$ BEGIN diff --git a/sql/reinit_sequences.sql b/sql/reinit_sequences.sql index e64c417d1bd..af7ad90cd09 100755 --- a/sql/reinit_sequences.sql +++ b/sql/reinit_sequences.sql @@ -1,16 +1,15 @@ Select setval('notifications_seq', (select max(notification_sid)+1 from notifications), false); Select setval('res_id_mlb_seq', (select max(res_id)+1 from res_letterbox), false); -Select setval('user_signatures_seq', (select max(id)+1 from user_signatures), false); +Select setval('user_signatures_id_seq', (select max(id)+1 from user_signatures), false); Select setval('templates_seq', (select max(template_id)+1 from templates), false); Select setval('groupbasket_redirect_system_id_seq', (select max(system_id)+1 from groupbasket_redirect), false); Select setval('actions_id_seq', (select max(id)+1 from actions), false); -Select setval('contacts_id_seq', (select max(contact_id)+1 from contacts), false); +Select setval('contacts_id_seq', (select max(id)+1 from contacts), false); select setval('doctypes_type_id_seq', (select max(type_id)+1 from doctypes), false); select setval('doctypes_first_level_id_seq', (select max(doctypes_first_level_id)+1 from doctypes_first_level), false); select setval('doctypes_second_level_id_seq', (select max(doctypes_second_level_id)+1 from doctypes_second_level), false); select setval('res_attachment_res_id_seq', (select max(res_id)+1 from res_attachments), false); -select setval('res_linked_mlb_seq', (select max(id)+1 from res_linked), false); select setval('notif_email_stack_seq', (select max(email_stack_sid)+1 from notif_email_stack), false); select setval('notif_event_stack_seq', (select max(event_stack_sid)+1 from notif_event_stack), false); select setval('notes_id_seq', (select max(id)+1 from notes), false); diff --git a/src/app/group/controllers/GroupController.php b/src/app/group/controllers/GroupController.php index e8dff3dea04..cc1f790cb18 100755 --- a/src/app/group/controllers/GroupController.php +++ b/src/app/group/controllers/GroupController.php @@ -11,7 +11,6 @@ use Respect\Validation\Validator; use Slim\Http\Request; use Slim\Http\Response; use SrcCore\controllers\PreparedClauseController; -use SrcCore\models\CoreConfigModel; use SrcCore\models\ValidatorModel; use User\controllers\UserController; use User\models\UserEntityModel; diff --git a/src/app/user/controllers/UserController.php b/src/app/user/controllers/UserController.php index 0245eda4839..53f412a86eb 100755 --- a/src/app/user/controllers/UserController.php +++ b/src/app/user/controllers/UserController.php @@ -1306,7 +1306,7 @@ class UserController if (!$this->checkNeededParameters(['data' => $data, 'needed' => ['entityId']])) { return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); } - if (empty(Entitymodel::getByEntityId(['entityId' => $data['entityId']]))) { + if (empty(EntityModel::getByEntityId(['entityId' => $data['entityId']]))) { return $response->withStatus(400)->withJson(['errors' => 'Entity not found']); } elseif (UserModel::hasEntity(['id' => $aArgs['id'], 'entityId' => $data['entityId']])) { return $response->withStatus(400)->withJson(['errors' => _USER_ALREADY_LINK_ENTITY]); -- GitLab