Pdf Merger Same issues : ps

This commit is contained in:
VE10-Sanjeev 2023-02-16 18:16:29 +05:30
parent e179c98d21
commit 5894dca19e
2 changed files with 36 additions and 20 deletions

View File

@ -22,7 +22,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', 0, 0), 'person_met_id' => array('Person met ID Proof', '18', 0, 0), 'address_proof_visited' => array('Address Proof', '5', 0, 0), 'name_board_seen' => array('Name Board Seen', '13', 0, 0), 'machinery_image' => array('Machinery Image', '22', 0, 0), 'gst_Regn_cert_pic' => array('GST Regn Cert', '13', 0, 0), 'pf_regn_pic' => array('PF Regn', '13', 0, 0), 'esic_regn_pic' => array('ESIC Regn', '13', 0, 0), 'export_import_cert_pic' => array('Export Import Cert', '13', 0, 0), 'factory_cert_pic' => array('Factory Cert', '13', 0, 0), 'shop_eat_act_cert_pic' => array('Shop Est Act Cert', '13', 0, 0), 'eb_bill_pic' => array('EB Bill', '13', 0, 0), 'practice_cert_pic' => array('Cert of Practice', '13', 0, 0), 'fire_noc_pic' => array('Fire NOC', '13', 0, 0), 'stock_image' => array('Stock image', '11', 1, 1), 'client_image' => array('Client Bills', '2', 1, 1), 'supplier_image' => array('Supplier Bills', '1', 1, 1), 'office_setup' => array('Office/Business Setup', '13', 1, 1), 'additional_photos' => array('Additional Photographs', '13', 1, 1),'Video' => array('Video', null, 1, 1));
private $photo_names = array('selfie_with_person_met' => array('Person met', '18', 0, 0), 'person_met_id' => array('Person met ID Proof', '18', 0, 0), 'address_proof_visited' => array('Address Proof', '5', 0, 0), 'name_board_seen' => array('Name Board Seen', '13', 0, 0), 'machinery_image' => array('Machinery Image', '22', 0, 0), 'gst_Regn_cert_pic' => array('GST Regn Cert', '13', 0, 0), 'pf_regn_pic' => array('PF Regn', '13', 0, 0), 'esic_regn_pic' => array('ESIC Regn', '13', 0, 0), 'export_import_cert_pic' => array('Export Import Cert', '13', 0, 0), 'factory_cert_pic' => array('Factory Cert', '13', 0, 0), 'shop_eat_act_cert_pic' => array('Shop Est Act Cert', '13', 0, 0), 'eb_bill_pic' => array('EB Bill', '13', 0, 0), 'practice_cert_pic' => array('Cert of Practice', '13', 0, 0), 'fire_noc_pic' => array('Fire NOC', '13', 0, 0), 'stock_image' => array('Stock image', '11', 1, 1), 'client_image' => array('Client Bills', '2', 1, 1), 'supplier_image' => array('Supplier Bills', '1', 1, 1), 'office_setup' => array('Office/Business Setup', '13', 1, 1), 'additional_photos' => array('Additional Photographs', '13', 1, 1),'Video' => array('Video', null, 1, 1),'PDF' => array('PDF', null, 1, 1));
private $existing_imges = array();
function __construct()
@ -8684,7 +8684,7 @@ class PD_Controller extends REST_Controller
$pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id);
if ($pd_master_details[0]['customer_segment_abbr'] == 'SAL') {
$this->photo_names['attendance_seen_pic'] = array('Attendance Img', '13');
$this->photo_names['attendance_seen_pic'] = array('Attendance Img', '13',null,null);
}
// print_r($this->existing_imges);die();
@ -8721,7 +8721,7 @@ class PD_Controller extends REST_Controller
// }
$final_data[] = $temp;
} else {
$temp_array = array('img_key' => $key, 'img_name' => $value[0], 'fk_form_id' => $value[1],"is_multiple" => $value[2], 'pd_image_alias_name' => "", 'is_name_editable' => $value[3],'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : "1"));
$temp_array = array('img_key' => $key, 'img_name' => $value[0], 'fk_form_id' => $value[1],"is_multiple" => $value[2], 'pd_image_alias_name' => "", 'is_name_editable' => $value[3],'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : ((strtoupper($key) =='PDF') ? "3" : "1")));
$temp_array[($value[2] ? 'img_data' : 'img_url')] = ($value[2] ? array() : '' );
$final_data[] = $temp_array;
}
@ -8734,7 +8734,7 @@ class PD_Controller extends REST_Controller
// echo "I have CT \n".$value['content_type'];
if (!$value['fk_form_id'] && ($value['pd_document_title'] != 'satellite')) {
// echo "I have CT if cond \n".$value['content_type'];
$final_data[] = array('img_key' => 'common_image', 'img_name' => $value['pd_document_title'], 'img_url' => $value['doc_url'], 'fk_form_id' => null, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable'],'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : "1"));
$final_data[] = array('img_key' => 'common_image', 'img_name' => $value['pd_document_title'], 'img_url' => $value['doc_url'], 'fk_form_id' => null, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable'],'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : ((strtoupper($key) =='PDF') ? "3" : "1")));
unset($this->existing_imges[$key]);
} elseif ($value['pd_document_title'] != 'satellite' && ($value['fk_form_id'] == 24 || $value['fk_form_id'] == 34)) {
// echo "I have CT ifelse cond \n".$value['content_type'];
@ -8753,7 +8753,7 @@ class PD_Controller extends REST_Controller
}
if ($is_listed) {
$final_data[] = array('img_key' => 'docs_to_be_collected', 'img_name' => $value['pd_document_title'], 'img_url' => $value['doc_url'], 'fk_form_id' => 24, 'is_multiple' => 0, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable'],'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : "1"));
$final_data[] = array('img_key' => 'docs_to_be_collected', 'img_name' => $value['pd_document_title'], 'img_url' => $value['doc_url'], 'fk_form_id' => 24, 'is_multiple' => 0, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable'],'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : ((strtoupper($key) =='PDF') ? "3" : "1")));
//break;
}
@ -8768,15 +8768,15 @@ class PD_Controller extends REST_Controller
if (is_array($docs_to_be_collected) && count($docs_to_be_collected)) {
$j = 0;
foreach ($docs_to_be_collected as $key => $value) {
$final_data[] = array('img_key' => 'docs_to_be_collected', 'img_name' => $value['doc_name'], 'fk_form_id' => "24", 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable'],'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : "1"));
$final_data[$j][($value[2] ? 'img_data' : 'img_url')] = ($value[2] ? array() : '' );
$final_data[] = array('img_key' => 'docs_to_be_collected', 'img_name' => $value['doc_name'], 'fk_form_id' => "24", 'pd_document_id' => isset($value['pd_document_id'])?$value['pd_document_id']:null, 'pd_image_alias_name' => isset($value['pd_image_alias_name'])?$value['pd_image_alias_name']:null, 'is_name_editable' => isset($value['is_name_editable'])?$value['is_name_editable']:null,'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : ((strtoupper($key) =='PDF') ? "3" : "1")));
$final_data[$j]['img_data'] = array();
$j++;
}
}
} else {
$i = 0;
foreach ($this->photo_names as $key => $value) {
$final_data[] = array('img_key' => $key, 'img_name' => $value[0], 'fk_form_id' => $value[1], "is_multiple" => $value[2], 'pd_image_alias_name' => "", 'is_name_editable' => $value[3] ,'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : "1"));
$final_data[] = array('img_key' => $key, 'img_name' => $value[0], 'fk_form_id' => $value[1], "is_multiple" => $value[2], 'pd_image_alias_name' => "", 'is_name_editable' => $value[3] ,'content_type'=>strtoupper($key) =='VIDEO' ? "2" : ((strtoupper($key) =='PDF') ? "3" : "1"));
$final_data[$i][($value[2] ? 'img_data' : 'img_url')] = ($value[2] ? array() : '' );
$i++;
}
@ -8784,7 +8784,7 @@ class PD_Controller extends REST_Controller
if (is_array($docs_to_be_collected) && count($docs_to_be_collected)) {
$k = 0;
foreach ($docs_to_be_collected as $key => $value) {
$final_data[] = array('img_key' => 'docs_to_be_collected', 'img_name' => $value['doc_name'], 'fk_form_id' => "24", "is_multiple" => 0, 'pd_image_alias_name' => "", 'is_name_editable' => 0 ,'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : "1"));
$final_data[] = array('img_key' => 'docs_to_be_collected', 'img_name' => $value['doc_name'], 'fk_form_id' => "24", "is_multiple" => 0, 'pd_image_alias_name' => "", 'is_name_editable' => 0 ,'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : ((strtoupper($key) =='PDF') ? "3" : "1")));
$final_data[$k][($value[2] ? 'img_data' : 'img_url')] = ($value[2] ? array() : '' );
$k++;
}
@ -8807,15 +8807,14 @@ class PD_Controller extends REST_Controller
$multiple_img_data = array();
$current_multiple_img_key = null;
// print_r($this->existing_imges);
foreach ($this->existing_imges as $key => $value) {
if($value['content_type'] == 3){$value['image_key'] == 'PDF';}
//print_r($value);die();
// echo $current_img_key.'***'.$value['pd_document_title'];
// echo '<br>';
// echo '<br>';
// echo "\n".$current_img_key.'***'.$value['pd_document_title'];
// print_r(count($this->existing_imges));
// echo $value['pd_document_title'];
// echo $value['pd_document_title'];die();
if ($current_img_key == 'selfie_with_person_met' && $value['img_type'] == 1) {
// echo "SELFIE";
$arr = array('img_key' => 'selfie_with_person_met', 'img_name' => $this->photo_names['selfie_with_person_met'][0], 'fk_form_id' => $this->photo_names['selfie_with_person_met'][1], 'img_url' => $value['doc_url'], 'is_multiple' => 0, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names['selfie_with_person_met'][3],'content_type'=> $value['content_type']);
unset($this->existing_imges[$key]);
@ -8823,10 +8822,12 @@ class PD_Controller extends REST_Controller
} else if ($current_img_key == 'person_met_id' && $value['img_type'] == 2) {
//echo 'HOLD';
$arr = array('img_key' => 'person_met_id', 'img_name' => $this->photo_names['person_met_id'][0], 'img_url' => $value['doc_url'], 'fk_form_id' => $this->photo_names['person_met_id'][1], 'is_multiple' => 0, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names['person_met_id'][3],'content_type'=> $value['content_type']);
unset($this->existing_imges[$key]);
return $arr;
if($value['content_type'] != 3){
$arr = array('img_key' => 'person_met_id', 'img_name' => $this->photo_names['person_met_id'][0], 'img_url' => $value['doc_url'], 'fk_form_id' => $this->photo_names['person_met_id'][1], 'is_multiple' => 0, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names['person_met_id'][3],'content_type'=> $value['content_type']);
unset($this->existing_imges[$key]);
return $arr;
}
// unset($this->existing_imges[$key]);
// unset($this->photo_names['selfie_with_person_met']);
// return $arr;
} else if ($current_img_key == 'approach_to_pd_location' && strpos($value['pd_document_title'], 'Approach') !== false) {
@ -8847,8 +8848,7 @@ class PD_Controller extends REST_Controller
// return $arr;
} else if (strtoupper($current_img_key) == 'VIDEO' && str_contains(strtoupper($value['pd_document_title']), 'VIDEO')) {
if ($current_img[2]) {
// echo "\n in if".$current_img_key;
// echo '\n before '.$current_multiple_img_key;
$current_multiple_img_key = $current_img_key;
if (!array_key_exists($current_img_key, $multiple_img_data)) {
$multiple_img_data[$current_img_key] = array('img_key' => $value['image_key'], 'img_name' => "Videos", 'img_data' => array(array('img_url' => $value['doc_url'], 'img_name' => $value['pd_document_title'], 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names[$current_img_key][3],'form_id' => $value['fk_form_id'])),'fk_form_id' => $this->photo_names[$current_img_key][1], 'is_multiple' => $current_img[2], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names[$current_img_key][3],'content_type'=> $value['content_type']);
@ -8861,6 +8861,21 @@ class PD_Controller extends REST_Controller
}
unset($this->existing_imges[$key]);
}
else if (strtoupper($current_img_key) == 'PDF' && str_contains(strtoupper($value['pd_document_name']), 'PDF')) {
if ($current_img[2]) {
$current_multiple_img_key = $current_img_key;
if (!array_key_exists($current_img_key, $multiple_img_data)) {
$multiple_img_data[$current_img_key] = array('img_key' => 'PDF', 'img_name' => 'PDF', 'img_data' => array(array('img_url' => $value['doc_url'], 'img_name' => $value['pd_document_title'], 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names[$current_img_key][3],'form_id' => $value['fk_form_id'])),'fk_form_id' => $this->photo_names[$current_img_key][1], 'is_multiple' => $current_img[2], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names[$current_img_key][3],'content_type'=> $value['content_type']);
} else {
$multiple_img_data[$current_img_key]['img_data'][] = array('img_url' => $value['doc_url'], 'img_name' => $value['pd_document_title'], 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names[$current_img_key][3],'form_id' => $value['fk_form_id']);
}
} else {
$arr = array('img_key' => 'PDF', 'img_name' => 'PDF', 'img_url' => $value['doc_url'], 'fk_form_id' => $this->photo_names[$value['pd_document_title']][1], 'is_multiple' => $current_img[2], 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names[$current_img_key][3],'content_type'=> $value['content_type']);
return $arr;
}
unset($this->existing_imges[$key]);
}
else if (strpos($current_img_key, $value['pd_document_title']) !== false) {
//unset($this->existing_imges[$key]);

View File

@ -427,6 +427,7 @@ class PD_Model extends SPARQ_Model {
$time = '+5 day';
$where_condition_array['isactive'] = 1;
}
if($api_client == 'report'){ $where_condition_array['content_type !='] = 3; }
//print_r($where_condition_array);die();
$document_lists = $this->selectRecords(PDDOCUMENTS,$where_condition_array);