diff --git a/migration/20.03/migrateCustomFields.php b/migration/20.03/migrateCustomFields.php old mode 100644 new mode 100755 index fadeaec737de9ef779d7b95d84f4605ab81ab9f3..c5740e7628c9bdb05df13a37f2eeabe70f5f8c4c --- a/migration/20.03/migrateCustomFields.php +++ b/migration/20.03/migrateCustomFields.php @@ -23,7 +23,7 @@ foreach ($customs as $custom) { $loadedXml = simplexml_load_file($path); if ($loadedXml) { - $indexingModels = \IndexingModel\models\IndexingModelModel::get(['select'=> ['id']]); + $indexingModels = \IndexingModel\models\IndexingModelModel::get(['select'=> ['id']]); if (!empty($indexingModels)) { $indexingModelsId = array_column($indexingModels, 'id'); } @@ -78,11 +78,15 @@ foreach ($customs as $custom) { if (!empty($indexingModelsId)) { foreach ($indexingModelsId as $indexingModelId) { - \IndexingModel\models\IndexingModelFieldModel::create([ - 'model_id' => $indexingModelId, - 'identifier' => 'indexingCustomField_'.$fieldId, - 'mandatory' => 'false', - 'unit' => 'mail' + \SrcCore\models\DatabaseModel::insert([ + 'table' => 'indexing_models_fields', + 'columnsValues' => [ + 'model_id' => $indexingModelId, + 'identifier' => 'indexingCustomField_'.$fieldId, + 'mandatory' => 'false', + 'default_value' => null, + 'unit' => 'mail' + ] ]); } } diff --git a/migration/20.03/migrateCustomValues.php b/migration/20.03/migrateCustomValues.php old mode 100644 new mode 100755 index 6f39176284ab03c4b3b7e1ae805ef14ccea553e1..243336734d62e9b85cb8c72c2905f59712d28de2 --- a/migration/20.03/migrateCustomValues.php +++ b/migration/20.03/migrateCustomValues.php @@ -62,11 +62,15 @@ foreach ($customs as $custom) { ]); if (!empty($indexingModels)) { - \IndexingModel\models\IndexingModelFieldModel::create([ - 'model_id' => $modelId, - 'identifier' => 'indexingCustomField_'.$fieldId, - 'mandatory' => 'false', - 'unit' => 'mail' + \SrcCore\models\DatabaseModel::insert([ + 'table' => 'indexing_models_fields', + 'columnsValues' => [ + 'model_id' => $modelId, + 'identifier' => 'indexingCustomField_'.$fieldId, + 'mandatory' => 'false', + 'default_value' => null, + 'unit' => 'mail' + ] ]); } } diff --git a/migration/20.03/migrateOldIndexingModels.php b/migration/20.03/migrateOldIndexingModels.php old mode 100644 new mode 100755 index e3adfc530f6387be0f4bad8b967e6ae7f504138f..304b372debb4dd073b501178b92ba37d86751390 --- a/migration/20.03/migrateOldIndexingModels.php +++ b/migration/20.03/migrateOldIndexingModels.php @@ -125,12 +125,15 @@ foreach ($customs as $custom) { } } 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'] + \SrcCore\models\DatabaseModel::insert([ + 'table' => 'indexing_models_fields', + 'columnsValues' => [ + 'model_id' => $modelId, + 'identifier' => $id, + 'mandatory' => $defaultValue['mandatory'], + 'default_value' => $defaultValue['default_value'], + 'unit' => $defaultValue['unit'] + ] ]); } ++$migrated; diff --git a/src/app/indexingModel/models/IndexingModelFieldModel.php b/src/app/indexingModel/models/IndexingModelFieldModel.php index 0188e201898e9154019a6a011dec99a9618df07a..0e064052126448b969149b6fda889bc7fb59094a 100755 --- a/src/app/indexingModel/models/IndexingModelFieldModel.php +++ b/src/app/indexingModel/models/IndexingModelFieldModel.php @@ -38,7 +38,7 @@ class IndexingModelFieldModel public static function create(array $args) { - ValidatorModel::notEmpty($args, ['model_id', 'mandatory', 'identifier', 'unit']); + ValidatorModel::notEmpty($args, ['model_id', 'enabled', 'mandatory', 'identifier', 'unit']); ValidatorModel::stringType($args, ['enabled', 'mandatory', 'identifier', 'unit']); ValidatorModel::intVal($args, ['model_id']); diff --git a/test/unitTests/app/resource/ResControllerTest.php b/test/unitTests/app/resource/ResControllerTest.php index b87541e0bf915688f45e5a6a66e4f42355b9f06e..7131dc3da5e0b4fa5dea6d009a4e90bb43be86b9 100755 --- a/test/unitTests/app/resource/ResControllerTest.php +++ b/test/unitTests/app/resource/ResControllerTest.php @@ -985,24 +985,28 @@ class ResControllerTest extends TestCase 'model_id' => 1, 'identifier' => 'indexingCustomField_1', 'mandatory' => 'true', + 'enabled ' => 'true', 'unit' => 'mail' ]); \IndexingModel\models\IndexingModelFieldModel::create([ 'model_id' => 1, 'identifier' => 'indexingCustomField_2', 'mandatory' => 'false', + 'enabled ' => 'true', 'unit' => 'mail' ]); \IndexingModel\models\IndexingModelFieldModel::create([ 'model_id' => 1, 'identifier' => 'indexingCustomField_3', 'mandatory' => 'false', + 'enabled ' => 'true', 'unit' => 'mail' ]); \IndexingModel\models\IndexingModelFieldModel::create([ 'model_id' => 1, 'identifier' => 'indexingCustomField_4', 'mandatory' => 'false', + 'enabled ' => 'true', 'unit' => 'mail' ]); diff --git a/test/unitTests/app/resource/SummarySheetControllerTest.php b/test/unitTests/app/resource/SummarySheetControllerTest.php index 5b28bd833b660afef92b9e4aadbb3f1b491c0437..bd03bb6e3e03b72690012d5b7a123f3c64053472 100644 --- a/test/unitTests/app/resource/SummarySheetControllerTest.php +++ b/test/unitTests/app/resource/SummarySheetControllerTest.php @@ -47,6 +47,7 @@ class SummarySheetControllerTest extends TestCase 'model_id' => 1, 'identifier' => 'indexingCustomField_4', 'mandatory' => 'false', + 'enabled ' => 'true', 'unit' => 'mail' ]); @@ -54,6 +55,7 @@ class SummarySheetControllerTest extends TestCase 'model_id' => 1, 'identifier' => 'recipients', 'mandatory' => 'false', + 'enabled ' => 'true', 'unit' => 'mail' ]);