SMC Vendor - Mail Changes : ps

This commit is contained in:
sanjeev 2021-12-09 20:48:18 +05:30
parent b9b528f480
commit 119ef8b097
3 changed files with 65 additions and 2 deletions

View File

@ -1638,8 +1638,11 @@ public function assignPDTempalate($data)
// IF Condition - PD AGENCY ID means SMC VENDOR FLOW
if(isset($records['pd_agency_id'])){
// IF Condition - using PDID get the lender and mapped with SMC_lender_id macthed means Vendor status dynamically assigned
// {"records":{"pd_id":"2795","fk_pd_allocated_to":"383","pd_agency_id":"2","fk_updatedby":"395"}}
if($smc_lender_id == $lender_id[0]['fk_lender_id'] && isset($records['pd_agency_id']) && $records['pd_agency_id'] != null){
$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']);}
}
}
else{

View File

@ -690,7 +690,67 @@ class PDALERTS
//print_r($CI->db->last_query);
//echo $d;
}
public static function sendMWcreditPDMail($CI,$pd_id)
{
// $pd_id = $arr['pd_id'];
if($pd_id != "" || $pd_id != null)
{
// $CI->db->SELECT("PDTRIGGER.pd_id,PDTRIGGER.pd_sno,ENTITY.short_name,PRODUCT.abbr,'concat(USERPROFILE.first_name,' ',USERPROFILE.last_name)' as officer_name,AGENCYLIST.agency_name,USERPROFILE.vendor_status,AGENCYLIST.mail_id,USERPROFILE.email");
$CI->db->SELECT("PDTRIGGER.pd_id,PDTRIGGER.pd_sno,concat(USERPROFILE.first_name,'',USERPROFILE.last_name) as officer_name,AGENCYLIST.agency_name,PDTRIGGER.vendor_status,AGENCYLIST.mail_id,USERPROFILE.email");
$CI->db->FROM(PDTRIGGER.' as PDTRIGGER');
$CI->db->JOIN(AGENCYLIST. ' as AGENCYLIST','PDTRIGGER.pd_agency_id = AGENCYLIST.agency_id');
$CI->db->JOIN(USERPROFILE. ' as USERPROFILE','PDTRIGGER.fk_pd_allocated_to = USERPROFILE.userid');
$CI->db->WHERE('PDTRIGGER.pd_id',$pd_id);
$pd_data = $CI->db->GET()->result_array();
if(count($pd_data))
{
$mail = $CI->phpmailer_library->load();
$content = "Hi ".$pd_data[0]['officer_name'].",<br><br>MW-credit PD (".$pd_data[0]['pd_sno'].") is Allocated to You";
$mail->IsSMTP(); // Telling the class to use SMTP
$mail_id1 = $pd_data[0]['email'];
$mail_id2 = $pd_data[0]['mail_id'];
$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"
if(ENVIRONMENT == 'testing'){ $mail->addBCC("venkiraj0@gmail.com");$mail->addBCC("venbalap08@gmail.com");}
$mail->addAddress($mail_id1); //
$mail->addBCC($mail_id2); //
$mail->From = 'noreply@pdgenie.com';
$fromName = 'PD Genie'; if(ENVIRONMENT == 'testing' || ENVIRONMENT == 'development') { $fromName .= ' ( TEST ENV ) '; }
$mail->FromName = $fromName;
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = "Mwise-credit PD Allocation";
$mail->Body = $content;
$mail->AltBody = $content;
// $try = 1;
// sendMailAgain:
// if(!$mail->send()) {
// //$logger->error("Mailer Error:" ,array($mail->ErrorInfo));
// //echo 'not send';
// log_message('ERROR','###MWISE-CREDITPD MAIL NOT SEND'.$content[1].'- mail Error - '.$mail->ErrorInfo);
// if($try == 4)
// {
// goto stopSendAttempt;
// }
// $try++;
// log_message('ERROR','###MWISE-CREDITPD MAIL attempt'.$try.' '.$content[1].'- mail Error - '.$mail->ErrorInfo);
// goto sendMailAgain;
// } else {
// //$logger->info("Mailer Send:" ,array('mail_ID' => $lender_email,'Status' => 'SEND'));
// log_message('ERROR','####MWISE-CREDITPD MAIL SEND'.$content[1]);
// }
// stopSendAttempt:
}
}
}
}

View File

@ -2299,7 +2299,7 @@ class PD_Model extends SPARQ_Model {
//Get SMC CityWise Agency
function getCityWiseSMCAgency($city){
$this->db->select('AGENCYLIST.agency_id as entity_id, AGENCYLIST.agency_name as full_name, AGENCYLIST.agency_abbr as short_name,AGENCYLIST.fk_city_id');
$this->db->select('AGENCYLIST.agency_id as entity_id, AGENCYLIST.agency_name as full_name, AGENCYLIST.agency_abbr as short_name,AGENCYLIST.fk_city_id,AGENCYLIST.mail_id');
$this->db->from(AGENCYLIST.' as AGENCYLIST');
$this->db->where('AGENCYLIST.isactive',1);
if($city!=""){