diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 28887f14..782493a4 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -681,10 +681,16 @@ class Sales_PD_Controller extends REST_Controller { log_message('ERROR','####SALESPD AFTER 10 PREPARED REPORT'.$records['sales_pd_id']); //echo 'afetr 10'; //trigger mail function - $s1 = $this->Sales_PD_Model->getState($records['sales_pd_id']); - $questions = json_decode($s1[0]['section_data'],true); - $Qdata = $this->processSalesPDQuestions($questions['questions'],1); - $state = '';if(!empty($Qdata)){$state = $Qdata['state'];} + $state = ''; + $form = $this->Sales_PD_Model->selectCustomRecords(array(),array('isactive' => 1,'sales_pd_id' => $records['sales_pd_id'],'section_id' => 1,'status' => 1),SALESPD_SECTION_DATA); + $gen_form = json_decode($form[0]['section_data'],true); + foreach ($gen_form['questions'] as $g_key => $g_value) + { + if($g_value['question_key'] == 'state') + { + $state = $g_value['answer_value']; + } + } PDALERTS::sendSalesPDMail($this,$records['sales_pd_id'],$state); } diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index dc188d5d..16055e8e 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -540,14 +540,14 @@ class PDALERTS $mail->Password = "noreply@ssa"; // "The password" $mail->Port = 465; // "The port" $mail_id = 'ssa@venbainfotech.com'; - if(ENVIRONMENT == 'testing' && $state == "Delhi"){ $mail->addBCC("venkiraj0@gmail.com");} + if(ENVIRONMENT == 'testing' && $state == 5){ $mail->addBCC("venkiraj0@gmail.com");} if(ENVIRONMENT == 'production') { $mail_id = 'cpa@smcfinance.com'; $mail->addBCC("neville@sinemanagement.com"); $mail->addBCC("ssa@venbainfotech.com"); $mail->addAddress('cpumumbai@smcfinance.com'); - if($state == "Delhi"){ $mail->addBCC("satendersingh@smcfinance.com");} + if($state == 5){ $mail->addBCC("satendersingh@smcfinance.com");} //$mail->addBCC("vitvelz@gmail.com"); } // Name is optional } $mail->addAddress($mail_id); diff --git a/api/application/models/Sales_PD_Model.php b/api/application/models/Sales_PD_Model.php index 04517592..a56b7cb3 100644 --- a/api/application/models/Sales_PD_Model.php +++ b/api/application/models/Sales_PD_Model.php @@ -80,15 +80,6 @@ class Sales_PD_Model extends SPARQ_Model { //echo $this->db->last_query();die(); return $result; } - public function getState($sales_pd_id){ - $this->db->SELECT('section_data'); - $this->db->FROM('t_salespd_section_data'); - $this->db->WHERE('sales_pd_id',$sales_pd_id); - $this->db->WHERE('isactive',1); - $this->db->WHERE('section_id',1); - $result = $this->db->get()->result_array(); - return $result; - } } \ No newline at end of file