From dac7783b3e943ff5d0923be7bf9d25692d4264fe Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Fri, 26 Feb 2021 14:33:19 +0530 Subject: [PATCH] LENDER ASC ORDER --- api/application/controllers/PD_Controller.php | 2 +- .../helpers/readexceldata_helper.php | 51 ++++++++++--------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 45ce2512..3702c152 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -94,7 +94,7 @@ class PD_Controller extends REST_Controller { { $fields = array('entity_id','full_name','short_name'); $where_condition_array = array('isactive' => 1,'fk_entity_type_id' => 2); - $result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENTITY); + $result_data = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,ENTITY,array(),'','full_name'); if(count($result_data)) { diff --git a/api/application/helpers/readexceldata_helper.php b/api/application/helpers/readexceldata_helper.php index f9ea7ad9..479f9456 100644 --- a/api/application/helpers/readexceldata_helper.php +++ b/api/application/helpers/readexceldata_helper.php @@ -3,7 +3,7 @@ class readexceldata { private static $current_section_id = null; - private static $current_excel_file_id = 9999; + private static $current_excel_file_id = null; public static function getExcelSectionData($file_path_withname,$section_id = null,$pd_id = null,$excel_file_id = null) { $CI =&get_instance(); @@ -101,32 +101,35 @@ class readexceldata { $return_data = SELF::getTriggerData($sheetData,$section_ref_data); //store address details in temp table SMC_TEMP_ADDRESS - if(array_key_exists('address_details', $return_data)) + if(SELF::$current_excel_file_id) { - foreach ($return_data['address_details'] as $key => $address) + if(array_key_exists('address_details', $return_data)) { - $display = $address['address'].', '.$address['city'].', '.$address['state'].', '.$address['pincode']; - - $pincode = $CI->PD_Model->selectCustomRecords(array('*'),array('pincode' => $address['pincode']),PINCODE); - $city = $CI->PD_Model->selectCustomRecords(array('*'),array('lower(name)' => strtolower($address['city'])),CITY); - // print_r($CI->db->last_query()); - // $state = $CI->PD_Model->selectCustomRecords(array('*'),array('pincode' => $address['pincode']),PINCODE,1); - $fields_to_insert = array('file_id' => SELF::$current_excel_file_id,'addressline' => $address['address']); - if(is_array($pincode) && count($pincode)) - { - $fields_to_insert['pincode'] = $pincode[0]['pincode_id']; - } - if(is_array($city) && count($city)) + foreach ($return_data['address_details'] as $key => $address) { - $fields_to_insert['city'] = $city[0]['city_id']; - $fields_to_insert['state'] = $city[0]['fk_state_id']; - } + $display = $address['address'].', '.$address['city'].', '.$address['state'].', '.$address['pincode']; - // print_r($fields_to_insert); - $temp_add_id = $CI->PD_Model->saveRecords($fields_to_insert,SMC_TEMP_ADDRESS); - $fields_to_insert['address_id'] = $temp_add_id; - $return_data['address_details'][ $key ]['display'] = $display; - $return_data['address_details'][ $key ]['id'] = $fields_to_insert; + $pincode = $CI->PD_Model->selectCustomRecords(array('*'),array('pincode' => $address['pincode']),PINCODE); + $city = $CI->PD_Model->selectCustomRecords(array('*'),array('lower(name)' => strtolower($address['city'])),CITY); + // print_r($CI->db->last_query()); + // $state = $CI->PD_Model->selectCustomRecords(array('*'),array('pincode' => $address['pincode']),PINCODE,1); + $fields_to_insert = array('file_id' => SELF::$current_excel_file_id,'addressline' => $address['address']); + if(is_array($pincode) && count($pincode)) + { + $fields_to_insert['pincode'] = $pincode[0]['pincode_id']; + } + if(is_array($city) && count($city)) + { + $fields_to_insert['city'] = $city[0]['city_id']; + $fields_to_insert['state'] = $city[0]['fk_state_id']; + } + + // print_r($fields_to_insert); + $temp_add_id = $CI->PD_Model->saveRecords($fields_to_insert,SMC_TEMP_ADDRESS); + $fields_to_insert['address_id'] = $temp_add_id; + $return_data['address_details'][ $key ]['display'] = $display; + $return_data['address_details'][ $key ]['id'] = $fields_to_insert; + } } } } @@ -276,7 +279,7 @@ class readexceldata $return_data = array(); foreach ($arr as $key => $value) { - if(is_string($value) || is_numeric($value)) + if((is_string($value) && $value != '') || is_numeric($value))// && $value != '') // if($value) { $return_data[$key] = $value;