diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index d557d01f..486f60fa 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -385,22 +385,22 @@ class PD_Controller extends REST_Controller { else // CHOOSE GENERIC TEMPLATE// { - if($pd_details['fk_customer_segment'] == 1 || $pd_details['fk_customer_segment'] == 2) + if( !strcasecmp($pd_details['fk_customer_segment'],'SAL-CASH') || !strcasecmp($pd_details['fk_customer_segment'],'SAL-CHQ')) { //SAL - (CASH/CHQ) $pd_details['fk_pd_template_id'] = 1; } - else if($pd_details['fk_customer_segment'] == 3 || $pd_details['fk_customer_segment'] == 5) + else if( !strcasecmp($pd_details['fk_customer_segment'],'SE-DI') || !strcasecmp($pd_details['fk_customer_segment'],'SEP-DI') || !strcasecmp($pd_details['fk_customer_segment'],'SEP_INDV')) { //* SENP/SEP - (DI) $pd_details['fk_pd_template_id'] = 2; } - else if($pd_details['fk_customer_segment'] == 4 || $pd_details['fk_customer_segment'] == 6) + else if( !strcasecmp($pd_details['fk_customer_segment'],'SE-AI') || !strcasecmp($pd_details['fk_customer_segment'],'SEP-AI') ) { //* SENP/SEP - (DI) $pd_details['fk_pd_template_id'] = 3; } - else if($pd_details['fk_customer_segment'] == 8) + else if( !strcasecmp($pd_details['fk_customer_segment'],'SE-RI')) { //* SENP/SEP - (RI) $pd_details['fk_pd_template_id'] = 4; @@ -2632,6 +2632,7 @@ public function getPDFormDetailsJSON_post() if($pd_id != $parent_pd_id) { $is_addtional_pd = 1; + // list of common forms for addtional PD (Other Assets,Family Details,Banking Details of Individuals,Existing Loan Obligations,Other Income Details,Loan Details,Final Remarks Form) $parent_form_index = array_search($pd_form_id,$parent_forms); $additional_pd_id = $pd_id; $pd_id = $parent_form_index != null ? $parent_pd_id : $pd_id; @@ -6190,7 +6191,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() if($template_forms_count[0]['count'] != 0) { - if($form['form_id'] == 13 || $form['form_id'] == 22) + if($form['form_id'] == 13 || $form['form_id'] == 22 || $form['form_id'] == 23) { $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => true,'isAnswerable'=>true); @@ -6216,7 +6217,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $client_form_status = 1; } - if($form['form_id'] == 11 || $form['form_id'] == 23) + if($form['form_id'] == 11 || $form['form_id'] == 22 || $form['form_id'] == 23) { //echo "COUNT YES STOCK" if($client_form_status == 1 && $supplier_form_status == 1) @@ -6240,7 +6241,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() else //Not previously answered { //echo "else-- " .$form['form_id']; - if($form['form_id'] == 13 || $form['form_id'] == 22) + if($form['form_id'] == 13 || $form['form_id'] == 22 || $form['form_id'] == 23) { $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false,'isAnswerable'=>true); @@ -6249,7 +6250,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() else{ if($business_form_status == 1){ - if($form['form_id'] == 11 || $form['form_id'] == 23) + if($form['form_id'] == 11 || $form['form_id'] == 22 || $form['form_id'] == 23) { //echo "BUSISTOCk"; if($client_form_status == 1 && $supplier_form_status == 1) @@ -7980,6 +7981,8 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() if($person['is_person_met'] == true ) { + + if($person['is_person_met_pic']) { $person_met_selfie_count++; @@ -8687,6 +8690,27 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $records = $this->post('records'); $pd_details = $this->PD_Model->getPDMasterDetails($records['fk_pd_id']); + + if(isset($records['isactive']) && $records['isactive'] == 0)//de activate the image + { + unset($records['image']); + $where_condition_array = array('pd_document_id' => $records['pd_document_id']); + $id = $this->PD_Model->updateRecords($records,PDDOCUMENTS,$where_condition_array); + if($id != null || $id != "") + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $id; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $data['msg'] = 'Something Went Wrong! Try Later'; + $this->response($data,REST_Controller::HTTP_OK); + } + } $output_file = APPPATH."/docs/temp_base64_image.jpeg"; $temp_file_name = $records['pd_document_name']; diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 2b8f7a5d..7d7524bc 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -933,25 +933,12 @@ class PD_Model extends SPARQ_Model { $template_id = ""; - // $categories = ""; - // $overall_answered_count = 0; - // $overall_question_count = 0; + //Get PD Master Details including Template id @param $pd_id $pd_master_detials = $this->getPDMasterDetails($pdid,$random_string); $pd_additional_requirements = $this->getPDAdditionalRequirements($pdid); $docs_to_be_collected = $this->getPDAdditionalRequirements($pdid); - // $addtional_pd_ids = $this->PD_Model->getAddtioonalPDIDs($pdid); - - // $addtional_pd_ids_string = null; - - // if($pd_master_detials[0]['parent_pd_id'] == $pdid) - // { - // $addtional_pd_ids_string = array(); - // } - // if(count($addtional_pd_ids)) - // { - // foreach($addtional_pd_ids as $addtional){ array_push($addtional_pd_ids_string,$addtional['pd_id']); } - // } + $pd_applicants_detials = $this->getApplicantsDetails($pdid); //print_r($pd_master_detials);die(); @@ -959,103 +946,7 @@ class PD_Model extends SPARQ_Model { $template_id = $pd_master_detials[0]['fk_pd_template_id']; } - //if($template_id != "" || $template_id != null) - // { - - // //Get Category, QUestions and Answers @param $template_id - // // $this->db->SELECT('QUESTIONCATEGORY.category_name,TEMPLATECATEGORYWEIGHTAGE.template_category_weightage_id, TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id, TEMPLATECATEGORYWEIGHTAGE.fk_template_id, TEMPLATECATEGORYWEIGHTAGE.weightage, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.createdon,"%d/%m/%Y") as createdon, TEMPLATECATEGORYWEIGHTAGE.fk_createdby, DATE_FORMAT(TEMPLATECATEGORYWEIGHTAGE.updatedon, "%d/%m/%Y") as updatedon, TEMPLATECATEGORYWEIGHTAGE.isactive, TEMPLATECATEGORYWEIGHTAGE.fk_updatedby'); - // // $this->db->FROM(TEMPLATECATEGORYWEIGHTAGE .' as TEMPLATECATEGORYWEIGHTAGE'); - // // $this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id = QUESTIONCATEGORY.question_category_id'); - // // // $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATECATEGORYWEIGHTAGE.fk_createdby = USERPROFILE.userid','LEFT'); - // // // $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATECATEGORYWEIGHTAGE.fk_updatedby = USERPROFILE1.userid','LEFT'); - // // $this->db->WHERE('TEMPLATECATEGORYWEIGHTAGE.fk_template_id',$template_id); - // // $categories = $this->db->GET()->result_array(); - // //print_r( $categories); - // if(count($categories)) - // { - - // foreach($categories as $category_key => $category) - // { - - // $this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive,QUESTIONS.fk_question_answertype,QUESTIONANSWERTYPE.answer_type_name,PDDETAIL.pd_detail_id'); - // //$this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION'); - // $this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION'); - // $this->db->JOIN(QUESTIONS.' as QUESTIONS','TEMPLATEQUESTION.fk_question_id = QUESTIONS.question_id'); - // $this->db->JOIN(QUESTIONANSWERTYPE.' as QUESTIONANSWERTYPE','QUESTIONS.fk_question_answertype = QUESTIONANSWERTYPE.question_answer_type_id'); - // $this->db->JOIN(PDDETAIL.' as PDDETAIL',"QUESTIONS.question_id = PDDETAIL.fk_question_id AND PDDETAIL.fk_pd_id = $pdid",'LEFT'); - // // $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATEQUESTION.fk_createdby = USERPROFILE.userid','LEFT'); - // // $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATEQUESTION.fk_updatedby = USERPROFILE1.userid','LEFT'); - // $this->db->WHERE('TEMPLATEQUESTION.fk_template_question_category_id',$category['fk_question_category_id']); - // $this->db->WHERE('TEMPLATEQUESTION.fk_template_id', $template_id); - // $this->db->ORDER_BY('QUESTIONS.question_id'); - // //$this->db->WHERE('TEMPLATEQUESTION.fk_template_id',$template_id); - - // $questions = $this->db->GET()->result_array(); - // $answerd_count = 0; - // $pd_docs = array(); - // foreach($questions as $t_key => $question) - // { - - // if($question['pd_detail_id'] != "" || $question['pd_detail_id'] != null){ - // $answerd_count++; - - // // Get Alredy stored Images - // $fields = array('pd_document_title', 'pd_document_name'); - // $where_condition_array = array('fk_pd_id'=>$pdid,'fk_pd_detail_id'=> $question['pd_detail_id']); - - // $pd_docs = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDDOCUMENTS); - // // print_r($pd_docs);die(); - // if(count($pd_docs)) - // { - // $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_detials[0]['fk_lender_id']; - // foreach($pd_docs as $doc_key => $doc) - // { - // if($doc['pd_document_name'] != "" || $doc['pd_document_name'] != null) - // { - // $profilepics3path = 'pd'.$pd_master_detials[0]['pd_id'].'/'.$doc['pd_document_name']; - // $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'+30 minutes'); - // $pd_docs[$doc_key]['pd_document_name'] = $singed_uri; - // } - // } - - // } - // $questions[$t_key]['images'] = $pd_docs; - // } - - // } - - // //print_r($questions);die(); - // $categories[$category_key]['questions_count'] = count($questions); - // $categories[$category_key]['answerd_count'] = $answerd_count; - // $overall_answered_count += count($questions); - // $overall_question_count += $answerd_count; - - // if(count($questions)) - // { - // //image S3 url attach is pending - // foreach($questions as $answer_key => $question) - // { - - // $this->db->SELECT('QUESTIONANSWERS.question_answer_id,QUESTIONANSWERS.answer,PDANSWER.pd_answer,TEMPLATEANSWERWEIGHTAGE.template_answer_weightage_id, TEMPLATEANSWERWEIGHTAGE.fk_template_question_id, TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id, TEMPLATEANSWERWEIGHTAGE.template_answer_weightage,PDANSWER.isactive,PDANSWER.pd_detail_answer_id,PDANSWER.fk_pd_detail_id'); - // $this->db->FROM(TEMPLATEANSWERWEIGHTAGE.' as TEMPLATEANSWERWEIGHTAGE'); - // $this->db->JOIN(QUESTIONANSWERS.' as QUESTIONANSWERS','TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id = QUESTIONANSWERS.question_answer_id','LEFT'); - // $this->db->JOIN(PDANSWER." as PDANSWER","QUESTIONANSWERS.question_answer_id = PDANSWER.pd_answer_id AND TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id = PDANSWER.pd_answer_id AND PDANSWER.isactive = 1 AND PDANSWER.fk_pd_id = $pdid",'LEFT'); - // // $this->db->WHERE('QUESTIONANSWERS.fk_question_id',$question['question_id']); - // $this->db->WHERE('TEMPLATEANSWERWEIGHTAGE.fk_template_question_id',$question['template_question_id']); - // // $this->db->WHERE('PDDETAIL.fk_pd_id',$pdid); - // $this->db->ORDER_BY('QUESTIONANSWERS.question_answer_id'); - // $answers = $this->db->GET()->result_array(); - // $questions[$answer_key]['answers'] = $answers; - // } - // } - // $categories[$category_key]['questions'] = $questions; - // } - - // } - // } - - - //Get Forms details + $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');