diff --git a/migration/20.10/2010.sql b/migration/20.10/2010.sql index 10c359f7b2cae21e03b13943df914c162de525d9..cb487a89b9684750a19e0bf45bfbbf5896b270fc 100755 --- a/migration/20.10/2010.sql +++ b/migration/20.10/2010.sql @@ -269,6 +269,13 @@ ALTER TABLE configurations RENAME COLUMN service TO privilege; DELETE FROM configurations WHERE privilege = 'admin_search'; INSERT INTO configurations (privilege, value) VALUES ('admin_search', '{"listEvent": {"defaultTab": "dashboard"},"listDisplay":{"templateColumns":6,"subInfos":[{"value":"getPriority","cssClasses":["align_leftData"],"icon":"fa-traffic-light"},{"value":"getCreationAndProcessLimitDates","cssClasses":["align_leftData"],"icon":"fa-calendar"},{"value":"getAssignee","cssClasses":["align_leftData"],"icon":"fa-sitemap"},{"value":"getDoctype","cssClasses":["align_leftData"],"icon":"fa-suitcase"},{"value":"getRecipients","cssClasses":["align_leftData"],"icon":"fa-user"},{"value":"getSenders","cssClasses":["align_leftData"],"icon":"fa-book"}]}}'); + +ALTER TABLE entities DROP COLUMN archival_agency; +ALTER TABLE entities DROP COLUMN archival_agreement; +ALTER TABLE entities DROP COLUMN IF EXISTS producer_service; +ALTER TABLE entities ADD COLUMN producer_service character varying(255); +UPDATE entities SET producer_service = entity_id; + DROP TABLE IF EXISTS search_templates; CREATE TABLE search_templates ( id serial, diff --git a/sql/data_fr.sql b/sql/data_fr.sql index 5748d62b3ec830a0ae20683aac2c2f210c2cc881..62ce7dfac106cfa02d0c61117280bc4a6d801fc7 100755 --- a/sql/data_fr.sql +++ b/sql/data_fr.sql @@ -1625,7 +1625,7 @@ Select setval('templates_association_id_seq', (select max(id)+1 from templates_a UPDATE entities SET business_id = concat('45239273100025/',entity_id); UPDATE entities SET business_id = concat('45239273100025/',entity_id); -UPDATE entities SET archival_agreement = 'MAARCH_LES_BAINS_ACTES_V2'; +-- UPDATE entities SET archival_agreement = 'MAARCH_LES_BAINS_ACTES_V2'; UPDATE doctypes SET retention_final_disposition = 'destruction'; UPDATE doctypes SET retention_rule = 'compta_3_03'; diff --git a/sql/structure.sql b/sql/structure.sql index d65c206108bcdf2c4fe1b943e27144ea7daddb94..d3ba963135150eb820d95d3bec12294aa952a9c0 100755 --- a/sql/structure.sql +++ b/sql/structure.sql @@ -395,8 +395,7 @@ CREATE TABLE entities parent_entity_id character varying(32), entity_type character varying(64), ldap_id character varying(255), - archival_agency character varying(255), - archival_agreement character varying(255), + producer_service character varying(255), folder_import character varying(64), external_id jsonb DEFAULT '{}', CONSTRAINT entities_pkey PRIMARY KEY (entity_id), diff --git a/src/app/entity/controllers/EntityController.php b/src/app/entity/controllers/EntityController.php index 4ec257d297f0058b40dd00e91301150e46b4d2bb..e232c1f3151a70c975085c9f4b8ceb61c87122dd 100755 --- a/src/app/entity/controllers/EntityController.php +++ b/src/app/entity/controllers/EntityController.php @@ -61,6 +61,9 @@ class EntityController return $response->withStatus(400)->withJson(['errors' => 'Entity not found']); } + $entity['producerService'] = $entity['producer_service']; + unset($entity['producer_service']); + $aEntities = EntityModel::getAllowedEntitiesByUserId(['userId' => $GLOBALS['login']]); foreach ($aEntities as $aEntity) { if ($aEntity['entity_id'] == $aArgs['id'] && $aEntity['allowed'] == false) { @@ -235,10 +238,16 @@ class EntityController return $response->withStatus(400)->withJson(['errors' => _CAN_NOT_MOVE_IN_CHILD_ENTITY]); } + if (!empty($body['producerService'])) { + $body['producer_service'] = $body['producerService']; + } else { + $body['producer_service'] = $aArgs['id']; + } + $neededData = [ 'entity_label', 'short_label', 'entity_type', 'adrs_1', 'adrs_2', 'adrs_3', 'zipcode', 'city', 'country', 'email', 'business_id', 'parent_entity_id', - 'ldap_id', 'archival_agreement', 'archival_agency', 'entity_full_name' + 'ldap_id', 'entity_full_name', 'producer_service' ]; foreach ($body as $key => $value) { if (!in_array($key, $neededData)) { @@ -539,7 +548,7 @@ class EntityController $fields = [ 'id', 'entity_id', 'entity_label', 'short_label', 'entity_full_name', 'enabled', 'adrs_1', 'adrs_2', 'adrs_3', 'zipcode', 'city', - 'country', 'email', 'parent_entity_id', 'entity_type', 'business_id', 'archival_agency', 'archival_agreement', 'folder_import' + 'country', 'email', 'parent_entity_id', 'entity_type', 'business_id', 'folder_import', 'producer_service' ]; $csvHead = array_merge($fields, [ 'diffusionList', 'visaCircuit', 'opinionCircuit', 'users', 'templates']); diff --git a/src/app/entity/models/EntityModelAbstract.php b/src/app/entity/models/EntityModelAbstract.php index e74eb9b895c83c38bdb364111a1a42afa3a8dbf5..a86b751dd532ec0099bc8bb6f4a18fc7dcb314bd 100755 --- a/src/app/entity/models/EntityModelAbstract.php +++ b/src/app/entity/models/EntityModelAbstract.php @@ -84,7 +84,7 @@ abstract class EntityModelAbstract ValidatorModel::stringType($aArgs, [ 'entity_id', 'entity_label', 'short_label', 'entity_type', 'adrs_1', 'adrs_2', 'adrs_3', 'zipcode', 'city', 'country', 'email', 'business_id', 'parent_entity_id', - 'ldap_id', 'transferring_agency', 'archival_agreement', 'archival_agency', 'entity_full_name' + 'ldap_id', 'transferring_agency', 'entity_full_name', 'producerService' ]); DatabaseModel::insert([ @@ -104,9 +104,8 @@ abstract class EntityModelAbstract 'parent_entity_id' => $aArgs['parent_entity_id'], 'entity_type' => $aArgs['entity_type'], 'ldap_id' => $aArgs['ldap_id'], - 'archival_agreement' => $aArgs['archival_agreement'], - 'archival_agency' => $aArgs['archival_agency'], 'entity_full_name' => $aArgs['entity_full_name'], + 'producer_service' => $aArgs['producerService'] ] ]);