Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5e740bce07
@ -96,6 +96,8 @@ defined('ROUTE_LOGIN_V') OR define('ROUTE_LOGIN_V', 'generateSatelliteImg
|
|||||||
defined('ROUTE_LOGIN_U') OR define('ROUTE_LOGIN_U', 'generateOTP');
|
defined('ROUTE_LOGIN_U') OR define('ROUTE_LOGIN_U', 'generateOTP');
|
||||||
defined('ROUTE_LOGIN_T') OR define('ROUTE_LOGIN_T', 'verifyOTP');
|
defined('ROUTE_LOGIN_T') OR define('ROUTE_LOGIN_T', 'verifyOTP');
|
||||||
defined('ROUTE_LOGIN_S') OR define('ROUTE_LOGIN_S', 'purge_pddata');
|
defined('ROUTE_LOGIN_S') OR define('ROUTE_LOGIN_S', 'purge_pddata');
|
||||||
|
defined('ROUTE_LOGIN_H') OR define('ROUTE_LOGIN_H', 'transferCreditPDToCETApp');
|
||||||
|
defined('ROUTE_LOGIN_G') OR define('ROUTE_LOGIN_G', 'transferSalesPDToCETApp');
|
||||||
defined('ROUTE_LOGIN_F') OR define('ROUTE_LOGIN_F', 'previewDigiLockerDocs');
|
defined('ROUTE_LOGIN_F') OR define('ROUTE_LOGIN_F', 'previewDigiLockerDocs');
|
||||||
// defined('ROUTE_LOGIN_F') OR define('ROUTE_LOGIN_F', 'downloadDigiLockerDocs');
|
// defined('ROUTE_LOGIN_F') OR define('ROUTE_LOGIN_F', 'downloadDigiLockerDocs');
|
||||||
defined('ROUTE_LOGIN_E') OR define('ROUTE_LOGIN_E', 'getDigiLockerDocs');
|
defined('ROUTE_LOGIN_E') OR define('ROUTE_LOGIN_E', 'getDigiLockerDocs');
|
||||||
|
|||||||
@ -421,3 +421,7 @@ $route['checkjsonPD']='Data_Dump_Controller/checkjsonPD';
|
|||||||
$route['deleteS3Image']='Data_Dump_Controller/deleteS3Images';
|
$route['deleteS3Image']='Data_Dump_Controller/deleteS3Images';
|
||||||
|
|
||||||
$route['saveShortsVideo'] = 'PD_Controller/saveShortsVideo';
|
$route['saveShortsVideo'] = 'PD_Controller/saveShortsVideo';
|
||||||
|
|
||||||
|
$route['transferSalesPDToCETApp'] = 'Sales_PD_Controller/transferSalesPDToCETApp';
|
||||||
|
$route['transferCreditPDToCETApp'] = 'SMC_Credit_PD_Controller/transferCreditPDToCETApp';
|
||||||
|
|
||||||
|
|||||||
@ -269,45 +269,149 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
|||||||
}
|
}
|
||||||
function uploadCreditPDDataToCETApp_get()
|
function uploadCreditPDDataToCETApp_get()
|
||||||
{
|
{
|
||||||
log_message('ERROR', '#### upload SMC Credit PDData To CETApp Called');
|
|
||||||
$smc_credit_pd = $this->uri->segment(2);
|
$smc_credit_pd = $this->uri->segment(2);
|
||||||
|
if($smc_credit_pd){
|
||||||
|
log_message('ERROR', '#### upload SMC-Credit PDData To CETApp Function Called');
|
||||||
|
$columns = array('PDTRIGGER.pd_id');
|
||||||
|
$table = PDTRIGGER . ' as PDTRIGGER';
|
||||||
|
$where_arr = array('PDTRIGGER.is_the_data_transfer_cet'=>0,'PDTRIGGER.pd_status' => COMPLETED,'PDTRIGGER.pd_id'=>$smc_credit_pd);
|
||||||
|
$details = $this->SMC_Credit_PD_Model->selectCustomRecords($columns, $where_arr, $table);
|
||||||
|
if(!empty($details)){
|
||||||
|
$response = $this->dataSynchronization($smc_credit_pd);
|
||||||
|
if($response){
|
||||||
|
$data['dataStatus'] = true;
|
||||||
|
$data['status'] = REST_Controller::HTTP_OK;
|
||||||
|
$data['msg'] = 'Data Shared Successfully';
|
||||||
|
$this->response($data,REST_Controller::HTTP_OK);
|
||||||
|
}else{
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = 'Something went wrong! Try Later';
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
log_message('ERROR', $smc_credit_pd.' Data already uploaded');
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = 'Data already uploaded! Try Later';
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$msg = 'Can`t Upload ID Not Founded ! Try Later';
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = $msg;
|
||||||
|
log_message('ERROR', $msg);
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public function transferCreditPDToCETApp_get()
|
||||||
|
{
|
||||||
|
$from_date = $this->get('from_date');
|
||||||
|
$to_date = $this->get('to_date');
|
||||||
|
if(($from_date != "" || $from_date != null) && ($to_date != "" || $to_date != null)){
|
||||||
|
$newDate1 = date("Y-m-d", strtotime($from_date));
|
||||||
|
$newDate2 = date("Y-m-d", strtotime($to_date));
|
||||||
|
$smc_lender_id = ENVIRONMENT == 'production' ? 7 : 35; //SMC lender id MWISE in live and demo
|
||||||
|
$msg = " SMC-Credit PDData To CETApp Date Given Format => " . $from_date ." to ".$to_date;
|
||||||
|
// $where = 'DATE(PDTRIGGER.completed_on) BETWEEN ' ."'$newDate1'". ' AND ' ."'$newDate2'";
|
||||||
|
$columns = array('PDTRIGGER.pd_id', 'PDTRIGGER.pd_status');
|
||||||
|
$table = PDTRIGGER . ' as PDTRIGGER';
|
||||||
|
|
||||||
|
$where = '(SELECT
|
||||||
|
MAX(DATE(logmaster.createdon))
|
||||||
|
FROM h_common_masters as logmaster
|
||||||
|
WHERE logmaster.new_value = "COMPLETED" AND PDTRIGGER.pd_id = logmaster.primary_key)
|
||||||
|
BETWEEN ' ."'$newDate1'". ' AND ' ."'$newDate2'";
|
||||||
|
$where_arr = array('PDTRIGGER.is_the_data_transfer_cet'=>0,'PDTRIGGER.fk_lender_id' => $smc_lender_id,'PDTRIGGER.pd_status' => COMPLETED, $where => null);
|
||||||
|
$details = $this->SMC_Credit_PD_Model->selectCustomRecords($columns, $where_arr, $table);
|
||||||
|
log_message('ERROR', $msg." Changed ".$newDate1." to ".$newDate2." Total Records => " . count($details));
|
||||||
|
if(!empty($details)){
|
||||||
|
$flag = 0;$ids=array();
|
||||||
|
for ($i = 0; $i < count($details); $i++) {
|
||||||
|
$smc_credit_pd = $details[$i]['pd_id'];
|
||||||
|
// echo $smc_credit_pd;
|
||||||
|
$result = $this->dataSynchronization($smc_credit_pd);
|
||||||
|
// $flag = $result == true ? $flag+1 : $flag;
|
||||||
|
if($result == true){
|
||||||
|
$flag = $flag+1;
|
||||||
|
array_push($ids, $smc_credit_pd);
|
||||||
|
//update here.
|
||||||
|
$update_fields2 = array('is_the_data_transfer_cet' => 1);
|
||||||
|
$this->SMC_Credit_PD_Model->updateRecords($update_fields2,PDTRIGGER,array('pd_id' => $smc_credit_pd));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['dataStatus'] = true;
|
||||||
|
$data['status'] = REST_Controller::HTTP_OK;
|
||||||
|
$data['msg'] = implode(', ', $ids).' ( '.$flag.' ) Data Shared Successfully';
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}else{
|
||||||
|
$msg = 'There is no data for Given Date ! Try Later';
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = $msg;
|
||||||
|
log_message('ERROR', $msg);
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$msg = 'Can`t Upload Date Not Founded ! Try Later';
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = $msg;
|
||||||
|
log_message('ERROR', $msg);
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function dataSynchronization($smc_credit_pd)
|
||||||
|
{
|
||||||
|
$this->load->helper('smc_creditpd');
|
||||||
$mater_details = $this->PD_Model->getPDMasterDetails($smc_credit_pd);
|
$mater_details = $this->PD_Model->getPDMasterDetails($smc_credit_pd);
|
||||||
$pd_section_data = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($smc_credit_pd,$mater_details[0]['fk_product_id'],null,null,'REPORT');
|
$pd_section_data = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($smc_credit_pd,$mater_details[0]['fk_product_id'],null,null,'REPORT');
|
||||||
log_message('ERROR', '#### Total Credit PD is ' . count($pd_section_data));
|
log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') There are ' . count($pd_section_data).' Forms ');
|
||||||
if (!empty($pd_section_data)) {
|
if (!empty($pd_section_data)) {
|
||||||
$forms_data_to_be_get_direct_from_excel_sheet = array(3, 9, 10, 15);
|
$forms_data_to_be_get_direct_from_excel_sheet = array(3, 9, 10, 15);
|
||||||
|
$companylist = $this->getCompanyName($pd_section_data[0]);
|
||||||
if (count($pd_section_data) > 0) {
|
if (count($pd_section_data) > 0) {
|
||||||
$common_fields = array('pdid'=>$mater_details[0]['pd_id'],
|
$common_fields = array('pdid'=>$mater_details[0]['pd_id'],
|
||||||
'product'=>$mater_details[0]['product_abbr'],
|
'product'=>$mater_details[0]['product_abbr'],
|
||||||
'caseno'=>$mater_details[0]['pd_sno']);
|
'caseno'=>$mater_details[0]['pd_sno']);
|
||||||
foreach ($pd_section_data as $key => $value) {
|
// foreach ($pd_section_data as $key => $value) {
|
||||||
|
// if (isset($value['json']) && $value['json'] != '') {
|
||||||
|
// $filter_form_id[$key] = $value['fk_form_id'];
|
||||||
|
// $CETAPP_creditPD_data[$value['form_name']] = json_decode($value['json'],true);
|
||||||
|
// } else {
|
||||||
|
// if (in_array($value['fk_form_id'], $forms_data_to_be_get_direct_from_excel_sheet)) {
|
||||||
|
// $data_from_excel = $this->loadDataFromExcelBusiProcess($mater_details, $value['fk_form_id']);
|
||||||
|
// $filter_form_id[$key] = $value['fk_form_id'];
|
||||||
|
// $CETAPP_creditPD_data[$value['form_name']] = json_decode($data_from_excel,true);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
foreach ($pd_section_data as $key => $value)
|
||||||
|
{
|
||||||
if (isset($value['json']) && $value['json'] != '') {
|
if (isset($value['json']) && $value['json'] != '') {
|
||||||
|
$value['json'] = smc_creditpd::getSMCCreditPDReportContent($value,$smc_credit_pd,$companylist);
|
||||||
$filter_form_id[$key] = $value['fk_form_id'];
|
$filter_form_id[$key] = $value['fk_form_id'];
|
||||||
|
// $view_data['pd_section_data'][$value['fk_form_id']] = $value['json'];
|
||||||
$CETAPP_creditPD_data[$value['form_name']] = $value['json'];
|
$CETAPP_creditPD_data[$value['form_name']] = $value['json'];
|
||||||
} else {
|
}
|
||||||
if (in_array($value['fk_form_id'], $forms_data_to_be_get_direct_from_excel_sheet)) {
|
else
|
||||||
|
{
|
||||||
|
if (in_array($value['fk_form_id'], $forms_data_to_be_get_direct_from_excel_sheet)) {
|
||||||
$data_from_excel = $this->loadDataFromExcelBusiProcess($mater_details, $value['fk_form_id']);
|
$data_from_excel = $this->loadDataFromExcelBusiProcess($mater_details, $value['fk_form_id']);
|
||||||
|
//print_r($data_from_excel);die();
|
||||||
|
// $view_data['pd_section_data'][$value['fk_form_id']] = $data_from_excel;
|
||||||
|
$CETAPP_creditPD_data[$value['form_name']] = $data_from_excel;
|
||||||
$filter_form_id[$key] = $value['fk_form_id'];
|
$filter_form_id[$key] = $value['fk_form_id'];
|
||||||
$CETAPP_creditPD_data[$value['form_name']] = $data_from_excel;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$photograph_data = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $smc_credit_pd,'isactive' => 1,'img_name!=' => 'satellite'),SMC_CREDIT_PD_DOCS);
|
|
||||||
$satellite_image = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $smc_credit_pd,'isactive' => 1,'img_name=' => 'satellite'),SMC_CREDIT_PD_DOCS);
|
|
||||||
if(count($photograph_data)>0){
|
|
||||||
for ($i = 0; $i < count($photograph_data); $i++){
|
|
||||||
$img_fields = $common_fields;
|
|
||||||
$img_fields['img_name'] = $photograph_data[$i]['img_name'];
|
|
||||||
$img_split = explode( ',', $photograph_data[$i]['img']);
|
|
||||||
$img_fields['img'] = $img_split[1];
|
|
||||||
cet_creditpd::pushwithcetphotographapi($img_fields,$i);
|
|
||||||
}}
|
|
||||||
if(!empty($satellite_image)){
|
|
||||||
$stt_fields = $common_fields;
|
|
||||||
$stt_fields['img_name'] = $satellite_image[0]['img_name'];
|
|
||||||
$stt_fields['img'] = $satellite_image[0]['img'];
|
|
||||||
cet_creditpd::pushwithcetphotographapi($stt_fields,0);
|
|
||||||
}
|
|
||||||
if ($mater_details[0]['product_abbr'] == 'LFMP' && (array_key_exists("key_stakeholders",$pd_section_data[5])) ) {
|
if ($mater_details[0]['product_abbr'] == 'LFMP' && (array_key_exists("key_stakeholders",$pd_section_data[5])) ) {
|
||||||
$LFMP_KeyStackholders = $pd_section_data[5]['key_stakeholders'];
|
$LFMP_KeyStackholders = $pd_section_data[5]['key_stakeholders'];
|
||||||
$temp_arr = [];
|
$temp_arr = [];
|
||||||
@ -340,9 +444,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
|||||||
$CETAPP_creditPD_data['Key Stakeholders in Business']['key_stakeholders'] = $temp_arr;
|
$CETAPP_creditPD_data['Key Stakeholders in Business']['key_stakeholders'] = $temp_arr;
|
||||||
}
|
}
|
||||||
} // ### LFMP key_stakeholders ends
|
} // ### LFMP key_stakeholders ends
|
||||||
if ((in_array(1, $filter_form_id)) && (in_array(21, $filter_form_id)))
|
// print_r($filter_form_id);die();
|
||||||
// && (in_array(4,$filter_form_id)))
|
|
||||||
{
|
|
||||||
$officer_id = isset($mater_details[0]['fk_updatedby']) ? $mater_details[0]['fk_updatedby'] : '';
|
$officer_id = isset($mater_details[0]['fk_updatedby']) ? $mater_details[0]['fk_updatedby'] : '';
|
||||||
$visit_date = isset($mater_details[0]['pd_visit_date']) ? $mater_details[0]['pd_visit_date'] : '';
|
$visit_date = isset($mater_details[0]['pd_visit_date']) ? $mater_details[0]['pd_visit_date'] : '';
|
||||||
if (!empty($officer_id)) {
|
if (!empty($officer_id)) {
|
||||||
@ -354,13 +456,48 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result = cet_creditpd::pushwithcetcreditpdapi($common_fields, $CETAPP_creditPD_data);
|
||||||
|
if($result == true){
|
||||||
|
$photograph_data = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $smc_credit_pd,'isactive' => 1,'img_name!=' => 'satellite'),SMC_CREDIT_PD_DOCS);
|
||||||
|
$satellite_image = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $smc_credit_pd,'isactive' => 1,'img_name=' => 'satellite'),SMC_CREDIT_PD_DOCS);
|
||||||
|
log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') There are ' . count($photograph_data).' Images');
|
||||||
|
if(count($photograph_data)>0){
|
||||||
|
for ($i = 0; $i < count($photograph_data); $i++){
|
||||||
|
$img_fields = $common_fields;
|
||||||
|
$img_fields['img_name'] = $photograph_data[$i]['img_name'];
|
||||||
|
$img_split = explode( ',', $photograph_data[$i]['img']);
|
||||||
|
$img_fields['img'] = $img_split[1];
|
||||||
|
$resultimages = cet_creditpd::pushwithcetphotographapi($img_fields,$i);
|
||||||
|
}}
|
||||||
|
if(!empty($satellite_image)){
|
||||||
|
log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') satellite Available');
|
||||||
|
$stt_fields = $common_fields;
|
||||||
|
$stt_fields['img_name'] = $satellite_image[0]['img_name'];
|
||||||
|
$stt_fields['img'] = $satellite_image[0]['img'];
|
||||||
|
$resultstatellite = cet_creditpd::pushwithcetphotographapi($stt_fields,0);
|
||||||
|
}
|
||||||
|
// print_r($CETAPP_creditPD_data);
|
||||||
|
// $path = $this->external_path ."/pd_reports/" . $mater_details[0]['pd_id'] . "/new-file-5-".$mater_details[0]['pd_id'].".json";
|
||||||
|
// $json = json_decode($view_data['pd_section_data'],true);
|
||||||
|
// $fp = fopen($path, 'w');
|
||||||
|
// fwrite($fp, $jsonString);
|
||||||
|
// fclose($fp);
|
||||||
|
// if(file_put_contents($path, $output_data))
|
||||||
|
// {
|
||||||
|
// $message = "<label class='text-success'>File createed and data added Success fully</p>";
|
||||||
|
// echo $message;
|
||||||
|
// }die();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}else{
|
||||||
|
log_message('ERROR', '#### Section Details pushed Images Details Not Pushed');
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = 'Section Details pushed Images Details Not Pushed ! Try Later';
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
}
|
}
|
||||||
cet_creditpd::pushwithcetcreditpdapi($common_fields, $CETAPP_creditPD_data);
|
|
||||||
|
|
||||||
$data['dataStatus'] = true;
|
|
||||||
$data['status'] = REST_Controller::HTTP_OK;
|
|
||||||
$data['msg'] = 'Data Shared Successfully';
|
|
||||||
$this->response($data, REST_Controller::HTTP_OK);
|
|
||||||
} else {
|
} else {
|
||||||
log_message('ERROR', '#### There is No Data Found relevant Credit PDID ');
|
log_message('ERROR', '#### There is No Data Found relevant Credit PDID ');
|
||||||
$data['dataStatus'] = false;
|
$data['dataStatus'] = false;
|
||||||
|
|||||||
@ -273,10 +273,100 @@ class Sales_PD_Controller extends REST_Controller {
|
|||||||
|
|
||||||
function uploadSalesPDDataToCETApp_get()
|
function uploadSalesPDDataToCETApp_get()
|
||||||
{
|
{
|
||||||
log_message('ERROR','#### upload SalesPDData To CETApp Called');
|
|
||||||
$sales_pd_id = $this->uri->segment(2);
|
$sales_pd_id = $this->uri->segment(2);
|
||||||
|
if($sales_pd_id){
|
||||||
|
log_message('ERROR', '#### upload Sales PDData To CETApp Function Called');
|
||||||
|
$columns = array('SALES_PD_DATA.sales_pd_id');
|
||||||
|
$table = SALES_PD_DATA . ' as SALES_PD_DATA';
|
||||||
|
$where_arr = array('SALES_PD_DATA.is_the_data_transfer_cet'=>0,'SALES_PD_DATA.status' => COMPLETED,'SALES_PD_DATA.sales_pd_id'=>$sales_pd_id);
|
||||||
|
$details = $this->Sales_PD_Model->selectCustomRecords($columns, $where_arr, $table);
|
||||||
|
if(!empty($details)){
|
||||||
|
$response = $this->dataSynchronization($sales_pd_id);
|
||||||
|
if($response){
|
||||||
|
$data['dataStatus'] = true;
|
||||||
|
$data['status'] = REST_Controller::HTTP_OK;
|
||||||
|
$data['msg'] = 'Data Shared Successfully';
|
||||||
|
$this->response($data,REST_Controller::HTTP_OK);
|
||||||
|
}else{
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = 'Something went wrong! Try Later';
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
log_message('ERROR', $sales_pd_id.' Data already uploaded');
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = 'Data already uploaded! Try Later';
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$msg = 'Can`t Upload. ID Not Founded ! Try Later';
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = $msg;
|
||||||
|
log_message('ERROR', $msg);
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public function transferSalesPDToCETApp_get()
|
||||||
|
{
|
||||||
|
$from_date = $this->get('from_date');
|
||||||
|
$to_date = $this->get('to_date');
|
||||||
|
if(($from_date != "" || $from_date != null) && ($to_date != "" || $to_date != null)){
|
||||||
|
$newDate1 = date("Y-m-d", strtotime($from_date));
|
||||||
|
$newDate2 = date("Y-m-d", strtotime($to_date));
|
||||||
|
$msg = " SMC-Credit PDData Transfer To CETApp Date Given Format => " . $from_date ." to ".$to_date;
|
||||||
|
// $where = 'DATE(PDTRIGGER.completed_on) BETWEEN ' ."'$newDate1'". ' AND ' ."'$newDate2'";
|
||||||
|
$columns = array('SALES_PD_DATA.sales_pd_id','SALES_PD_DATA.status', 'SALES_PD_DATA.completed_date');
|
||||||
|
$table = SALES_PD_DATA . ' as SALES_PD_DATA';
|
||||||
|
$where = 'DATE(SALES_PD_DATA.completed_date)
|
||||||
|
BETWEEN ' ."'$newDate1'". ' AND ' ."'$newDate2'";
|
||||||
|
$where_arr = array('SALES_PD_DATA.is_the_data_transfer_cet'=>0,'SALES_PD_DATA.status' => COMPLETED, $where => null);
|
||||||
|
$details = $this->Sales_PD_Model->selectCustomRecords($columns, $where_arr, $table);
|
||||||
|
log_message('ERROR', $msg." Changed ".$newDate1." to ".$newDate2." Total Records => " . count($details));
|
||||||
|
if(!empty($details)){
|
||||||
|
$flag = 0;$ids=array();
|
||||||
|
for ($i = 0; $i < count($details); $i++) {
|
||||||
|
$sales_pd_id = $details[$i]['sales_pd_id'];
|
||||||
|
// echo $sales_pd_id;
|
||||||
|
$result = $this->dataSynchronization($sales_pd_id);
|
||||||
|
if($result == true){
|
||||||
|
$flag = $flag+1;
|
||||||
|
//update here.
|
||||||
|
$update_fields2 = array('is_the_data_transfer_cet' => 1);
|
||||||
|
$this->Sales_PD_Model->updateRecords($update_fields2,SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id));
|
||||||
|
array_push($ids, $sales_pd_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
// $flag = ($result == true) ? $flag+1 : $flag;
|
||||||
|
}
|
||||||
|
$data['dataStatus'] = true;
|
||||||
|
$data['status'] = REST_Controller::HTTP_OK;
|
||||||
|
$data['msg'] = implode(', ', $ids).' ( '.$flag.' ) Data Shared Successfully';
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}else{
|
||||||
|
$msg = 'There is no data for Given Date ! Try Later';
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = $msg;
|
||||||
|
log_message('ERROR', $msg);
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$msg = 'Can`t Upload Date Not Founded ! Try Later';
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = $msg;
|
||||||
|
log_message('ERROR', $msg);
|
||||||
|
$this->response($data, REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function dataSynchronization($sales_pd_id)
|
||||||
|
{
|
||||||
if(!empty($sales_pd_id)){
|
if(!empty($sales_pd_id)){
|
||||||
log_message('ERROR','#### Sales PD = '.$sales_pd_id);
|
|
||||||
$columns = array('SALES_PD_DATA.*','ENTITY.short_name','PRODUCT.abbr','USERPROFILE.smc_emp_code');
|
$columns = array('SALES_PD_DATA.*','ENTITY.short_name','PRODUCT.abbr','USERPROFILE.smc_emp_code');
|
||||||
$table = SALES_PD_DATA.' as SALES_PD_DATA';
|
$table = SALES_PD_DATA.' as SALES_PD_DATA';
|
||||||
$joins = array(
|
$joins = array(
|
||||||
@ -293,7 +383,8 @@ class Sales_PD_Controller extends REST_Controller {
|
|||||||
|
|
||||||
$where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $sales_pd_id);
|
$where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $sales_pd_id);
|
||||||
$sales_pd_data = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
|
$sales_pd_data = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
|
||||||
log_message('ERROR','#### Total Sales PD is '.count($sales_pd_data));
|
// log_message('ERROR', '#### Sales PD ('.$sales_pd_id.') There are ' . count($sales_pd_data).' Forms ');
|
||||||
|
log_message('ERROR', '#### Sales PD ('.$sales_pd_id.')');
|
||||||
if(count($sales_pd_data)>0)
|
if(count($sales_pd_data)>0)
|
||||||
{
|
{
|
||||||
$all_section_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $sales_pd_id,'isactive' => 1),SALESPD_SECTION_DATA,array(),'','section_id','ASC');
|
$all_section_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $sales_pd_id,'isactive' => 1),SALESPD_SECTION_DATA,array(),'','section_id','ASC');
|
||||||
@ -307,18 +398,7 @@ class Sales_PD_Controller extends REST_Controller {
|
|||||||
$section_fields['section'.$section['section_id'] ] = $this->processSalesPDJSON($section);
|
$section_fields['section'.$section['section_id'] ] = $this->processSalesPDJSON($section);
|
||||||
}
|
}
|
||||||
|
|
||||||
$photograph_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS);
|
|
||||||
|
|
||||||
if(count($photograph_data)>0){
|
|
||||||
for ($i = 0; $i < count($photograph_data); $i++){
|
|
||||||
$img_fields = $common_fields;
|
|
||||||
$img_fields['img_name'] = $photograph_data[$i]['img_name'];
|
|
||||||
$img_split = explode( ',', $photograph_data[$i]['img']);
|
|
||||||
$img_fields['img'] = $img_split[1];
|
|
||||||
// $img_fields[0]['img'] = $photograph_data[$i]['img'];
|
|
||||||
cet_salespd::pushwithcetphotographapi($img_fields,$i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// cet_salespd::pushwithcetsalespdapi($common_fields,$section_fields,1);
|
// cet_salespd::pushwithcetsalespdapi($common_fields,$section_fields,1);
|
||||||
$CETAPP_salesPD_data = $section_fields;
|
$CETAPP_salesPD_data = $section_fields;
|
||||||
@ -331,20 +411,36 @@ class Sales_PD_Controller extends REST_Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cet_salespd::pushwithcetsalespdapi($common_fields,$CETAPP_salesPD_data,1);
|
$result = cet_salespd::pushwithcetsalespdapi($common_fields,$CETAPP_salesPD_data,1);
|
||||||
|
if($result == true){
|
||||||
$satellite_image = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name' => 'satellite','isactive' => 1),SALEPD_DOCS);
|
$photograph_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS);
|
||||||
if(!empty($satellite_image)){
|
$satellite_image = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name' => 'satellite','isactive' => 1),SALEPD_DOCS);
|
||||||
$stt_fields = $common_fields;
|
log_message('ERROR', '#### Sales PD ('.$sales_pd_id.') There are ' . count($photograph_data).' Images');
|
||||||
$stt_fields['img_name'] = $satellite_image[0]['img_name'];
|
if(count($photograph_data)>0){
|
||||||
$stt_fields['img'] = $satellite_image[0]['img'];
|
for ($i = 0; $i < count($photograph_data); $i++){
|
||||||
cet_salespd::pushwithcetphotographapi($stt_fields,0);
|
$img_fields = $common_fields;
|
||||||
|
$img_fields['img_name'] = $photograph_data[$i]['img_name'];
|
||||||
|
$img_split = explode( ',', $photograph_data[$i]['img']);
|
||||||
|
$img_fields['img'] = $img_split[1];
|
||||||
|
// $img_fields[0]['img'] = $photograph_data[$i]['img'];
|
||||||
|
cet_salespd::pushwithcetphotographapi($img_fields,$i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($satellite_image)){
|
||||||
|
log_message('ERROR', '#### Sales PD ('.$sales_pd_id.') satellite Available');
|
||||||
|
$stt_fields = $common_fields;
|
||||||
|
$stt_fields['img_name'] = $satellite_image[0]['img_name'];
|
||||||
|
$stt_fields['img'] = $satellite_image[0]['img'];
|
||||||
|
cet_salespd::pushwithcetphotographapi($stt_fields,0);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}else{
|
||||||
|
log_message('ERROR', '#### Section Details pushed Images Details Not Pushed');
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||||
|
$data['msg'] = 'Section Details pushed Images Details Not Pushed ! Try Later';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['dataStatus'] = true;
|
|
||||||
$data['status'] = REST_Controller::HTTP_OK;
|
|
||||||
$data['msg'] = 'Data Shared Successfully';
|
|
||||||
$this->response($data,REST_Controller::HTTP_OK);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -72,7 +72,7 @@ class AUTHORIZATION
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( $routingName == ROUTE_LOGIN_X || $routingName == ROUTE_LOGIN_Y || $routingName == ROUTE_LOGIN_Z || $routingName == ROUTE_LOGIN_W || $routingName == ROUTE_LOGIN_V || $routingName == ROUTE_LOGIN_A || $routingName == TURN_SERVER_API || $routingName == VIDEO_CHAT_ACCESS_KEY_API || $routingName ==SAVEROOMINFO_API || $routingName ==SAVESMCCREDITPDIMAGE_API || $routingName ==GETSMCPDIMGSECTIONDATA_API || $routingName == ROUTE_LOGIN_T || $routingName == ROUTE_LOGIN_U || $routingName == ROUTE_LOGIN_B || $routingName == ROUTE_LOGIN_C || $routingName == ROUTE_LOGIN_D || $routingName == ROUTE_LOGIN_E || $routingName == ROUTE_LOGIN_F || $routingName == ROUTE_LOGIN_S)
|
if( $routingName == ROUTE_LOGIN_X || $routingName == ROUTE_LOGIN_Y || $routingName == ROUTE_LOGIN_Z || $routingName == ROUTE_LOGIN_W || $routingName == ROUTE_LOGIN_V || $routingName == ROUTE_LOGIN_A || $routingName == TURN_SERVER_API || $routingName == VIDEO_CHAT_ACCESS_KEY_API || $routingName ==SAVEROOMINFO_API || $routingName ==SAVESMCCREDITPDIMAGE_API || $routingName ==GETSMCPDIMGSECTIONDATA_API || $routingName == ROUTE_LOGIN_T || $routingName == ROUTE_LOGIN_U || $routingName == ROUTE_LOGIN_B || $routingName == ROUTE_LOGIN_C || $routingName == ROUTE_LOGIN_D || $routingName == ROUTE_LOGIN_E || $routingName == ROUTE_LOGIN_F || $routingName == ROUTE_LOGIN_S || $routingName == ROUTE_LOGIN_G || $routingName == ROUTE_LOGIN_H)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ class CET_CREDITPD
|
|||||||
public static function pushwithcetcreditpdapi($fields,$data)
|
public static function pushwithcetcreditpdapi($fields,$data)
|
||||||
{
|
{
|
||||||
log_message('ERROR','#### Inside cet creditpd helper fns');
|
log_message('ERROR','#### Inside cet creditpd helper fns');
|
||||||
|
$CI =&get_instance();
|
||||||
if (array_key_exists("Photograph's", $data)) {
|
if (array_key_exists("Photograph's", $data)) {
|
||||||
unset($data["Photograph's"]);
|
unset($data["Photograph's"]);
|
||||||
}
|
}
|
||||||
@ -26,6 +27,17 @@ class CET_CREDITPD
|
|||||||
$headers = array('Content-Type: application/json');
|
$headers = array('Content-Type: application/json');
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
$output_data = json_encode( $fields );
|
$output_data = json_encode( $fields );
|
||||||
|
// log_message('ERROR','#### output_data '.$output_data);
|
||||||
|
// $path = $CI->external_path."/tmp/".$fields['pdid']."1.json";
|
||||||
|
// // $fp = fopen($path, 'w');
|
||||||
|
// // fwrite($fp, $output_data);
|
||||||
|
// if(file_put_contents($path, $output_data))
|
||||||
|
// {
|
||||||
|
// $message = "<label class='text-success'>File createed and data added Success fully</p>";
|
||||||
|
// echo $message;
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// print_r($fields);die();
|
||||||
// log_message('ERROR',"PullcreditPDData api Request Format : ".$output_data);
|
// log_message('ERROR',"PullcreditPDData api Request Format : ".$output_data);
|
||||||
// curl_setopt( $ch,CURLOPT_URL, "https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdData");
|
// curl_setopt( $ch,CURLOPT_URL, "https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdData");
|
||||||
curl_setopt( $ch,CURLOPT_URL, CET_CREDIT_PD_INTEGRATION_URL);
|
curl_setopt( $ch,CURLOPT_URL, CET_CREDIT_PD_INTEGRATION_URL);
|
||||||
@ -38,7 +50,7 @@ class CET_CREDITPD
|
|||||||
$response = json_decode($result);
|
$response = json_decode($result);
|
||||||
log_message('ERROR',"CET APP CREDIT PDID (".$pdid.") response :".json_encode($response));
|
log_message('ERROR',"CET APP CREDIT PDID (".$pdid.") response :".json_encode($response));
|
||||||
curl_close( $ch );
|
curl_close( $ch );
|
||||||
|
return $response->status == 200 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// multipart/form-data;
|
// multipart/form-data;
|
||||||
@ -59,6 +71,7 @@ class CET_CREDITPD
|
|||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
$log_msg = " PullcreditPdPhotographsData api (".$fields['img_name'].")";
|
$log_msg = " PullcreditPdPhotographsData api (".$fields['img_name'].")";
|
||||||
$fields['img'] = $curlFile;
|
$fields['img'] = $curlFile;
|
||||||
|
log_message('ERROR',"CET APP CREDIT PDID (".$pdid.") response :".json_encode($fields));
|
||||||
curl_setopt( $ch,CURLOPT_URL, CET_CREDIT_PD_INTEGRATION_IMG_URL);
|
curl_setopt( $ch,CURLOPT_URL, CET_CREDIT_PD_INTEGRATION_IMG_URL);
|
||||||
curl_setopt( $ch,CURLOPT_POST, true );
|
curl_setopt( $ch,CURLOPT_POST, true );
|
||||||
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
|
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
|
||||||
@ -71,7 +84,7 @@ class CET_CREDITPD
|
|||||||
curl_close( $ch );
|
curl_close( $ch );
|
||||||
unlink($file);
|
unlink($file);
|
||||||
// unlink($file_name_with_full_path);
|
// unlink($file_name_with_full_path);
|
||||||
|
return $response->status == 200 ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -65,6 +65,7 @@ class CET_SALESPD
|
|||||||
$response = json_decode($result);
|
$response = json_decode($result);
|
||||||
log_message('ERROR',"CET APP SALES PDID (".$pdid.") "."PullSalesPDData api response :".json_encode($response));
|
log_message('ERROR',"CET APP SALES PDID (".$pdid.") "."PullSalesPDData api response :".json_encode($response));
|
||||||
curl_close( $ch );
|
curl_close( $ch );
|
||||||
|
return $response->status == 200 ? true : false;
|
||||||
|
|
||||||
}
|
}
|
||||||
// multipart/form-data;
|
// multipart/form-data;
|
||||||
@ -97,6 +98,7 @@ class CET_SALESPD
|
|||||||
log_message('ERROR',"###CET APP SALES PDID (".$pdid.") ".$log_msg."response :".json_encode($response));
|
log_message('ERROR',"###CET APP SALES PDID (".$pdid.") ".$log_msg."response :".json_encode($response));
|
||||||
curl_close( $ch );
|
curl_close( $ch );
|
||||||
unlink($file);
|
unlink($file);
|
||||||
|
return $response->status == 200 ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user