CHANGE_NOTIFICATION_MAIL_ALLOW_NULL_ISSUE : AADHAVAN
This commit is contained in:
parent
d0f6db8884
commit
5d20b696e9
@ -2063,10 +2063,12 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$this->myLogger->logme('error', 'sendMailForDownloadingECard - inside try');
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - inside try');
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
$counts = 0;
|
||||||
|
|
||||||
foreach ($ids as $key => $id) {
|
foreach ($ids as $key => $id) {
|
||||||
|
|
||||||
$get_emp_email_and_other_details = $this->employeePolicyModel
|
$get_emp_email_and_other_details = $this->employeePolicyModel
|
||||||
->select('employee_polices.client_policy_id, employees.emp_code, employees.email_corporate,employees.client_id as client_id, employees.name, employee_polices.rand_string, employee_polices.tpa_id')
|
->select('employee_polices.client_policy_id, employees.relationship, employees.emp_code, employees.email_corporate,employees.client_id as client_id, employees.name, employee_polices.rand_string, employee_polices.tpa_id')
|
||||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
->where('employees.emp_status', 'active')
|
->where('employees.emp_status', 'active')
|
||||||
->where('employees.is_active', '1')
|
->where('employees.is_active', '1')
|
||||||
@ -2091,19 +2093,28 @@ class EmpDataServiceController extends BaseController
|
|||||||
$params['notification'] = $notification;
|
$params['notification'] = $notification;
|
||||||
$params['notification'] = $notification;
|
$params['notification'] = $notification;
|
||||||
$params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details;
|
$params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details;
|
||||||
$wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
|
// $this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',);
|
||||||
|
|
||||||
$count++;
|
if (isset($get_emp_email_and_other_details['email_corporate']) && !empty($get_emp_email_and_other_details['email_corporate']) && $get_emp_email_and_other_details['relationship'] === 'Self') {
|
||||||
|
$wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
|
||||||
|
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
$counts++;
|
||||||
|
|
||||||
|
|
||||||
if ($count == 20 || $count == count($ids) - 1) {
|
if ($count == 20 || $counts == count($ids) - 1) {
|
||||||
|
if(count($wholeData) > 0){
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job to bulk mail',);
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job to bulk mail',);
|
||||||
|
|
||||||
|
$job_details = new Jobs();
|
||||||
|
$r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $wholeData]);
|
||||||
|
$wholeData = [];
|
||||||
|
$count = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$job_details = new Jobs();
|
|
||||||
$r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $wholeData]);
|
|
||||||
$wholeData = [];
|
|
||||||
$count = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',);
|
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',);
|
||||||
|
|||||||
@ -877,7 +877,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
if (isset($notification) && $notification['enabled'] == 1) {
|
if (isset($notification) && $notification['enabled'] == 1) {
|
||||||
//trigger
|
//trigger
|
||||||
if ($dataToInsert[$a]['relationship'] == 'Self') {
|
if ($dataToInsert[$a]['relationship'] == 'Self' && isset($dataToInsert[$a]['email_corporate']) && !empty($dataToInsert[$a]['email_corporate'])) {
|
||||||
|
|
||||||
$params['dataToInsert'] = $dataToInsert[$a];
|
$params['dataToInsert'] = $dataToInsert[$a];
|
||||||
$params['notification'] = $notification;
|
$params['notification'] = $notification;
|
||||||
@ -887,13 +887,12 @@ class EmployeeRestController extends AdminController
|
|||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
if($count == 20 || $a == count($dataToInsert)-1){
|
if($count == 20 || $a == count($dataToInsert)-1){
|
||||||
$job_details = new Jobs();
|
if (count($wholeData) > 0) {
|
||||||
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
|
$job_details = new Jobs();
|
||||||
// $wholeData[]= $r;
|
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
|
||||||
|
$wholeData = [];
|
||||||
// Mailhelper::bulk_mail($wholeData);
|
$count = 0;
|
||||||
$wholeData = [];
|
}
|
||||||
$count = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -147,11 +147,14 @@ class NotificationController extends AdminController
|
|||||||
$count++;
|
$count++;
|
||||||
$temp_whole_data[] = $value;
|
$temp_whole_data[] = $value;
|
||||||
if($count == 20 || $whole_index == count($wholeData)-1 && $index == count($values)-1){
|
if($count == 20 || $whole_index == count($wholeData)-1 && $index == count($values)-1){
|
||||||
$job_details = new Jobs();
|
if (count($temp_whole_data) > 0) {
|
||||||
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $temp_whole_data]);
|
$job_details = new Jobs();
|
||||||
|
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $temp_whole_data]);
|
||||||
|
|
||||||
$temp_whole_data = [];
|
$temp_whole_data = [];
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,21 +57,32 @@ class sendMailNotification
|
|||||||
if ($value['relationship'] != 'Self') {
|
if ($value['relationship'] != 'Self') {
|
||||||
|
|
||||||
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
|
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
|
||||||
|
|
||||||
foreach ($emp_data as $key => $value) {
|
|
||||||
if ($value['relationship'] == 'Self') {
|
|
||||||
$employee_name =$value['name'];
|
|
||||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
|
||||||
|
|
||||||
$mail = $value['email_corporate'];
|
if(count($emp_data) > 1){
|
||||||
|
$mail ='';
|
||||||
|
foreach ($emp_data as $key => $values) {
|
||||||
|
if ($value['relationship'] == 'Self') {
|
||||||
|
$employee_name =$values['name'];
|
||||||
|
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||||
|
|
||||||
|
$mail = $values['email_corporate'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$mail ='';
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$employee_name =$value['name'];
|
$employee_name =$value['name'];
|
||||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||||
$mail = $value['email_corporate'];
|
$mail = $value['email_corporate'];
|
||||||
}
|
}
|
||||||
|
if (isset($mail) && !empty($mail)) {
|
||||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($wholeData) < 1) {
|
||||||
|
$wholeData = [];
|
||||||
}
|
}
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
}else{
|
}else{
|
||||||
@ -194,8 +205,9 @@ class sendMailNotification
|
|||||||
|
|
||||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||||
// $mail = "aadhavanvalli@gmail.com";
|
// $mail = "aadhavanvalli@gmail.com";
|
||||||
|
// if (isset($mail) && !empty($mail)) {
|
||||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||||
|
// }
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user