Commit 9362ce3c authored by lionel.marie-louise's avatar lionel.marie-louise
Browse files

Update files to SMAGI

parent ed26b596
......@@ -8,7 +8,7 @@
</INDEX>
<INDEX>
<column>custom_n1</column>
<label>Chiffre</label>
<label>custom_n1</label>
<type>float</type>
<img>default_string.gif</img>
</INDEX>
......@@ -50,19 +50,19 @@
</INDEX>
<INDEX>
<column>custom_n2</column>
<label>chiffre 2</label>
<label>custom_n2</label>
<type>float</type>
<img>plus.png</img>
</INDEX>
<INDEX>
<column>custom_f2</column>
<label>chiffre f2</label>
<label>custom_f2</label>
<type>float</type>
<img>plus.png</img>
</INDEX>
<INDEX>
<column>custom_d2</column>
<label>data d2</label>
<label>custom_d2</label>
<type>date</type>
<img>plus.png</img>
</INDEX>
......@@ -237,7 +237,7 @@
</INDEX>
<INDEX>
<column>custom_t10</column>
<label>_EMAIL_FROM_ADDRESS</label>
<label>custom_t10</label>
<type>string</type>
<img>plus.png</img>
</INDEX>
......@@ -249,25 +249,25 @@
</INDEX>
<INDEX>
<column>custom_t11</column>
<label>_EMAIL_TO_ADDRESS</label>
<label>custom_t11</label>
<type>string</type>
<img>plus.png</img>
</INDEX>
<INDEX>
<column>custom_t12</column>
<label>_EMAIL_CC_ADDRESS</label>
<label>custom_t12</label>
<type>string</type>
<img>plus.png</img>
</INDEX>
<INDEX>
<column>custom_t13</column>
<label>_EMAIL_ID</label>
<label>custom_t13</label>
<type>string</type>
<img>plus.png</img>
</INDEX>
<INDEX>
<column>custom_t14</column>
<label>_EMAIL_ACCOUNT</label>
<label>custom_t14</label>
<type>string</type>
<img>plus.png</img>
</INDEX>
......
-- *************************************************************************--
-- --
-- --
-- Model migration script - 19.04 to 20.03 --
-- Model migration script - 19.04_TMA1 to 20.03_TMA1 --
-- --
-- --
-- *************************************************************************--
UPDATE parameters SET param_value_string = '20.03.21' WHERE id = 'database_version';
/*SGAMI-SO DEBUT*/
UPDATE parameters SET param_value_string = '20.03.22_TMA1' WHERE id = 'database_version';
/*SGAMI-SO FIN*/
UPDATE parameters SET description = 'Département par défaut sélectionné dans les autocomplétions de la Base Adresse Nationale' WHERE id = 'defaultDepartment';
......@@ -234,10 +236,20 @@ CREATE TABLE indexing_models_fields
mandatory BOOLEAN NOT NULL,
default_value json,
unit text NOT NULL,
/*SGAMI-SO DEBUT*/
allowed_values jsonb,
/*SGAMI-SO FIN*/
CONSTRAINT indexing_models_fields_pkey PRIMARY KEY (id)
)
WITH (OIDS=FALSE);
/*SGAMI-SO DEBUT*/
CREATE TABLE IF NOT EXISTS procedures (
procedure_id SERIAL NOT NULL,
procedure_label CHARACTER VARYING(256),
CONSTRAINT procedures_key PRIMARY KEY (procedure_id)
);
/*SGAMI-SO FIN*/
/* TAGS */
DO $$ BEGIN
......@@ -822,6 +834,9 @@ END$$;
/* DATA */
TRUNCATE TABLE custom_fields;
INSERT INTO custom_fields (id, label, type, values) VALUES (1, 'Nature', 'select', '["Courrier simple", "Courriel", "Courrier suivi", "Courrier avec AR", "Autre"]');
/*SGAMI-SO DEBUT*/
INSERT INTO custom_fields (id, label, type, values) VALUES (2, 'Référence courrier expéditeur', 'string', '[]');
/*SGAMI-SO FIN*/
SELECT setval('custom_fields_id_seq', (select max(id)+1 from custom_fields), false);
......@@ -884,6 +899,9 @@ INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_val
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'confidentiality', TRUE, null, 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'documentDate', TRUE, null, 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'arrivalDate', TRUE, null, 'mail');
/*SGAMI-SO DEBUT*/
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'indexingCustomField_2', FALSE, '"Référence courrier expéditeur"', 'mail');
/*SGAMI-SO FIN*/
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'subject', TRUE, null, 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'indexingCustomField_1', FALSE, '"Courrier simple"', 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'senders', TRUE, null, 'contact');
......
-- *************************************************************************--
-- --
-- --
-- Model migration script - 20.03.21_TMA1 to 20.03.22_TMA1 --
-- --
-- --
-- *************************************************************************--
/*SGAMI-SO DEBUT*/
CREATE TABLE IF NOT EXISTS procedures (
procedure_id SERIAL NOT NULL,
procedure_label CHARACTER VARYING(256),
CONSTRAINT procedures_key PRIMARY KEY (procedure_id)
);
/*SGAMI-SO FIN*/
DROP TABLE IF EXISTS indexing_models_fields;
CREATE TABLE indexing_models_fields
(
id SERIAL NOT NULL,
model_id INTEGER NOT NULL,
identifier text NOT NULL,
mandatory BOOLEAN NOT NULL,
default_value json,
unit text NOT NULL,
/*SGAMI-SO DEBUT*/
allowed_values jsonb,
/*SGAMI-SO FIN*/
CONSTRAINT indexing_models_fields_pkey PRIMARY KEY (id)
)
WITH (OIDS=FALSE);
INSERT INTO custom_fields (id, label, type, values) VALUES (2, 'Référence courrier expéditeur', 'string', '[]');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'indexingCustomField_2', FALSE, '"Référence courrier expéditeur"', 'mail');
UPDATE parameters SET param_value_string = '20.03.22_TMA1' WHERE id = 'database_version'
\ No newline at end of file
......@@ -31,4 +31,4 @@ php ./migrateContacts.php
php ./migrateTemplates.php
php ./migrateOutgoingTemplate.php
php ./migrateLinkedResources.php
php ./migrateThesaurus.php
php ./migrateThesaurus.php
\ No newline at end of file
......@@ -11,7 +11,7 @@ foreach ($customs as $custom) {
continue;
}
#SGAMI-DEBUT
$idCustomField = 2;
$idCustomField = 3;
#SGAMI-FIN
\SrcCore\models\DatabasePDO::reset();
new \SrcCore\models\DatabasePDO(['customId' => $custom]);
......@@ -81,7 +81,8 @@ foreach ($customs as $custom) {
'type' => $type,
'values' => empty($values) ? '[]' : json_encode(array_values($values))
]);
/*SGAMI-SO DEBUT
Par défaut les champs custom sont desactivéS
if (!empty($indexingModelsId)) {
foreach ($indexingModelsId as $indexingModelId) {
\IndexingModel\models\IndexingModelFieldModel::create([
......@@ -92,7 +93,7 @@ foreach ($customs as $custom) {
]);
}
}
SGAMI-SO FIN*/
$column = (string)$value->column;
$listColunm[] = $column;
$csColumn = "custom_fields->>''{$fieldId}''";
......
......@@ -11,7 +11,7 @@ foreach ($customs as $custom) {
continue;
}
#SGAMI-DEBUT
$idCustomField = 37;
$idCustomField = 38;
#SGAMI-FIN
\SrcCore\models\DatabasePDO::reset();
new \SrcCore\models\DatabasePDO(['customId' => $custom]);
......@@ -21,7 +21,9 @@ foreach ($customs as $custom) {
// Migrate others Field
$migrateToCustom = [
['id' => 'description', 'label' => 'Autres informations', 'customType' => 'string', 'modelId' => [1, 2, 3, 4]],
/* SGAMI-SO DEBUT
['id' => 'external_reference', 'label' => 'Référence courrier expéditeur', 'customType' => 'string', 'modelId' => [1]],
SGAMI-SO FIN */
['id' => 'reference_number', 'label' => 'N° recommandé', 'customType' => 'string', 'modelId' => [1, 2]],
['id' => 'scan_date', 'label' => 'Date de scan', 'customType' => 'date', 'modelId' => [1, 2]],
['id' => 'scan_user', 'label' => 'Utilisateur de scan', 'customType' => 'string', 'modelId' => [1, 2]],
......@@ -58,6 +60,8 @@ foreach ($customs as $custom) {
}
\Basket\models\BasketModel::update(['postSet' => ['basket_clause' => "REPLACE(basket_clause, '{$migration['id']}', '{$csColumn}')"], 'where' => ['1 = ?'], 'data' => [1]]);
/*SGAMI-SO DEBUT
Par défaut les champs custom sont desactivéS
foreach ($migration['modelId'] as $modelId) {
$indexingModels = \IndexingModel\models\IndexingModelModel::get([
'select'=> [1],
......@@ -86,6 +90,7 @@ foreach ($customs as $custom) {
'data' => [$columnValue['res_id']]
]);
}
SGAMI-SO DEBUT*/
$migrated[] = $migration['id'];
#SGAMI-SO debut
......
......@@ -4,24 +4,33 @@ $aDataIncoming['incoming'] = [
'doctype' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'priority' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'confidentiality' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'docDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
/*SGAMI-SO DEBUT*/
'documentDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
/*SGAMI-SO FIN */
'arrivalDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'subject' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'indexingCustomField_1' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'mail'],
/*SGAMI-SO DEBUT*/
'indexingCustomField_2' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'mail'],
/*SGAMI-SO FIN*/
'senders' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'contact'],
'recipients' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'contact'],
'initiator' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
'destination' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
'processLimitDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
'folder' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classement'],
'tags' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classement'],
/*SGAMI-SO DEBUT*/
'folders' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classifying'],
'tags' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classifying'],
/*SGAMI-SO FIN*/
];
$aDataIncoming['outgoing'] = [
'doctype' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'priority' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'confidentiality' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'docDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
/*SGAMI-SO DEBUT*/
'documentDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
/*SGAMI-SO FIN */
'subject' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'indexingCustomField_1' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'mail'],
'senders' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'contact'],
......@@ -29,15 +38,19 @@ $aDataIncoming['outgoing'] = [
'initiator' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
'destination' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
'processLimitDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
'folder' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classement'],
'tags' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classement'],
/*SGAMI-SO DEBUT*/
'folders' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classifying'],
'tags' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classifying'],
/*SGAMI-SO FIN*/
];
$aDataIncoming['internal'] = [
'doctype' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'priority' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'confidentiality' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'docDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
/*SGAMI-SO DEBUT*/
'documentDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
/*SGAMI-SO FIN */
'subject' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'indexingCustomField_1' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'mail'],
'senders' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'contact'],
......@@ -45,14 +58,18 @@ $aDataIncoming['internal'] = [
'initiator' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
'destination' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
'processLimitDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
'folder' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classement'],
'tags' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classement'],
/*SGAMI-SO DEBUT*/
'folders' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classifying'],
'tags' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'classifying'],
/*SGAMI-SO FIN*/
];
$aDataIncoming['ged_doc'] = [
'doctype' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'confidentiality' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'docDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
/*SGAMI-SO DEBUT*/
'documentDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
/*SGAMI-SO FIN */
'subject' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'senders' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'contact'],
'recipients' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'contact'],
......@@ -108,7 +125,9 @@ foreach ($customs as $custom) {
if ($key == 'type_id') {
$doctype = \Doctype\models\DoctypeModel::get(['select' => [1], 'where' => ['type_id = ?', 'enabled = ?'], 'data' => [$field, 'Y']]);
if (!empty($doctype)) {
$datasToImport['doctype']['default_value'] = json_encode($field);
/*SGAMI-SO DEBUT*/
$datasToImport['doctype']['doc'] = json_encode(array($field), JSON_NUMERIC_CHECK);
/*SGAMI-SO FIN*/
}
} elseif ($key == 'priority') {
$priority = \Priority\models\PriorityModel::getById(['select' => [1], 'id' => $field]);
......@@ -125,12 +144,18 @@ foreach ($customs as $custom) {
}
}
foreach ($datasToImport as $id => $defaultValue) {
/*SGAMI-SO DEBUT*/
$field =($defaultValue['default_value'] == '""') ? NULL : ($defaultValue['default_value']);
/*SGAMI-SO FIN*/
\IndexingModel\models\IndexingModelFieldModel::create([
'model_id' => $modelId,
'identifier' => $id,
'mandatory' => $defaultValue['mandatory'],
'default_value' => $defaultValue['default_value'],
'unit' => $defaultValue['unit']
'unit' => $defaultValue['unit'],
/*SGAMI-SO DEBUT*/
'allowed_values'=> empty($defaultValue['doc']) ? NULL : ($defaultValue['doc'])
/*SGAMI-SO FIN*/
]);
}
++$migrated;
......
......@@ -49,7 +49,10 @@ class IndexingModelFieldModel
'identifier' => $args['identifier'],
'mandatory' => $args['mandatory'],
'default_value' => $args['default_value'],
'unit' => $args['unit']
'unit' => $args['unit'],
/*SGAMI-SO DEBUT*/
'allowed_values'=> $args['allowed_values']
/*SGAMI-SO FIN*/
]
]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment