CUS LINK VALIDATION REMOVED

This commit is contained in:
Velz2020 2020-03-24 14:07:33 +05:30
parent c6ad7dd690
commit 6552ec5300
2 changed files with 145 additions and 2 deletions

View File

@ -9482,6 +9482,145 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
}
//CUstomer Link for Tele PD to upload photos
public function uploadPDPhotosByApplicant_post()
{
$records = $this->post('records');
}
//Applicant Link Check and Get Image Details
public function getPDImgDetails_post()
{
$random_string = $this->post('random_string');
$pd_id = $this->post('pd_id');
if(!$pd_id)
{
//Get PD ID by Random String
$pd_id = $this->PD_Model->selectCustomRecords(array('pd_id','is_cus_link_valid','cus_link_count','is_cus_link_disabled'),array('random_string' => $random_string),PDTRIGGER);
if(count($pd_id) && count($pd_id) == 1)
{
//check and update link meta data
if($pd_id[0]['is_cus_link_valid'])
{
//$this->updateLinkMetaData($pd_id[0]['pd_id'],$pd_id[0]['cus_link_count'],$random_string);
//get img Data
$this->getPDImgData($pd_id[0]['pd_id'],$random_string,$pd_id[0]['is_cus_link_disabled']);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Link Expired';
$this->response($data,REST_Controller::HTTP_OK);
}
}
else if(count($pd_id) > 1 || !count($pd_id))
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Invalid Link';
$this->response($data,REST_Controller::HTTP_OK);
}
}
else
{
//check and update link meta data
}
}
//update link meta data
public function updateLinkMetaData($pd_id,$link_count,$random_string)
{
//echo 'updateLinkMetaData';
$this->load->library('user_agent');
$agent = 'DEFAULT';
if ($this->agent->is_browser())
{
$agent = $this->agent->browser().' '.$this->agent->version();
}
elseif ($this->agent->is_robot())
{
$agent = $this->agent->robot();
}
elseif ($this->agent->is_mobile())
{
$agent = $this->agent->mobile();
}
else
{
$agent = 'Unidentified User Agent';
}
//echo $agent;echo $this->input->ip_address();echo $this->agent->platform();
//$this->PD_Model->saveRecords(array('fk_pd_id' => $pd_id,'browser' => $agent,'ip_address' => $this->input->ip_address(),'platform' => $this->agent->platform()),CUS_LINK_META_DATA);
//update link access count in PD trigger table
//$this->PD_Model->updateRecords(array('cus_link_count' =>($link_count + 1) ),PDTRIGGER,array('pd_id' => $pd_id,'random_string' => $random_string));
}
public function getPDImgData($pd_id,$random_string,$is_cus_link_disabled)
{
$existing_imges = $this->PD_Model->getSignedPDDocsURL($pd_id,null,null,null,null,'report');
$photo_names = array('selfie_with_person_met' => array('Person met','18'),'person_met_id' => array('Person met ID Proof','18'),'approach_to_pd_location' => array('Approach to pd location','5'),'name_board_seen' => array('Name board seen','13'), 'stock_image' => array('Stock image','11'),'attendance_seen_pic' => array('Attendance Img','13'),'attendance_seen_pic' => array('Attendance Img','13'),'client_image' => array('Client Details Image','2'),'supplier_image' => array('Supplier Details Image','1'),'machinary_image' => array('Machinery Image','22'),'gst_Regn_cert' => array('GST Regn Cert','13'),'pf_regn' => array('PF Regn','13'),'esic_regn' => array('ESIC Regn','13'),'export_import_cert' => array('Export Import Cert','13'),'factory_cert' => array('Factory Cert','13'),'shop_eat_act_cert' => array('Shop Est Act Cert','13'),'eb_bill' => array('EB Bill','13'));
$final_data = array();
$common_images = array();
//print_r(($existing_imges));
if(count($existing_imges))
{
foreach ($existing_imges as $key => $value)
{
if($value['img_type'] == 1)
{
$final_data[] = array('img_key' => 'selfie_with_person_met','img_name' => $photo_names['selfie_with_person_met'][0],'fk_form_id' => $photo_names['selfie_with_person_met'][1],'img_url' => $value['doc_url'],'is_multiple' => 0);
continue;
}
else if($value['img_type'] == 2)
{
$final_data[] = array('img_key' => 'person_met_id','img_name' => $photo_names['person_met_id'][0],'img_url' => $value['doc_url'],'fk_form_id' => $photo_names['selfie_with_person_met'][1],'is_multiple' => 0);
continue;
}
else if(strpos($value['pd_document_title'], 'Approach') !== false)
{
$final_data[] = array('img_key' => 'approach_to_pd_location','img_name' => $photo_names['approach_to_pd_location'][0],'img_url' => $value['doc_url'],'fk_form_id' => $photo_names['approach_to_pd_location'][1],'is_multiple' => 0);
continue;
}
else if(isset($photo_names [ $value['pd_document_title'] ]))
{
$final_data[] = array('img_key' => $value['pd_document_title'],'img_name' => $photo_names[ $value['pd_document_title'] ][0],'img_url' => $value['doc_url'],'fk_form_id' => $photo_names[ $value['pd_document_title'] ][1],'is_multiple' => 0);
continue;
}
else
{
$common_images[] = array('img_key' => $value['pd_document_title'],'img_name' => $value['pd_document_title'],'img_url' => $value['doc_url'],'fk_form_id' => $value['fk_form_id']);
continue;
}
}
}
else
{
}
//print_r($final_data);
$final_data[] = array('imag_data' => $common_images,'is_multiple' => 1);
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = array('pd_id' => $pd_id,'random_string' => $random_string,'is_cus_link_disabled' => $is_cus_link_disabled,'img_data' => $final_data);
$this->response($data,REST_Controller::HTTP_OK);
}
}

View File

@ -70,8 +70,7 @@ class AUTHORIZATION
{
$role_permission_array = $CI->config->item('api_user_auth_info')[$CI->uri->uri_string];
}
// print_r($role_permission_array);
// die();
if( $routingName == ROUTE_LOGIN_X || $routingName == ROUTE_LOGIN_Y)
{
@ -99,6 +98,11 @@ class AUTHORIZATION
return $validateToken;
}
}
//not checking routes of applicant img capturing functionality
else if( $routingName == 'getPDImgDetails' || $routingName == 'uploadPDImgByApplicant')
{
return true;
}
//For all route name except contant route
else if($routingName!=ROUTE_LOGIN){
$validateToken = self::validateTimestamp();