diff --git a/api/application/composer.json b/api/application/composer.json
index 275403d9..6490947c 100644
--- a/api/application/composer.json
+++ b/api/application/composer.json
@@ -19,7 +19,8 @@
"aws/aws-sdk-php": "^3.64",
"amphp/amp": "^1.2",
"dompdf/dompdf" : "0.8.2",
- "tecnickcom/tcpdf": "^6.2"
+ "tecnickcom/tcpdf": "^6.2",
+ "phpmailer/phpmailer": "^6.0"
},
"suggest": {
diff --git a/api/application/composer.lock b/api/application/composer.lock
index c3f2dc96..f8926ec7 100644
--- a/api/application/composer.lock
+++ b/api/application/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "3c701de93cab2666e738c9d504ee46b0",
+ "content-hash": "41e739a6decc9a048b148e7142286874",
"packages": [
{
"name": "amphp/amp",
@@ -645,6 +645,72 @@
"homepage": "https://github.com/PhenX/php-svg-lib",
"time": "2018-06-03T10:10:03+00:00"
},
+ {
+ "name": "phpmailer/phpmailer",
+ "version": "v6.0.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPMailer/PHPMailer.git",
+ "reference": "8190d73eb5def11a43cfb020b7f36db65330698c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/8190d73eb5def11a43cfb020b7f36db65330698c",
+ "reference": "8190d73eb5def11a43cfb020b7f36db65330698c",
+ "shasum": ""
+ },
+ "require": {
+ "ext-ctype": "*",
+ "ext-filter": "*",
+ "php": ">=5.5.0"
+ },
+ "require-dev": {
+ "doctrine/annotations": "1.2.*",
+ "friendsofphp/php-cs-fixer": "^2.2",
+ "phpdocumentor/phpdocumentor": "2.*",
+ "phpunit/phpunit": "^4.8 || ^5.7",
+ "zendframework/zend-eventmanager": "3.0.*",
+ "zendframework/zend-i18n": "2.7.3",
+ "zendframework/zend-serializer": "2.7.*"
+ },
+ "suggest": {
+ "ext-mbstring": "Needed to send email in multibyte encoding charset",
+ "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
+ "league/oauth2-google": "Needed for Google XOAUTH2 authentication",
+ "psr/log": "For optional PSR-3 debug logging",
+ "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
+ "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "PHPMailer\\PHPMailer\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-2.1"
+ ],
+ "authors": [
+ {
+ "name": "Jim Jagielski",
+ "email": "jimjag@gmail.com"
+ },
+ {
+ "name": "Marcus Bointon",
+ "email": "phpmailer@synchromedia.co.uk"
+ },
+ {
+ "name": "Andy Prevost",
+ "email": "codeworxtech@users.sourceforge.net"
+ },
+ {
+ "name": "Brent R. Matzelle"
+ }
+ ],
+ "description": "PHPMailer is a full-featured email creation and transfer class for PHP",
+ "time": "2018-11-16T00:41:32+00:00"
+ },
{
"name": "psr/http-message",
"version": "1.0.1",
diff --git a/api/application/config/autoload.php b/api/application/config/autoload.php
index 36f2e98f..746c2e22 100644
--- a/api/application/config/autoload.php
+++ b/api/application/config/autoload.php
@@ -58,7 +58,7 @@ $autoload['packages'] = array();
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
-$autoload['libraries'] = array('database','format','smartie' => 'smarty');
+$autoload['libraries'] = array('database','format');
/*
| -------------------------------------------------------------------
diff --git a/api/application/config/constants.php b/api/application/config/constants.php
index a27d8185..d45c5950 100644
--- a/api/application/config/constants.php
+++ b/api/application/config/constants.php
@@ -86,8 +86,8 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto
// define login route name for token verification
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllEntites/:any)'); // no errors
-//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors
-defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN','getFullPDDetails'); // no errors
+defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors
+//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN','getFullPDDetails'); // no errors
/*********************AWS resources Constants*************************************************/
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');
diff --git a/api/application/config/customconfig_one.php b/api/application/config/customconfig_one.php
index d01b9bf6..4e3532cb 100644
--- a/api/application/config/customconfig_one.php
+++ b/api/application/config/customconfig_one.php
@@ -49,7 +49,7 @@ $config['authorization_key'] = 'sparqvenba2018';
/* End of file jwt.php */
/* Location: ./application/config/jwt.php */
-$config['master_tables_field_names'] = array('INDUSTRYCLASSIFICATION' => 'name','UOM' => 'name','OCCUPATIONMEMBERS' => 'name','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'name','RELATIONSHIPS' => 'name','FREQUENCY' => 'name', 'CUSTOMERBEHAVIOUR' => 'description', 'CUSTOMERSEGMENT' => 'name','DESIGNATION' => 'short_name', 'EARNINGMEMBERSSTATUS' => 'earning_member_status','EDUQUALIFICATION' => 'qualification_name','ADDRESSTYPE' => 'address_type','LOCALITY' => 'locality_name','ASSETTYPE' => 'name','PROPERTIES' => 'name','INVESTMENTTYPE' => 'name','INSURANCETYPE' => 'name','PERSONSMET' => 'person_met_name','RESIDENCEOWNERSHIP' => 'name','PAYMENTMODE' => 'name','ACCOUNTTYPE' => 'name','SOURCEOFOTHERINCOME' => 'name','MORTAGEPROPERTYTYPE' => 'name','ENDUSEOFLOAN' => 'enduse_of_loan','SOURCEOFBALANCETRANSFER' => 'name', 'STATUSOFCONSTRUCTION' => 'name','BTLENDERLIST'=>'lender_name','MORTAGEPROPERTIES'=>'property_name','EXISTINGLOANTYPES'=>'loan_type_name','PDAPPLICANTSDETAILS'=>'applicant_name','RELATIONWITHBUSINESS'=>'relation_with_business_name','BUSINESSENTITYTYPE'=>'business_entity_type_name','COMPANYRELATIONSHIPS'=>'name','STATE'=>'name','CITY'=>'name','COUNTRY'=>'country_name','BOUNCEMASTER'=>'bounce_reason_name','BUSINESSEXPENSES'=>'expense_item','BUSINESSINCOME'=>'business_income_item','COMMENTSONLOCALITY'=>'rating','COMPANY'=>'company_id','LOCALITY'=>'locality_name','NONINDIVIDUALENTITIES'=>'non_individual_entity_name','PDFORMS'=>'pd_form_name','PDLOCATIONAPPROACH'=>'description','PDTYPE'=>'type_name','PDNOTIFICATION'=>'pd_status','QUESTIONCATEGORY'=>'category_name','ROLES'=>'role_name','SUBPRODUCTS'=>'name','TITLES'=>'name','PINCODE'=>'pincode','PRODUCTS'=>'name');
+$config['master_tables_field_names'] = array('INDUSTRYCLASSIFICATION' => 'name','UOM' => 'name','OCCUPATIONMEMBERS' => 'name','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'name','RELATIONSHIPS' => 'name','FREQUENCY' => 'name', 'CUSTOMERBEHAVIOUR' => 'description', 'CUSTOMERSEGMENT' => 'name','DESIGNATION' => 'short_name', 'EARNINGMEMBERSSTATUS' => 'earning_member_status','EDUQUALIFICATION' => 'qualification_name','ADDRESSTYPE' => 'address_type','LOCALITY' => 'locality_name','ASSETTYPE' => 'name','PROPERTIES' => 'name','INVESTMENTTYPE' => 'name','INSURANCETYPE' => 'name','PERSONSMET' => 'person_met_name','RESIDENCEOWNERSHIP' => 'name','PAYMENTMODE' => 'name','ACCOUNTTYPE' => 'name','SOURCEOFOTHERINCOME' => 'name','MORTAGEPROPERTYTYPE' => 'name','ENDUSEOFLOAN' => 'enduse_of_loan','SOURCEOFBALANCETRANSFER' => 'name', 'STATUSOFCONSTRUCTION' => 'name','BTLENDERLIST'=>'lender_name','MORTAGEPROPERTIES'=>'property_name','EXISTINGLOANTYPES'=>'loan_type_name','PDAPPLICANTSDETAILS'=>'applicant_name','RELATIONWITHBUSINESS'=>'relation_with_business_name','BUSINESSENTITYTYPE'=>'business_entity_type_name','COMPANYRELATIONSHIPS'=>'name','STATE'=>'name','CITY'=>'name','COUNTRY'=>'country_name','BOUNCEMASTER'=>'bounce_reason_name','BUSINESSEXPENSES'=>'expense_item','BUSINESSINCOME'=>'business_income_item','COMMENTSONLOCALITY'=>'rating','COMPANY'=>'company_id','LOCALITY'=>'locality_name','NONINDIVIDUALENTITIES'=>'non_individual_entity_name','PDFORMS'=>'pd_form_name','PDLOCATIONAPPROACH'=>'description','PDTYPE'=>'type_name','PDNOTIFICATION'=>'pd_status','QUESTIONCATEGORY'=>'category_name','ROLES'=>'role_name','SUBPRODUCTS'=>'name','TITLES'=>'name','PINCODE'=>'pincode','PRODUCTS'=>'name','ENTITYTYPE'=>'name','PDTEAM'=>'team_name','ENTITY'=>'short_name','PDSTATUS'=>'pd_status_name');
-$config['master_tables_pkid'] = array('INDUSTRYCLASSIFICATION' => 'industry_classification_id','UOM' => 'uom_id','OCCUPATIONMEMBERS' => 'occupation_non_earning_member_id','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'type_of_activity_id','RELATIONSHIPS' => 'relationship_id','FREQUENCY' => 'frequency_id', 'CUSTOMERBEHAVIOUR' => 'customer_behaviour_id', 'CUSTOMERSEGMENT' => 'customer_segment_id','DESIGNATION' => 'designation_id', 'EARNINGMEMBERSSTATUS' => 'earning_member_status_id','EDUQUALIFICATION' => 'qualification_id','ADDRESSTYPE' => 'address_type_id','LOCALITY' => 'locality_id','ASSETTYPE' => 'id','PROPERTIES' => 'id','INVESTMENTTYPE' => 'id','INSURANCETYPE' => 'id','PERSONSMET' => 'person_met_id','RESIDENCEOWNERSHIP' => 'id','PAYMENTMODE' => 'id','ACCOUNTTYPE' => 'id','SOURCEOFOTHERINCOME' => 'id','MORTAGEPROPERTYTYPE' => 'id','ENDUSEOFLOAN' => 'enduse_of_loan_id','SOURCEOFBALANCETRANSFER' => 'id', 'STATUSOFCONSTRUCTION' => 'id','MORTAGEPROPERTIES' => 'mortage_property_id','BTLENDERLIST'=>'bt_lender_list_id','EXISTINGLOANTYPES'=>'existing_loan_type_id','PDAPPLICANTSDETAILS'=>'pd_co_applicant_id','RELATIONWITHBUSINESS'=>'relation_with_business_id','BUSINESSENTITYTYPE'=>'business_entity_type_id','COMPANYRELATIONSHIPS'=>'company_relationship_id','STATE'=>'state_id','CITY'=>'city_id','COUNTRY'=>'country_id','BOUNCEMASTER'=>'bounce_id','BUSINESSEXPENSES'=>'expense_item_id','BUSINESSINCOME'=>'business_income_id','COMMENTSONLOCALITY'=>'comments_on_locality_id','COMPANY'=>'name','LOCALITY'=>'locality_id','NONINDIVIDUALENTITIES'=>'non_individual_entity_id','PDFORMS'=>'form_id','PDLOCATIONAPPROACH'=>'pd_location_approach_id','PDTYPE'=>'pd_type_id','PDNOTIFICATION'=>'pdnotification_id','QUESTIONCATEGORY'=>'question_category_id','ROLES'=>'role_id','SUBPRODUCTS'=>'subproduct_id','TITLES'=>'title_id','PINCODE'=>'pincode_id','PRODUCTS'=>'product_id');
+$config['master_tables_pkid'] = array('INDUSTRYCLASSIFICATION' => 'industry_classification_id','UOM' => 'uom_id','OCCUPATIONMEMBERS' => 'occupation_non_earning_member_id','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'type_of_activity_id','RELATIONSHIPS' => 'relationship_id','FREQUENCY' => 'frequency_id', 'CUSTOMERBEHAVIOUR' => 'customer_behaviour_id', 'CUSTOMERSEGMENT' => 'customer_segment_id','DESIGNATION' => 'designation_id', 'EARNINGMEMBERSSTATUS' => 'earning_member_status_id','EDUQUALIFICATION' => 'qualification_id','ADDRESSTYPE' => 'address_type_id','LOCALITY' => 'locality_id','ASSETTYPE' => 'id','PROPERTIES' => 'id','INVESTMENTTYPE' => 'id','INSURANCETYPE' => 'id','PERSONSMET' => 'person_met_id','RESIDENCEOWNERSHIP' => 'id','PAYMENTMODE' => 'id','ACCOUNTTYPE' => 'id','SOURCEOFOTHERINCOME' => 'id','MORTAGEPROPERTYTYPE' => 'id','ENDUSEOFLOAN' => 'enduse_of_loan_id','SOURCEOFBALANCETRANSFER' => 'id', 'STATUSOFCONSTRUCTION' => 'id','MORTAGEPROPERTIES' => 'mortage_property_id','BTLENDERLIST'=>'bt_lender_list_id','EXISTINGLOANTYPES'=>'existing_loan_type_id','PDAPPLICANTSDETAILS'=>'pd_co_applicant_id','RELATIONWITHBUSINESS'=>'relation_with_business_id','BUSINESSENTITYTYPE'=>'business_entity_type_id','COMPANYRELATIONSHIPS'=>'company_relationship_id','STATE'=>'state_id','CITY'=>'city_id','COUNTRY'=>'country_id','BOUNCEMASTER'=>'bounce_id','BUSINESSEXPENSES'=>'expense_item_id','BUSINESSINCOME'=>'business_income_id','COMMENTSONLOCALITY'=>'comments_on_locality_id','COMPANY'=>'name','LOCALITY'=>'locality_id','NONINDIVIDUALENTITIES'=>'non_individual_entity_id','PDFORMS'=>'form_id','PDLOCATIONAPPROACH'=>'pd_location_approach_id','PDTYPE'=>'pd_type_id','PDNOTIFICATION'=>'pdnotification_id','QUESTIONCATEGORY'=>'question_category_id','ROLES'=>'role_id','SUBPRODUCTS'=>'subproduct_id','TITLES'=>'title_id','PINCODE'=>'pincode_id','PRODUCTS'=>'product_id','ENTITYTYPE'=>'entity_type_id','PDTEAM'=>'pdteam_id','ENTITY'=>'entity_id','PDSTATUS'=>'pd_status_id');
?>
\ No newline at end of file
diff --git a/api/application/config/routes.php b/api/application/config/routes.php
index 9f0a4cd4..c7af5212 100644
--- a/api/application/config/routes.php
+++ b/api/application/config/routes.php
@@ -189,6 +189,7 @@ $route['getFamilyDetails'] = 'PD_Controller/getFamilyDetailsFromBusinessAndGener
$route['getProductsFromBusiness'] = 'PD_Controller/getProductsWithTypeofActivityFromBusiness';
$route['getAllPersonsName'] = 'PD_Controller/getAllPersonsName';
$route['getAssetsWithLoanFromBusiness'] = 'PD_Controller/getAssetsWithLoanFromBusiness';
+$route['getListOfCities'] = 'PD_Controller/getListOfCities';
// $route['savePDFormDetailsJSON'] = 'PD_Controller/savePDFormDetailsJSON';
// $route['getPDFormDetailsJSON'] = 'PD_Controller/getPDFormDetailsJSON';
diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php
index 66195c52..30bcd20b 100644
--- a/api/application/controllers/PD_Controller.php
+++ b/api/application/controllers/PD_Controller.php
@@ -9,7 +9,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . '/libraries/REST_Controller.php';
-require_once APPPATH . '/libraries/Smartie.php';
+//require_once APPPATH . '/libraries/Smartie.php';
//require BASEPATH.'core/Controller.php';
@@ -27,6 +27,7 @@ class PD_Controller extends REST_Controller {
$this->load->helper('GETPROCESSEDJSON');
$this->load->library('pdfgenerator');
$this->load->library('excel');
+ $this->load->library('phpmailer_library');
//$this->load->library('pdfgen_tcpdf');
@@ -217,9 +218,11 @@ class PD_Controller extends REST_Controller {
//array_push($result_data[$key],$cities);
$result_data['cities'] = $cities;
- $fields = array('pincode_id','pincode');
- $where_condition_array = array('isactive' => 1,'fk_state_id' => $stateid);
- $pincode = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PINCODE);
+ // $fields = array('pincode_id','pincode');
+ // $where_condition_array = array('isactive' => 1,'fk_state_id' => $stateid);
+ // $pincode = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PINCODE);
+ //echo "sds";
+ $pincode = $this->db->SELECT('pincode_id,pincode')->FROM(PINCODE)->WHERE('fk_state_id',$stateid)->OR_WHERE('fk_state_id is null')->ORDER_BY('is_others')->ORDER_BY('pincode_id')->GET()->result_array();
//array_push($result_data[$key],$cities);
$result_data['pincode'] = $pincode;
@@ -580,8 +583,9 @@ class PD_Controller extends REST_Controller {
unset($pd_details['firstName']);
unset($pd_details['officerName']);
$pd_details['initiate_location'] = $pd_details['link'];
+ $pd_details['customer_link'] = "http://maps.google.com/?q=".$pd_details['link'];
unset($pd_details['link']);
- $this->aws_sns->sendSMS($msg,$no);
+ //$this->aws_sns->sendSMS($msg,$no);
}
if($pd_details['pd_status'] == STARTED)
@@ -1125,7 +1129,12 @@ class PD_Controller extends REST_Controller {
}
}
- else // Find Officers in General Team
+
+
+
+
+ }
+ else // Find Officers in General Team
{
@@ -1264,10 +1273,6 @@ class PD_Controller extends REST_Controller {
$this->response($data,REST_Controller::HTTP_OK);
}
}
-
-
-
- }
}
else
{
@@ -4066,7 +4071,7 @@ class PD_Controller extends REST_Controller {
public function getCompaniesListsFromGeneralFormRawJSON_post()
{
- $records = $this->post('records');
+ $records = $this->post('records');
$pd_id = $records['pd_id'];
@@ -4100,7 +4105,8 @@ class PD_Controller extends REST_Controller {
array('form_id' => 11,'form_name' => 'Stock Details'),
);
- $temp = array();
+ $temp = array();
+ $business_form_status = 0;
foreach($form_array as $form)
{
$this->db->SELECT('count(*) as count');
@@ -4112,11 +4118,39 @@ class PD_Controller extends REST_Controller {
$template_forms_count = $this->db->GET()->result_array();
if($template_forms_count[0]['count'] != 0) {
- $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => true);
+ if($form['form_id'] == 13)
+ {
+ $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => true,'isAnswerable'=>true);
+ $business_form_status = 1;
+ }
+ else
+ {
+ if($business_form_status == 1){
+ $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => true,'isAnswerable'=>true);
+ }
+ else
+ {
+ $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => true,'isAnswerable'=>false);
+ }
+ }
}
else
{
- $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false);
+
+ if($form['form_id'] == 13)
+ {
+ $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false,'isAnswerable'=>true);
+ $business_form_status = 1;
+ }
+ else{
+ if($business_form_status == 1){
+ $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false,'isAnswerable'=>true);
+ }
+ else
+ {
+ $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false,'isAnswerable'=>false);
+ }
+ }
}
}
@@ -4203,8 +4237,7 @@ class PD_Controller extends REST_Controller {
public function getPDOfficerCurrentLocation_post()
{
$pdid = $this->post('pd_id');
-
-
+ //PDALERTS::pdnotification($pdid);
$result_data = $this->db->SELECT('*')->FROM(PDOFFICERCURRENTLOCATION)->WHERE('fk_pd_id',$pdid)->ORDER_BY(PDOFFICERCURRENTLOCATIONID,'DESC')->LIMIT(1)->GET()->result_array();
if(count($result_data))
@@ -4523,6 +4556,20 @@ class PD_Controller extends REST_Controller {
}
+ // Get List of Cities from PD TriggeredTabel to Frond End Filter.
+ public function getListOfCities_get()
+ {
+ $this->db->DISTINCT();
+ $this->db->SELECT('CITY.city_id,CITY.name');
+ $this->db->FROM(PDTRIGGER.' as PDTRIGGER');
+ $this->db->JOIN(CITY.' as CITY','PDTRIGGER.fk_city = CITY.city_id');
+ $city = $this->db->GET()->result_array();
+ $data['dataStatus'] = true;
+ $data['status'] = REST_Controller::HTTP_OK;
+ $data['records'] = $city;
+ $this->response($data,REST_Controller::HTTP_OK);
+
+ }
diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php
index ce841add..b700e5ae 100644
--- a/api/application/helpers/pdalerts_helper.php
+++ b/api/application/helpers/pdalerts_helper.php
@@ -8,37 +8,36 @@ class PDALERTS
/*
This function plays role of sending sms/email while PD status changing.
@param pdid
- get current status, lender, created by, allocated_to by using 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 pdnotification($pdid)
{
+
//echo "called";
if($pdid != "" || $pdid != null)
{
$CI =&get_instance();
$CI->load->library('AWS_SNS');
+ //$CI->load->library('Phpmailer_library');
$pd_notification_configs = array();
- $mobile_nos_to_send_notification = array();
- $email_ids_to_send_notification = array();
+ //die();
- //echo "FROM HELPER-PD_ID -" . $pdid;
-
- /*
- *
- * SMS FUNCTIONALITY
- */
-
- //1.Get Current Status and createdby , lenders info by pdid
- $CI->db->SELECT("PDTRIGGER.fk_lender_id,PDTRIGGER.lender_applicant_id,PDTRIGGER.pd_status,PDTRIGGER.fk_createdby,CREATED.email as created_mail,CREATED.mobile_no as created_mobile_no,PDTRIGGER.fk_pd_allocated_to,ALLOCATED.email as allocated_email,ALLOCATED.mobile_no as allocated_mobile_no,PDTRIGGER.executive_id,EXECUTIVE.email as executive_email,EXECUTIVE.mobile_no as executive_mobile_no,PDTRIGGER.central_pd_officer_id,CENTRALPDOFFICER.mobile_no as centralpdofficer_mobile_no,CENTRALPDOFFICER.email as centralpdofficer_mail,PDTRIGGER.pd_agency_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno");
+ /*********************************************/
+ /*******Get PD Master Details*****************/
+ /*********************************************/
+ $CI->db->SELECT("PDTRIGGER.fk_lender_id,ENTITY.short_name,PDTRIGGER.lender_applicant_id,PDTRIGGER.fk_pd_type,PDTRIGGER.pd_status,PDTRIGGER.pd_date_of_initiation,PDTRIGGER.scheduled_on,PDTRIGGER.updatedon,PDTRIGGER.fk_pd_allocated_to,ALLOCATED.email as allocated_email,ALLOCATED.mobile_no as allocated_mobile_no,concat(ALLOCATED.first_name,' ',ALLOCATED.last_name) as pdofficer_name,PDTRIGGER.executive_id,EXECUTIVE.email as executive_email,EXECUTIVE.mobile_no as executive_mobile_no,PDTRIGGER.central_pd_officer_id,CENTRALPDOFFICER.mobile_no as centralpdofficer_mobile_no,CENTRALPDOFFICER.email as centralpdofficer_mail,PDTRIGGER.pd_agency_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,CREATED.fk_entity_type_id,CREATED.email as created_email,PDTRIGGER.pd_contact_person_mail,PDAPPLICANTSDETAILS.applicant_name,PDAPPLICANTSDETAILS.mobile_no as customer_mobile_no,PDTRIGGER.customer_link");
$CI->db->FROM(PDTRIGGER." as PDTRIGGER");
$CI->db->JOIN(USERPROFILE." as CREATED","PDTRIGGER.fk_createdby = CREATED.userid",'LEFT');
+ $CI->db->JOIN(ENTITY." as ENTITY","PDTRIGGER.fk_lender_id = ENTITY.entity_id",'LEFT');
$CI->db->JOIN(USERPROFILE." as ALLOCATED","PDTRIGGER.fk_pd_allocated_to = ALLOCATED.userid",'LEFT');
$CI->db->JOIN(USERPROFILE." as EXECUTIVE","PDTRIGGER.executive_id = EXECUTIVE.userid",'LEFT');
$CI->db->JOIN(USERPROFILE." as CENTRALPDOFFICER","PDTRIGGER.central_pd_officer_id = CENTRALPDOFFICER.userid",'LEFT');
+ $CI->db->JOIN(PDAPPLICANTSDETAILS." as PDAPPLICANTSDETAILS","PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id AND PDAPPLICANTSDETAILS.applicant_type = 1",'LEFT');
$CI->db->WHERE("PDTRIGGER.pd_id",$pdid);
$core_details = $CI->db->GET()->result_array();
//print_r($core_details);
@@ -48,10 +47,10 @@ class PDALERTS
if(count($core_details))
{
- //2.Get Notification Configuration by using pd staus idate
-
-
- $CI->db->SELECT("PDNOTIFICATION.pd_status,PDNOTIFICATION.sms_lender, PDNOTIFICATION.sms_pdofficer, PDNOTIFICATION.sms_pdincharge, PDNOTIFICATION.mail_lender, PDNOTIFICATION.mail_pdincharge, PDNOTIFICATION.mail_pdofficer");
+ /*********************************************/
+ /*******Get Notification Config Details*****/
+ /*********************************************/
+ $CI->db->SELECT("*");
$CI->db->FROM(PDNOTIFICATION." as PDNOTIFICATION");
$CI->db->WHERE("PDNOTIFICATION.pd_status",$core_details[0]['pd_status']);
$CI->db->WHERE("PDNOTIFICATION.isactive",1);
@@ -59,126 +58,226 @@ class PDALERTS
//print_r($CI->db->last_query());
//print_r($pd_notification_configs);
+ /*********************************************/
+ /*******Get SMS Notifications From Master*****/
+ /*********************************************/
+ $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();
+
+
if(count($pd_notification_configs))
{
- //sent sms to lender contacts
-
- if($pd_notification_configs[0]['sms_lender'] == 1)
- {
- array_push($mobile_nos_to_send_notification,$core_details[0]['pd_contact_mobileno']);
- }
-
-
- //add pd officer no
- if($pd_notification_configs[0]['sms_pdofficer'] == 1)
- {
- array_push($mobile_nos_to_send_notification,$core_details[0]['allocated_mobile_no']);
+ /*********************************************/
+ /*******Send SMS Notification to Lender*****/
+ /*********************************************/
- if($core_details[0]['executive_mobile_no'] != "" || $core_details[0]['executive_mobile_no'] != null)
+ if($pd_notification_configs[0]['sms_lender'] == 1)
+ {
+ $lender_sms = (string)$core_details[0]['pd_contact_mobileno'];
+
+ if($pd_notification_msg[0]['lender'] != null)
+ {
+ $msg = $pd_notification_msg[0]['lender'];
+ $msg = self::stringReplace($msg,$core_details);
+ //echo $msg;
+ $msg = str_replace('
','',$msg);
+ $CI->aws_sns->sendSMS($msg,$lender_sms);
+ }
+
+
+ }
+
+
+ /*********************************************/
+ /*******Send Mail Notification to Lender*****/
+ /*********************************************/
+ if($pd_notification_configs[0]['mail_lender'] == 1)
+ {
+ $lender_email = null;
+
+ if($core_details[0]['fk_entity_type_id'] == 2 )
+ {
+ $lender_email = $core_details[0]['created_email'];
+ }
+ else if($core_details[0]['pd_contact_person_mail'] != null)
+ {
+ $lender_email = $core_details[0]['pd_contact_person_mail'];
+ }
+
+
+ if($lender_email != null)
+ {
+ $msg = $pd_notification_msg[0]['lender'];
+ $msg = self::stringReplace($msg,$core_details);
+ self::sendMail($CI,$lender_email,$msg,$core_details);
+ }
+ }
+
+
+
+ /*********************************************/
+ /*******Send SMS Notification to PD Officer*****/
+ /*********************************************/
+ if($pd_notification_configs[0]['sms_pdofficer'] == 1)
{
- array_push($mobile_nos_to_send_notification,$core_details[0]['executive_mobile_no']);
+ $mobile_nos_to_send_notification = array();
+ array_push($mobile_nos_to_send_notification,$core_details[0]['allocated_mobile_no']);
+
+ if($core_details[0]['executive_mobile_no'] != "" || $core_details[0]['executive_mobile_no'] != null)
+ {
+ array_push($mobile_nos_to_send_notification,$core_details[0]['executive_mobile_no']);
+ }
+
+
+ if($pd_notification_msg[0]['pdofficer'] != null)
+ {
+ $msg = $pd_notification_msg[0]['pdofficer'];
+ $msg = self::stringReplace($msg,$core_details);
+ foreach($mobile_nos_to_send_notification as $mobile){ $CI->aws_sns->sendSMS($msg,(string)$mobile); };
+ }
+
+
+
}
- if($core_details[0]['centralpdofficer_mobile_no'] != "" || $core_details[0]['centralpdofficer_mobile_no'] != null)
+
+ /*********************************************/
+ /*******Send SMS Notification to Customer*****/
+ /*********************************************/
+ if($pd_notification_configs[0]['sms_customer'] == 1)
{
- array_push($mobile_nos_to_send_notification,$core_details[0]['centralpdofficer_mobile_no']);
+ if($core_details[0]['customer_mobile_no'] != "" || $core_details[0]['customer_mobile_no'] != null)
+ {
+ if($pd_notification_msg[0]['customer'] != null)
+ {
+ $msg = $pd_notification_msg[0]['customer'];
+ $msg = self::stringReplace($msg,$core_details);
+ $CI->aws_sns->sendSMS($msg,(string)$core_details[0]['customer_mobile_no']);
+ }
+ }
}
- }
-
- //add pd incharge mobile_no's
- if($pd_notification_configs[0]['sms_pdincharge'] == 1)
- {
+
+
+ /*********************************************/
+ /**Send SMS Notification to Central PD Officer**/
+ /*********************************************/
+ if($pd_notification_configs[0]['sms_pdincharge'] == 1)
+ {
+ if($core_details[0]['centralpdofficer_mobile_no'] != "" || $core_details[0]['centralpdofficer_mobile_no'] != null)
+ {
+ if($pd_notification_msg[0]['pdincharge'] != null)
+ {
+ $msg = $pd_notification_msg[0]['pdincharge'];
+ $msg = self::stringReplace($msg,$core_details);
+ $CI->aws_sns->sendSMS($msg,(string)$core_details[0]['centralpdofficer_mobile_no']);
+ }
+ }
+ }
+
+
+ /*********************************************/
+ /**Send SMS Notification to QC Team*****/
+ /*********************************************/
+ if($pd_notification_configs[0]['sms_qcteam'] == 1)
+ {
$CI->db->DISTINCT();
$CI->db->SELECT("mobile_no");
$CI->db->FROM(USERPROFILE." as USERPROFILE");
$CI->db->JOIN(USERPROFILEROLES." as USERPROFILEROLES","USERPROFILE.userid = USERPROFILEROLES.fk_userid AND USERPROFILEROLES.isactive = 1 AND USERPROFILE.isactive = 1");
- $CI->db->WHERE("USERPROFILEROLES.user_role",3);
- $inchagre_mobile_nos = $CI->db->GET()->result_array();
- if(count($inchagre_mobile_nos))
+ $CI->db->WHERE("USERPROFILEROLES.user_role",6);//QC Manager
+ $CI->db->OR_WHERE("USERPROFILEROLES.user_role",7);//QC Officer
+ $qcteam_mobile_nos = $CI->db->GET()->result_array();
+
+ if(count($qcteam_mobile_nos))
{
- foreach($inchagre_mobile_nos as $mobile)
+ $mobile_nos_to_send_notification = array();
+ foreach($qcteam_mobile_nos as $mobile)
{
array_push($mobile_nos_to_send_notification,$mobile);
}
- }
- }
-
- }
- $msg = "PD for Lender Applicant ID -:". $core_details[0]['lender_applicant_id'] ." has been ". $core_details[0]['pd_status']; // status base configurable
- //print_r($mobile_nos_to_send_notification);
- foreach($mobile_nos_to_send_notification as $no)
- {
-
-
- $no = (string)$no;
- //echo "SNSNO-".$no;
- $CI->aws_sns->sendSMS($msg,$no);
- }
-
- }
- /*
- * **********************************************************************************************************
- * EMAIL FUNCTIONALITY
- ************************************************************************************************************
- */
-
-
- if(count($core_details))
- {
-
-
- if(count($pd_notification_configs))
- {
- //add pd officer email
- if($pd_notification_configs[0]['mail_pdofficer'] == 1)
- {
- array_push($email_ids_to_send_notification,$core_details[0]['allocated_email']);
- if($core_details[0]['executive_email'] != "" || $core_details[0]['executive_email'] != null)
- {
- array_push($email_ids_to_send_notification,$core_details[0]['executive_email']);
- }
- if($core_details[0]['centralpdofficer_mail'] != "" || $core_details[0]['centralpdofficer_mail'] != null)
- {
- array_push($email_ids_to_send_notification,$core_details[0]['centralpdofficer_mail']);
- }
- }
-
-
-
- //add pd incharge emails
- if($pd_notification_configs[0]['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 AND USERPROFILE.isactive = 1");
- $CI->db->WHERE("USERPROFILEROLES.user_role",3);
- $inchagre_email = $CI->db->GET()->result_array();
- if(count($inchagre_email))
- {
- foreach($inchagre_email as $email)
+
+ if($pd_notification_msg[0]['qc_team'] != null)
{
- array_push($email_ids_to_send_notification,$email);
+ $msg = $pd_notification_msg[0]['qc_team'];
+ $msg = self::stringReplace($msg,$core_details);
+
+ foreach($mobile_nos_to_send_notification as $mobile){
+ $CI->aws_sns->sendSMS($msg,(string)$mobile['mobile_no']);
+ };
}
}
+ }
+
}
- //$msg = "PD for Lender Applicant ID:".$core_details['lender_applicant_id']."has been".$core_details['pd_status_name']; // status base configurable
- foreach($email_ids_to_send_notification as $email)
- {
-
- //email SES have to config
- //$CI->aws_ses->sendMail($email);
- }
}
- }
-
- /*End of Email Functionality*/
}
}
+
+ /*********************************************/
+ /**REPLACE PLACEHOLDERS****/
+ /*********************************************/
+ public static function stringReplace($msg,$core_details)
+ {
+
+ $msg = str_replace('{{applicant_name}}',$core_details[0]['applicant_name'],$msg);
+ $msg = str_replace('{{applicant_id}}',$core_details[0]['lender_applicant_id'],$msg);
+ $msg = str_replace('{{schedule_time}}',$core_details[0]['scheduled_on'],$msg);
+ $msg = str_replace('{{initiate_time}}',$core_details[0]['pd_date_of_initiation'],$msg);
+ $msg = str_replace('{{pdofficer_name}}',$core_details[0]['pdofficer_name'],$msg);
+ $msg = str_replace('{{start_time}}',$core_details[0]['updatedon'],$msg);
+ $msg = str_replace('{{pdofficer_name}}',$core_details[0]['pdofficer_name'],$msg);
+ $msg = str_replace('{{lender_name}}',$core_details[0]['short_name'],$msg);
+ $msg = str_replace('{{link}}',$core_details[0]['customer_link'],$msg);
+ //$msg = str_replace('{{\n\n}}','\n\n',$msg);
+ $msg = str_replace('\n','
',$msg);
+ $msg = str_replace('\\',' ',$msg);
+ $msg = nl2br($msg);
+
+ return $msg;
+
+ }
+
+
+
+ public static function sendMail($CI,$lender_email,$msg,$core_details)
+ {
+ //echo "Mail called";
+
+ $mail = $CI->phpmailer_library->load();
+ //echo "$msg";
+
+ $mail->IsSMTP(); // Telling the class to use SMTP
+ $mail->SMTPAuth = true;
+ //$mail->SMTPDebug = 3;
+ $mail->SMTPSecure = "ssl";
+ $mail->Host = 'bh-in-16.webhostbox.net'; // SMTP server
+ $mail->Username = "noreply@ssa.sineedge.com"; // "The account"
+ $mail->Password = "noreply@ssa"; // "The password"
+ $mail->Port = 465; // "The port"
+ $mail->addAddress('velmurugan.s@venbainfotech.com'); // Name is optional
+ $mail->From = 'noreply@ssa.sineedge.com';
+ $mail->FromName = 'SineEdge QC Team';
+ $mail->isHTML(true); // Set email format to HTML
+ $mail->Subject = 'PD Report For Application ID -'.$core_details[0]['lender_applicant_id'];
+ $mail->Body = $msg;
+ $mail->AltBody = $msg;
+
+ if(!$mail->send()) {
+ //echo 'Message could not be sent.';
+ //echo 'Mailer Error: ' . $mail->ErrorInfo;
+ } else {
+ //echo 'Message has been sent';
+ }
+ }
+
+
}
diff --git a/api/application/libraries/Phpmailer_library.php b/api/application/libraries/Phpmailer_library.php
new file mode 100644
index 00000000..37a42bdf
--- /dev/null
+++ b/api/application/libraries/Phpmailer_library.php
@@ -0,0 +1,23 @@
+
\ No newline at end of file
diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php
index d96f5a68..365e8a27 100644
--- a/api/application/models/PD_Model.php
+++ b/api/application/models/PD_Model.php
@@ -793,13 +793,17 @@ class PD_Model extends SPARQ_Model {
//Get Forms details
- $this->db->SELECT('TEMPLATEFORMS.form_id,PDFORMS.pd_form_order,PDFORMS.pd_form_name as form_name');
+ $this->db->SELECT('TEMPLATEFORMS.form_id,PDFORMS.pd_form_order,PDFORMS .pd_form_level_order,PDFORMS.pd_form_name as form_name');
$this->db->FROM(TEMPLATEFORMS.' as TEMPLATEFORMS');
$this->db->JOIN(PDFORMS.' as PDFORMS','TEMPLATEFORMS.form_id = PDFORMS.pd_form_id');
$this->db->WHERE('TEMPLATEFORMS.fk_template_id',$template_id);
$this->db->WHERE('TEMPLATEFORMS.isactive',1);
$this->db->ORDER_BY('PDFORMS.pd_form_order');
$template_forms = $this->db->GET()->result_array();
+ $level_one_status = 0;
+ $level_one_total = 0;
+ $level_two_status = 0;
+ $level_two_total = 0;
foreach($template_forms as $template_key => $value)
{
$this->db->SELECT('count(*) as count');
@@ -813,14 +817,46 @@ class PD_Model extends SPARQ_Model {
if(count($template_forms_count) && $template_forms_count[0]['count'] != 0)
{
$template_forms[$template_key]['isAnswered'] = true;
+ if($value['pd_form_level_order'] == 1){$level_one_status++; $level_one_total++;}
+ else if($value['pd_form_level_order'] == 2){$level_two_status++; $level_two_total++;}
}
else
{
$template_forms[$template_key]['isAnswered'] = false;
+ if($value['pd_form_level_order'] == 1){ $level_one_total++;}
+ else if($value['pd_form_level_order'] == 2){$level_two_total++;}
}
-
+
+ if($value['pd_form_level_order'] == 1)
+ {
+ $template_forms[$template_key]['isAnswerable'] = true;
+ }
+ else if($value['pd_form_level_order'] == 2)
+ {
+ if($level_one_status != $level_one_total)
+ {
+ $template_forms[$template_key]['isAnswerable'] = false;
+ }
+ else
+ {
+ $template_forms[$template_key]['isAnswerable'] = true;
+ }
+ }
+ else if($value['pd_form_level_order'] == 3)
+ {
+ if($level_two_status != $level_two_total)
+ {
+ $template_forms[$template_key]['isAnswerable'] = false;
+ }
+ else
+ {
+ $template_forms[$template_key]['isAnswerable'] = true;
+ }
+ }
}
+
+
if($pd_master_detials[0]['fk_pd_type'] == 2 && $client == 1)
{