Skip to content
Snippets Groups Projects
Verified Commit e27cbd4f authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #11269 TIME 3 migrate old indexing models

parent a64322d5
No related branches found
No related tags found
No related merge requests found
......@@ -3,16 +3,8 @@ installed.lck
apps/maarch_entreprise/xml/config.xml
apps/maarch_entreprise/xml/mailevaConfig.xml
apps/maarch_entreprise/xml/log4php.xml
.vscode/
.phplint-cache
.phplint.yml
*.log
xdelete.sh
test/unitTests/build/
modules/convert/batch/scripts/launch_fulltext_letterbox.sh
modules/convert/batch/scripts/launch_convert_letterbox.sh
modules/convert/batch/config/config_only_indexes.xml
modules/convert/batch/tmp/
modules/visa/xml/remoteSignatoryBooks.xml
dist/
node_modules/
......
......@@ -435,7 +435,6 @@ 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, 'arrivalDate', TRUE, '""', 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'subject', TRUE, '""', 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'indexingCustomField_1', FALSE, '""', 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'indexingCustomField_2', FALSE, '""', 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'senders', TRUE, '""', 'contact');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'getRecipients', FALSE, '""', 'contact');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (1, 'initiator', TRUE, '""', 'process');
......@@ -451,7 +450,6 @@ INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_val
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'docDate', TRUE, '""', 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'subject', TRUE, '""', 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'indexingCustomField_1', FALSE, '""', 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'indexingCustomField_2', FALSE, '""', 'mail');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'senders', FALSE, '""', 'contact');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'getRecipients', TRUE, '""', 'contact');
INSERT INTO indexing_models_fields (model_id, identifier, mandatory, default_value, unit) VALUES (2, 'initiator', TRUE, '""', 'process');
......
......@@ -11,3 +11,5 @@ php ./exportCases.php
php ./exportFileplans.php
php ./exportFolders.php
php ./removeProcessModes.php
php ./migrateCategories.php
php ./migrateOldIndexingModels.php
<?php
$aDataIncoming['incoming'] = [
'doctype' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'priority' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'confidential' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'docDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'arrivalDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'subject' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'indexingCustomField_1' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'mail'],
'senders' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'contact'],
'getRecipients' => ['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'],
];
$aDataIncoming['outgoing'] = [
'doctype' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'priority' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'confidential' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'docDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'subject' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'indexingCustomField_1' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'mail'],
'senders' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'contact'],
'getRecipients' => ['mandatory' => 'true', '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'],
];
$aDataIncoming['internal'] = [
'doctype' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'priority' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'confidential' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'docDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'subject' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'indexingCustomField_1' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'mail'],
'senders' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'contact'],
'getRecipients' => ['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'],
];
$aDataIncoming['ged_doc'] = [
'doctype' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'confidential' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'docDate' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'subject' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'mail'],
'senders' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'contact'],
'getRecipients' => ['mandatory' => 'false', 'default_value' => '""', 'unit' => 'contact'],
'initiator' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
'destination' => ['mandatory' => 'true', 'default_value' => '""', 'unit' => 'process'],
];
require '../../vendor/autoload.php';
chdir('../..');
......@@ -34,6 +94,7 @@ foreach ($customs as $custom) {
if (empty($fieldContent['category_id'])) {
continue;
}
$datasToImport = $aDataIncoming[$fieldContent['category_id']];
$modelId = \IndexingModel\models\IndexingModelModel::create([
'label' => $oldIndexingModel['label'],
......@@ -44,23 +105,36 @@ foreach ($customs as $custom) {
]);
foreach ($fieldContent as $key => $field) {
if (in_array($key, ['type_id', 'priority', 'subject', 'destination'])) {
if ($key == 'type_id') {
$identifier = 'doctype';
} else {
$identifier = $key;
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);
}
\IndexingModel\models\IndexingModelFieldModel::create([
'model_id' => $modelId,
'identifier' => $identifier,
'mandatory' => 'false',
'default_value' => json_encode($field),
'unit' => 'mail'
]);
} elseif ($key == 'priority') {
$priority = \Priority\models\PriorityModel::getById(['select' => [1], 'id' => $field]);
if (!empty($priority)) {
$datasToImport['priority']['default_value'] = json_encode($field);
}
} elseif ($key == 'destination') {
$destination = \Entity\models\EntityModel::get(['select' => ['id'], 'where' => ['entity_id = ?', 'enabled = ?'], 'data' => [$field, 'Y']]);
if (!empty($destination)) {
$datasToImport['destination']['default_value'] = json_encode($destination[0]['id']);
}
} elseif ($key == 'subject') {
$datasToImport['subject']['default_value'] = json_encode($field);
}
}
foreach ($datasToImport as $id => $defaultValue) {
\IndexingModel\models\IndexingModelFieldModel::create([
'model_id' => $modelId,
'identifier' => $id,
'mandatory' => $defaultValue['mandatory'],
'default_value' => $defaultValue['default_value'],
'unit' => $defaultValue['unit']
]);
}
++$migrated;
}
printf("Migration ancien modèles d'indexation (CUSTOM {$custom}) : " . $migrated . " modèle utilisé(s) et migré(s).\n");
printf("Migration anciens modèles d'indexation (CUSTOM {$custom}) : " . $migrated . " modèle(s) utilisé(s) et migré(s).\n");
}
......@@ -12,7 +12,6 @@
namespace Doctype\models;
use SrcCore\models\ValidatorModel;
use SrcCore\models\CoreConfigModel;
use SrcCore\models\DatabaseModel;
class DoctypeModelAbstract
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment