From bf54068ac5e62f0397d4d0d4d9d04640f507ea4f Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Tue, 31 Mar 2020 22:53:40 +0530 Subject: [PATCH] CUS LINK 5 --- api/application/controllers/PD_Controller.php | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 3513326b..9e0a0a1d 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -20,7 +20,7 @@ class PD_Controller extends REST_Controller { //class level variable declaration //protected $external_path; - private $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')); + private $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_pic' => array('GST Regn Cert','13'),'pf_regn_pic' => array('PF Regn','13'),'esic_regn_pic' => array('ESIC Regn','13'),'export_import_cert_pic' => array('Export Import Cert','13'),'factory_cert_pic' => array('Factory Cert','13'),'shop_eat_act_cert_pic' => array('Shop Est Act Cert','13'),'eb_bill_pic' => array('EB Bill','13'),'practice_cert_pic' => array('Cert of Practice','13'),'fire_noc_pic' => array('Fire NOC','13')); private $existing_imges = array(); function __construct() @@ -6152,7 +6152,7 @@ public function getPDFormDetailsJSON_post() $t = substr_replace($t,'',strpos($t,''),(strlen(''))); } - //echo $t;die(); + echo $t;die(); //$t = file_get_contents($this->external_path ."/pd_reports/" . $pdid . "/sample.html"); // $start_pos = strpos($t,''); @@ -9521,6 +9521,18 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $img_array['Name'] = $records['name']; $current_doc_title = $records['image_key']; } + else if(strpos($records['image_key'], 'name_board_seen') !== false) + { + $img_array['image'] = $records['image']; + $img_array['Name'] = $records['name']; + $current_doc_title = $records['image_key']; + } + else if(strpos($records['image_key'], 'common_image') !== false) + { + $img_array['image'] = $records['image']; + $img_array['Name'] = $records['name']; + $current_doc_title = $records['image_key']; + } else { $img_array['image'] = $records['image']; @@ -9530,8 +9542,13 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() //echo $current_doc_title;die(); //de activate previous one - $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)); + + if($records['image_key'] != 'common_image') + { + $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)); // print_r($this->db->last_query()); + } + $res = $this->saveBase64Images($records['fk_pd_id'],$records['fk_form_id'],$company_id = null,$rental_count_id = null,array($img_array)); if($res) { @@ -9632,7 +9649,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $final_data = array(); $common_images = array(); - // print_r(($this->existing_imges));//die(); + //print_r(count($this->existing_imges));die(); if(count($this->existing_imges)) { foreach ($this->photo_names as $key => $value) @@ -9653,7 +9670,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() { foreach ($this->photo_names as $key => $value) { - $final_data[] = array('img_key' => $key,'img_name' => $key,'img_url' => "",'fk_form_id' => $value[1]); + $final_data[] = array('img_key' => $key,'img_name' => $value[0],'img_url' => "",'fk_form_id' => $value[1]); } } @@ -9700,6 +9717,14 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() // unset($this->photo_names['selfie_with_person_met']); // return $arr; } + else if($current_img_key == 'name_board_seen' && strpos($value['pd_document_title'], 'Name Board Seen') !== false) + { + unset($this->existing_imges[$key]); + //echo "APPROACH"; + return array('img_key' => 'name_board_seen','img_name' => $this->photo_names['approach_to_pd_location'][0],'img_url' => $value['doc_url'],'fk_form_id' => $this->photo_names['approach_to_pd_location'][1],'is_multiple' => 0); + // unset($this->photo_names['selfie_with_person_met']); + // return $arr; + } else if(strpos($current_img_key, $value['pd_document_title']) !== false) {