diff --git a/src/app/resource/controllers/ResController.php b/src/app/resource/controllers/ResController.php index a9be47310a21f8dacc7b3f78aa8e47b078fb7fa4..520c9c4489ef2dfc9a4138c0465bea07bd933f3b 100755 --- a/src/app/resource/controllers/ResController.php +++ b/src/app/resource/controllers/ResController.php @@ -708,7 +708,7 @@ class ResController 'res_id' => $args['resId'], 'sequence' => 0, 'item_id' => $diffusion['id'], - 'item_type' => $diffusion['type'], + 'item_type' => $diffusion['type'] == 'user' ? 'user_id' : 'entity_id', 'item_mode' => $diffusion['mode'], 'added_by_user' => $GLOBALS['userId'], 'difflist_type' => 'entity_id' @@ -859,25 +859,25 @@ class ResController } if (!empty($body['diffusionList'])) { if (!Validator::arrayType()->notEmpty()->validate($body['diffusionList'])) { - return ['errors' => 'Body diffusion is not an array']; + return ['errors' => 'Body diffusionList is not an array']; } $destFound = false; foreach ($body['diffusionList'] as $key => $diffusion) { if ($diffusion['mode'] == 'dest') { if ($destFound) { - return ['errors' => "Body diffusion has multiple dest"]; + return ['errors' => "Body diffusionList has multiple dest"]; } $destFound = true; } - if ($diffusion['type'] == 'user_id' || $diffusion['mode'] == 'dest') { + if ($diffusion['type'] == 'user' || $diffusion['mode'] == 'dest') { $user = UserModel::getByLogin(['login' => $diffusion['id'], 'select' => [1]]); if (empty($user)) { - return ['errors' => "Body diffusion[{$key}] id does not exist"]; + return ['errors' => "Body diffusionList[{$key}] id does not exist"]; } } else { $entity = EntityModel::getByEntityId(['entityId' => $diffusion['id'], 'select' => [1]]); if (empty($entity)) { - return ['errors' => "Body diffusion[{$key}] id does not exist"]; + return ['errors' => "Body diffusionList[{$key}] id does not exist"]; } } } diff --git a/src/app/resource/controllers/StoreController.php b/src/app/resource/controllers/StoreController.php index aa9ed7139785d0478faca686468ec121995dc21d..e6a6d7d9d90c6f930c3afdee4a02e8b87e4605fa 100755 --- a/src/app/resource/controllers/StoreController.php +++ b/src/app/resource/controllers/StoreController.php @@ -121,7 +121,6 @@ class StoreController $args['typist'] = $GLOBALS['id']; } - if (!empty($args['initiator'])) { $entity = EntityModel::getById(['id' => $args['initiator'], 'select' => ['entity_id']]); $args['initiator'] = $entity['entity_id'];