template dynamic api changes : ps

This commit is contained in:
sanjeev 2022-01-05 17:10:42 +05:30
parent 194e6d1d24
commit 5f136d0b5c

View File

@ -2358,8 +2358,29 @@ class PD_Model extends SPARQ_Model {
$this->db->WHERE('TEMPLATE_JSON_V2.map_id',$map_id);
$this->db->ORDER_BY('PDFORMS.pd_form_order');
$template_forms = $this->db->GET()->result_array();
// print_r($template_forms);die();
if(count($template_forms) > 0){
array_push($template_forms,Array('map_id'=>$map_id,'form_id' => '18','pd_form_order' => '2','pd_form_level_order' => '1','form_name' => 'General Information','is_form_disabled'=>0));
array_push($template_forms,Array('map_id'=>$map_id,'form_id' => '24','pd_form_order' => '21','pd_form_level_order' => '3','form_name' => 'Credit Manager Queries','is_form_disabled'=>0));
array_push($template_forms,Array('map_id'=>$map_id,'form_id' => '26','pd_form_order' => '24','pd_form_level_order' => '1','form_name' => 'Photograph','is_form_disabled'=>0));
}
$buiness_related_form = array(22,14,1,2,11,16);
if(!strcasecmp($pd_master_detials[0]['lender_short_name'], 'CLIX')){
array_push($buiness_related_form,21);//buiness banking form id pushed for filter.
}
if(!strcasecmp($pd_master_detials[0]['lender_short_name'], 'CLIX') || (!strcasecmp($pd_master_detials[0]['lender_short_name'], 'MWISE'))){
array_push($buiness_related_form,23);//Future Plans & Business Environments form id pushed for filter.
}
if(!strcasecmp($pd_master_detials[0]['customer_segment_abbr'], 'SE-AI')){
array_push($buiness_related_form,16);//Assessed Income form id pushed for filter.
}
for($j=0;$j<count($buiness_related_form);$j++){
$keyValue = $buiness_related_form[$j];
$key = 'form_id';
$filter_array = array_filter($template_forms, function($value) use ($key, $keyValue ) {
return $value[$key] != $keyValue;
});
}
$template_forms = array_values($filter_array);
$level_one_status = 0;
$level_one_total = 0;
$level_two_status = 0;
@ -2371,13 +2392,14 @@ class PD_Model extends SPARQ_Model {
//echo "parent";
foreach($template_forms as $template_key => $value)
{
$this->db->SELECT('count(*) as count');
$this->db->SELECT('count(*) as count,fk_form_id');
$this->db->FROM(PDFORMDETAILSJSON.' as PDFORMDETAILSJSON');
$this->db->WHERE('PDFORMDETAILSJSON.fk_pd_id',$pdid);
$this->db->WHERE('PDFORMDETAILSJSON.fk_form_id',$value['form_id']);
$this->db->WHERE('PDFORMDETAILSJSON.isactive',1);
$template_forms_count = 0;
$template_forms_count = $this->db->GET()->result_array();
// print_r($template_forms_count);die();
//if($value['form_id'] == 4){print_r($template_forms_count);}
if(count($template_forms_count) && $template_forms_count[0]['count'] != 0)
@ -2600,4 +2622,11 @@ class PD_Model extends SPARQ_Model {
$query = $this->db->get();
return $query->result();
}
public function filterArrayByKeyValue($array, $key, $keyValue)
{
return array_filter($array, function($value) use ($key, $keyValue) {
return $value[$key] == $keyValue;
});
}
}