diff --git a/src/app/entity/controllers/EntityController.php b/src/app/entity/controllers/EntityController.php index 271ee9b7713113cbdd123782e427d34c0e18f90a..ae4299df1925e6e02444b538cee7d665171fbe61 100644 --- a/src/app/entity/controllers/EntityController.php +++ b/src/app/entity/controllers/EntityController.php @@ -199,7 +199,16 @@ class EntityController return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); } - unset($data['entity_id']); + $neededData = [ + 'entity_label', 'short_label', 'entity_type', 'adrs_1', 'adrs_2', 'adrs_3', + 'zipcode', 'city', 'country', 'email', 'business_id', 'parent_entity_id', + 'entity_path', 'ldap_id', 'archival_agreement', 'archival_agency', 'entity_full_name' + ]; + foreach ($data as $key => $value) { + if (!in_array($key, $neededData)) { + unset($data[$key]); + } + } EntityModel::update(['set' => $data, 'where' => ['entity_id = ?'], 'data' => [$aArgs['id']]]); HistoryController::add([ 'tableName' => 'entities', diff --git a/src/app/entity/models/EntityModelAbstract.php b/src/app/entity/models/EntityModelAbstract.php index bbd0115bcc63cd2db6f757992e4fd20a8034a2f7..315866b10ca2b08713f2cb14694045fcce155856 100644 --- a/src/app/entity/models/EntityModelAbstract.php +++ b/src/app/entity/models/EntityModelAbstract.php @@ -91,6 +91,11 @@ class EntityModelAbstract { ValidatorModel::notEmpty($aArgs, ['set', 'where', 'data']); ValidatorModel::arrayType($aArgs, ['set', 'where', 'data']); + ValidatorModel::stringType($aArgs['set'], [ + 'entity_label', 'short_label', 'entity_type', 'adrs_1', 'adrs_2', 'adrs_3', + 'zipcode', 'city', 'country', 'email', 'business_id', 'parent_entity_id', + 'entity_path', 'ldap_id', 'transferring_agency', 'archival_agreement', 'archival_agency', 'entity_full_name' + ]); DatabaseModel::update([ 'table' => 'entities',