igr live issues

This commit is contained in:
VE10-Sanjeev 2025-04-01 10:27:42 +00:00
parent 6f81ce7617
commit 957616db54
2 changed files with 33 additions and 22 deletions

View File

@ -928,7 +928,7 @@ function viewIGRDetails()
$result_for_email = $this->inwardgateregister_model->getDetailsforEmail($this->session->get('userId'),$roleId);
$result_for_history = $this->inwardgateregister_model->getHistoryDetailsforEmail($IGRNo);
$notification = new Notification();
$history_content = "<br>IGR History<br><br> <ul>";
@ -984,19 +984,21 @@ function viewIGRDetails()
// $history_content .= "<br>" . $readable_field . ": `" . $history[$j]->old_data . "` was updated to `" . $history[$j]->new_data . "` .";
}
$history_content .= "</ul>";
$email = "";
for ($i = 0; $i < count($result_for_email['emails']); $i++) {
$email .= $result_for_email['emails'][$i]->email . " , ";
$to_email_addr = "";
for ($i = 0; $i < count($result_for_email['to_mails']); $i++) {
$to_email_addr .= $result_for_email['to_mails'][$i]->email . " , ";
// $to_email_addr .= "sanjeev.p@venbainfotech.com,gowtham.m@venbainfotech.com";
}
$email = rtrim($email, " ,");
$to_email_addr = rtrim($to_email_addr, " ,");
$email_response = $notification->sendEmail([
'recipient_email' => $email,
'recipient_email' => $to_email_addr,
'subject' => $result_for_email['company'].' - IGR Notification',
// 'carboncopy'=>Sales@resicoindustries.com,Factory@resicoindustries.com,Invoice@resicoindustries.com,
// 'description' => 'IGR Number : '.$IGRNo.' is Edited By '.($result_for_email['full_name'] ?? $this->session->get('name'))." On ".date('d-m-Y H:i A', strtotime(get_current_date_time() . ' +30 seconds')). $history_content,
'description' => $result_for_history['first_line']."<br>" .$history_content,
'company' => $result_for_email['company'],
'from_mail'=> $result_for_email['from_mail']
'from_mail'=> $result_for_email['from_mails']
]);
log_message('error', 'email reponse : ' . json_encode($email_response));
@ -1006,9 +1008,9 @@ function viewIGRDetails()
// Log the result
if ($receiving_status) {
$this->logger->info("Email IDs = " . $email . " " . $mail_log);
$this->logger->info("Email IDs = " . $to_email_addr . " " . $mail_log);
} else {
$this->logger->error("Email IDs = " . $email . " " . $mail_log);
$this->logger->error("Email IDs = " . $to_email_addr . " " . $mail_log);
}
// echo "***".$history_content;die;
@ -1424,22 +1426,24 @@ function updateIGRWeight(){
$result_for_email = $this->inwardgateregister_model->getDetailsforEmail($this->session->get('userId'),$roleId);
$email = "";
for ($i = 0; $i < count($result_for_email['emails']); $i++) {
$email .= $result_for_email['emails'][$i]->email . " , ";
}
$email = rtrim($email, " ,");
// print_r($result_for_email);die;
$to_email_addr = '';
for ($i = 0; $i < count($result_for_email['to_mails']); $i++) {
$to_email_addr .= $result_for_email['to_mails'][$i]->email . " , ";
}
// $to_email_addr = " gowtham.m@venbainfotech.com , sanjeev.p@venbainfotech.com";
$to_email_addr = rtrim($to_email_addr, " ,");
$content = 'A new remark was created by '.$result_for_email['full_name'].' against IGR no '.$IGRNo.',</br></br> "'.$remark.'"';
$notification = new Notification();
$notification->sendEmail([
'recipient_email' => $email,
'recipient_email' => $to_email_addr,
'subject' => $result_for_email['company'].' - IGR Remark Raised',
'description' => $content,
'company' => $result_for_email['company'],
'from_mail'=> $result_for_email['from_mail']
'from_mail'=> $result_for_email['from_mails']
]);

View File

@ -1317,15 +1317,22 @@ $builder = $this->db->table('t_igr_history')
$query2 = $this->db->query("
SELECT email FROM tbl_users
WHERE isDeleted = 0 AND roleId =".$roleId // hardcoded because auditor role only. refer with gwm 29/01/2025
WHERE isDeleted = 0 AND roleId =".$roleId
);
$emails = $query2->getResult();
$to_mails = $query2->getResult();
$query3 = $this->db->query("
SELECT email FROM tbl_users
WHERE isDeleted = 0 AND userId =".$userId
);
$from_mails = $query3->getRow();
return [
'from_mail' => $company ? $company->EmailAddress : null,
'full_name' => $fullName ? $fullName->FullName : null,
'company' => $company ? $company->CompanyName : null,
'emails' => $emails
'company_mail' => $company ? $company->EmailAddress : null,
'full_name' => $fullName ? $fullName->FullName : null,
'from_mails' => $from_mails ? $from_mails->email : null ,
'to_mails' => $to_mails,
];
}