diff --git a/api/application/config/routes.php b/api/application/config/routes.php index afcbcbbe..f8cb6d71 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -69,7 +69,10 @@ $route['getListOfCity'] = 'Common_Masters_Controller/getListOfCity'; $route['saveBranch'] = 'Common_Masters_Controller/saveBranch'; $route['getListOfMaster'] = 'Common_Masters_Controller/getListOfMaster'; -$route['saveMaster'] = 'Common_Masters_Controller/saveMaster'; +$route['saveMaster'] = 'Common_Masters_Controller/saveMaster'; +$route['savePDAllocationType'] = 'Common_Masters_Controller/savePDAllocationType'; +$route['savePDNotifications'] = 'Common_Masters_Controller/savePDNotifications'; +$route['getPDNotificationsList'] = 'Common_Masters_Controller/getPDNotificationsList'; diff --git a/api/application/controllers/Common_Masters_Controller.php b/api/application/controllers/Common_Masters_Controller.php index ebcb2986..a62769a7 100644 --- a/api/application/controllers/Common_Masters_Controller.php +++ b/api/application/controllers/Common_Masters_Controller.php @@ -1214,5 +1214,78 @@ class Common_Masters_Controller extends REST_Controller { } /* End of City Listing */ + /* For only update PDAllocationType */ + public function savePDAllocationType_post() + { + + $records = $this->post('records'); + $count = 0; + + + foreach( $records as $record){ + $where_condition_array = array('pd_allocation_type_id' => $record['pd_allocation_type_id']); + $result = $this->Common_Masters_Model->updateRecords($record,PDALLOCATIONTYPE,$where_condition_array); + if($result == 1) + { + $count++; + } + } + + if($count == count($records)) + { + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $this->response($data,REST_Controller::HTTP_OK); + } + } + /**End of PD-Allocation-Type */ + + + /* For update PD Notification Table info*/ + + public function savePDNotifications_post() + { + + } + + + /* For Get List PD Notifications config's */ + + public function getPDNotificationsList_get() + { + $columns = array('PDNOTIFICATION.pdnotification_id', 'PDNOTIFICATION.fk_pd_status_id','PDSTATUS.pd_status_name', 'PDNOTIFICATION.sms_lender', 'PDNOTIFICATION.sms_pdofficer', 'PDNOTIFICATION.sms_pdincharge', 'PDNOTIFICATION.mail_lender','PDNOTIFICATION.mail_pdincharge', 'PDNOTIFICATION.mail_pdofficer', 'PDNOTIFICATION.isactive'); + $table = PDNOTIFICATION." as PDNOTIFICATION"; + $joins = array( + + array('table' => PDSTATUS.' as PDSTATUS', + 'condition' => 'PDNOTIFICATION.fk_pd_status_id = PDSTATUS.pd_status_id ', + 'jointype' => 'INNER') + ); + $result = $this->Common_Masters_Model->getJoinRecords($columns,$table,$joins); + if(count($result)) + { + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $this->response($data,REST_Controller::HTTP_OK); + } + + + } } \ No newline at end of file diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 7a5f0a40..f2713e49 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -19,6 +19,7 @@ class PD_Controller extends REST_Controller { parent::__construct(); $this->load->model('PD_Model'); $this->load->library('AWS_S3'); + $this->load->library('AWS_SES'); } /***********************Get get List Of Lenders Details for PD Trigger Page************************/ @@ -171,7 +172,9 @@ class PD_Controller extends REST_Controller { /********For Save New PD while Trigger****/ public function triggerNewPD_post() { - + echo "TRIGGER"; + //$this->aws_ses->verifyEmailAddress('velmurugan.s@venbainfotech.com'); + die(); $pd_details = json_decode($this->post('pd_details'),true); $pd_applicant_details = json_decode($this->post('pd_applicant_details'),true); $pd_document_titles = json_decode($this->post('pd_document_titles'),true); diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index 5f053e41..55b276a7 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -33,10 +33,10 @@ class PDALERTS //1.Get Current Status and createdby , lenders info by pdid $CI->db->SELECT("PDTRIGGER.fk_lender_id,PDTRIGGER.lender_applicant_id,PDTRIGGER.fk_pd_status,PDSTATUS.pd_status_name,PDTRIGGER.fk_createdby,USERPROFILE.fk_entity_id as created_entity_type,USERPROFILE.email as created_mail,USERPROFILE.mobile_no as created_mobile_no,PDTRIGGER.fk_pd_allocated_to,ALLOCATED.email as allocated_email,ALLOCATED.mobile_no as allocated_mobile_no,ALLOCATED.fk_entity_id as allocated_entity_type,PDTRIGGER.pd_agency_id"); - $CI->db->FROM(PDTRIGGER". as PDTRIGGER"); + $CI->db->FROM(PDTRIGGER." as PDTRIGGER"); $CI->db->JOIN(USERPROFILE." as USERPROFILE","PDTRIGGER.fk_createdby = USERPROFILE.user_id"); $CI->db->JOIN(USERPROFILE." as ALLOCATED","PDTRIGGER.fk_pd_allocated_to = ALLOCATED.user_id"); - $CI->db->JOIN(PDSTATUS." as PDSTATUS","PDTRIGGER.fk_pd_status = PDSTATUS.pd_status_id") + $CI->db->JOIN(PDSTATUS." as PDSTATUS","PDTRIGGER.fk_pd_status = PDSTATUS.pd_status_id"); $CI->db->WHERE("PDTRIGGER.pd_id",$pdid); $core_details = $CI->db->GET()->result_array(); @@ -117,6 +117,68 @@ class PDALERTS * EMAIL FUNCTIONALITY */ + + if(count($core_details)) + { + + //pd cretaed entity type is 2 then sent mail only for that email + if($core_details['created_entity_type'] == 2) // 2 - Lender Type + { + if($pd_notification_configs['mail_lender'] == 1) + { + array_push($email_ids_to_send_notification,$core_details['created_mail']); + } + } + else //sent email to all lender contacts associated to lender id + { + if($pd_notification_configs['mail_lender'] == 1) + { + + $CI->db->SELECT("contact_email"); + $CI->db->FROM(ENTITYCHILD); + $CI->db->WHERE("fk_entity_id",$core_details['fk_lender_id']); + $lender_emails = $CI->db->GET()->result_array(); + if(count($lender_mobile_nos)) + { + foreach($lender_emails as $lender_email) + { + array_push($email_ids_to_send_notification,$lender_email); + } + } + } + } + + //add pd officer email + if($pd_notification_configs['mail_pdofficer'] == 1) + { + array_push($email_ids_to_send_notification,$core_details['allocated_email']); + } + + //add pd incharge emails + if($pd_notification_configs['mail_pdincharge'] == 1) + { + $CI->db->DISTINCT(); + $CI->db->SELECT("email"); + $CI->db->FROM(USERPROFILE." as USERPROFILE"); + $CI->db->JOIN(USERPROFILEROLES." as USERPROFILEROLES","USERPROFILE.userid = USERPROFILEROLES.fk_userid AND USERPROFILEROLES.isactive = 1"); + $CI->db->WHERE("USERPROFILEROLES.user_role",'PDINCHAGRE'); + $inchagre_email = $CI->db->GET()->result_array(); + if(count($inchagre_email)) + { + foreach($inchagre_email as $email) + { + array_push($email_ids_to_send_notification,$email); + } + } + } + + //$msg = "PD for Lender Applicant ID:".$core_details['lender_applicant_id']."has been".$core_details['pd_status_name']; // status base configurable + foreach($mobile_nos_to_send_notification as $no) + { + + //email SES + } + } } @@ -124,7 +186,7 @@ class PDALERTS } - + } diff --git a/api/application/libraries/AWS_SES.php b/api/application/libraries/AWS_SES.php index 6dae5211..a626fd9c 100644 --- a/api/application/libraries/AWS_SES.php +++ b/api/application/libraries/AWS_SES.php @@ -21,7 +21,7 @@ class AWS_SES //echo "listAllBuckets"; $this->SES = SesClient::factory($this->ses_properties); - $this->sendMail(); + $this->createCustomVerificationEmailTemplate(); } @@ -31,14 +31,14 @@ class AWS_SES // Replace these sample addresses with the addresses of your recipients. If // your account is still in the sandbox, these addresses must be verified. - $recipient_emails = ['sanjeev.p@venbainfotech.com']; + $recipient_emails = ['vitvelz@gmail.com']; // Specify a configuration set. If you do not want to use a configuration // set, comment the following variable, and the // 'ConfigurationSetName' => $configuration_set argument below. //$configuration_set = 'ConfigSet'; - $subject = 'Amazon SES test (AWS SDK for PHP)'; + $subject = 'SineEdge Test'; $plaintext_body = 'This email was sent with Amazon SES using the AWS SDK for PHP.' ; $html_body = '