sparqapi/api/application/helpers/custom_pdalerts_helper.php
2021-01-04 15:16:09 +05:30

68 lines
2.3 KiB
PHP

<?php
class CUSTOM_PDALERTS
{
/*
This function plays role of sending sms/email while PD status changing.
@param pdid
get current status, lender, created by, allocated_to, etc by using pdid.
then get pd notification config's using current pd status.
based on that pd config's send sms/email to endpoints
*/
public static function custom_pdnotification($CI,$core_details)
{
//echo 'CUSTOM';
/********************CUSTOM MAIL NOTIFICATION***********************/
if(($core_details[0]['pd_status'] == 'TRIGGERED') && ($core_details[0]['short_name'] == 'IIB' || $core_details[0]['short_name'] == 'UDAAN' || $core_details[0]['short_name'] == 'IMGC'))
{
//get msg config
$CI->db->SELECT("*");
$CI->db->FROM(PDNOTIFICATIONMSG." as PDNOTIFICATIONMSG");
$CI->db->WHERE("PDNOTIFICATIONMSG.pd_status",$core_details[0]['pd_status']);
$CI->db->WHERE("PDNOTIFICATIONMSG.isactive",1);
$pd_notification_msg = $CI->db->GET()->result_array();
$msg = $pd_notification_msg[0]['pdincharge'];
$msg = PDALERTS::stringReplace($msg,$core_details);
$additional_data_for_logs['to_whom'] = 'LEDNER';
if(ENVIRONMENT == 'production')
{
PDALERTS::sendMail($CI,'sinepd@sinemanagement.com',$msg,$core_details);
PDALERTS::sendMail($CI,'ssa@venbainfotech.com',$msg,$core_details);
log_message('ERROR','###CUSTOM MAIL TRIGGERED to sinepd@sinemanagement.com');
}
else if(ENVIRONMENT == 'testing')
{
//echo 'TESTING';
PDALERTS::sendMail($CI,'ssa@venbainfotech.com',$msg,$core_details);
//PDALERTS::sendMail($CI,'vitvelz@gmail.com',$msg,$core_details);
log_message('ERROR','###CUSTOM MAIL TRIGGERED to ssa@venbainfotech.com');
}
}
if($core_details[0]['pd_status'] == ALLOCATED_TO_FIA && $core_details[0]['vendor_email'] != '')
{
$msg = 'Dear Team,\n\n New PD has been Allocated to you. \" {{applicant_name}} \" ID - \" {{applicant_id}} \" .\n\nWarm Regards,\nSineedge Consulting Private Limited.';
$msg = PDALERTS::stringReplace($msg,$core_details,'MAIL');
PDALERTS::sendMail($CI,$core_details[0]['vendor_email'],$msg,$core_details);
}
//die();
/********************************************************/
}
}
?>