mail issue
This commit is contained in:
parent
3dac74521d
commit
fb781ab722
@ -14,45 +14,47 @@ function collectLeaveData($id){
|
||||
if (!function_exists('collectDelegationData')) {
|
||||
|
||||
function collectDelegationData($id){
|
||||
|
||||
|
||||
$ci =& get_instance();
|
||||
return $ci->Notification_model->get_delegation_data_using_delegation_id($id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('collectExpenceData')) {
|
||||
|
||||
function collectExpenceData($id){
|
||||
|
||||
|
||||
$ci =& get_instance();
|
||||
return $ci->Notification_model->get_expence_data_using_expence_id($id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getTempleteData')) {
|
||||
|
||||
function getTempleteData($code, $type){
|
||||
|
||||
|
||||
$ci =& get_instance();
|
||||
return $ci->Notification_model->get_template_data_using_code($code, $type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('replaceTemplateWithData')) {
|
||||
|
||||
function replaceTemplateWithData($originalTemplate, $placeholders) {
|
||||
$notificationContent = $originalTemplate;
|
||||
$notificationContent = $originalTemplate;
|
||||
|
||||
foreach ($placeholders as $value) {
|
||||
$notificationContent = str_replace($value['placeholder'], $value['strval'], $notificationContent);
|
||||
}
|
||||
|
||||
return $notificationContent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -6,10 +6,10 @@
|
||||
if (!function_exists('send_emails')) {
|
||||
|
||||
function send_emails($to, $subject, $body, $aliasName = '', $cc = null, $bcc = null, $receipt = null)
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
log_message('info', 'send_mail_helper_loadded');
|
||||
log_message('info', 'Receiptent mail - '.$to.' - subject - '.$subject.' - body - '.$body);
|
||||
log_message('info', 'Receiptent mail - '.$to.' - subject - '.$subject.' - body - '.$body);
|
||||
log_message('info', 'Sender mail '.business()->sender_mail);
|
||||
|
||||
|
||||
@ -18,16 +18,16 @@ function send_emails($to, $subject, $body, $aliasName = '', $cc = null, $bcc = n
|
||||
log_message('info', 'phpmailer loaded');
|
||||
|
||||
$mailer->isSMTP();
|
||||
$mailer->CharSet = 'utf-8';
|
||||
$mailer->CharSet = 'utf-8';
|
||||
$mailer->Host= 'mail.venbait.in';
|
||||
$mailer->SMTPSecure = 'ssl';
|
||||
$mailer->SMTPAuth =true;
|
||||
$mailer->SMTPDebug = false;
|
||||
$mailer->SMTPDebug =false;
|
||||
$mailer->Username='bbone@venbait.in';
|
||||
$mailer->Password='xk!L(N_-R#};';
|
||||
$mailer->Port=465;
|
||||
$mailer->setFrom(business()->sender_mail, $aliasName);
|
||||
$mailer->addAddress('suseendhiran13@gmail.com');
|
||||
$mailer->addAddress($to);
|
||||
|
||||
// Add CC recipients
|
||||
// if ($cc !== null) {
|
||||
@ -52,9 +52,10 @@ function send_emails($to, $subject, $body, $aliasName = '', $cc = null, $bcc = n
|
||||
// }
|
||||
|
||||
$mailer->Subject=$subject;
|
||||
|
||||
$mailer->isHTML(true);
|
||||
$mailer->Body=$body;
|
||||
|
||||
|
||||
$attachmentPath = '/path/to/your/attachment/' . $receipt;
|
||||
|
||||
if (file_exists($attachmentPath)) {
|
||||
@ -62,14 +63,14 @@ function send_emails($to, $subject, $body, $aliasName = '', $cc = null, $bcc = n
|
||||
}
|
||||
|
||||
$mailer->send();
|
||||
|
||||
return true;
|
||||
log_message('info', 'success : mail sendsuccessfully');
|
||||
return true;
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
log_message('info', 'Error mail noy send: '.$mailer->ErrorInfo);
|
||||
return 'Error: ' . $mailer->ErrorInfo;
|
||||
log_message('info', 'Error : '.$mailer->ErrorInfo);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -81,19 +82,19 @@ function send_emails($to, $subject, $body, $aliasName = '', $cc = null, $bcc = n
|
||||
if (!function_exists('send_emails_forgot_password')) {
|
||||
|
||||
function send_emails_forgot_password($to, $subject, $body, $aliasName = '', $cc = null, $bcc = null, $receipt = null)
|
||||
{
|
||||
|
||||
{
|
||||
|
||||
log_message('info', 'send_mail_helper_loadded');
|
||||
log_message('info', 'Receiptent mail - '.$to.' - subject - '.$subject.' - body - '.$body);
|
||||
log_message('info', 'Receiptent mail - '.$to.' - subject - '.$subject.' - body - '.$body);
|
||||
log_message('info', 'Sender mail '.business()->sender_mail);
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$mailer = new PHPMailer(true);
|
||||
log_message('info', 'phpmailer loaded');
|
||||
|
||||
|
||||
$mailer->isSMTP();
|
||||
$mailer->CharSet = 'utf-8';
|
||||
$mailer->CharSet = 'utf-8';
|
||||
$mailer->Host='smtp.sendgrid.net';
|
||||
$mailer->SMTPSecure = 'tls';
|
||||
$mailer->SMTPAuth =true;
|
||||
@ -103,7 +104,7 @@ function send_emails_forgot_password($to, $subject, $body, $aliasName = '', $cc
|
||||
$mailer->Port='587';
|
||||
$mailer->setFrom('no-reply@tripapprovaltool.com');
|
||||
$mailer->addAddress($to);
|
||||
|
||||
|
||||
// Add CC recipients
|
||||
if ($cc !== null) {
|
||||
if (is_array($cc)) {
|
||||
@ -114,7 +115,7 @@ function send_emails_forgot_password($to, $subject, $body, $aliasName = '', $cc
|
||||
$mailer->addCC($cc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add BCC recipients
|
||||
if ($bcc !== null) {
|
||||
if (is_array($bcc)) {
|
||||
@ -125,32 +126,32 @@ function send_emails_forgot_password($to, $subject, $body, $aliasName = '', $cc
|
||||
$mailer->addBCC($bcc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$mailer->Subject=$subject;
|
||||
$mailer->isHTML(true);
|
||||
$mailer->Body=$body;
|
||||
|
||||
|
||||
$attachmentPath = '/path/to/your/attachment/' . $receipt;
|
||||
|
||||
|
||||
if (file_exists($attachmentPath)) {
|
||||
$mailer->addAttachment($attachmentPath);
|
||||
}
|
||||
|
||||
|
||||
$mailer->send();
|
||||
|
||||
return true;
|
||||
|
||||
return true;
|
||||
log_message('info', 'success : mail sendsuccessfully');
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
|
||||
return 'Error: ' . $mailer->ErrorInfo;
|
||||
log_message('info', 'Error : '.$mailer->ErrorInfo);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -235,7 +235,7 @@ public function createLeave()
|
||||
$data['business_id'] = user()->business_id;
|
||||
$data['status'] = 'pending';
|
||||
// $data['created_date'] = date('d-m-Y');
|
||||
$perm_data['created_date_new'] = date('d-m-Y');
|
||||
$data['created_date_new'] = date('Y-m-d');
|
||||
$data['created_time'] = date('H:i A');
|
||||
$leave_year = date('Y', strtotime($this->input->post('from_date_new')));
|
||||
|
||||
|
||||
@ -42,29 +42,34 @@ public function __construct()
|
||||
// Function for Mail Send
|
||||
public function prepareNotificationData($body,$templateData,$Data,$type,$code){
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
// echo 1;die;
|
||||
$getBusinessData = $this->Notification_model->get_admin_and_hr_mail_id(user()->business_id);
|
||||
|
||||
$managerID = $Data->ManagerId;
|
||||
|
||||
$managerMail = $this->Notification_model->get_user_data($managerID);
|
||||
|
||||
|
||||
|
||||
$cc_mail_data = [$getBusinessData->admin_email, $getBusinessData->hr_email, $Data->managerEmail, $Data->delegatePersonEmail];
|
||||
|
||||
if($Data->delegatePersonEmail == NULL)
|
||||
{
|
||||
{
|
||||
if($Data->managerEmail == NULL){
|
||||
|
||||
|
||||
$cc_mail_data = [$getBusinessData->admin_email, $getBusinessData->hr_email];
|
||||
}
|
||||
else{
|
||||
|
||||
$cc_mail_data = [$getBusinessData->admin_email, $getBusinessData->hr_email, $Data->managerEmail];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($type === 'Email'){
|
||||
|
||||
|
||||
if($code === 'APPLY_LEAVE' || $code === 'LEAVE_PERMISSION'){
|
||||
|
||||
$to = $getBusinessData->hr_email;
|
||||
@ -116,7 +121,7 @@ public function prepareNotificationDataForDelegation($body,$templateData,$Data,$
|
||||
|
||||
$getBusinessData = $this->Notification_model->get_admin_and_hr_mail_id(user()->business_id);
|
||||
if($type === 'Email'){
|
||||
|
||||
|
||||
$to = $Data->delegatePersonEmail;
|
||||
$cc = [$getBusinessData->admin_email, $getBusinessData->hr_email];
|
||||
$subject = $templateData->subject;
|
||||
@ -125,7 +130,7 @@ public function prepareNotificationDataForDelegation($body,$templateData,$Data,$
|
||||
// echo $result; die;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -134,7 +139,7 @@ public function prepareNotificationDataForExpence($body,$templateData,$Data,$typ
|
||||
// echo $body; die;
|
||||
|
||||
$getBusinessData = $this->Notification_model->get_admin_and_hr_mail_id(user()->business_id);
|
||||
|
||||
|
||||
if(!empty($Data->managerEmail)){
|
||||
$mail = [$getBusinessData->admin_email, $Data->managerEmail];
|
||||
}else{
|
||||
@ -143,7 +148,7 @@ public function prepareNotificationDataForExpence($body,$templateData,$Data,$typ
|
||||
|
||||
$cc_mail_data = [$getBusinessData->admin_email, $getBusinessData->hr_email, $Data->managerEmail, $Data->delegatePersonEmail];
|
||||
if($Data->delegatePersonEmail == NULL)
|
||||
{
|
||||
{
|
||||
if($Data->managerEmail == NULL){
|
||||
|
||||
$cc_mail_data = [$getBusinessData->admin_email, $getBusinessData->hr_email];
|
||||
@ -152,12 +157,12 @@ public function prepareNotificationDataForExpence($body,$templateData,$Data,$typ
|
||||
$cc_mail_data = [$getBusinessData->admin_email, $getBusinessData->hr_email, $Data->managerEmail];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($type === 'Email'){
|
||||
|
||||
if($code === 'EXPENCE_CLAIM'){
|
||||
|
||||
|
||||
$to = $getBusinessData->hr_email;
|
||||
$cc = $mail;
|
||||
$subject = $templateData->subject;
|
||||
@ -167,7 +172,7 @@ public function prepareNotificationDataForExpence($body,$templateData,$Data,$typ
|
||||
return $result;
|
||||
|
||||
}else if($code === 'APPROVE_EXPENCE' || ($code === 'DECLINE_EXPENCE')){
|
||||
|
||||
|
||||
$to = $Data->emp_email;
|
||||
$cc = $cc_mail_data;
|
||||
$subject = $templateData->subject;
|
||||
@ -177,7 +182,7 @@ public function prepareNotificationDataForExpence($body,$templateData,$Data,$typ
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -188,20 +193,26 @@ public function prepareNotificationDataForExpence($body,$templateData,$Data,$typ
|
||||
|
||||
|
||||
|
||||
//Send Mail For Apply Leave and apply Permission also Approve and Decline
|
||||
//Send Mail For Apply Leave and apply Permission also Approve and Decline
|
||||
public function sendNotification($leave_id, $code, $type){
|
||||
try {
|
||||
$leaveData = collectLeaveData($leave_id);
|
||||
// print_r($leaveData);
|
||||
$templateData = getTempleteData($code, $type);
|
||||
if($code === 'APPLY_LEAVE' || $code === 'LEAVE_PERMISSION'){
|
||||
|
||||
$FormettedTemplateData = $this->preprocessTemplateData($leaveData,$templateData);
|
||||
// print_r($leaveData);
|
||||
}
|
||||
else if($code === 'APPROVE_LEAVE' || $code === 'APPROVE_PERMISSION'){
|
||||
$FormettedTemplateData = $this->preprocessTemplateDataForLeaveApprove($leaveData,$templateData);
|
||||
// print_r($FormettedTemplateData);
|
||||
// print_r($templateData);
|
||||
}
|
||||
else if($code === 'DECLINE_LEAVE' || $code === 'DECLINE_PERMISSION'){
|
||||
$FormettedTemplateData = $this->preprocessTemplateDataForLeaveDecline($leaveData,$templateData);
|
||||
// print_r($FormettedTemplateData);
|
||||
// print_r($templateData);
|
||||
}
|
||||
return $this->prepareNotificationData($FormettedTemplateData,$templateData,$leaveData,$type, $code);
|
||||
} catch (Exception $e) {
|
||||
@ -211,27 +222,35 @@ public function sendNotification($leave_id, $code, $type){
|
||||
|
||||
|
||||
public function preprocessTemplateData($leaveData, $templateData){
|
||||
|
||||
|
||||
$managerID = $leaveData->ManagerId;
|
||||
$managerName = $this->Notification_model->get_user_data($managerID);
|
||||
|
||||
|
||||
$inputString = $templateData->placeholder;
|
||||
$placeholders = explode(',', $inputString);
|
||||
if($leaveData->leave_code === 'permission'){
|
||||
if(empty($managerName->name)){
|
||||
$values = ['Manager', $leaveData->emp_name, $leaveData->leave_type, $leaveData->perm_date_new_new, $leaveData->from_time, $leaveData->to_time, $leaveData->risedby, $leaveData->status, $leaveData->comments];
|
||||
$perm_date_new = date('d-m-Y', strtotime($leaveData->perm_date_new));
|
||||
$values = ['Manager', $leaveData->emp_name, $leaveData->leave_type, $perm_date_new, $leaveData->from_time, $leaveData->to_time, $leaveData->risedby, $leaveData->status, $leaveData->comments];
|
||||
}
|
||||
else{
|
||||
$values = [$managerName->name, $leaveData->emp_name, $leaveData->leave_type, $leaveData->perm_date_new_new, $leaveData->from_time, $leaveData->to_time, $leaveData->risedby, $leaveData->status, $leaveData->comments];
|
||||
$perm_date_new = date('d-m-Y', strtotime($leaveData->perm_date_new));
|
||||
$values = [$managerName->name, $leaveData->emp_name, $leaveData->leave_type, $perm_date_new, $leaveData->from_time, $leaveData->to_time, $leaveData->risedby, $leaveData->status, $leaveData->comments];
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(empty($managerName->name)){
|
||||
$values = ['Manager', $leaveData->emp_name, $leaveData->no_of_days, $leaveData->leave_type, $leaveData->from_date_new_new, $leaveData->to_date_new_new, $leaveData->risedby, $leaveData->leave_bal, $leaveData->status, $leaveData->comments];
|
||||
$fromDate = date('d-m-Y', strtotime($leaveData->from_date_new));
|
||||
$toDate = date('d-m-Y', strtotime($leaveData->to_date_new));
|
||||
|
||||
$values = ['Manager', $leaveData->emp_name, $leaveData->no_of_days, $leaveData->leave_type, $fromDate, $toDate, $leaveData->risedby, $leaveData->leave_bal, $leaveData->status, $leaveData->comments];
|
||||
|
||||
}
|
||||
else{
|
||||
$values = [$managerName->name, $leaveData->emp_name, $leaveData->no_of_days, $leaveData->leave_type, $leaveData->from_date_new_new, $leaveData->to_date_new_new, $leaveData->risedby, $leaveData->leave_bal, $leaveData->status, $leaveData->comments];
|
||||
$fromDate = date('d-m-Y', strtotime($leaveData->from_date_new));
|
||||
$toDate = date('d-m-Y', strtotime($leaveData->to_date_new));
|
||||
|
||||
$values = [$managerName->name, $leaveData->emp_name, $leaveData->no_of_days, $leaveData->leave_type, $fromDate, $toDate_new, $leaveData->risedby, $leaveData->leave_bal, $leaveData->status, $leaveData->comments];
|
||||
|
||||
}
|
||||
}
|
||||
@ -240,55 +259,63 @@ public function preprocessTemplateData($leaveData, $templateData){
|
||||
$result[] = ['placeholder' => '[' . trim($placeholder, '[]') . ']', 'strval' => $values[$index]];
|
||||
}
|
||||
|
||||
return $body = replaceTemplateWithData($templateData->content,$result);
|
||||
return $body = replaceTemplateWithData($templateData->content,$result);
|
||||
|
||||
}
|
||||
|
||||
public function preprocessTemplateDataForLeaveApprove($leaveData, $templateData){
|
||||
|
||||
|
||||
$managerID = $leaveData->ManagerId;
|
||||
$managerName = $this->Notification_model->get_user_data($managerID);
|
||||
|
||||
|
||||
$inputString = $templateData->placeholder;
|
||||
$placeholders = explode(',', $inputString);
|
||||
if($leaveData->leave_code === 'permission'){
|
||||
$values = [$leaveData->emp_name, $leaveData->from_time, $leaveData->to_time, $leaveData->perm_date_new, $leaveData->ApproveBy, $leaveData->status];
|
||||
$perm_date_new = date('d-m-Y', strtotime($leaveData->perm_date_new));
|
||||
$values = [$leaveData->emp_name, $leaveData->from_time, $leaveData->to_time, $perm_date_new, $leaveData->ApproveBy, $leaveData->status];
|
||||
}
|
||||
else{
|
||||
$values = [$leaveData->emp_name, $leaveData->from_date_new, $leaveData->to_date_new, $leaveData->no_of_days, $leaveData->ApproveBy, $leaveData->status];
|
||||
$fromDate = date('d-m-Y', strtotime($leaveData->from_date_new));
|
||||
$toDate = date('d-m-Y', strtotime($leaveData->to_date_new));
|
||||
|
||||
$values = [$leaveData->emp_name, $fromDate, $toDate, $leaveData->no_of_days, $leaveData->ApproveBy, $leaveData->status];
|
||||
}
|
||||
$result = [];
|
||||
foreach ($placeholders as $index => $placeholder) {
|
||||
$result[] = ['placeholder' => '[' . trim($placeholder, '[]') . ']', 'strval' => $values[$index]];
|
||||
}
|
||||
|
||||
return $body = replaceTemplateWithData($templateData->content,$result);
|
||||
return $body = replaceTemplateWithData($templateData->content,$result);
|
||||
|
||||
}
|
||||
|
||||
public function preprocessTemplateDataForLeaveDecline($leaveData, $templateData){
|
||||
|
||||
|
||||
$managerID = $leaveData->ManagerId;
|
||||
$managerName = $this->Notification_model->get_user_data($managerID);
|
||||
|
||||
|
||||
$inputString = $templateData->placeholder;
|
||||
$placeholders = explode(',', $inputString);
|
||||
if($leaveData->leave_code === 'permission'){
|
||||
$values = [$leaveData->emp_name, $leaveData->from_time, $leaveData->to_time, $leaveData->perm_date_new, $leaveData->declined_by, $leaveData->status, $leaveData->DReason];
|
||||
$perm_date_new = date('d-m-Y', strtotime($leaveData->perm_date_new));
|
||||
$values = [$leaveData->emp_name, $leaveData->from_time, $leaveData->to_time, $perm_date_new, $leaveData->declined_by, $leaveData->status, $leaveData->DReason];
|
||||
}
|
||||
else{
|
||||
$values = [$leaveData->emp_name, $leaveData->from_date_new, $leaveData->to_date_new, $leaveData->no_of_days, $leaveData->declined_by, $leaveData->status, $leaveData->DReason];
|
||||
$fromDate = date('d-m-Y', strtotime($leaveData->from_date_new));
|
||||
$toDate = date('d-m-Y', strtotime($leaveData->to_date_new));
|
||||
|
||||
$values = [$leaveData->emp_name, $fromDate, $toDate, $leaveData->no_of_days, $leaveData->declined_by, $leaveData->status, $leaveData->DReason];
|
||||
}
|
||||
$result = [];
|
||||
foreach ($placeholders as $index => $placeholder) {
|
||||
$result[] = ['placeholder' => '[' . trim($placeholder, '[]') . ']', 'strval' => $values[$index]];
|
||||
}
|
||||
|
||||
return $body = replaceTemplateWithData($templateData->content,$result);
|
||||
return $body = replaceTemplateWithData($templateData->content,$result);
|
||||
|
||||
}
|
||||
|
||||
// end of Send Mail For Apply Leave and apply Permission also Approve and Decline
|
||||
|
||||
// end of Send Mail For Apply Leave and apply Permission also Approve and Decline
|
||||
|
||||
|
||||
|
||||
@ -300,12 +327,12 @@ public function sendNotificationForDelegation($Delecation_id, $code, $type){
|
||||
|
||||
$FormettedTemplateData = $this->preprocessTemplateDataForAssignDelegation($delegationData,$templateData);
|
||||
return $this->prepareNotificationDataForDelegation($FormettedTemplateData,$templateData,$delegationData,$type, $code);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function preprocessTemplateDataForAssignDelegation($Data, $templateData){
|
||||
|
||||
|
||||
$inputString = $templateData->placeholder;
|
||||
$placeholders = explode(',', $inputString);
|
||||
|
||||
@ -315,7 +342,7 @@ public function preprocessTemplateDataForAssignDelegation($Data, $templateData){
|
||||
$result[] = ['placeholder' => '[' . trim($placeholder, '[]') . ']', 'strval' => $values[$index]];
|
||||
}
|
||||
|
||||
return $body = replaceTemplateWithData($templateData->content,$result);
|
||||
return $body = replaceTemplateWithData($templateData->content,$result);
|
||||
|
||||
}
|
||||
|
||||
@ -329,7 +356,7 @@ public function sendNotificationForExpense($ecpence_id, $code, $type){
|
||||
|
||||
$expenceData = collectExpenceData($ecpence_id);
|
||||
$expenceChildData = $this->Notification_model->get_expence_child_data_using_expence_id($ecpence_id);
|
||||
|
||||
|
||||
// echo $ecpence_id;
|
||||
// echo '--------------------------------------------------------------';
|
||||
// echo '<pre>';
|
||||
@ -349,17 +376,17 @@ public function sendNotificationForExpense($ecpence_id, $code, $type){
|
||||
}else if($code === 'DECLINE_EXPENCE'){
|
||||
|
||||
$FormettedTemplateData = $this->preprocessTemplateDataForExpenseDecline($expenceData,$templateData,$expenceChildData);
|
||||
|
||||
|
||||
}
|
||||
return $this->prepareNotificationDataForExpence($FormettedTemplateData,$templateData,$expenceData,$type, $code);
|
||||
}
|
||||
|
||||
|
||||
public function preprocessTemplateDataForExpense($Data, $templateData, $expenceChildData){
|
||||
|
||||
|
||||
$inputString = $templateData->placeholder;
|
||||
$placeholders = explode(',', $inputString);
|
||||
|
||||
|
||||
$tableRows = '';
|
||||
foreach ($expenceChildData as $row) {
|
||||
$tableRows .= '<tr>';
|
||||
@ -368,7 +395,7 @@ public function preprocessTemplateDataForExpense($Data, $templateData, $expenceC
|
||||
$tableRows .= '<td>' . $row['childDescription'] . '</td>';
|
||||
$tableRows .= '</tr>';
|
||||
}
|
||||
|
||||
|
||||
$values =[$Data->managerName, $Data->emp_name];
|
||||
$emailTemplate = str_replace('[table_rows]', $tableRows, $templateData->content);
|
||||
foreach ($placeholders as $index => $placeholder) {
|
||||
@ -379,10 +406,10 @@ public function preprocessTemplateDataForExpense($Data, $templateData, $expenceC
|
||||
}
|
||||
|
||||
public function preprocessTemplateDataForExpenseApprove($Data, $templateData, $expenceChildData){
|
||||
|
||||
|
||||
$inputString = $templateData->placeholder;
|
||||
$placeholders = explode(',', $inputString);
|
||||
|
||||
|
||||
$tableRows = '';
|
||||
foreach ($expenceChildData as $row) {
|
||||
$tableRows .= '<tr>';
|
||||
@ -392,23 +419,23 @@ public function preprocessTemplateDataForExpenseApprove($Data, $templateData, $e
|
||||
$tableRows .= '<td>' . $row['childStatus'] . '</td>';
|
||||
$tableRows .= '</tr>';
|
||||
}
|
||||
|
||||
|
||||
$values =[$Data->managerName, $Data->emp_name, $Data->status];
|
||||
$emailTemplate = str_replace('[table_rows]', $tableRows, $templateData->content);
|
||||
foreach ($placeholders as $index => $placeholder) {
|
||||
$result[] = ['placeholder' => '[' . trim($placeholder, '[]') . ']', 'strval' => $values[$index]];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$body = replaceTemplateWithData($emailTemplate,$result);
|
||||
return $body;
|
||||
}
|
||||
|
||||
public function preprocessTemplateDataForExpenseDecline($Data, $templateData, $expenceChildData){
|
||||
|
||||
|
||||
$inputString = $templateData->placeholder;
|
||||
$placeholders = explode(',', $inputString);
|
||||
|
||||
|
||||
$tableRows = '';
|
||||
foreach ($expenceChildData as $row) {
|
||||
$tableRows .= '<tr>';
|
||||
@ -418,7 +445,7 @@ public function preprocessTemplateDataForExpenseDecline($Data, $templateData, $e
|
||||
$tableRows .= '<td>' . $row['childStatus'] . '</td>';
|
||||
$tableRows .= '</tr>';
|
||||
}
|
||||
|
||||
|
||||
$values =[$Data->managerName, $Data->emp_name, $Data->status];
|
||||
$emailTemplate = str_replace('[table_rows]', $tableRows, $templateData->content);
|
||||
foreach ($placeholders as $index => $placeholder) {
|
||||
|
||||
@ -23,7 +23,7 @@ public function get_leave_data_using_leave_id($leave_id)
|
||||
// return $this->db->last_query();
|
||||
return $row;
|
||||
} else {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -45,7 +45,7 @@ public function get_delegation_data_using_delegation_id($delegation_id)
|
||||
// return $this->db->last_query();
|
||||
return $row;
|
||||
} else {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -70,7 +70,7 @@ public function get_expence_data_using_expence_id($expence_id)
|
||||
// return $this->db->last_query();
|
||||
return $row;
|
||||
} else {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -97,7 +97,7 @@ public function get_template_data_using_code($code, $type){
|
||||
if ($query->num_rows() > 0) {
|
||||
return $query->row();
|
||||
} else {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,11 +107,11 @@ public function get_user_data($user_id){
|
||||
$this->db->from('users');
|
||||
$this->db->where('id', $user_id);
|
||||
$query = $this->db->get();
|
||||
// $query = $query->result();
|
||||
// $query = $query->result();
|
||||
if ($query->num_rows() > 0) {
|
||||
return $query->row();
|
||||
} else {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
// return $query;
|
||||
|
||||
@ -126,10 +126,10 @@ public function get_admin_and_hr_mail_id($id){
|
||||
if ($query->num_rows() > 0) {
|
||||
return $query->row();
|
||||
} else {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user