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

View File

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