diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index e0809461..da1eca5d 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -2990,19 +2990,31 @@ class PD_Controller extends REST_Controller { $records = $this->post('records'); $pdid = $records['pd_id']; - $fields = array('column_name', 'column_value'); - $where_condition_array = array('column_name'=>'type_of_activity','isactive'=>1,'fk_form_id'=>13,'fk_pd_id'=>$pdid); - $result_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILS); + // $fields = array('column_name', 'column_value'); + // $where_condition_array = array('column_name'=>'type_of_activity','isactive'=>1,'fk_form_id'=>13,'fk_pd_id'=>$pdid); + // $or_where_total = array(array('column_name'=>'profession_name')); + // $result_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILS,$or_where_total); + $this->db->SELECT('column_name,column_value'); + $this->db->FROM(PDFORMDETAILS); + $this->db->WHERE('isactive',1); + $this->db->WHERE('fk_form_id',13); + $this->db->WHERE('fk_pd_id',$pdid); + $this->db->GROUP_START(); + $this->db->OR_WHERE('column_name','type_of_activity'); + $this->db->OR_WHERE('column_name','profession_name'); + $this->db->GROUP_END(); + $result_array = $this->db->GET()->result_array(); + //print_r($this->db->last_query()); if(count($result_array)) { $fields = array('name'); - $where_condition_array = array('type_of_activity_id'=>$result_array[0]['column_value'],'isactive'=>1); + $where_condition_array = array('type_of_activity_id'=>$result_array[1]['column_value'],'isactive'=>1); $result = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,TYPEOFACTIVITY); - if(count($result)){ $result_array[0]['name'] = $result[0]['name']; } + if(count($result)){ $result_array[1]['name'] = $result[0]['name']; } $data['dataStatus'] = true;