FEAT_ECARD SENT STATUS FLAG ADDED
This commit is contained in:
parent
9d22244b20
commit
c6f06828e0
@ -181,7 +181,7 @@ class ClientController extends AdminController
|
||||
print_rr($attachments);
|
||||
}
|
||||
|
||||
public function testingForReviewMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 0) //this function for only tsesting some logics not use for business logic
|
||||
public function testingForReviewMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 1) //this function for only tsesting some logics not use for business logic
|
||||
{
|
||||
|
||||
$client_policy_ids = $this->employeeModel
|
||||
@ -3708,8 +3708,8 @@ class ClientController extends AdminController
|
||||
|
||||
public function sendextraparam(){
|
||||
|
||||
$employeeRestController = new EmployeeServiceController();
|
||||
$employeeRestController->employeesEnrollmentInsert(['file_id' => 683]);
|
||||
// $employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 715]);
|
||||
|
||||
// $dashBoardController = new DashboardController();
|
||||
// $client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id=159, $client_branch_id=126);
|
||||
|
||||
@ -417,8 +417,9 @@ class DashboardController extends AdminController
|
||||
|
||||
// Send the mail notification
|
||||
$mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
|
||||
// dd($mail_result);
|
||||
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
|
||||
$reminder_whole_mail[] = $mail_result;
|
||||
$reminder_whole_mail[] = $mail_result[0];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -483,7 +484,7 @@ class DashboardController extends AdminController
|
||||
// Send the mail notification
|
||||
$mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
|
||||
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
|
||||
$reminder_whole_mail[] = $mail_result;
|
||||
$reminder_whole_mail[] = $mail_result[0];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -496,14 +497,14 @@ class DashboardController extends AdminController
|
||||
}
|
||||
|
||||
// dd($reminder_whole_mail);
|
||||
// print_rr($reminder_whole_mail); die;
|
||||
|
||||
// Process and queue bulk emails
|
||||
if (!empty($reminder_whole_mail) && count($reminder_whole_mail) > 0) {
|
||||
|
||||
$reminder_whole_mail = array_chunk($reminder_whole_mail, 20);
|
||||
|
||||
foreach ($reminder_whole_mail as $key => $value) {
|
||||
$job_details = new Jobs();
|
||||
// $job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $value]);
|
||||
}
|
||||
}
|
||||
@ -517,6 +518,8 @@ class DashboardController extends AdminController
|
||||
|
||||
public function sendManualReminder($client_id, $client_branch_id)
|
||||
{
|
||||
$this->myLogger->logme('error','Log Works');
|
||||
|
||||
$this->myLogger->logme('error', "sendManualRemainder called with client_id: {$client_id}, client_branch_id: {$client_branch_id}");
|
||||
|
||||
$client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id, $client_branch_id);
|
||||
@ -526,6 +529,8 @@ class DashboardController extends AdminController
|
||||
|
||||
if ($client_policy_data) {
|
||||
$result = $this->sendRemainderMail($client_policy_data);
|
||||
log_message('error',json_encode($result));
|
||||
$this->myLogger->logme('error',$result);
|
||||
$this->myLogger->logme('error', "Manual Remainder Mail sending result: " . ($result ? 'success' : 'failure'));
|
||||
|
||||
if ($result) {
|
||||
@ -552,6 +557,7 @@ class DashboardController extends AdminController
|
||||
{
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found','message2' => 'Failed' ], 200);
|
||||
}
|
||||
|
||||
|
||||
$emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard($policy_id);
|
||||
if(count($emp_data) == 0)
|
||||
|
||||
@ -108,7 +108,7 @@ class EmployeeController extends AdminController
|
||||
emp_name : $filterData['emp_name'] ?? null,
|
||||
status : $filterData['status'] ?? [],
|
||||
);
|
||||
|
||||
log_message('error',json_encode($data['employees']));
|
||||
// Set getData in $data array with the processed $filterData
|
||||
$data['getData'] = $filterData;
|
||||
}
|
||||
|
||||
@ -2095,7 +2095,7 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
$params['dataToInsert'] = $value; //holds employee master data
|
||||
$params['notification'] = $notification;
|
||||
$params['client_data'] = $client_details;
|
||||
|
||||
$params['common'] = [];
|
||||
//store email and mail content via helper to send notification
|
||||
$emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
|
||||
}
|
||||
|
||||
@ -2,10 +2,19 @@
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\GmailSentHistoryModel;
|
||||
use Exception;
|
||||
|
||||
|
||||
class GmailResponseHandler{
|
||||
private $myLogger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function receive_and_distribute_param_to_functions($params)
|
||||
@ -14,6 +23,7 @@ class GmailResponseHandler{
|
||||
|
||||
$this->store_gmail_response_data($params);
|
||||
$this->gmail_response_logger($params);
|
||||
$this->client_id_flag_setter($params);
|
||||
|
||||
}
|
||||
catch(Exception $e)
|
||||
@ -81,13 +91,34 @@ class GmailResponseHandler{
|
||||
}
|
||||
|
||||
$gmailModel = new GmailSentHistoryModel();
|
||||
$save_status = $gmailModel->insert($data);
|
||||
|
||||
|
||||
$save_status = $gmailModel->insert($data);
|
||||
}
|
||||
|
||||
public function gmail_response_logger($params){
|
||||
public function gmail_response_logger($params)
|
||||
{
|
||||
$this->myLogger->logme('error',json_encode($params));
|
||||
}
|
||||
|
||||
public function client_id_flag_setter($params)
|
||||
{
|
||||
try{
|
||||
if (isset($params['params']['common']['mail_type'])){
|
||||
if($params['params']['common']['mail_type'] == 'member_ecard_mail'){
|
||||
$employeePolicyModel = new EmployeePolicyModel();
|
||||
$update_status = $employeePolicyModel->where('id',$params['params']['common']['employee_policy_id'])->set('ecard_sent_status',1)->update();
|
||||
if($update_status){
|
||||
$this->myLogger->logme('error',"ecard_sent_status updated for ".$params['params']['common']['employee_policy_id']);
|
||||
}else{
|
||||
$this->myLogger->logme('error','ecard_sent_status failed to update');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch(Exception $e){
|
||||
$error = $e->getMessage();
|
||||
$this->myLogger->logme('error','An Error Occured - '.$error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -126,14 +126,14 @@ class MailHelper
|
||||
if($res['gmail_api']['status'])
|
||||
{
|
||||
$response = $res;
|
||||
// $MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode(['status' => 'success','code' => 200, 'message'=>('Email Sent Successfully...'.$emaill),'data' => $res,],200);
|
||||
}
|
||||
else
|
||||
{
|
||||
$myLogger->logme('error', "mail sent failed - $emaill");
|
||||
$response = $res;
|
||||
// $MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode(['status' => 'failed','code' => 404,'message'=>( 'Email Sent Failed...' . $emaill ),'data' => $res ],404);
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ class MailHelper
|
||||
$msg['params'] = $params;
|
||||
$myLogger->logme('error', "mail sent failed - $msg");
|
||||
$response = $msg;
|
||||
// $MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode(['status' => 'failed','code' => 500,'data' => $msg],500);
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ class MailHelper
|
||||
|
||||
public static function bulk_mail(array $mails = [])
|
||||
{
|
||||
// print_r();die;
|
||||
// print_r($mails);die;
|
||||
$model = new JobModel();
|
||||
$start = microtime(true);
|
||||
$runtime= 0;
|
||||
@ -165,7 +165,9 @@ class MailHelper
|
||||
return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...'],200);
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
return json_encode(['status' => 'failed','code' => 500],500);
|
||||
$error = $th->getMessage();
|
||||
log_message('error',$error);
|
||||
return json_encode(['status' => 'failed','code' => 500,'error'=>$error],500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ class EmployeePolicyModel extends Model
|
||||
"rand_string",
|
||||
"is_active",
|
||||
"claim_status",
|
||||
'ecard_sent_status'
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
@ -125,7 +126,6 @@ class EmployeePolicyModel extends Model
|
||||
->join('client_branch', 'emp.client_branch_id = client_branch.id') //cm - client master
|
||||
->orderBy('emp.emp_code', 'ASC')
|
||||
->orderBy('employee_polices.employee_id', 'ASC');
|
||||
|
||||
// Conditionally add where clauses
|
||||
if ($client_id != 0 && !empty($client_id)) {
|
||||
$result->where('emp.client_id', $client_id);
|
||||
@ -194,6 +194,7 @@ class EmployeePolicyModel extends Model
|
||||
$result->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.status', 'active')
|
||||
->where('employee_polices.tpa_id is not null')
|
||||
->where('employee_polices.ecard_sent_status',0)
|
||||
->where('emp.relationship','Self');
|
||||
|
||||
return $result->findAll();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user