FIX_ISSUE
This commit is contained in:
parent
3eb5b89314
commit
b0f41725a8
@ -180,10 +180,13 @@ class EmployeeController extends AdminController
|
||||
|
||||
//handles employee & dependent bulk upload with events like inception,addition,deletion, correction and SI enhancements
|
||||
public function employeesUplodWithEvents($post_data = [])
|
||||
{
|
||||
{
|
||||
if(empty($post_data)){
|
||||
$post_data = $this->request->getPost();
|
||||
$post_data = array_merge($post_data, $this->request->getFiles());
|
||||
$is_post_request = true;
|
||||
}else{
|
||||
$is_post_request = false;
|
||||
}
|
||||
|
||||
// $empDataServiceController = new EmpDataServiceController();
|
||||
@ -340,7 +343,7 @@ class EmployeeController extends AdminController
|
||||
$avatar = isset($post_data['emplist']) ? $post_data['emplist'] : $this->request->getFile('emplist');
|
||||
if (!$avatar) {
|
||||
$this->myLogger->logme("error", 'File not found');
|
||||
if (!empty($post_data)) {
|
||||
if (!$is_post_request) {
|
||||
return ['status' => false, 'message' => 'File not found'];
|
||||
} else {
|
||||
return $this->respond(['dataStatus' => false, 'code' => 400, 'message' => 'File not found'], 400);
|
||||
@ -356,7 +359,7 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme("error", 'File move successful');
|
||||
} else {
|
||||
$this->myLogger->logme("error", 'File move failed');
|
||||
if (!empty($post_data)) {
|
||||
if (!$is_post_request) {
|
||||
return ['status' => false, 'message' => 'File move failed'];
|
||||
} else {
|
||||
return $this->respond(['dataStatus' => false, 'code' => 500, 'message' => 'File move failed'], 500);
|
||||
@ -364,7 +367,7 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme("error", 'Upload failed Invalid file');
|
||||
if (!empty($post_data)) {
|
||||
if (!$is_post_request) {
|
||||
return ['status' => false, 'message' => 'Invalid file'];
|
||||
} else {
|
||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'Invalid file'], 404);
|
||||
@ -406,7 +409,7 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme("error", '{file_id} is less than 1MB, validating on the fly', ['file_id' => $file_id]);
|
||||
//endof validation process
|
||||
if (isset($result['error_summary']) && count($result['error_summary'])) {
|
||||
if(!empty($post_data)){
|
||||
if(!$is_post_request){
|
||||
return ['status' => false, 'message' => 'file rejected with errors', 'file_id' => $file_id];
|
||||
}else{
|
||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
|
||||
@ -419,7 +422,7 @@ class EmployeeController extends AdminController
|
||||
$this->myLogger->logme("error", '{file_id} is greather than 1MB, validating with job queue', ['file_id' => $file_id]);
|
||||
}
|
||||
|
||||
if (!empty($post_data)) {
|
||||
if (!$is_post_request) {
|
||||
return ['status' => true, 'message' => 'File upload successs, Data validation is in-progress', 'file_id' => $file_id];
|
||||
} else {
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user