CUSTOM PD ALERT ENABLED
This commit is contained in:
parent
0cb78ffabe
commit
04ddab4b1c
57
api/application/helpers/custom_pdalerts_helper.php
Normal file
57
api/application/helpers/custom_pdalerts_helper.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?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);
|
||||||
|
}
|
||||||
|
else if(ENVIRONMENT == 'testing')
|
||||||
|
{
|
||||||
|
//echo 'TESTING';
|
||||||
|
PDALERTS::sendMail($CI,'ssa@venbainfotech.com',$msg,$core_details);
|
||||||
|
//PDALERTS::sendMail($CI,'vitvelz@gmail.com',$msg,$core_details);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
@ -25,6 +25,7 @@ class PDALERTS
|
|||||||
$CI =&get_instance();
|
$CI =&get_instance();
|
||||||
//$CI->load->library('AWS_SNS');
|
//$CI->load->library('AWS_SNS');
|
||||||
$CI->load->helper('push_notification');
|
$CI->load->helper('push_notification');
|
||||||
|
$CI->load->helper('custom_pdalerts');
|
||||||
$pd_notification_configs = array();
|
$pd_notification_configs = array();
|
||||||
//die();
|
//die();
|
||||||
$additional_data_for_logs = array('pd_id' =>$pdid);
|
$additional_data_for_logs = array('pd_id' =>$pdid);
|
||||||
@ -56,6 +57,12 @@ class PDALERTS
|
|||||||
// die();
|
// die();
|
||||||
if(count($core_details))
|
if(count($core_details))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//Trigger Custom Notification apart from entity and PD level notification config
|
||||||
|
CUSTOM_PDALERTS::custom_pdnotification($CI,$core_details);//die();
|
||||||
|
//END Trigger Custom Notification apart from entity and PD level notification config
|
||||||
|
|
||||||
|
|
||||||
$is_pd_notify_enabled = $core_details[0]['is_notify_enabled'];
|
$is_pd_notify_enabled = $core_details[0]['is_notify_enabled'];
|
||||||
$is_sms_enabled = $core_details[0]['is_sms_enabled'];
|
$is_sms_enabled = $core_details[0]['is_sms_enabled'];
|
||||||
$is_mail_enabled = $core_details[0]['is_mail_enabled'];
|
$is_mail_enabled = $core_details[0]['is_mail_enabled'];
|
||||||
@ -203,20 +210,7 @@ class PDALERTS
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************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'))
|
|
||||||
// {
|
|
||||||
// if(ENVIRONMENT == 'production')
|
|
||||||
// {
|
|
||||||
// self::sendMail($CI,'sinepd@sinemanagement.com',$msg,$core_details);
|
|
||||||
// }
|
|
||||||
// else if(ENVIRONMENT == 'testing')
|
|
||||||
// {
|
|
||||||
// self::sendMail($CI,'ssa@venbainfotech.com',$msg,$core_details);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user