diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 499e1bba..80785b81 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -245,8 +245,8 @@ defined('PDSTATUSID') OR define('PDSTATUSID','pd_status_id'); defined('PDTEAM') OR define('PDTEAM','m_pdteam'); defined('PDTEAMID') OR define('PDTEAMID','pdteam_id'); -defined('PDTEAMCITYMAP') OR define('PDTEAMCITYMAP','m_pdteam_city_mapping'); -defined('PDTEAMCITYMAPID') OR define('PDTEAMCITYMAPID','pdteam_city_mapping_id'); +defined('PDTEAMMAP') OR define('PDTEAMMAP','m_pdteam_map'); +defined('PDTEAMMAPID') OR define('PDTEAMMAPID','pdteam_map_id'); defined('PDOFFICIERSDETAILS') OR define('PDOFFICIERSDETAILS','m_pd_officiers_details'); defined('PDOFFICIERSDETAILSID') OR define('PDOFFICIERSDETAILSID','pd_officier_id'); diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index a843a0b9..e6d1f40e 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -203,8 +203,8 @@ class PD_Controller extends REST_Controller { /***********************PD ALLOCATION TYPE PROCESS **********/ - $where_condition_array = array('fk_city_id' => $pd_details['fk_city']); - $temp_city_id = $this->PD_Model->selectRecords(PDTEAMCITYMAP,$where_condition_array,$limit=0,$offset=0); + $where_condition_array = array('fk_city_id' => $pd_details['fk_city'],'fk_lender_id' => $pd_details['fk_lender_id']); + $temp_city_id = $this->PD_Model->selectRecords(PDTEAMMAP,$where_condition_array,$limit=0,$offset=0); if(count($temp_city_id)) { if($temp_city_id[0]['type'] == 0) // Allocate to Vendor @@ -218,30 +218,6 @@ class PD_Controller extends REST_Controller { if($local_pd_allocation_type == 1)// AUTO - Load Balance Allocation { - //1.select list pd officers from lender_pd offices map table and choose minimun allocated one - $fields = array('fk_user_id'); - $where_condition_array = array('fk_lender_id'=>$pd_details['fk_lender_id'],'isactive' => 1); - $lender_specific_pdofficers_list = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS); - - if(count($lender_specific_pdofficers_list)) - { - //select currently allocated PD values from PDOFFICIERSDETAILS table to find min value - $lender_specific_pdofficer_list_and_allocated_values = $this->PD_Model->getLenderSpecificPDOfficersListAndAllocatedValues($lender_specific_pdofficers_list); - - if(count($lender_specific_pdofficer_list_and_allocated_values)) - { - $allocated_values = array_column($lender_specific_pdofficer_list_and_allocated_values,'allocated'); - - $min_allocated = min($allocated_values); - $key = array_search($min_allocated,$allocated_values); - $final_pd_officer_to_allocate = $lender_specific_pdofficer_list_and_allocated_values[$key]['fk_user_id']; - $pd_details['fk_pd_allocated_to'] = $final_pd_officer_to_allocate; - $pd_details['fk_pd_status'] = ALLOCATED; - } - - } - else - { //select list of pd officers based on pd type, product, customer segment, and team from table (t_pd_officiers_details) and choose minimun allocated one and assign pd Officer and change status form TRIGGERED to ALLOCATED $fields = array('fk_user_id,allocated'); @@ -261,7 +237,7 @@ class PD_Controller extends REST_Controller { $pd_details['fk_pd_allocated_to'] = $final_pd_officer_to_allocate; $pd_details['fk_pd_status'] = ALLOCATED; - } + } else if($local_pd_allocation_type == 2) // AUTO - NEAREST Allocation diff --git a/api/application/controllers/Question_Management_Controller.php b/api/application/controllers/Question_Management_Controller.php index 4e6eb702..3ae9caed 100644 --- a/api/application/controllers/Question_Management_Controller.php +++ b/api/application/controllers/Question_Management_Controller.php @@ -106,7 +106,7 @@ class Question_Management_Controller extends REST_Controller { if(array_key_exists('answers',$records)) { $answers = $records['answers']; - unset($records['ansewrs']); + unset($records['answers']); } $where_condtion_array = array('question_id'=>$records['question_id']); diff --git a/api/application/controllers/User_Management_Controller.php b/api/application/controllers/User_Management_Controller.php index f3133e1e..8ac41641 100644 --- a/api/application/controllers/User_Management_Controller.php +++ b/api/application/controllers/User_Management_Controller.php @@ -19,6 +19,7 @@ class User_Management_Controller extends REST_Controller { parent::__construct(); $this->load->model('User_Management_Model'); $this->load->library('AWS_S3'); + $this->load->library('AWS_SES'); } public function listAllUsers_get() @@ -44,7 +45,7 @@ class User_Management_Controller extends REST_Controller { public function saveNewUser_post() { - //print_r(json_decode($this->post('pdofficer'),true));die; + $roles = ""; $lender_hierarchy = ""; $pdofficer = ""; @@ -55,11 +56,7 @@ class User_Management_Controller extends REST_Controller { $records = json_decode($this->post('records'),true); - //print_r($records);die; - //$roles = json_decode($this->post('roles'),true); - //print_r(json_decode($this->post('lender_hierarchy'),true));die; - //$lender_hierarchy = json_decode($this->post('lender_hierarchy'),true); - //echo $_FILES['profilepic']['name'];die; + if(!empty($_FILES['profilepic']['tmp_name'])) { @@ -118,14 +115,14 @@ class User_Management_Controller extends REST_Controller { $this->User_Management_Model->saveRecords($role_array,USERPROFILEROLES); } } - //$user_id = 52; + if($lender_hierarchy != "") { - //print_r($lender_hierarchy);die; + foreach($lender_hierarchy as $hierarchy) - { //echo $hierarchy['lender_hierarchy_id'];die; - $hierarchy = array('fk_hierarchy_id'=>$hierarchy['lender_hierarchy_id'],'fk_user_id'=>$user_id);//insert hierarchy againest lender type users + { + $hierarchy = array('fk_hierarchy_id'=>$hierarchy['lender_hierarchy_id'],'fk_user_id'=>$user_id); $this->User_Management_Model->saveRecords($hierarchy,USERPROFILEHIERARCHY); } } @@ -137,6 +134,10 @@ class User_Management_Controller extends REST_Controller { } if($user_id != '' || $user_id != null) { + + // send a verification mail for registered user to get PD alert informations + // They have to clik a verification link from sent mail + $this->aws_ses->verifyEmailIdentity($records['email']); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; $data['record'] = $user_id; diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index 55b276a7..c09e0e12 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -113,8 +113,9 @@ class PDALERTS /* - * + * ********************************************************************************************************** * EMAIL FUNCTIONALITY + ************************************************************************************************************ */ @@ -173,10 +174,11 @@ class PDALERTS } //$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) + foreach($email_ids_to_send_notification as $email) { - //email SES + //email SES have to config + //$CI->aws_ses->sendMail($email); } diff --git a/api/application/libraries/AWS_SES.php b/api/application/libraries/AWS_SES.php index 555116b9..1e8d8b37 100644 --- a/api/application/libraries/AWS_SES.php +++ b/api/application/libraries/AWS_SES.php @@ -25,20 +25,20 @@ class AWS_SES } - public function sendMail() + public function sendMail($email) { $sender_email = 'velmurugan.s@venbainfotech.com'; // 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 = ['raro@spindl-e.com']; + $recipient_emails = [$email]; // 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 = 'SineEdge Test'; + $subject = 'SineEdge PD Test'; $plaintext_body = 'This email was sent with Amazon SES using the AWS SDK for PHP.' ; $html_body = '

AWS Amazon Simple Email Service Test Email

'. '

This email was sent with '. @@ -89,7 +89,7 @@ class AWS_SES 'EmailAddress' => $email, ]); - print_r($result); + //print_r($result); } public function sendCustomVerificationEmail($email,$template_name = 'myCustom') @@ -113,7 +113,7 @@ class AWS_SES 'TemplateSubject' => 'customTemlate', // REQUIRED ]); - print_r($result); + //print_r($result); }