autologin Fixes : ps

This commit is contained in:
VE10-Sanjeev 2023-07-11 20:11:21 +05:30
parent aaa9450ccd
commit 6f649f1231

View File

@ -1821,7 +1821,8 @@ public function filterSalesPDList_post() {
}
}
public function toMakeCetNewSalesPd($array){
public function toMakeCetNewSalesPd($array)
{
// print_r($array['type']);die;
// header("Location: https://demo.pdgenie.com/salespdpwa/#/sales-pd-list/list-pd");
@ -1834,18 +1835,11 @@ public function filterSalesPDList_post() {
$loanamount = $array['loanamount'];
$createdby = null;
$salepdid = null;
$current_date = date("d/m/Y H:i:s");
// $reponse_arr = json_decode(,true);
// print_r(APPPATH."controller/newSalesPD.json");die();
$lenderid = (ENVIRONMENT == 'production' ? 7 : 35);
if($applicantid != null && (!empty($applicantid))){
$where_condition = array("applicant_id"=>$applicantid);
$is_exist_applicant_id = $this->Sales_PD_Model->selectCustomRecords(array('sales_pd_sno'),$where_condition,SALES_PD_DATA);
if(count($is_exist_applicant_id)){
$is_exist_sales_pd_sno = $is_exist_applicant_id[0]['sales_pd_sno'];
log_message('ERROR','## InVaild : Applicant_id Already Exist with '.$is_exist_sales_pd_sno.' PD');
$salepdid = 0;
}else{
log_message('ERROR','## Vaild : Applicant_id = '.$applicantid);
if ((!empty($sales_pd_type)) && (!empty($productname)) && (!empty($applicantname)) && (!empty($applicantid)) && (!empty($usersemailid)) && (!empty($loanamount))) {
@ -1867,12 +1861,18 @@ public function filterSalesPDList_post() {
/************user id******************/
$columns = array('USERPROFILE.userid', 'ROLES.role_id', 'USERPROFILEROLES.user_role', 'ROLES.role_name');
$table = USERPROFILE . ' as USERPROFILE';
$joins = array(array('table' => USERPROFILEROLES. ' as USERPROFILEROLES',
$joins = array(
array(
'table' => USERPROFILEROLES . ' as USERPROFILEROLES',
'condition' => 'USERPROFILEROLES.fk_userid = USERPROFILE.userid and USERPROFILEROLES.isactive =1',
'jointype' => 'INNER'),
array('table' => ROLES.' as ROLES',
'jointype' => 'INNER'
),
array(
'table' => ROLES . ' as ROLES',
'condition' => 'ROLES.role_id = USERPROFILEROLES.user_role',
'jointype' => 'INNER'));
'jointype' => 'INNER'
)
);
$order_by = 'USERPROFILE.userid';
if ($usersemailid) {
$user_where_condition['email like'] = '%' . $usersemailid . '%';
@ -1881,13 +1881,22 @@ public function filterSalesPDList_post() {
$user_id = $user_details[0]['userid'];
$role_id = $user_details[0]['role_id'];
$createdby = $user_id;
if($applicantid != null && (!empty($applicantid))){
$where_condition = array("applicant_id"=>$applicantid);
$is_exist_applicant_id = $this->Sales_PD_Model->selectCustomRecords(array('sales_pd_sno'),$where_condition,SALES_PD_DATA);
}
if(!empty($is_exist_applicant_id) && count($is_exist_applicant_id)){
$is_exist_sales_pd_sno = $is_exist_applicant_id[0]['sales_pd_sno'];
log_message('ERROR','## InVaild : Applicant_id Already Exist with ``'.$is_exist_sales_pd_sno.'`` PD');
$salepdid = 0;
}
else{
log_message('ERROR','## Vaild : Applicant_id = '.$applicantid);
/************random URL******************/
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < 16; $i++)
{
for ($i = 0; $i < 16; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
@ -1914,13 +1923,10 @@ public function filterSalesPDList_post() {
foreach ($template['sections'] as $key => $value) {
$section_id = $template['sections'][$key]['section_id'];
$section_name = $template['sections'][$key]['section_name'];
switch($section_id)
{
switch ($section_id) {
case 1:
if($value['questions'])
{
foreach($value['questions'] as $form_key => $form_value)
{
if ($value['questions']) {
foreach ($value['questions'] as $form_key => $form_value) {
$fieldtype = isset($form_value['type']) ? $form_value['type'] : "";
// echo $fieldtype;
if ($form_value['question_key'] == 'application_id') {
@ -1940,40 +1946,33 @@ public function filterSalesPDList_post() {
else if ($form_value['question_key'] === 'state') {
$value['questions'][$form_key]['answer_value'] = 0;
$value['questions'][$form_key]['answers'] = $this->Sales_PD_Model->selectCustomRecords(array('state_id as answer_id', 'name as answer'), array('isactive' => 1), STATE);
}
else if($form_value['question_key'] === 'person_met_designation'){
} else if ($form_value['question_key'] === 'person_met_designation') {
$value['questions'][$form_key]['answer_value'] = 0;
$value['questions'][$form_key]['answers'] = $this->Sales_PD_Model->selectCustomRecords(array('company_relationship_id as answer_id', 'name as answer'), array('isactive' => 1), COMPANYRELATIONSHIPS);
}
else if(!empty($form_value['question_key'])){
} else if (!empty($form_value['question_key'])) {
$value['questions'][$form_key]['answer_value'] = ($fieldtype == 8 || $fieldtype == 4 || $fieldtype == 3 || $fieldtype == 2) ? 0 : null;
}
}
$general = array("section_id" => $section_id, "section_name" => $section_name, "onsubmit" => null, "questions" => $value['questions'], "order_id" => 1, "is_complete" => 1, "fk_createdby" => $createdby, "sales_pd_id" => $id);
array_push($section_data, $general);
}
break;
case 2:
if($value['questions'] && $loanamount)
{
foreach($value['questions'] as $form_key => $form_value)
{
if ($value['questions'] && $loanamount) {
foreach ($value['questions'] as $form_key => $form_value) {
$fieldtype = isset($form_value['type']) ? $form_value['type'] : "";
if ($form_value['question_key'] == 'loan_amount_applied') {
$value['questions'][$form_key]['answer_value'] = $loanamount;
}
else if(!empty($form_value['question_key'])){
} else if (!empty($form_value['question_key'])) {
$value['questions'][$form_key]['answer_value'] = ($fieldtype == 8 || $fieldtype == 4 || $fieldtype == 3 || $fieldtype == 2) ? 0 : null;
}
}
$fund = array("section_id" => $section_id, "section_name" => $section_name, "onsubmit" => null, "questions" => $value['questions'], "order_id" => 1, "is_complete" => 1, "fk_createdby" => $createdby, "sales_pd_id" => $id);
array_push($section_data, $fund);
}
break;
default: "No Sections";
default:
"No Sections";
}
}
if (!empty($section_data)) {
@ -2002,7 +2001,7 @@ public function filterSalesPDList_post() {
}
log_message('ERROR', '## 6) Finally, ' . $data['msg']);
date_default_timezone_set("Asia/Kolkata");
$current_date = date("d/m/Y H:i:s");
$smcauthtoken = smcfinance::SmcFinanceAuthUrl();
if ($smcauthtoken != null) {
log_message('ERROR', '## 7) I Got SMC Finance Auth Token');
@ -2010,13 +2009,12 @@ public function filterSalesPDList_post() {
} else {
log_message('ERROR', '## 7) SMC Finance Auth Token Not Founded, ' . $smcauthtoken);
}
}
} else {
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Param (or) Value Not Missing,Please Check again';
}
}
}
if (ENVIRONMENT == 'production') {
@ -2035,15 +2033,15 @@ public function filterSalesPDList_post() {
// $redirect_uri = "http://localhost:4200/#/auto?token=".$token; // For Localhost
$redirect_uri = "https://demo.pdgenie.com/salespdpwa/#/auto?token=" . $token; // For Testing
}
// echo $auth_user_id."#".$auth_password."#".$user_id."#".$role_id."#".$current_date."#".$usersemailid."#".$salepdid;
log_message('ERROR', '## 8) Redirect B4 '.$auth_user_id."#".$auth_password."#".$user_id."#".$role_id."#".$current_date."#".$usersemailid."#".$salepdid);
// MwiseSales@yahoo.com#sine1234#293#19#06/07/2023 16:02:57#mwisesales1@sine.com#904
// https://demo.pdgenie.com/salespdpwa/#/auto?token=TXdpc2VTYWxlc0B5YWhvby5jb20jc2luZTEyMzQjMjkzIzE5IzA2LzA3LzIwMjMgMTY6MDI6NTcjbXdpc2VzYWxlczFAc2luZS5jb20jOTA0
// echo $redirect_uri;
// die();
log_message('ERROR', '## 9) Redirect Aftr `' . $redirect_uri . '`');
header("Location: " . $redirect_uri);
// $this->response($data,REST_Controller::HTTP_OK);
//if($data['dataStatus']){ header("Location: https://sidharthindustries.com/SIA/"); }
}
function uploadSalesImages_get(){