diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php
index 9b3c5fbb..63cd621e 100644
--- a/api/application/controllers/PD_Controller.php
+++ b/api/application/controllers/PD_Controller.php
@@ -9077,7 +9077,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$custom_log_info = '###Payload Size - '. (int) $_SERVER['CONTENT_LENGTH'].' ###saveApplicantFromGeneralForm - PDID - ('. $records['fk_pd_id'] .') - ' . date('Y-m-d H:i:s A');
log_message('ERROR',$custom_log_info);
- $applicant_type = $records['is_applicant'] ? 0 : ($records['is_person_met'] ? 3 : '');
+ $applicant_type = ($records['is_person_met'] ? 3 : ($records['is_applicant'] ? 0 : ''));//3 - person met,0 - co applicant
$applicant_details = array('fk_pd_id' => $records['fk_pd_id'],'applicant_name' => trim($records['applicant_name']),'applicant_title_name' => $records['applicant_title_name'],'applicant_type' => $applicant_type );
//print_r($applicant_details);
if($records['pd_co_applicant_id'] == "" || $records['pd_co_applicant_id'] == null)
@@ -9087,14 +9087,20 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
}
else
{
- if($applicant_type == 0)
+
+ //pull applicant details from master
+ $curret_applicant_type = $this->PD_Model->selectCustomRecords(array('*'),array('pd_co_applicant_id' => $records['pd_co_applicant_id']),PDAPPLICANTSDETAILS);
+ //print_r($curret_applicant_type);//die();
+ if($curret_applicant_type[0]['applicant_type'] == 1)
{
unset($applicant_details['applicant_type']);
}
+ //print_r($applicant_details);die();
$applicant_id = $this->PD_Model->updateRecords($applicant_details,PDAPPLICANTSDETAILS,array('pd_co_applicant_id' => $records['pd_co_applicant_id']));
$current_operation = 2;// 2 means UPDATE
}
- //echo $current_operation.$applicant_id;die();
+ //echo $current_operation.$applicant_id;
+ //die();
if($records['is_person_met'])
{
$img_data = array();
diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php
index f43068ef..3b357e26 100644
--- a/api/application/controllers/Sales_PD_Controller.php
+++ b/api/application/controllers/Sales_PD_Controller.php
@@ -189,7 +189,7 @@ class Sales_PD_Controller extends REST_Controller {
//$json_data = (json_decode($sales_pd_data[0]['pd_json'],true));
- //satellite_image::getSatelliteImage($sales_pd_id,2);
+ satellite_image::getSatelliteImage($sales_pd_id,2);
$all_section_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $sales_pd_id,'isactive' => 1),SALESPD_SECTION_DATA);
// print_r($this->db->last_query());die();
$view_data['master'] = $sales_pd_data;
@@ -724,165 +724,58 @@ class Sales_PD_Controller extends REST_Controller {
$records = $this->post('records');
$section_data = array();
- if($records['section_id'] != 9)
- {
+
$section_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $records['sales_pd_id'],'isactive' => 1,'section_id' => $records['section_id']),SALESPD_SECTION_DATA);
- //print_r( json_decode($section_data[0]['section_data'],true));
- }
- else
- {
- $image_order = array('selfie_with_person_met','approach_to_pd_location','name_board_seen','stock_image','workplace_interior_image');
- $images = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $records['sales_pd_id'],'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS);
- //print_r($images);die();
-
- $photo_names = array('selfie_with_person_met' => 'Selfie with person met','approach_to_pd_location' => 'Approach to pd location','name_board_seen' => 'Name board seen', 'stock_image' => 'Stock image','workplace_interior_image' => 'Workplace interior image');
-
-
- $questions = array();
- $questions_group = array();
-
- foreach ($photo_names as $photo_key => $photo_value)
+ //print_r( json_decode($section_data[0]['section_data'],true));die();
+ if($records['section_id'] == 9)
{
- if(count($images))
+ $all_sales_pd_images = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $records['sales_pd_id'],'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS);
+ //print_r($all_sales_pd_images);die();
+ $photo_questions = (json_decode(($section_data[0]['section_data']),true));
+ // print_r($photo_questions);
+ foreach ($photo_questions['questions'] as $key => $value)
{
- // foreach ($images as $key => $value)
- // {
-
- //check current photo is exist in images array
- //print_r($photo_key);
- $is_exist = false;
- $exist_data = array();
+ if(isset($value['answer_value']) && $value['answer_value'] && !$value['is_repeatable'])
+ {
+ $selfie = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $records['sales_pd_id'],'img_name' => 'selfie_with_person_met','isactive' => 1),SALEPD_DOCS);
+ if(count($selfie))
+ {
+ // $photo_questions['questions'][$key]['answer_value'] = $selfie[0]['img'];
+ $photo_questions['questions'][$key]['answer_value'] = "CHNAGED";
+ }
+ }
+ else
+ {
- //$question = [];
- foreach ($images as $key => $value)
+ foreach ($value['questions_group'] as $v_key => $individual_value)
{
- if($photo_key == $value['img_name'])
+ //print_r($individual_value);die();
+ if($individual_value['questions'][0]['answer_value'])
{
- $is_exist = true;
- $exist_data[] = array('img_name' => $value['img_name'],'img' => $value['img']);
- // unset($images[$key]);
- // break;
- }
+ //iterate all_sales_pd_images to get one
+ foreach ($all_sales_pd_images as $img_key => $img_value)
+ {
+ if($individual_value['questions'][0]['question_key'] == $img_value['img_name'])
+ {
+ //$photo_questions['questions'][$key]['questions_group'][$v_key]['questions'][0]['answer_value'] = $img_value['img'];
+ $photo_questions['questions'][$key]['questions_group'][$v_key]['questions'][0]['answer_value'] = "CHANGED";
+ unset($all_sales_pd_images[$img_key]);
+ break;
+ }
+ }
+ }
}
- // echo $is_exist;
- // echo '
';
- if($is_exist)
- {
- // echo "YESPART";
- // echo '
';
- foreach ($exist_data as $exist_data_key => $exist_data_value)
- {
-
-
- $question['is_repeatable'] = "";
- $question['group_title'] = null;
- $question['answer_value'] = $exist_data_value['img'];
- //$question['answer_value'] = "IMG";
- $question['question'] = $photo_names [ $exist_data_value['img_name'] ];
- $question['question_key'] = $exist_data_value['img_name'];
- $question['type'] = 6;
- $question['validations'] = [];
- $question['raw_validations'] = [];
- $question['api_properties'] = null;
- $question['answers'] = null;
- $question['onchange_properties'] = null;
- if($exist_data_value['img_name'] == 'selfie_with_person_met')
- {
- $questions[] = $question;
- }
- else
- {
- $questions[ $photo_names [ $exist_data_value['img_name'] ] ] ['is_repeatable'] = 1;
- $questions[ $photo_names [ $exist_data_value['img_name'] ] ] ['group_title'] = $photo_names [ $exist_data_value['img_name'] ];
- $questions[ $photo_names [ $exist_data_value['img_name'] ] ] ['group_type'] = 6;
- $questions[ $photo_names [ $exist_data_value['img_name'] ] ] ['questions_group'][0]['questions'][] = $question;
- }
- }
- $exist_data = array();
-
- }
- else
- {
- // echo "NOPART";
- // echo '
';
- // print_r($questions);
- $question['is_repeatable'] = "";
- $question['group_title'] = null;
- $question['answer_value'] = '';
- //$question['answer_value'] = "IMG";
- $question['question'] = $photo_value;
- $question['question_key'] =$photo_key;
- $question['type'] = 6;
- $question['validations'] = [];
- $question['raw_validations'] = [];
- $question['api_properties'] = null;
- $question['answers'] = null;
- $question['onchange_properties'] = null;
- if($photo_key == 'selfie_with_person_met')
- {
- //echo 'SELFIE';
- $questions[] = $question;
- }
- else
- {
- $questions[ $photo_names [ $value['img_name'] ] ] ['is_repeatable'] = 1;
- $questions[ $photo_names [ $value['img_name'] ] ] ['group_title'] = $photo_value;
- $questions[ $photo_names [ $value['img_name'] ] ] ['group_type'] = 6;
- $questions[ $photo_names [ $value['img_name'] ] ] ['questions_group'][0]['questions'][] = $question;
- }
- //break;
- // print_r($questions);
- // die();
- }
-
- //}
- }
- else
- {
- $question['is_repeatable'] = "";
- $question['group_title'] = null;
- $question['answer_value'] = '';
- //$question['answer_value'] = "IMG";
- $question['question'] = $photo_value;
- $question['question_key'] =$photo_key;
- $question['type'] = 6;
- $question['validations'] = [];
- $question['raw_validations'] = [];
- $question['api_properties'] = null;
- $question['answers'] = null;
- $question['onchange_properties'] = null;
- if($photo_key == 'selfie_with_person_met')
- {
- $questions[] = [];
- }
- else
- {
- $questions[ $photo_key ] ['is_repeatable'] = 1;
- $questions[ $photo_key ] ['group_title'] = $photo_value;
- $questions[ $photo_key ] ['group_type'] = 6;
- $questions[ $photo_key ] ['questions_group'][0]['questions'][] = [];
- }
+ }
}
+ //die();
+ $photo_questions = json_encode($photo_questions);
+ $section_data[0]['section_data'] = $photo_questions;
}
-
- $temp['questions'] = array_values($questions);
- //print_r($questions);die();
-
- $temp['section_id'] = 9;
- $temp['section_name'] = 'Photography';
- $temp['onsubmit'] = '';
- $temp['sales_pd_id'] = $records['sales_pd_id'];
-
- //print_r($temp);die();
- $temp2['section_data'] = json_encode($temp);
-
- $temp2['id'] = null;
- $temp2['sales_pd_id'] = $records['sales_pd_id'];
- $temp2['section_id'] = $records['section_id'];
- $temp2['status'] = '1';
- $section_data[] = $temp2;
-
- }
+
+
+
+
+
if($section_data)
{
@@ -904,7 +797,7 @@ class Sales_PD_Controller extends REST_Controller {
public function testAPISalesPD_post()
{
- PDALERTS::sendSalesPDMail($this,2);die();
+ //PDALERTS::sendSalesPDMail($this,2);die();
}
}
diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php
index 5cb01bfb..bcd7670e 100644
--- a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php
+++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php
@@ -4655,19 +4655,22 @@ if($total_no_of_business > 0) {
";
+ $footer_lender_stamp = MYUTIL::dispatchDisclaimer($lender_disclaimer,3);
+ if(isset($footer_lender_stamp))
+ {
+ //$footer_lender_disclaimer = MYUTIL::dispatchDisclaimer($lender_disclaimer,3);
+ echo '
'. $footer_lender_disclaimer['disclaimer'] .'
'; + echo ''. $footer_lender_disclaimer['disclaimer'] .'
'; } - else - { - $footer_lender_disclaimer = MYUTIL::dispatchDisclaimer($lender_disclaimer,3); - echo 'Person(s) Met:
'; - echo ''.$person_met_details.'
'; - - //if($display_for_person_met != "" || $display_for_person_met != null){ - echo ''.$person_met_details.'
'; + + //if($display_for_person_met != "" || $display_for_person_met != null){ + echo 'Loan Applicants: