MULTIPLE ADDRESS HANDLED IN PROCESSSED JSON
This commit is contained in:
parent
0f08a56d31
commit
bf9410cb40
@ -1872,76 +1872,77 @@ class GETPROCESSEDJSON
|
||||
$master_tables_field_names = $CI->config->item('master_tables_field_names');
|
||||
$master_tables_pkid = $CI->config->item('master_tables_pkid');
|
||||
|
||||
//print_r($raw_json);
|
||||
|
||||
print_r($raw_json);
|
||||
foreach($raw_json['addresses'] as $raw_json_key => $address)
|
||||
{
|
||||
// GET KEYS FROM MASTER TABLE FOR SUPPLIER FORM
|
||||
$fields = array('question', 'key', 'ismaster', 'master_name');
|
||||
$where_condition_array = array('fk_form_id' => $formid,'isactive' => 1);
|
||||
$master_keys = $CI->PD_Model->selectCustomRecords($fields,$where_condition_array,QUESTIONKEYMAPPING);
|
||||
|
||||
if(array_key_exists('address_type',$raw_json))
|
||||
if(array_key_exists('address_type',$address))
|
||||
{
|
||||
$CI->db->SELECT( $master_tables_field_names['ADDRESSTYPE'] );
|
||||
$CI->db->FROM(ADDRESSTYPE);
|
||||
$CI->db->WHERE('isactive',1);
|
||||
$CI->db->WHERE($master_tables_pkid['ADDRESSTYPE'] ,$raw_json['address_type']);
|
||||
$CI->db->WHERE($master_tables_pkid['ADDRESSTYPE'] ,$address['address_type']);
|
||||
$adress_type_name= $CI->db->GET()->result_array();
|
||||
//print_r($CI->db->last_query());
|
||||
if(count($adress_type_name))
|
||||
{
|
||||
$raw_json['address_type_master'] = $adress_type_name[0][$master_tables_field_names['ADDRESSTYPE']];
|
||||
$raw_json['addresses'][$raw_json_key]['address_type_master'] = $adress_type_name[0][$master_tables_field_names['ADDRESSTYPE']];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(array_key_exists('locality',$raw_json))
|
||||
if(array_key_exists('locality',$address))
|
||||
{
|
||||
$CI->db->SELECT( $master_tables_field_names['LOCALITY'] );
|
||||
$CI->db->FROM(LOCALITY);
|
||||
$CI->db->WHERE('isactive',1);
|
||||
$CI->db->WHERE($master_tables_pkid['LOCALITY'] ,$raw_json['locality']);
|
||||
$CI->db->WHERE($master_tables_pkid['LOCALITY'] ,$address['locality']);
|
||||
$locality_name= $CI->db->GET()->result_array();
|
||||
//print_r($CI->db->last_query());
|
||||
if(count($locality_name))
|
||||
{
|
||||
$raw_json['locality_master'] = $locality_name[0][$master_tables_field_names['LOCALITY']];
|
||||
$raw_json['addresses'][$raw_json_key]['locality_master'] = $locality_name[0][$master_tables_field_names['LOCALITY']];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(array_key_exists('pd_location',$raw_json))
|
||||
if(array_key_exists('pd_location',$address))
|
||||
{
|
||||
$CI->db->SELECT( $master_tables_field_names['PDLOCATIONAPPROACH'] );
|
||||
$CI->db->FROM(PDLOCATIONAPPROACH);
|
||||
$CI->db->WHERE('isactive',1);
|
||||
$CI->db->WHERE($master_tables_pkid['PDLOCATIONAPPROACH'] ,$raw_json['pd_location']);
|
||||
$CI->db->WHERE($master_tables_pkid['PDLOCATIONAPPROACH'] ,$address['pd_location']);
|
||||
$pd_location_approach= $CI->db->GET()->result_array();
|
||||
//print_r($CI->db->last_query());
|
||||
if(count($pd_location_approach))
|
||||
{
|
||||
$raw_json['pd_location_master'] = $pd_location_approach[0][$master_tables_field_names['PDLOCATIONAPPROACH']];
|
||||
$raw_json['addresses'][$raw_json_key]['pd_location_master'] = $pd_location_approach[0][$master_tables_field_names['PDLOCATIONAPPROACH']];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(array_key_exists('comment_locality',$raw_json))
|
||||
if(array_key_exists('comment_locality',$address))
|
||||
{
|
||||
$CI->db->SELECT( $master_tables_field_names['COMMENTSONLOCALITY'] );
|
||||
$CI->db->FROM(COMMENTSONLOCALITY);
|
||||
$CI->db->WHERE('isactive',1);
|
||||
$CI->db->WHERE($master_tables_pkid['COMMENTSONLOCALITY'] ,$raw_json['comment_locality']);
|
||||
$CI->db->WHERE($master_tables_pkid['COMMENTSONLOCALITY'] ,$address['comment_locality']);
|
||||
$comments_on_locality= $CI->db->GET()->result_array();
|
||||
//print_r($CI->db->last_query());
|
||||
if(count($comments_on_locality))
|
||||
{
|
||||
$raw_json['comment_locality_master'] = $comments_on_locality[0][$master_tables_field_names['COMMENTSONLOCALITY']];
|
||||
$raw_json['addresses'][$raw_json_key]['comment_locality_master'] = $comments_on_locality[0][$master_tables_field_names['COMMENTSONLOCALITY']];
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists('additional_address_units',$raw_json))
|
||||
if(array_key_exists('additional_address_units',$address))
|
||||
{
|
||||
|
||||
foreach($raw_json['additional_address_units'] as $additional_address_unit_key => $additional_address_unit)
|
||||
foreach($address['additional_address_units'] as $additional_address_unit_key => $additional_address_unit)
|
||||
{
|
||||
$CI->db->SELECT( $master_tables_field_names['ADDRESSTYPE'] );
|
||||
$CI->db->FROM(ADDRESSTYPE);
|
||||
@ -1951,12 +1952,14 @@ class GETPROCESSEDJSON
|
||||
//print_r($CI->db->last_query());
|
||||
if(count($premises_type))
|
||||
{
|
||||
$raw_json['additional_address_units'][$additional_address_unit_key]['premises_type_master'] = $premises_type[0][$master_tables_field_names['ADDRESSTYPE']];
|
||||
$raw_json['addresses'][$raw_json_key]['additional_address_units'][$additional_address_unit_key]['premises_type_master'] = $premises_type[0][$master_tables_field_names['ADDRESSTYPE']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $raw_json;
|
||||
}
|
||||
|
||||
return ($raw_json);
|
||||
|
||||
}
|
||||
/*****************########## END OF ADDRESS FORM DETAILS ##########**************/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user