MUL ADDRESS

This commit is contained in:
velz 2019-02-27 19:09:20 +05:30
parent 9a8c73e628
commit 7808d0d777
4 changed files with 121 additions and 2 deletions

View File

@ -517,6 +517,12 @@ defined('PERSONALASSETGRIDID') OR define('PERSONALASSETGRIDID','personal_asset_g
defined('PERSONALASSETGRIDVARIANCE') OR define('PERSONALASSETGRIDVARIANCE','m_personal_asset_grid_variance');
defined('PERSONALASSETGRIDVARIANCEID') OR define('PERSONALASSETGRIDVARIANCEID','m_personal_asset_grid_variance');
defined('PDADDRESS') OR define('PDADDRESS','t_pd_address');
defined('PDADDRESSID') OR define('PDADDRESSID','pd_address_id');
defined('PDCOMPANY') OR define('PDCOMPANY','t_pd_company');
defined('PDCOMPANYID') OR define('PDCOMPANYID','pd_company_id');

View File

@ -296,10 +296,22 @@ class PD_Controller extends REST_Controller {
$pd_details = json_decode($this->post('pd_details'),true);
$pd_addtional_requirements = array();
$addresses = array();
$company = array();
if($this->post('addtional_requirements'))
{
$pd_addtional_requirements = json_decode($this->post('addtional_requirements'),true);
}
if($this->post('addresses'))
{
$addresses = json_decode($this->post('addresses'),true);
}
if($this->post('company'))
{
$company = json_decode($this->post('company'),true);
}
$pd_applicant_details = json_decode($this->post('pd_applicant_details'),true);
$pd_document_titles = "";
$pd_document_from_mobile = "";
@ -528,6 +540,24 @@ class PD_Controller extends REST_Controller {
$this->PD_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS);
}
}
if(count($addresses))
{
foreach($addresses as $address_key => $address)
{
$address['fk_pd_id'] = $pd_id;
$this->PD_Model->saveRecords($address,PDADDRESS);
}
}
if(count($company))
{
foreach($company as $company_key => $new_company)
{
$new_company['fk_pd_id'] = $pd_id;
$this->PD_Model->saveRecords($new_company,PDCOMPANY);
}
}
}
/****************END OF ADDTIONAL REQUIREMENTS SECTION*******************************************/
@ -762,6 +792,42 @@ class PD_Controller extends REST_Controller {
}
public function updatePDAddress_post()
{
$records = $this->post('records');
$count = 0;
foreach($records as $key => $value)
{
if($value['pd_address_id'] != "" || $value['pd_address_id'] != null)
{
$where_condition_array = array('pd_address_id' => $value['pd_address_id']);
$id = $this->db->updateRecords($value,PDADDRESS,$where_condition_array);
if($id != "" || $id != null){ $count++; }
}
else
{
$id = $this->db->saveRecords($value,PDADDRESS);
if($id != "" || $id != null){ $count++; }
}
}
if($count != count($records))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = true;
$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);
}
}
/**
* Pd Discussion OTP Checking function
* sriram
@ -1503,6 +1569,12 @@ class PD_Controller extends REST_Controller {
//Get All PD Template and It's Question with Answers
$result_data['pd_question_answer'] = $this->PD_Model->getPDQuestionAnswers($pdid);
//Get All PD Address
$result_data['pd_address'] = $this->PD_Model->getPDAddress($pdid);
//Get All PD COmpanies
$result_data['pd_company'] = $this->PD_Model->getPDCompany($pdid);
//Get Addtional Requirements details
$result_data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);

View File

@ -21,8 +21,8 @@ class AWS_S3
//echo "listAllBuckets";
$this->S3 = S3Client::factory($this->s3_properties);
// echo "Called";
// $this->createNewBucket();
// echo "Called";
// $this->setCors();
}

View File

@ -285,6 +285,47 @@ class PD_Model extends SPARQ_Model {
}
public function getPDAddress($pdid)
{
$this->db->SELECT('PDADDRESS.pd_address_id, PDADDRESS.addressline, PDADDRESS.fk_city, PDADDRESS.fk_state,PDADDRESS.pincode,PDADDRESS.isactive,PDADDRESS.createdon,PDADDRESS.updatedon,PDADDRESS.is_visited');
$this->db->FROM(PDADDRESS.' as PDADDRESS');
$this->db->JOIN(STATE.' as STATE','PDADDRESS.fk_state = STATE.state_id','LEFT');
$this->db->JOIN(CITY.' as CITY','PDADDRESS.fk_city = CITY.city_id','LEFT');
$this->db->WHERE('PDADDRESS.fk_pd_id ',$pdid);
$this->db->ORDER_BY('PDADDRESS.pd_address_id');
$result_child_array = $this->db->GET()->result_array();
if(count($result_child_array) != 0)
{
return $result_child_array;
}
else
{
return array();
}
}
public function getPDCompany($pdid)
{
$this->db->SELECT('PDCOMPANY.pd_company_id, PDCOMPANY.company_name, PDCOMPANY.isactive,PDCOMPANY.createdon,PDCOMPANY.updatedon');
$this->db->FROM(PDCOMPANY.' as PDCOMPANY');
$this->db->WHERE('PDCOMPANY.fk_pd_id ',$pdid);
$this->db->ORDER_BY('PDCOMPANY.pd_company_id');
$result_child_array = $this->db->GET()->result_array();
if(count($result_child_array) != 0)
{
return $result_child_array;
}
else
{
return array();
}
}
/*
* GET PD Log Details by pdid
*/