VENDOR PD FORM STATUS
This commit is contained in:
parent
52eab8665f
commit
d65062f23c
@ -92,6 +92,7 @@ defined('ROUTE_LOGIN_Y') OR define('ROUTE_LOGIN_Y', '(getPDReportPDFprevi
|
||||
defined('ROUTE_LOGIN_Z') OR define('ROUTE_LOGIN_Z', 'getSalesPDImgDataCusLink'); // no errors
|
||||
defined('ROUTE_LOGIN_W') OR define('ROUTE_LOGIN_W', 'saveSalesPDImage'); // no errors
|
||||
defined('ROUTE_LOGIN_V') OR define('ROUTE_LOGIN_V', 'generateSatelliteImg'); // no errors
|
||||
defined('ROUTE_LOGIN_A') OR define('ROUTE_LOGIN_A', 'getAuditedImages'); // no errors
|
||||
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN','getFullPDDetails'); // no errors
|
||||
|
||||
/*********************AWS resources Constants*************************************************/
|
||||
@ -628,5 +629,7 @@ defined('CUS_VIDEO') OR define('CUS_VIDEO','t_cus_video');
|
||||
|
||||
defined('CREDITPDTEMPLATE') OR define('CREDITPDTEMPLATE','m_credit_pd_template');
|
||||
|
||||
defined('VENDORFORMSTATUS') OR define('VENDORFORMSTATUS','t_vendor_form_status');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -257,6 +257,7 @@ $route['updateVendorStatus'] = 'PD_Controller/updateVendorStatus';
|
||||
$route['getVendorAnswers'] = 'PD_Controller/getVendorAnswers';
|
||||
$route['auditSmartPDImages'] = 'PD_Controller/auditSmartPDImages';
|
||||
$route['getAuditedImages'] = 'PD_Controller/getAuditedImages';
|
||||
$route['updateVendorFormStatus'] = 'PD_Controller/updateVendorFormStatus';
|
||||
//$route['getTypeOfActivetyFromBusinessJSON'] = 'PD_Controller/getTypeOfActivetyFromBusinessJSON';
|
||||
|
||||
//Dashboard and Reports Related routes
|
||||
|
||||
@ -2172,6 +2172,11 @@ public function assignPDTempalate($data)
|
||||
//Get Docs to be collected array
|
||||
$result_data['docs_to_be_collected'] = $this->PD_Model->getDocsToBeCollected($pdid);
|
||||
|
||||
if($result_data['pd_master_details'][0]['fk_pd_type'] == 2) //smart pd get vendor forms status
|
||||
{
|
||||
$result_data['vendor_form_status'] = $this->PD_Model->getVendorFormStatus($pdid);
|
||||
}
|
||||
|
||||
//Get All PD Logs
|
||||
$result_data['pd_logs'] = $this->PD_Model->getPDLogs($pdid);
|
||||
//print_r($result_data['pd_logs']);die();
|
||||
@ -2771,6 +2776,12 @@ public function assignPDTempalate($data)
|
||||
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILSJSON);
|
||||
// }
|
||||
// End Of update Additional Entry
|
||||
if($temp_array['fk_form_id'] == 25) //vendor form id
|
||||
{
|
||||
$custom_log_info = '### Disable all forms VENDOR_FORMS_STATUS to zero - ('. $pdid.' - '. $formid.') - ' . date('Y-m-d H:i:s A');
|
||||
log_message('ERROR',$custom_log_info);
|
||||
$this->PD_Model->updateRecords(array('form_status' => 0),VENDORFORMSTATUS,array('fk_pd_id' => $pdid));
|
||||
}
|
||||
$custom_log_info = '### JSON Saved Successfully PDID - ('. $pdid.' - '. $formid.') - ' . date('Y-m-d H:i:s A');
|
||||
log_message('ERROR',$custom_log_info);
|
||||
|
||||
@ -9066,9 +9077,15 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
// echo $company_id;die();
|
||||
//de activate previous one
|
||||
|
||||
if(!$records['is_multiple'])
|
||||
if(!$records['is_multiple'] || isset($records['pd_document_id']))
|
||||
{
|
||||
$this->PD_Model->updateRecords(array('isactive' => 0),PDDOCUMENTS,array('fk_pd_id' => $records['fk_pd_id'],'fk_form_id' => $records['fk_form_id'],'pd_document_title' => $current_doc_title));
|
||||
$where_condition_array = array('fk_pd_id' => $records['fk_pd_id'],'fk_form_id' => $records['fk_form_id'],'pd_document_title' => $current_doc_title);
|
||||
if(isset($records['pd_document_id']) && isset($records['retake_flag']) && $records['retake_flag'])
|
||||
{
|
||||
$where_condition_array = array('pd_document_id' => $records['pd_document_id']);
|
||||
unset($records['pd_document_id']); unset($records['retake_flag']) ;
|
||||
}
|
||||
$this->PD_Model->updateRecords(array('isactive' => 0,'retake_flag' => 0),PDDOCUMENTS,$where_condition_array);
|
||||
// print_r($this->db->last_query());
|
||||
}
|
||||
|
||||
@ -10239,6 +10256,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
{
|
||||
|
||||
$docs = ($this->post());
|
||||
//print_r($docs);die();
|
||||
$result_array = array();
|
||||
$is_api_processed = false;
|
||||
$total_affected_rows = null;
|
||||
@ -10251,14 +10269,14 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
$where_condition_array[] = $value['pd_document_id'] ;
|
||||
}
|
||||
|
||||
$this->db->WHERE_IN('pd_document_id',$where_condition_array)->UPDATE(PDDOCUMENTS,array('retake_flag' => 1));
|
||||
$ids = $this->db->WHERE_IN('pd_document_id',$where_condition_array)->UPDATE(PDDOCUMENTS,array('retake_flag' => 1));
|
||||
$total_affected_rows = $this->db->affected_rows();
|
||||
$is_api_processed = $total_affected_rows == count($docs) ? true : false;
|
||||
//print_r($this->db->last_query());
|
||||
|
||||
}
|
||||
|
||||
if((count($docs) == $total_affected_rows) && $is_api_processed)
|
||||
//echo count($docs);echo($total_affected_rows);echo ($is_api_processed);
|
||||
if($ids)// && $is_api_processed)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
@ -10289,8 +10307,9 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
if(count($pd_id) && count($pd_id) == 1)
|
||||
{
|
||||
//check and update link meta data
|
||||
if($pd_id[0]['is_cus_link_valid'] && !$pd_id[0]['is_cus_link_disabled'])
|
||||
{
|
||||
// echo $pd_id[0]['is_cus_link_valid'];echo $pd_id[0]['is_cus_link_disabled'];
|
||||
// if($pd_id[0]['is_cus_link_valid'] && !$pd_id[0]['is_cus_link_disabled'])
|
||||
// {
|
||||
|
||||
$where_condition_array = array('fk_pd_id' => $pd_id[0]['pd_id'],'retake_flag' => 1);
|
||||
$document_lists = $this->db->SELECT('*')->FROM(PDDOCUMENTS)->WHERE($where_condition_array)->get()->result_array();
|
||||
@ -10341,7 +10360,9 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
}
|
||||
else
|
||||
{
|
||||
$arr = array('img_key' => $value['pd_document_title'],'img_name' => $this->photo_names['name_board_seen'][0],'img_url' => $singed_uri,'fk_form_id' => $this->photo_names['name_board_seen'][1],'is_multiple' => 0,'pd_document_id' => $value['pd_document_id']);
|
||||
$img_key = isset($this->photo_names[ $value['pd_document_title'] ]) ? $this->photo_names[ $value['pd_document_title'] ][0] : ($value['fk_form_id'] == 24 ? 'docs_to_be_collected':'common_image');
|
||||
$arr = array('img_key' => $img_key,'img_name' => $value['pd_document_title'],'img_url' => $singed_uri,'fk_form_id' => $value['fk_form_id'],'is_multiple' => 0,'pd_document_id' => $value['pd_document_id']);
|
||||
//if(!$value['fk_form_id']){ $arr }
|
||||
$result_array[] = $arr;
|
||||
}
|
||||
#######################################################################################################################
|
||||
@ -10351,23 +10372,23 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result_array;
|
||||
$data['records'] = array('pd_id' => $pd_id[0]['pd_id'],'img_data' => $result_array,'is_cus_link_disabled' => $pd_id[0]['is_cus_link_disabled'],'random_string' => $random_string);
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$data['msg'] = 'Link Expired';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
//}
|
||||
// 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;
|
||||
@ -10377,6 +10398,18 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function updateVendorFormStatus_post()
|
||||
{
|
||||
//print_r($this->post());
|
||||
$id = $this->PD_Model->updateRecords(array('form_status' => 1),VENDORFORMSTATUS,array('fk_pd_id' => $this->post('fk_pd_id'),'fk_form_id' => $this->post('fk_form_id')));
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $id;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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)
|
||||
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)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1080,6 +1080,36 @@ class PD_Model extends SPARQ_Model {
|
||||
$this->db->WHERE('fk_pd_id',$pdid);
|
||||
return $this->db->GET()->result_array();
|
||||
}
|
||||
|
||||
public function getVendorFormStatus($pdid)
|
||||
{
|
||||
|
||||
$res = $this->getVendorFormsWithStatus($pdid);
|
||||
if(count($res))
|
||||
{
|
||||
//echo 'exist';
|
||||
return $res;
|
||||
}
|
||||
else//18,5,13,11,19,20
|
||||
{
|
||||
//echo 'insert';
|
||||
$f_arr = array(18,5,13,11,19,20);
|
||||
foreach ($f_arr as $key => $value)
|
||||
{
|
||||
$this->saveRecords(array('fk_pd_id' => $pdid,'fk_form_id' => $value),VENDORFORMSTATUS);
|
||||
}
|
||||
|
||||
return $this->getVendorFormsWithStatus($pdid);
|
||||
}
|
||||
}
|
||||
|
||||
function getVendorFormsWithStatus($pdid)
|
||||
{
|
||||
$this->db->SELECT('fk_form_id, fk_pd_id, form_status');
|
||||
$this->db->FROM(VENDORFORMSTATUS);
|
||||
$this->db->WHERE('fk_pd_id',$pdid);
|
||||
return $this->db->GET()->result_array();
|
||||
}
|
||||
|
||||
public function getTemplateForPD($pdid,$client,$random_string,$api = 'WEB')
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user