From fdf17ee662092c3d7fb65d81342541307a0427b1 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Sun, 18 Sep 2022 22:53:05 +0530 Subject: [PATCH] Face Compare report Changes 4 : ps --- api/application/controllers/PD_Controller.php | 43 ++++++++++--------- api/application/helpers/faceapi_helper.php | 1 - .../report_templates/JSONTOREPORT_CLIX.php | 8 ++-- .../JSONTOREPORT_CLIX_SMARTPD.php | 7 ++- .../JSONTOREPORT_CLIX_TELE_PD.php | 8 ++-- .../report_templates/JSONTOREPORT_DI_AI.php | 8 ++-- .../JSONTOREPORT_DI_AI_ADDON.php | 8 ++-- .../JSONTOREPORT_DI_AI_SMARTPD.php | 8 ++-- .../JSONTOREPORT_DI_AI_TELE_PD.php | 7 ++- .../report_templates/JSONTOREPORT_RI.php | 8 ++-- .../JSONTOREPORT_RI_SMARTPD.php | 8 ++-- .../JSONTOREPORT_RI_TELE_PD.php | 8 ++-- .../report_templates/JSONTOREPORT_SAL.php | 8 ++-- .../JSONTOREPORT_SAL_SMARTPD.php | 8 ++-- .../JSONTOREPORT_SAL_TELE_PD.php | 8 ++-- 15 files changed, 88 insertions(+), 58 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index fe43775d..db100ab5 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4646,9 +4646,10 @@ class PD_Controller extends REST_Controller $data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid, null, null, 'common', null, 'report'); } $db_result = $this->PD_Model->selectCustomRecords(array('facecrop'), array('fk_pd_id' => $pdid,'isactive'=>1), PDAPPLICANTSDETAILS); - $string = $db_result[0]['facecrop']; - // echo gettype($string); - $my_array = json_decode($string, true); + for ($dinx = 0; $dinx < count($db_result); $dinx++) { + $string = $db_result[$dinx]['facecrop']; + $my_array[$dinx] = json_decode($string, true); + } $data['facecrop'] = $my_array; // echo "i ahve image"; // print_r($data['pd_images']);die(); @@ -5802,9 +5803,11 @@ class PD_Controller extends REST_Controller } $db_result = $this->PD_Model->selectCustomRecords(array('facecrop'), array('fk_pd_id' => $pdid,'isactive'=>1), PDAPPLICANTSDETAILS); - $string = $db_result[0]['facecrop']; - // echo gettype($string); - $my_array = json_decode($string, true); + for ($dinx = 0; $dinx < count($db_result); $dinx++) { + $string = $db_result[$dinx]['facecrop']; + // echo gettype($string); + $my_array[$dinx] = json_decode($string, true); + } $data['facecrop'] = $my_array; // echo gettype($my_array); // print_r($my_array); @@ -10497,11 +10500,11 @@ class PD_Controller extends REST_Controller - // public function toMakeFaceBoundingBox_get(){ - public function toMakeFaceBoundingBox($pdid,$len_id){ - // $pdid = $this->get('pd'); //comment this bcoz test purpose - // $master_details = $this->PD_Model->getPDMasterDetails($pdid); //comment this bcoz test purpose - // $len_id = $master_details[0]['fk_lender_id']; //comment this bcoz test purpose + public function toMakeFaceBoundingBox_get(){ + // public function toMakeFaceBoundingBox($pdid,$len_id){ + $pdid = $this->get('pd'); //comment this bcoz test purpose + $master_details = $this->PD_Model->getPDMasterDetails($pdid); //comment this bcoz test purpose + $len_id = $master_details[0]['fk_lender_id']; //comment this bcoz test purpose log_message('ERROR', "In PD Controller (to Make FaceBoundingBox called ) PDID : " . $pdid); $where = array('isactive' => 1, 'fk_form_id' => 18, 'fk_pd_id' => $pdid); @@ -10557,7 +10560,6 @@ class PD_Controller extends REST_Controller $where_condition_array['image_key in ("selfie_with_person_met","person_met_id")'] = null; $select_col = array('pd_document_id', 'pd_document_name', 'pd_document_title', 'image_key'); $img_result = $this->PD_Model->selectCustomRecords($select_col, $where_condition_array, PDDOCUMENTS); - // print_r($this->db->last_query()); // echo count($img_result); // print_r($img_result); @@ -10582,7 +10584,7 @@ class PD_Controller extends REST_Controller $response = faceapi::toMakeFaceBoundingBox($bounding_box, $destination_path, $file_name, $img_result[$k]['image_key'], $apcntid); array_push($img_response, $response); if (($img_result[$k]['image_key'] == 'selfie_with_person_met')) { - $this->uploadPicInS3($pdid, $destination_path, $bucketname, $applicants_details[$j]['pd_co_applicant_id']); + $this->uploadPicInS3($pdid, $destination_path, $bucketname, $applicants_details[$j]['pd_co_applicant_id'],$extension); } // faceapi::toMakeFaceBoundingBox($bounding_box,$destination_path,$file_name); @@ -10613,9 +10615,9 @@ class PD_Controller extends REST_Controller } } else { log_message('ERROR', "In PD Controller to Make FaceBoundingBox Faceapi Image Already Generated"); - $data['dataStatus'] = false; - $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $data['msg'] = 'Faceapi Image Already Generated 2'; + // $data['dataStatus'] = false; + // $data['status'] = REST_Controller::HTTP_NO_CONTENT; + // $data['msg'] = 'Faceapi Image Already Generated 2'; } } // for @ $applicants_details = j } else { @@ -10629,8 +10631,9 @@ class PD_Controller extends REST_Controller // $this->response($data, REST_Controller::HTTP_OK); } - public function uploadPicInS3($pdid,$destination_path,$bucketname,$apcntid){ - $file = "face_api_image_".$apcntid.".jpeg"; + public function uploadPicInS3($pdid,$destination_path,$bucketname,$apcntid,$extension){ + $file = "face_api_image_".$apcntid.$extension; + $dbfile = "face_api_image_".$apcntid.".jpeg"; $key = 'pd' . $pdid . '/' . $file; $sourcefile = $destination_path.$file; @@ -10642,11 +10645,11 @@ class PD_Controller extends REST_Controller log_message('ERROR', "In PD Controller to Make FaceBoundingBox updating pdtrigger table facemark_image_generated as 1"); // Make inactive old entries with same data $this->db->WHERE('fk_pd_id', $pdid) - ->WHERE('pd_document_title', 'face_api_result_image')->UPDATE(PDDOCUMENTS, array('isactive' => 0)); + ->WHERE('pd_document_title', 'face_api_result_image_'.$apcntid)->UPDATE(PDDOCUMENTS, array('isactive' => 0)); // then update $this->db->WHERE('fk_pd_id', $pdid)->WHERE('pd_co_applicant_id', $apcntid)->UPDATE(PDAPPLICANTSDETAILS, array('facemark_image_generated' => 1)); log_message('ERROR', "In PD Controller to Make FaceBoundingBox save document table face_api_result_image after unlink"); - $record_data = array('fk_pd_id' => $pdid, 'pd_document_title' => 'face_api_result_image', 'pd_document_name' => $file ,'co_applicant_id'=>$apcntid,'image_key'=>'face_mark'); + $record_data = array('fk_pd_id' => $pdid, 'pd_document_title' => 'face_api_result_image_'.$apcntid, 'pd_document_name' => $dbfile ,'co_applicant_id'=>$apcntid,'image_key'=>'face_mark'); $this->PD_Model->saveRecords($record_data, PDDOCUMENTS); unlink($destination_path.$file); } diff --git a/api/application/helpers/faceapi_helper.php b/api/application/helpers/faceapi_helper.php index 59508f16..99bf5959 100644 --- a/api/application/helpers/faceapi_helper.php +++ b/api/application/helpers/faceapi_helper.php @@ -8,7 +8,6 @@ class faceapi log_message('ERROR', "In faceapi helper @ line no : 6 to Make FaceBoundingBox", $path, $file_name); $file_path = $path . $file_name; - // $red = imagecolorallocate($img, 255, 0, 0); // $black = imagecolorallocate($img, 0, 0, 0); // $white = imagecolorallocate($img, 255, 255, 255); diff --git a/api/application/views/report_templates/JSONTOREPORT_CLIX.php b/api/application/views/report_templates/JSONTOREPORT_CLIX.php index dbc651b8..4c80c722 100644 --- a/api/application/views/report_templates/JSONTOREPORT_CLIX.php +++ b/api/application/views/report_templates/JSONTOREPORT_CLIX.php @@ -742,8 +742,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
Face Comparison" ; $notequal_mark ='
'; @@ -771,7 +773,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } // ########################### End of Percentage Bar Section ######################################### - } + }} ?>

