diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 46a82f2e..c0cd0c40 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2375,6 +2375,7 @@ class EmployeeRestController extends AdminController $value['membersCountOfActive'] = $activeCount; $value['membersCountOfInactive'] = $inactiveCount; $value['is_ecard_bulk_download'] = 0; + $value['is_ecard_bulk_download_for_employee'] = 0; array_push($result, $value); @@ -5456,7 +5457,11 @@ class EmployeeRestController extends AdminController } $policyTransactionModel = new PolicyTransactionModel(); - $policy_transaction_data = $policyTransactionModel->where('is_active', 1)->where('policy_no', $client_policy_data['policy_no'])->findAll(); + $policy_transaction_data = $policyTransactionModel + ->where('is_active', 1) + ->where('policy_no', $client_policy_data['policy_no']) + ->where('action_type', $cd_data['event_name']) + ->findAll(); if(empty($policy_transaction_data)){ $this->myLogger->logme('error', 'getPolicyAndEndorsementFiles: No Policy Transaction data found for policy_no=' . $client_policy_data['policy_no']); @@ -5525,7 +5530,12 @@ class EmployeeRestController extends AdminController if(empty($employee_data)){ return $this->respond(['status' => false, 'code' => 404, 'message' => 'No employee data found for the policy'], 200); } + + $received_data['folder_name'] = 'bulk_ecards_' . $employee_data[0]['policy_no'] . '_' . date('Y-m-d_H-i-s'); + // Dispatch background job to process the bulk e-card download + $r = Jobs::addJob(['job_name' => 'bulkEcardDownloadAsZipFromS3', 'payload' => $received_data]); + $this->myLogger->logme('error', 'bulkEcardDownloadAsZip: Job dispatched with result = ' . json_encode($r ?? [])); return $this->respond(['status' => true, 'code' => 200, 'message' => 'Bulk E-card download process started. Link share your mail'], 200);