SALES PD LOGS

This commit is contained in:
Velz2020 2020-02-11 11:55:23 +05:30
parent 5cb09cfe0b
commit 951520230b
3 changed files with 15 additions and 7 deletions

View File

@ -152,6 +152,7 @@ class Sales_PD_Controller extends REST_Controller {
// } // }
function prepareSalesPDReport($sales_pd_id,$api = true) function prepareSalesPDReport($sales_pd_id,$api = true)
{ {
log_message('ERROR','####PREPARE SALESPD REPORT CALLED'.$sales_pd_id);
$columns = array('SALES_PD_DATA.*','ENTITY.short_name','PRODUCT.abbr'); $columns = array('SALES_PD_DATA.*','ENTITY.short_name','PRODUCT.abbr');
$table = SALES_PD_DATA.' as SALES_PD_DATA'; $table = SALES_PD_DATA.' as SALES_PD_DATA';
$joins = array( $joins = array(
@ -214,6 +215,7 @@ class Sales_PD_Controller extends REST_Controller {
// echo $bytes; // echo $bytes;
// die(); // die();
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$this->external_path.'/sales_pd/'.$sales_pd_id.'/temp.pdf'); $bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$this->external_path.'/sales_pd/'.$sales_pd_id.'/temp.pdf');
log_message('ERROR','####SALES PD REPORT UPLOAD TO S3'.$sales_pd_id);
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
@ -481,6 +483,7 @@ class Sales_PD_Controller extends REST_Controller {
$is_entry_done = null; $is_entry_done = null;
$id = null; $id = null;
//print_r($records);die(); //print_r($records);die();
log_message('ERROR','####SALESPD SAVE CALLED');
$section_names = array('1' => 'General Section','2' => 'Fund Requirement','3' => 'stakeholders','4' => 'Brief of business','5' => 'Financial','6' => 'Property Details','7' => 'Officer Details','8' => 'Final Remraks','9' => 'Photography'); $section_names = array('1' => 'General Section','2' => 'Fund Requirement','3' => 'stakeholders','4' => 'Brief of business','5' => 'Financial','6' => 'Property Details','7' => 'Officer Details','8' => 'Final Remraks','9' => 'Photography');
@ -494,7 +497,7 @@ class Sales_PD_Controller extends REST_Controller {
log_message('ERROR','####INSERT NEW SALESPD');
$salepd_serial_no = count($lender_short_name)? $lender_short_name[0]['short_name']:'UNKNOWN'; $salepd_serial_no = count($lender_short_name)? $lender_short_name[0]['short_name']:'UNKNOWN';
$salepd_serial_no .= count($product_short_name)? '-'.$product_short_name[0]['abbr']:'-UNKNOWN'; $salepd_serial_no .= count($product_short_name)? '-'.$product_short_name[0]['abbr']:'-UNKNOWN';
$salepd_serial_no .= '-'.(++$count[0]['count']); $salepd_serial_no .= '-'.(++$count[0]['count']);
@ -507,6 +510,7 @@ class Sales_PD_Controller extends REST_Controller {
//echo $product_short_name[0]['abbr']; //echo $product_short_name[0]['abbr'];
if(isset($records['status']) && $records['status'] == 'COMPLETED') if(isset($records['status']) && $records['status'] == 'COMPLETED')
{ {
log_message('ERROR','####COMPLETE SALESPD'.$records['sales_pd_id']);
$drafted_sections = $this->Sales_PD_Model->selectCustomRecords(array('section_id'),array('status' => 0,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA); $drafted_sections = $this->Sales_PD_Model->selectCustomRecords(array('section_id'),array('status' => 0,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA);
$completed_sections = $this->Sales_PD_Model->selectCustomRecords(array('section_id'),array('status' => 1,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA); $completed_sections = $this->Sales_PD_Model->selectCustomRecords(array('section_id'),array('status' => 1,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA);
@ -587,6 +591,7 @@ class Sales_PD_Controller extends REST_Controller {
$this->prepareSalesPDReport($records['sales_pd_id'],false); $this->prepareSalesPDReport($records['sales_pd_id'],false);
sleep(10); sleep(10);
log_message('ERROR','####SALESPD AFTER 10 PREPARED REPORT'.$sales_pd_id);
//echo 'afetr 10'; //echo 'afetr 10';
//trigger mail function //trigger mail function
PDALERTS::sendSalesPDMail($this,$records['sales_pd_id']); PDALERTS::sendSalesPDMail($this,$records['sales_pd_id']);
@ -595,6 +600,7 @@ class Sales_PD_Controller extends REST_Controller {
} }
else else
{ {
log_message('ERROR','####UPDATE SALESPD'.$records['sales_pd_id']);
$id = $this->Sales_PD_Model->updateRecords($records,SALES_PD_DATA,array('sales_pd_id' => $records['sales_pd_id'])); $id = $this->Sales_PD_Model->updateRecords($records,SALES_PD_DATA,array('sales_pd_id' => $records['sales_pd_id']));
} }

View File

@ -524,7 +524,7 @@ class PDALERTS
public static function sendSalesPDMail($CI,$salespd_id) public static function sendSalesPDMail($CI,$salespd_id)
{ {
log_message('ERROR','####SALESPD MAIL CALLED'.$sales_pd_id);
$mail = $CI->phpmailer_library->load(); $mail = $CI->phpmailer_library->load();
$mail_contents = SELF::salesPDMailContentGrabber($CI,$salespd_id); $mail_contents = SELF::salesPDMailContentGrabber($CI,$salespd_id);
//echo "$msg"; //echo "$msg";
@ -565,13 +565,13 @@ class PDALERTS
if(!$mail->send()) { if(!$mail->send()) {
//$logger->error("Mailer Error:" ,array($mail->ErrorInfo)); //$logger->error("Mailer Error:" ,array($mail->ErrorInfo));
//echo 'not send'; //echo 'not send';
log_message('ERROR','SALESPD MAIL NOT SEND'.$mail_contents[1].'- mail Error - '.$mail->ErrorInfo); log_message('ERROR','###SALESPD MAIL NOT SEND'.$mail_contents[1].'- mail Error - '.$mail->ErrorInfo);
if($try == 4) if($try == 4)
{ {
goto stopSendAttempt; goto stopSendAttempt;
} }
$try++; $try++;
log_message('ERROR','SALESPD MAIL attempt'.$try.' '.$mail_contents[1].'- mail Error - '.$mail->ErrorInfo); log_message('ERROR','###SALESPD MAIL attempt'.$try.' '.$mail_contents[1].'- mail Error - '.$mail->ErrorInfo);
goto sendMailAgain; goto sendMailAgain;
} else { } else {
@ -579,7 +579,7 @@ class PDALERTS
//echo 'DONE'; //echo 'DONE';
//echo 'send'; //echo 'send';
$mail_send_status = 'Sent'; $mail_send_status = 'Sent';
log_message('ERROR','SALESPD MAIL SEND'.$mail_contents[1]); log_message('ERROR','####SALESPD MAIL SEND'.$mail_contents[1]);
} }
stopSendAttempt: stopSendAttempt:
@ -591,6 +591,7 @@ class PDALERTS
public static function salesPDMailContentGrabber($CI,$sales_pd_id) public static function salesPDMailContentGrabber($CI,$sales_pd_id)
{ {
log_message('ERROR','####SALESPD MAIL CONTENT GRABBER CALLED'.$sales_pd_id);
$columns = array('SALES_PD_DATA.*','ENTITY.short_name','PRODUCT.abbr'); $columns = array('SALES_PD_DATA.*','ENTITY.short_name','PRODUCT.abbr');
$table = SALES_PD_DATA.' as SALES_PD_DATA'; $table = SALES_PD_DATA.' as SALES_PD_DATA';
$joins = array( $joins = array(

View File

@ -79,6 +79,7 @@
else else
{ {
define('ENVIRONMENT','development'); define('ENVIRONMENT','development');
define('XLPATH',$_SERVER['DOCUMENT_ROOT'].'/ssa_external_data/'.ENVIRONMENT);
} }
@ -110,7 +111,7 @@ switch (ENVIRONMENT)
ini_set('display_errors', 1); ini_set('display_errors', 1);
break; break;
case 'production': case 'production':
ini_set('display_errors', 0); ini_set('display_errors', 1);
if (version_compare(PHP_VERSION, '5.3', '>=')) if (version_compare(PHP_VERSION, '5.3', '>='))
{ {
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);