WATER MARK PD APP NOTIFICATION INLINE IMAGE TRANSFORM

This commit is contained in:
Velz2020 2019-07-11 21:03:02 +05:30
parent 38ada12735
commit aee1a3af35
6 changed files with 493 additions and 250 deletions

View File

@ -87,13 +87,13 @@ $query_builder = TRUE;
$db['dev'] = array(
'dsn' => '',
'hostname' => 'sine-edge-dev.cya6cheplup2.ap-south-1.rds.amazonaws.com',
'hostname' => 'sineedge-prod.c5vaalihixyr.ap-south-1.rds.amazonaws.com',
//'hostname' => 'localhost',
'username' => 'sparqdev_mas001',
'username' => 'dbadmin',
//'username' => 'root',
'password' => 'sparqvenba',
'password' => 'DBadmin12345',
// 'password' => '',
'database' => 'sine_edge_dev',
'database' => 'sineedgedemo',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
@ -112,13 +112,13 @@ $db['dev'] = array(
$db['test'] = array(
'dsn' => '',
'hostname' => 'sine-edge-dev.cya6cheplup2.ap-south-1.rds.amazonaws.com',
'hostname' => 'sineedge-prod.c5vaalihixyr.ap-south-1.rds.amazonaws.com',
//'hostname' => 'localhost',
'username' => 'sparqdev_mas001',
'username' => 'dbadmin',
//'username' => 'root',
'password' => 'sparqvenba',
'password' => 'DBadmin12345',
// 'password' => '',
'database' => 'sine_edge_test',
'database' => 'sineedgedemo',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,

View File

@ -727,7 +727,7 @@ class PD_Controller extends REST_Controller {
unset($pd_details['mobile_no']);
unset($pd_details['firstName']);
unset($pd_details['officerName']);
$pd_details['initiate_location'] = $pd_details['link'];
$pd_details['initiate_location'] = isset($pd_details['link']) ? $pd_details['link'] : null;;
unset($pd_details['link']);
}
@ -757,7 +757,7 @@ class PD_Controller extends REST_Controller {
if(array_key_exists('link',$pd_details))
{
$pd_details['complete_location'] = $pd_details['link'];
$pd_details['complete_location'] = isset($pd_details['link']) ? $pd_details['link'] : null;;
unset($pd_details['link']);
}
@ -2195,7 +2195,8 @@ class PD_Controller extends REST_Controller {
public function savePDFormDetailsJSON_post()
{
//ini_set('max_execution_time', 60);
$this->load->helper('INLINEPHOTOTRANSFORM');
$records = $this->post('records');
$pdid = $records['pdid'];
$formid = $records['formid'];
@ -2227,6 +2228,9 @@ class PD_Controller extends REST_Controller {
if($formid == 18)
{
$records = $this->saveCoApplicantsFromGeneralInfoForm($records);
$records = INLINEPHOTOTRANSFORM::retransformGeneralFormInlinePhotos($records);
}
if($formid == 10)
@ -2237,7 +2241,8 @@ class PD_Controller extends REST_Controller {
//From Business form save Employee Salary as Business Expenses
if($formid == 13)
{
$this->saveEmpSalaryAsBusinessExpensesFromBusinessForm($records);
$this->saveEmpSalaryAsBusinessExpensesFromBusinessForm($records);
$records = INLINEPHOTOTRANSFORM::retransformBusinessFormInlinePhotos($records);
}
if($formid == 22)
@ -5035,8 +5040,8 @@ class PD_Controller extends REST_Controller {
$records = $this->post('records');
$pdid = $records['pd_id'];
//ini_set('max_execution_time', 300);
PDALERTS::pdnotification(300);die();
// $this->load->helper('push_notification');
// PUSH_NOTIFICATION::notifyMob('fzVpWPyynTI:APA91bH16QpgugWec5VAMRPXu8kDFytkMRxXGRJGm1XJwd5H6oWmp8OCTfx7F8qj97zC0i7oyg73uRFkZS6rOxeJbkTk6KJN5mYZT5gRJIDJ_CQ6n6nuQZ5LwFs9_x9cr5sraA5ADyMu','EST','test mesg from server',1);die();
$is_regenerate = 0;
if(isset($records['regenerate']))
{
@ -6140,6 +6145,31 @@ class PD_Controller extends REST_Controller {
$temp_data = explode( ',', $temp_base64_string );
fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) );
fclose( $ifp );
// ################### start img water marking with text
$imagetobewatermark=imagecreatefrompng($output_file);
$location_watermarktext="Location: ".$doc['link'];
$font=APPPATH."docs/robold.ttf"; //metion font and it's location
$fontsize="7";
$water_mark_text_color = imagecolorallocate($imagetobewatermark, 55, 55, 55);
imagettftext($imagetobewatermark, $fontsize, 0, 5, 10, $water_mark_text_color, $font, $location_watermarktext);
imagettftext($imagetobewatermark, $fontsize, 0, 5, 20, $water_mark_text_color, $font, 'Date: '.date('Y-m-d h:i:s a'));
imagepng($imagetobewatermark,$output_file);//save as png file in ouputfile location
//################# end img water marking with text
//###########image water marking with logo
$pd_logo = imagecreatefrompng(APPPATH.'docs/icon.png');
$curret_file = imagecreatefrompng($output_file);
$sx = imagesx($curret_file);
$sy = imagesy($curret_file);
// imagecopyresized ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) : bool
imagecopyresized ( $curret_file , $pd_logo , ($sx - 50) , ($sy - 54) , 0 , 0 , 50 , 50 , 50 , 54 );
imagepng($curret_file,$output_file);// save png image in specified location
//###########end of image water marking with logo
$tempdoc = $output_file;
$tempdocname = $temp_file_name;
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details[0]['fk_lender_id'];
@ -6421,126 +6451,151 @@ class PD_Controller extends REST_Controller {
#####supplier Form Questions########
$supplier_form = isset($form_data[1][0]['processed_json'])?(json_decode($form_data[1][0]['processed_json'],true)):array();
//print_r($supplier_form);die();
if(!((count($business_form['select_business_activity_type']) == 1) && ($business_form['select_business_activity_type'][0]['type_of_activity_id'] == 5)))
{
if(count($supplier_form))
{
$supplier_count = 0;
if(array_key_exists('manufacturing_details',$supplier_form))
if(count($supplier_form))
{
if(isset($supplier_form['manufacturing_details'][0]['main_raw_materials']))
{
foreach ($supplier_form['manufacturing_details'][0]['main_raw_materials'] as $manu_key => $manu_value)
if($supplier_form['supplier_info_available'] == 1)
{
if(array_key_exists('manufacturing_details',$supplier_form))
{
if($manu_value['manufacturing_raw_material_name'] != "" && $manu_value['manufacturing_supplier_name'] != "" && $manu_value['manufacturing_contact_person_name'] != "" && ($manu_value['manufacturing_contact_person_mobile_number'] != "" || $manu_value['person_landline'] != ""))
if(isset($supplier_form['manufacturing_details'][0]['main_raw_materials']))
{
$supplier_count ++;
foreach ($supplier_form['manufacturing_details'][0]['main_raw_materials'] as $manu_key => $manu_value)
{
if($manu_value['manufacturing_raw_material_name'] != "" && $manu_value['manufacturing_supplier_name'] != "" && $manu_value['manufacturing_contact_person_name'] != "" && ($manu_value['manufacturing_contact_person_mobile_number'] != "" || $manu_value['person_landline'] != ""))
{
$supplier_count ++;
}
}
}
}
}
//echo 'IN manu-'.$supplier_count;
}
if(array_key_exists('trade_details',$supplier_form))
{
if(isset($supplier_form['trade_details'][0]['trading_products']))
{
foreach ($supplier_form['trade_details'][0]['trading_products'] as $trading_key => $trading_value)
if(array_key_exists('trade_details',$supplier_form))
{
if($trading_value['trade_product_name'] != "" && $trading_value['trade_supplier_name'] != "" && $trading_value['trade_product_contact_person_name'] != "" && ($trading_value['trade_product_contact_person_mobile_number'] != "" || $trading_value['person_landline'] != ""))
if(isset($supplier_form['trade_details'][0]['trading_products']))
{
$supplier_count ++;
foreach ($supplier_form['trade_details'][0]['trading_products'] as $trading_key => $trading_value)
{
if($trading_value['trade_product_name'] != "" && $trading_value['trade_supplier_name'] != "" && $trading_value['trade_product_contact_person_name'] != "" && ($trading_value['trade_product_contact_person_mobile_number'] != "" || $trading_value['person_landline'] != ""))
{
$supplier_count ++;
}
}
}
}
if(array_key_exists('servicing_details',$supplier_form))
{
if(isset($supplier_form['servicing_details'][0]['service_providers']))
{
foreach ($supplier_form['servicing_details'][0]['service_providers'] as $serivce_key => $service_value)
{
if($service_value['service_provider_name'] != "" && $service_value['service_provider_supplier_name'] != "" && $service_value['service_provider_contact_person_name'] != "" && ($service_value['service_provider_contact_person_mobile_number'] != "" || $service_value['person_landline'] != ""))
{
$supplier_count ++;
}
}
}
}
$score_questions['business']['minimum_supplier_info'] = $supplier_count ? 'Provided':'Not Provided';
}
//echo 'IN trade-'.$supplier_count;
else
{
$score_questions['business']['minimum_supplier_info'] = 'Not Applicable';
}
}else
{
$score_questions['business']['minimum_supplier_info'] = 'Not Applicable';
}
//echo $supplier_count;
// 16 - QNO(2.7) - atleast one supplier
$score_questions['business']['minimum_supplier_info'] = $supplier_count ? 'Provided':'Not Provided';
}
else
{
$score_questions['business']['minimum_supplier_info'] = 'Not Applicable';
}
}else { $score_questions['business']['minimum_supplier_info'] = 'Not Applicable'; }
//echo $score_questions['business']['minimum_supplier_info'];die();
#####End of supplier Form Questions########
#####client Form Questions########
$client_form = isset($form_data[2][0]['processed_json'])?(json_decode($form_data[2][0]['processed_json'],true)):array();
//print_r($client_form);die();
if(count($client_form))
{
$client_form = isset($form_data[2][0]['processed_json'])?(json_decode($form_data[2][0]['processed_json'],true)):array();
$client_count = 0;
if(array_key_exists('manufacturing_details',$client_form))
if(count($client_form))
{
if(isset($client_form['manufacturing_details'][0]['main_raw_materials']))
{
if($client_form['client_info_available'] == 1)
{
foreach ($client_form['manufacturing_details'][0]['main_raw_materials'] as $key => $value)
if(array_key_exists('manufacturing_details',$client_form))
{
if($value['manufacturing_product_name'] != "" && $value['manufacturing_client_name'] != "" && $value['manufacturing_contact_person_name'] != "" && ($value['manufacturing_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
if(isset($client_form['manufacturing_details'][0]['main_raw_materials']))
{
$client_count++;
foreach ($client_form['manufacturing_details'][0]['main_raw_materials'] as $key => $value)
{
if($value['manufacturing_product_name'] != "" && $value['manufacturing_client_name'] != "" && $value['manufacturing_contact_person_name'] != "" && ($value['manufacturing_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
{ $client_count++; }
}
}
}
if(array_key_exists('trade_details',$client_form))
{
if(isset($client_form['trade_details'][0]['trading_products']))
{
foreach ($client_form['trade_details'][0]['trading_products'] as $key => $value)
{
//print_r($value);die();
if($value['trade_product_name'] != "" && (isset($value['trade_client_name'])) && $value['trade_client_name'] != "" && $value['trade_product_contact_person_name'] != "" && ($value['trade_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
{
$client_count++;
}
}
}
}
if(array_key_exists('service_provider_details',$client_form))
{
if(isset($client_form['service_provider_details'][0]['service_products']))
{
foreach ($client_form['service_provider_details'][0]['service_products'] as $key => $value)
{
if($value['service_provider_product_name'] != "" && $value['service_provider_client_name'] != "" && $value['service_provider_product_contact_person_name'] != "" && ($value['service_provider_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
{ $client_count++; }
}
}
}
$score_questions['business']['minimum_client_info'] = $client_count ? 'Provided':'Not Provided';
}
else
{
$score_questions['business']['minimum_client_info'] = 'Not Provided';
}
}
else
{
$score_questions['business']['minimum_client_info'] = 'Not Applicable';
}
if(array_key_exists('trade_details',$client_form))
{
if(isset($client_form['trade_details'][0]['trading_products']))
{
foreach ($client_form['trade_details'][0]['trading_products'] as $key => $value)
{
if($value['trade_product_name'] != "" && $value['trade_client_name'] != "" && $value['trade_product_contact_person_name'] != "" && ($value['trade_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
{
$client_count++;
}
}
}
}
if(array_key_exists('service_provider_details',$client_form))
{
if(isset($client_form['service_provider_details'][0]['service_products']))
{
foreach ($client_form['service_provider_details'][0]['service_products'] as $key => $value)
{
if($value['service_provider_product_name'] != "" && $value['service_provider_client_name'] != "" && $value['service_provider_product_contact_person_name'] != "" && ($value['service_provider_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
{
$client_count++;
}
}
}
}
//echo $client_count;
// 17 - QNO(2.8) - atleast one client
$score_questions['business']['minimum_client_info'] = $client_count ? 'Provided':'Not Provided';
}
else
{
$score_questions['business']['minimum_client_info'] = 'Not Applicable';
}
#####End of client Form Questions########
#####Stock Form Questions########
@ -6928,7 +6983,7 @@ class PD_Controller extends REST_Controller {
}
if( $client != 'WEB')// if API came from web then ignore this check
if($client != 'WEB')// if API came from web then ignore this check
{
$certificate_count = 0;
$name_board_image_count = 0;
@ -7034,7 +7089,7 @@ class PD_Controller extends REST_Controller {
$finance_form_photo_count = isset($pd_images[14]) ? count($pd_images[14]) : 0;
//print_r($finance_form);die();
//print_r($pd_images[14]);die();
if(!strcasecmp($finance_form['is_financial_statements'],'yes') && !($finance_form_photo_count) )
if(! (isset($finance_form['is_financial_statements']) && strcasecmp($finance_form['is_financial_statements'],'yes') && !($finance_form_photo_count)) )
{
$incomplete_details[] = 'Financial Section - Financial Images Not captured';
}
@ -7066,18 +7121,20 @@ class PD_Controller extends REST_Controller {
if($client != 'WEB')
{
#####supplier Form Questions########
$supplier_form = isset($form_data[1][0]['processed_json'])?(json_decode($form_data[1][0]['processed_json'],true)):array();
//print_r($supplier_form);die();
$supplier_count = 0;
$insufficient_supplier_info = 0;
$supplier_images = isset($pd_images[1]) ? $pd_images[1] : array();
//print_r($pd_images[1]);die();
if(!((count($business_form['select_business_activity_type']) == 1) && ($business_form['select_business_activity_type'][0]['type_of_activity_id'] == 5)))
{
if(count($supplier_form))
{
if($supplier_form['supplier_info_available'] == 1)
{
if(array_key_exists('manufacturing_details',$supplier_form))
{
if(isset($supplier_form['manufacturing_details'][0]['main_raw_materials']))
@ -7091,33 +7148,37 @@ class PD_Controller extends REST_Controller {
if($manu_value['manufacturing_raw_material_name'] != "" && $manu_value['manufacturing_supplier_name'] != "" && $manu_value['manufacturing_contact_person_name'] != "" && ($manu_value['manufacturing_contact_person_mobile_number'] != "" || $manu_value['person_landline'] != ""))
{
$supplier_count ++;
$cureent_supplier_images_count = 0 ;
//$cureent_supplier_images_count = 0 ;
//Images name check
$supplier_name = $manu_value['manufacturing_supplier_name'].' - Raw Material '.($manu_key+1);
//$supplier_name = $manu_value['manufacturing_supplier_name'].' - Raw Material '.($manu_key+1);
if(count($supplier_images))
{
foreach ($supplier_images as $key => $value)
{
if( !strcasecmp($supplier_name, $value['pd_document_title']))
{
$cureent_supplier_images_count++;
}
// if(count($supplier_images))
// {
// foreach ($supplier_images as $key => $value)
// {
// if( !strcasecmp($supplier_name, $value['pd_document_title']))
// {
// $cureent_supplier_images_count++;
// }
}
if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient.';}
}
else
{
$incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
}
// }
// if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient.';}
// }
// else
// {
// $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
// }
}
else
else if($manu_value['manufacturing_raw_material_name'] == "" && $manu_value['manufacturing_supplier_name'] == "" && $manu_value['manufacturing_contact_person_name'] != "" && ($manu_value['manufacturing_contact_person_mobile_number'] == "" || $manu_value['person_landline'] == ""))
{
$incomplete_details[] = 'Supplier Section - Supplier (Raw Material '.($key+1).') Details not sufficient';
$insufficient_supplier_info++;
}
// else
// {
// $incomplete_details[] = 'Supplier Section - Supplier (Raw Material '.($key+1).') Details not sufficient';
// }
}
@ -7140,34 +7201,83 @@ class PD_Controller extends REST_Controller {
{
$supplier_count ++;
$cureent_supplier_images_count = 0 ;
// $cureent_supplier_images_count = 0 ;
//Images name check
$supplier_name = $trading_value['trade_supplier_name'].' - Trading Product '.($trading_key+1);
if(count($supplier_images))
{
foreach ($supplier_images as $key => $value)
{
if( !strcasecmp($supplier_name, $value['pd_document_title']))
{
$cureent_supplier_images_count++;
}
}
if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient';}
// //Images name check
// $supplier_name = $trading_value['trade_supplier_name'].' - Trading Product '.($trading_key+1);
// if(count($supplier_images))
// {
// foreach ($supplier_images as $key => $value)
// {
// if( !strcasecmp($supplier_name, $value['pd_document_title']))
// {
// $cureent_supplier_images_count++;
// }
// }
// if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient';}
}
else
{
$incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
}
}
// else
// {
// $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
// }
else if($trading_value['trade_product_name'] == "" && $trading_value['trade_supplier_name'] == "" && $trading_value['trade_product_contact_person_name'] != "" && ($trading_value['trade_product_contact_person_mobile_number'] == "" || $trading_value['person_landline'] == ""))
{
$insufficient_supplier_info++;
}
// else
// {
// $incomplete_details[] = 'Supplier Section - Supplier (Trading Product '.($key+1).') Details not sufficient';
// }
}
}
//echo 'IN trade-'.$supplier_count;
}
}
else
if(array_key_exists('servicing_details',$supplier_form))
{
if(isset($supplier_form['servicing_details'][0]['service_providers']))
{
foreach ($supplier_form['servicing_details'][0]['service_providers'] as $serivce_key => $service_value)
{
if($service_value['service_provider_name'] != "" && $service_value['service_provider_supplier_name'] != "" && $service_value['service_provider_contact_person_name'] != "" && ($service_value['service_provider_contact_person_mobile_number'] != "" || $service_value['person_landline'] != ""))
{
$incomplete_details[] = 'Supplier Section - Supplier (Trading Product '.($key+1).') Details not sufficient';
$supplier_count ++;
// $cureent_supplier_images_count = 0 ;
// //Images name check
// $supplier_name = $trading_value['trade_supplier_name'].' - Trading Product '.($trading_key+1);
// if(count($supplier_images))
// {
// foreach ($supplier_images as $key => $value)
// {
// if( !strcasecmp($supplier_name, $value['pd_document_title']))
// {
// $cureent_supplier_images_count++;
// }
// }
// if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient';}
}
// else
// {
// $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
// }
else if($service_value['service_provider_name'] == "" && $service_value['service_provider_supplier_name'] == "" && $service_value['service_provider_contact_person_name'] == "" && ($service_value['service_provider_contact_person_mobile_number'] == "" || $service_value['person_landline'] == ""))
{
$insufficient_supplier_info++;
}
// else
// {
// $incomplete_details[] = 'Supplier Section - Supplier (Trading Product '.($key+1).') Details not sufficient';
// }
}
@ -7179,9 +7289,15 @@ class PD_Controller extends REST_Controller {
}
}
if($supplier_count && (count($supplier_images) != 3) ){ $incomplete_details[] = 'Supplier Section - Images Not sufficient'; }
if($insufficient_supplier_info){ $incomplete_details[] = 'Supplier Section - Information Not sufficient';
}
if(!$supplier_count){ $incomplete_details[] = 'Supplier Section - supplier informations not Sufficient'; }
}
//echo $score_questions['business']['minimum_supplier_info'];die();
#####End of supplier Form Questions########
@ -7192,9 +7308,11 @@ class PD_Controller extends REST_Controller {
//print_r($client_form);die();
$client_images = isset($pd_images[2]) ? $pd_images[2] : array();
$client_count = 0;
$insufficient_client_info = 0;
if(count($client_form))
{
if($client_form['client_info_available'] == 1)
{
if(array_key_exists('manufacturing_details',$client_form))
{
@ -7206,36 +7324,36 @@ class PD_Controller extends REST_Controller {
if($value['manufacturing_product_name'] != "" && $value['manufacturing_client_name'] != "" && $value['manufacturing_contact_person_name'] != "" && ($value['manufacturing_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
{
$client_count++;
$current_client_images_count = 0 ;
// $current_client_images_count = 0 ;
//Images name check
$client_name = $value['manufacturing_client_name'].' - Manufacturing Product '.($key+1);
// //Images name check
// $client_name = $value['manufacturing_client_name'].' - Manufacturing Product '.($key+1);
if(count($client_images))
{
foreach ($client_images as $key => $value)
{
if( !strcasecmp($client_name, $value['pd_document_title']))
{
$current_client_images_count++;
}
}
if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
}
else
{
$incomplete_details[] = 'Client Section - '.$client_name .'- Images Not Found';
}
// if(count($client_images))
// {
// foreach ($client_images as $key => $value)
// {
// if( !strcasecmp($client_name, $value['pd_document_title']))
// {
// $current_client_images_count++;
// }
// }
// if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
// }
// else
// {
// $incomplete_details[] = 'Client Section - '.$client_name .'- Images Not Found';
// }
}
else if($value['manufacturing_product_name'] == "" && $value['manufacturing_client_name'] == "" && $value['manufacturing_contact_person_name'] == "" && ($value['manufacturing_contact_person_mobile_number'] == "" || $value['person_landline'] == ""))
{
$insufficient_client_info++;
}
else
{
$incomplete_details[] = 'Client Section - Client (Manufacturing Product '.($key+1).') Details not sufficient';
}
// else
// {
// $incomplete_details[] = 'Client Section - Client (Manufacturing Product '.($key+1).') Details not sufficient';
// }
}
}
}
@ -7252,35 +7370,35 @@ class PD_Controller extends REST_Controller {
if($value['trade_product_name'] != "" && (isset($value['trade_client_name'])) && $value['trade_client_name'] != "" && $value['trade_product_contact_person_name'] != "" && ($value['trade_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
{
$client_count++;
$current_client_images_count = 0 ;
// $current_client_images_count = 0 ;
//Images name check
$client_name = $value['trade_client_name'].' - Trading Product '.($key+1);
// //Images name check
// $client_name = $value['trade_client_name'].' - Trading Product '.($key+1);
if(count($client_images))
{
foreach ($client_images as $key => $value)
{
if( !strcasecmp($client_name, $value['pd_document_title']))
{
$current_client_images_count++;
}
}
if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
}
else
{
$incomplete_details[] = 'Client Section - '.$client_name .'- Images Not Found';
}
// if(count($client_images))
// {
// foreach ($client_images as $key => $value)
// {
// if( !strcasecmp($client_name, $value['pd_document_title']))
// {
// $current_client_images_count++;
// }
// }
// if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
// }
// else
// {
// $incomplete_details[] = 'Client Section - '.$client_name .'- Images Not Found';
// }
}
else if($value['trade_product_name'] == "" && (isset($value['trade_client_name'])) && $value['trade_client_name'] == "" && $value['trade_product_contact_person_name'] == "" && ($value['trade_product_contact_person_mobile_number'] == "" || $value['person_landline'] == ""))
{
}
else
{
$incomplete_details[] = 'Client Section - Client (Trading Product '.($key+1).') Details not sufficient';
$insufficient_client_info++;
}
// else
// {
// $incomplete_details[] = 'Client Section - Client (Trading Product '.($key+1).') Details not sufficient';
// }
}
}
@ -7296,40 +7414,44 @@ class PD_Controller extends REST_Controller {
if($value['service_provider_product_name'] != "" && $value['service_provider_client_name'] != "" && $value['service_provider_product_contact_person_name'] != "" && ($value['service_provider_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
{
$client_count++;
$current_client_images_count = 0 ;
// $current_client_images_count = 0 ;
//Images name check
$client_name = $value['service_provider_client_name'].' - Service Provider '.($key+1);
// //Images name check
// $client_name = $value['service_provider_client_name'].' - Service Provider '.($key+1);
if(count($client_images))
{
foreach ($client_images as $key => $value)
{
if( !strcasecmp($client_name, $value['pd_document_title']))
{
$current_client_images_count++;
}
}
if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
}
else
{
$incomplete_details[] ='Client Section - ' .$client_name .'- Images Not Found';
}
// if(count($client_images))
// {
// foreach ($client_images as $key => $value)
// {
// if( !strcasecmp($client_name, $value['pd_document_title']))
// {
// $current_client_images_count++;
// }
// }
// if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
// }
// else
// {
// $incomplete_details[] ='Client Section - ' .$client_name .'- Images Not Found';
// }
}
else if($value['service_provider_product_name'] == "" && $value['service_provider_client_name'] == "" && $value['service_provider_product_contact_person_name'] == "" && ($value['service_provider_product_contact_person_mobile_number'] == "" || $value['person_landline'] == ""))
{
}
else
{
$incomplete_details[] = 'Client Section - Client (Service Provider '.($key+1).') Details not sufficient';
$insufficient_client_info++;
}
// else
// {
// $incomplete_details[] = 'Client Section - Client (Service Provider '.($key+1).') Details not sufficient';
// }
}
}
}
//echo $client_count;die();
if($client_count && (count($client_images) != 3) ){ $incomplete_details[] = 'Client Section - Images not sufficient';}
if($insufficient_client_info){ $incomplete_details[] = 'Client Section - Information Insufficient';}
}
}
@ -7338,7 +7460,7 @@ class PD_Controller extends REST_Controller {
#####Stock Form Questions########
$stock_form = isset($form_data[11][0]['processed_json'])?(json_decode($form_data[11][0]['processed_json'],true)):array();
//print_r($stock_form);
//print_r($stock_form);die();
if(count($stock_form))
{
//print_r($stock_form);die();
@ -7398,9 +7520,9 @@ class PD_Controller extends REST_Controller {
}
}
if( $total_stock_observed != 0 && !(count($pd_images[11])))//&& !count($pd_images[11][0])) )
if( $total_stock_observed != 0 && !(count($pd_images[11])) != 3)//&& !count($pd_images[11][0])) )
{
$incomplete_details[] = 'Stock Section - Images not sufficient. Available Images - '.(count($pd_images[11]) ? count($pd_images[11]) : 0);
$incomplete_details[] = 'Stock Section - Images not sufficient. Available Images';// - '.(count($pd_images[11]) ? count($pd_images[11]) : 0);
}
//}
}
@ -7411,7 +7533,7 @@ class PD_Controller extends REST_Controller {
{
//have to check salary information form
}
else if(($pd_master_details[0]['customer_segment_abbr'] == 'SE-RI')
else if(($pd_master_details[0]['customer_segment_abbr'] == 'SE-RI'))
{
//have to check rental information form
}
@ -7517,7 +7639,7 @@ class PD_Controller extends REST_Controller {
$fk_user_id = $records['fk_user_id'];
$select_data = array('notification_token_id');
$where_condition_array = array('fk_user_id' =>$fk_user_id );
//$where_condition_array = array('fk_user_id' =>$fk_user_id );
$exist_data = $this->PD_Model->selectCustomRecords($select_data,$where_condition_array,USERNOTIFICATIONTOKENS);
if(!count($exist_data))
@ -7551,7 +7673,7 @@ class PD_Controller extends REST_Controller {
{
$exist_notification_token_id = $exist_data[0]['notification_token_id'];
$where_condition_array = array('notification_token_id' => $exist_notification_token_id);
$update_data = array('notification_token_id' => $exist_notification_token_id);
$update_data = array();
if($records['client'] == 'MOB')
{
$update_data['mob_token'] = $records['token'];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 190 KiB

View File

@ -0,0 +1,117 @@
<?php
class INLINEPHOTOTRANSFORM
{
public static function retransformGeneralFormInlinePhotos($records)
{
if(isset($records['individuals']) && count($records['individuals']))
{
$CI =& get_instance();
$pd_details =$CI->PD_Model->getPDMasterDetails($records['pdid']);
foreach ($records['individuals'] as $key => $value) {
if(isset($value['is_person_met_pic']) && $value['is_person_met_pic'] != "")
{
$base64 = self::addTimestampAndReturnBase64($CI,$value['is_person_met_pic'],$value['applicant_name'],$pd_details,18);
$records['individuals'][$key]['is_person_met_pic'] = $base64;
}
if(isset($value['is_person_met_id_proof']) && $value['is_person_met_id_proof'] != "")
{
$base64 = self::addTimestampAndReturnBase64($CI,$value['is_person_met_id_proof'],($value['applicant_name'].'-id_proof'),$pd_details,18);
$records['individuals'][$key]['is_person_met_id_proof'] = $base64;
}
return $records;
}
}
}
public static function retransformBusinessFormInlinePhotos($records)
{
return $records;
}
public static function addTimestampAndReturnBase64($CI,$base64,$doc_name,$pd_details,$form_id)
{
// ##############################################
$temp_base64_string = $base64;
$title = $doc_name;
$output_file = APPPATH."/docs/temp_base64_image.png";
//Generate Random File Name
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < 5; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
$temp_file_name = $randomString.date('Y-m-d-H:i:s').'.png';
$ifp = fopen( $output_file, 'wb' );
$temp_data = explode( ',', $temp_base64_string );
fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) );
fclose( $ifp );
//echo mime_content_type($output_file);
// ################### start img water marking with text
$imagetobewatermark=imagecreatefromjpeg($output_file);
$location_watermarktext="Location: ".$pd_details[0]['start_location'];
$font=APPPATH."docs/robold.ttf"; //metion font and it's location
$fontsize="7";
$water_mark_text_color = imagecolorallocate($imagetobewatermark, 234, 100, 81);
imagettftext($imagetobewatermark, $fontsize, 0, 5, 10, $water_mark_text_color, $font, $location_watermarktext);
imagettftext($imagetobewatermark, $fontsize, 0, 5, 20, $water_mark_text_color, $font, 'Date: '.date('Y-m-d h:i:s a'));
imagepng($imagetobewatermark,$output_file);//save as png file in ouputfile location
//################# end img water marking with text
//###########image water marking with logo
$pd_logo = imagecreatefrompng(APPPATH.'docs/icon.png');
$curret_file = imagecreatefrompng($output_file);
$sx = imagesx($curret_file);
$sy = imagesy($curret_file);
// imagecopyresized ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) : bool
imagecopyresized ( $curret_file , $pd_logo , ($sx - 50) , ($sy - 54) , 0 , 0 , 50 , 50 , 50 , 54 );
imagepng($curret_file,$output_file);// save png image in specified location
//###########end of image water marking with logo
self::saveImagesInS3($CI,$pd_details,$output_file,$temp_file_name,$form_id,$title);
//convert img to base64
//$path = $output_file;
//$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($output_file);
return 'data:image/png;base64,' . base64_encode($data);
//ENd of convert img to base64
}
public static function saveImagesInS3($CI,$pd_details,$output_file,$temp_file_name,$form_id,$title)
{
$tempdoc = $output_file;
$tempdocname = $temp_file_name;
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details[0]['fk_lender_id'];
$key = 'pd'.$pd_details[0]['pd_id'].'/'.$tempdocname;
$sourcefile = $tempdoc;
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
$s3result= $CI->aws_s3->uploadFileToS3Bucket($bucket_data);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{
$record_data = array('fk_pd_id' => $pd_details[0]['pd_id'],'pd_document_title'=>$title,'pd_document_name'=>$tempdocname,'fk_form_id'=>$form_id);
$id = $CI->PD_Model->saveRecords($record_data,PDDOCUMENTS);
//if($id != null || $id != "") { $count++;}
}
}
}

View File

@ -37,8 +37,8 @@ class PDALERTS
$CI->db->JOIN(USERPROFILE." as EXECUTIVE","PDTRIGGER.executive_id = EXECUTIVE.userid",'LEFT');
$CI->db->JOIN(USERPROFILE." as CENTRALPDOFFICER","PDTRIGGER.central_pd_officer_id = CENTRALPDOFFICER.userid",'LEFT');
$CI->db->JOIN(PDAPPLICANTSDETAILS." as PDAPPLICANTSDETAILS","PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id AND PDAPPLICANTSDETAILS.applicant_type = 1",'LEFT');
$CI->db->JOIN(USERNOTIFICATIONTOKENS." as PDOFFICER","PDTRIGGER.fk_pd_allocated_to = PDOFFICER.fk_userid",'LEFT');
$CI->db->JOIN(USERNOTIFICATIONTOKENS." as PDEXECUTIVE","PDTRIGGER.executive_id = PDEXECUTIVE.fk_userid",'LEFT');
$CI->db->JOIN(USERNOTIFICATIONTOKENS." as PDOFFICER","PDTRIGGER.fk_pd_allocated_to = PDOFFICER.fk_user_id",'LEFT');
$CI->db->JOIN(USERNOTIFICATIONTOKENS." as PDEXECUTIVE","PDTRIGGER.executive_id = PDEXECUTIVE.fk_user_id",'LEFT');
$CI->db->JOIN(USERNOTIFICATIONTOKENS." as CENTRALPDOFFICERTOKEN","PDTRIGGER.central_pd_officer_id = CENTRALPDOFFICERTOKEN.fk_userid",'LEFT');
$CI->db->WHERE("PDTRIGGER.pd_id",$pdid);
$core_details = $CI->db->GET()->result_array();

View File

@ -24,7 +24,23 @@ class PUSH_NOTIFICATION
public static function notifyWeb($web_token,$pd_status,$msg)
{
$app_msg = array
$web_msg = array
(
'title'=> $msg,
'body'=> $msg,
'icon' => 'https://ssa.sineedge.com/logo/sinelogo.png',
'img' => 'https://ssa.sineedge.com/logo/sinelogo.png'
);
self::dispatchNotification(array($web_token),$web_msg,1);
}
public static function notifyMob($mob_token,$pd_status,$msg)
{
$app_msg = array
(
'message'=> $msg,
'title'=> $msg,
@ -32,30 +48,17 @@ class PUSH_NOTIFICATION
'tickerText'=> $msg,
'vibrate'=>1,
'sound'=>1,
'largeIcon'=>'large_icon',
'smallIcon'=>'small_icon'
'largeIcon'=>'https://ssa.sineedge.com/logo/sinelogo.png',
'smallIcon'=>'https://ssa.sineedge.com/logo/sinelogo.png'
);
self::dispatchNotification(array($web_token),$app_msg,1);
}
public static function notifyMob($mob_token,$pd_status,$msg)
{
$web_msg = array
(
'title'=> $msg,
'body'=> $msg,
'icon' => 'https://ssa.sineedge.com/logo/sinelogo.png',
'img' => ''
);
self::dispatchNotification(array($mob_token),$web_msg,2);
self::dispatchNotification(array($mob_token),$app_msg,2);
}
public static function dispatchNotification($token,$msg,$type)
{
$fields = array
('registration_ids'=>$token,
//'data'=>$app_msg,
@ -77,7 +80,8 @@ class PUSH_NOTIFICATION
$result = curl_exec($ch );
curl_close( $ch );
$CI =&get_instance();
MYLOG::logFunction()->info("PUSH NOTIFICATION ",$result);
//print_r($result);
MYLOG::logFunction()->info("PUSH NOTIFICATION ",array($result));
}
}