SMC Vendor AutoMail : ps

This commit is contained in:
sanjeev 2021-12-25 11:02:43 +05:30
parent 289d51003a
commit 68b6e594f4
2 changed files with 49 additions and 53 deletions

View File

@ -1654,7 +1654,7 @@ public function assignPDTempalate($data)
$records['vendor_status'] = isset($records['pd_status']) ? $records['pd_status'] : ALLOCATED ; //Here vendor_status is dynamic (ALLOCATED,SCHEDULED,COMPLETED like that)
//Mail - SMC Vendor.
if($records['vendor_status'] == ALLOCATED){
PDALERTS::sendMWcreditPDMail($this,$records['pd_id']);
PDALERTS::sendMWcreditPDMail($this,$records['pd_id'],2);
$records['pd_status'] = ALLOCATED_TO_FIA;
}
}
@ -11294,13 +11294,12 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
{
$pd_details['pd_status'] = ALLOCATED_TO_FIA;
$pd_details['vendor_status'] = ALLOCATED;
PDALERTS::sendMWcreditPDMail($this,$pd_details['pd_id']);
PDALERTS::sendMWcreditPDMail($this,$pd_details['pd_id'],1);
}
else if(count($regional_credit_manager))
{
$pd_details['fk_pd_allocated_to'] = $regional_credit_manager[0]['userid'];
$pd_details['pd_status'] = ALLOCATED;
}
else
{

View File

@ -691,7 +691,7 @@ class PDALERTS
//echo $d;
}
public static function sendMWcreditPDMail($CI,$pd_id)
public static function sendMWcreditPDMail($CI,$pd_id,$flag)
{
// $pd_id = $arr['pd_id'];
if($pd_id != "" || $pd_id != null)
@ -718,57 +718,54 @@ class PDALERTS
$core_details = $CI->db->GET()->result_array();
// echo count($core_details);
// die();
if(count($core_details))
{
$mail = $CI->phpmailer_library->load();
// $content = "Hi Sir/Mam".$pd_data[0]['officer_name'].",<br><br>MW-credit PD (".$pd_data[0]['officer_name'].") is Allocated to You";
$CI->db->SELECT("*");
$CI->db->FROM(PDNOTIFICATIONMSG." as PDNOTIFICATIONMSG");
$CI->db->WHERE("PDNOTIFICATIONMSG.pd_status",ALLOCATED);
$CI->db->WHERE("PDNOTIFICATIONMSG.isactive",1);
$pd_notification_msg = $CI->db->GET()->result_array();
// print_r($pd_notification_msg);die();
$msg = $pd_notification_msg[0]['lender'];
$msg = self::stringReplace($msg,$core_details,'MAIL');
$mail->IsSMTP(); // Telling the class to use SMTP
$mail_id1 = $core_details[0]['allocated_email'];
$mail_id2 = $core_details[0]['agency_mail'];
$mail->SMTPAuth = true;
$mail->SMTPDebug = 0;
$mail->SMTPSecure = "ssl";
$mail->Host = 'bh-in-16.webhostbox.net'; // SMTP server
$mail->Username = "noreply@ssa.sineedge.com"; // "The account"
$mail->Password = "noreply@ssa"; // "The password"
$mail->Port = 465; // "The port"
$mail->From = 'noreply@pdgenie.com';
$fromName = 'PD Genie';
$subject = 'PD Allocated For Application ID -'.$core_details[0]['lender_applicant_id'];
$mail->addAddress($mail_id1);
$mail->addBCC($mail_id2);
if(ENVIRONMENT == 'testing' || ENVIRONMENT == 'development') {
$fromName .= ' ( TEST ENV ) ';
$subject .= ' ( TEST ENV ) ';
$mail->addBCC("venkiraj0@gmail.com");
}
$mail->FromName = $fromName;
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = 'Dear Team<br><br> '.$msg;
$mail->AltBody = $msg;
if(!$mail->send()) {
// $logger->error("Mailer Error:" ,array($mail->ErrorInfo));
log_message('ERROR','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND'.$subject.'- mail Error - '.$mail->ErrorInfo);
if(count($core_details))
{
$mail = $CI->phpmailer_library->load();
if($flag == 2){
// Allocated to Agency
$mail_id = $core_details[0]['agency_mail'];
$msg = "PD for Loan Application ID-".$core_details[0]['pd_sno']." (".$core_details[0]['lender_applicant_id'] ." ".$core_details[0]['short_name'].") have been triggered to the vendor. ";
$subject = "PD allocated to vendor for application ID - ".$core_details[0]['pd_sno'] ." & ". $core_details[0]['lender_applicant_id'] ." ".$core_details[0]['short_name'];
}else if($flag == 1){
// Allocated by CM/RCM
$mail_id = $core_details[0]['allocated_email'];
$msg = "PD for Loan Application ID -".$core_details[0]['pd_sno'] ." & ". $core_details[0]['lender_applicant_id'] ." ".$core_details[0]['short_name']." have been triggered to the vendor.";
$subject = "PD allocated for application ID - ".$core_details[0]['pd_sno'] ." & ". $core_details[0]['lender_applicant_id'] ." ".$core_details[0]['short_name'];
}
$mail->IsSMTP(); // Telling the class to use SMTP
$mail->SMTPAuth = true;
$mail->SMTPDebug = 0;
$mail->SMTPSecure = "ssl";
$mail->Host = 'bh-in-16.webhostbox.net'; // SMTP server
$mail->Username = "noreply@ssa.sineedge.com"; // "The account"
$mail->Password = "noreply@ssa"; // "The password"
$mail->Port = 465; // "The port"
$mail->From = 'noreply@pdgenie.com';
$fromName = 'PD Genie';
$mail->addAddress($mail_id);
if(ENVIRONMENT == 'testing' || ENVIRONMENT == 'development') {
$fromName .= ' ( TEST ENV ) ';
$subject .= ' ( TEST ENV ) ';
}
$mail->FromName = $fromName;
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = 'Dear Team ,<br><br> '.$msg;
$mail->AltBody = $msg;
if(!$mail->send()) {
// $logger->error("Mailer Error:" ,array($mail->ErrorInfo));
log_message('ERROR','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND'.$subject.'- mail Error - '.$mail->ErrorInfo);
}
else{
// log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL SENDED SUCESSFULLY'.$subject);
}
}else{
log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND BCOZ '.count($core_details).' core_details');
}
else{
// log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL SENDED SUCESSFULLY'.$subject);
}
}else{
log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND BCOZ '.count($core_details).' core_details');
}else{
log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND BCOZ THERE IS NO PDID');
}
}else{
log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND BCOZ THERE IS NO PDID');
}
}//function closed here.
}