Loan Applicants:

diff --git a/api/application/views/report_templates/JSONTOREPORT_CLIX_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_CLIX_SMARTPD.php index e2e02013..50d71762 100644 --- a/api/application/views/report_templates/JSONTOREPORT_CLIX_SMARTPD.php +++ b/api/application/views/report_templates/JSONTOREPORT_CLIX_SMARTPD.php @@ -749,8 +749,10 @@ font-weight: bolder;;
Face Comparison" ; $notequal_mark ='
'; @@ -778,6 +780,7 @@ font-weight: bolder;; } // ########################### End of Percentage Bar Section ######################################### + } } ?> diff --git a/api/application/views/report_templates/JSONTOREPORT_CLIX_TELE_PD.php b/api/application/views/report_templates/JSONTOREPORT_CLIX_TELE_PD.php index 166c564c..a3b46cd5 100644 --- a/api/application/views/report_templates/JSONTOREPORT_CLIX_TELE_PD.php +++ b/api/application/views/report_templates/JSONTOREPORT_CLIX_TELE_PD.php @@ -745,8 +745,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
Face Comparison" ; $notequal_mark ='
'; @@ -774,7 +776,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } // ########################### End of Percentage Bar Section ######################################### - } + }} ?>

Loan Applicants:

diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php index abb045a9..1d700b30 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php @@ -759,8 +759,10 @@ if ( isset($pdf) ) {
Face Comparison" ; $notequal_mark ='
'; @@ -800,7 +802,7 @@ if ( isset($pdf) ) { } // echo '
'; // ########################### End of Percentage Bar Section ######################################### - } + }} ?>

Applicants:

diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php index eec38cbf..01a596f9 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php @@ -719,8 +719,10 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo '
'; if(!empty($facecrop)){ - $ci = !empty($facecrop[0]['compare_image']) ? $facecrop[0]['compare_image'] :array() ; - $si = !empty($facecrop[1]['source_image']) ? $facecrop[1]['source_image'] : array(); + for ($fc = 0; $fc < count($facecrop); $fc++) { + $fc_arr = $facecrop[$fc]; + $ci = !empty($fc_arr[0]['compare_image']) ? $fc_arr[0]['compare_image'] :array() ; + $si = !empty($fc_arr[1]['source_image']) ? $fc_arr[1]['source_image'] : array(); // ########################### Percentage Bar Section ######################################### echo "

Face Comparison

" ; $notequal_mark ='
'; @@ -748,7 +750,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } // ########################### End of Percentage Bar Section ######################################### - } + }} diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php index f2e85953..8d9ea2e5 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php @@ -743,8 +743,10 @@ if ( isset($pdf) ) {
Face Comparison" ; $notequal_mark ='
'; @@ -772,7 +774,7 @@ if ( isset($pdf) ) { } // ########################### End of Percentage Bar Section ######################################### - } + }} ?>

Applicants:

diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php index cac17c7b..263ce64a 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php @@ -741,8 +741,10 @@ if ( isset($pdf) ) {
Face Comparison" ; $notequal_mark ='
'; @@ -770,6 +772,7 @@ if ( isset($pdf) ) { } // ########################### End of Percentage Bar Section ######################################### + } } ?> diff --git a/api/application/views/report_templates/JSONTOREPORT_RI.php b/api/application/views/report_templates/JSONTOREPORT_RI.php index 3cc1e53e..3714d300 100644 --- a/api/application/views/report_templates/JSONTOREPORT_RI.php +++ b/api/application/views/report_templates/JSONTOREPORT_RI.php @@ -709,8 +709,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
Face Comparison" ; $notequal_mark ='
'; @@ -738,7 +740,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } // ########################### End of Percentage Bar Section ######################################### - } + }} ?>

Loan Applicants:

diff --git a/api/application/views/report_templates/JSONTOREPORT_RI_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_RI_SMARTPD.php index b27d2bcf..0ef9e146 100644 --- a/api/application/views/report_templates/JSONTOREPORT_RI_SMARTPD.php +++ b/api/application/views/report_templates/JSONTOREPORT_RI_SMARTPD.php @@ -709,8 +709,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
Face Comparison" ; $notequal_mark ='
'; @@ -738,7 +740,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } // ########################### End of Percentage Bar Section ######################################### - } + }} ?>

Loan Applicants:

diff --git a/api/application/views/report_templates/JSONTOREPORT_RI_TELE_PD.php b/api/application/views/report_templates/JSONTOREPORT_RI_TELE_PD.php index 83fb10a4..f245bd2c 100644 --- a/api/application/views/report_templates/JSONTOREPORT_RI_TELE_PD.php +++ b/api/application/views/report_templates/JSONTOREPORT_RI_TELE_PD.php @@ -710,8 +710,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
Face Comparison" ; $notequal_mark ='
'; @@ -739,7 +741,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } // ########################### End of Percentage Bar Section ######################################### - } + }} ?>

Loan Applicants:

diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL.php b/api/application/views/report_templates/JSONTOREPORT_SAL.php index 2344fcbe..ae2a7494 100644 --- a/api/application/views/report_templates/JSONTOREPORT_SAL.php +++ b/api/application/views/report_templates/JSONTOREPORT_SAL.php @@ -709,8 +709,10 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ?> Face Comparison" ; $notequal_mark ='
'; @@ -738,7 +740,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } // ########################### End of Percentage Bar Section ######################################### - } + }} ?> diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php index 8f551c8c..cf57c14f 100644 --- a/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php +++ b/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php @@ -717,8 +717,10 @@ font-weight: bolder;; ?> Face Comparison" ; $notequal_mark ='
'; @@ -746,7 +748,7 @@ font-weight: bolder;; } // ########################### End of Percentage Bar Section ######################################### - } + }} ?> diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL_TELE_PD.php b/api/application/views/report_templates/JSONTOREPORT_SAL_TELE_PD.php index 9115d1bc..10fb9bae 100644 --- a/api/application/views/report_templates/JSONTOREPORT_SAL_TELE_PD.php +++ b/api/application/views/report_templates/JSONTOREPORT_SAL_TELE_PD.php @@ -711,8 +711,10 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ?> Face Comparison" ; $notequal_mark ='
'; @@ -740,7 +742,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } // ########################### End of Percentage Bar Section ######################################### - } + }} ?>