diff --git a/src/app/email/controllers/EmailController.php b/src/app/email/controllers/EmailController.php index a0fefe06619085921b48302ea0e8d1340975e32f..4179624b51bb4cec5b6f14a153e0cff7f905b16b 100644 --- a/src/app/email/controllers/EmailController.php +++ b/src/app/email/controllers/EmailController.php @@ -291,7 +291,7 @@ class EmailController 'info' => _EMAIL_REMOVED ]); - if (!empty($email['data']['document'])) { + if (!empty($email['document'])) { $document = (array)json_decode($email['document']); HistoryController::add([ diff --git a/src/app/entity/controllers/ListTemplateController.php b/src/app/entity/controllers/ListTemplateController.php index d561ed3da726ff2f50bc3036405a68b735973a27..78864a9f549e73f9c821f1e3a7b66cf352f21239 100755 --- a/src/app/entity/controllers/ListTemplateController.php +++ b/src/app/entity/controllers/ListTemplateController.php @@ -49,9 +49,9 @@ class ListTemplateController 'data' => $data ]); - for ($i = 0; $i < count($listTemplates); $i++) { - $listTemplates[$i]['isPrivate'] = $listTemplates[$i]['owner'] != null; - unset($listTemplates[$i]['owner']); + foreach ($listTemplates as $key => $listTemplate) { + $listTemplates[$key]['isPrivate'] = $listTemplates[$key]['owner'] != null; + unset($listTemplates[$key]['owner']); } return $response->withJson(['listTemplates' => $listTemplates]); @@ -263,12 +263,12 @@ class ListTemplateController if (empty($listTemplate)) { return $response->withStatus(400)->withJson(['errors' => 'List template not found']); } - if (empty($listTemplate['owner']) && ($listTemplate['type'] != 'visaCircuit' || $listTemplate['type'] != 'opinionCircuit') ) { - if (!PrivilegeController::hasPrivilege(['privilegeId' => 'manage_entities', 'userId' => $GLOBALS['id']]) && !empty($listTemplate['entityId'])) { + if (empty($listTemplate['owner'])) { + if (!PrivilegeController::hasPrivilege(['privilegeId' => 'manage_entities', 'userId' => $GLOBALS['id']]) && !empty($listTemplate['entityId'])) { return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); } - if (!PrivilegeController::hasPrivilege(['privilegeId' => 'admin_listmodels', 'userId' => $GLOBALS['id']]) && empty($listTemplate['entityId'])) { + if (!PrivilegeController::hasPrivilege(['privilegeId' => 'admin_listmodels', 'userId' => $GLOBALS['id']]) && empty($listTemplate['entityId'])) { return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); } } else {