FIX_CDMASTER_DUP_ISSUE
This commit is contained in:
parent
04d6cfe7dc
commit
9db59e70ed
@ -47,7 +47,8 @@ class Autoload extends AutoloadConfig
|
|||||||
public $psr4 = [
|
public $psr4 = [
|
||||||
APP_NAMESPACE => APPPATH, // For custom app namespace
|
APP_NAMESPACE => APPPATH, // For custom app namespace
|
||||||
'Config' => APPPATH . 'Config',
|
'Config' => APPPATH . 'Config',
|
||||||
'Helpers' => APPPATH . 'Helpers'
|
'Helpers' => APPPATH . 'Helpers',
|
||||||
|
'App\\Libraries' => APPPATH . 'Libraries',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -602,3 +602,5 @@ $routes->get('generateAuthToken','ICICILombardController::generateAuthToken');
|
|||||||
$routes->get('createEnrollmentBatch','ICICILombardController::createEnrollmentBatch');
|
$routes->get('createEnrollmentBatch','ICICILombardController::createEnrollmentBatch');
|
||||||
$routes->get('getEnrollmentBatchStatus','ICICILombardController::getEnrollmentBatchStatus');
|
$routes->get('getEnrollmentBatchStatus','ICICILombardController::getEnrollmentBatchStatus');
|
||||||
$routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
|
$routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
|
||||||
|
|
||||||
|
$routes->get('testTracelog','TestBusinessController::a');
|
||||||
@ -10,7 +10,7 @@ class ICICILombardController extends AdminController
|
|||||||
public function generateAuthToken($scope = 'esbhealth')
|
public function generateAuthToken($scope = 'esbhealth')
|
||||||
{
|
{
|
||||||
helper('api');
|
helper('api');
|
||||||
|
// dd($scope);
|
||||||
$url = 'https://ilesbapigee.insurancearticlez.com/generate-jwt-token';
|
$url = 'https://ilesbapigee.insurancearticlez.com/generate-jwt-token';
|
||||||
$method = 'POST';
|
$method = 'POST';
|
||||||
$headers = [
|
$headers = [
|
||||||
@ -24,10 +24,10 @@ class ICICILombardController extends AdminController
|
|||||||
'client_id' => 'Nhanceins',
|
'client_id' => 'Nhanceins',
|
||||||
'client_secret' => 'P4W0G6TAYMa0MV8bbVSx4pTAqbCcUIg48kCWa6PJykAhGWzPmpPr0iLuNWtz5wqN'
|
'client_secret' => 'P4W0G6TAYMa0MV8bbVSx4pTAqbCcUIg48kCWa6PJykAhGWzPmpPr0iLuNWtz5wqN'
|
||||||
];
|
];
|
||||||
|
print_rr(json_encode($body));//die;
|
||||||
$response = call_third_party_api($url, $method, $headers, $body);
|
$response = call_third_party_api($url, $method, $headers, $body);
|
||||||
|
|
||||||
|
print_rr(json_encode($response));//die;
|
||||||
if($response['status'] != true){
|
if($response['status'] != true){
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'status' => false,
|
'status' => false,
|
||||||
@ -44,7 +44,7 @@ class ICICILombardController extends AdminController
|
|||||||
helper('api');
|
helper('api');
|
||||||
|
|
||||||
//fetch token
|
//fetch token
|
||||||
$tokenResponse = $this->generateAuthToken('esbgpabatchcreation');
|
$tokenResponse = $this->generateAuthToken();
|
||||||
if (!$tokenResponse || empty($tokenResponse['data']['access_token'])) {
|
if (!$tokenResponse || empty($tokenResponse['data']['access_token'])) {
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'status' => false,
|
'status' => false,
|
||||||
@ -53,12 +53,13 @@ class ICICILombardController extends AdminController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$token = $tokenResponse['data']['access_token'];
|
$token = $tokenResponse['data']['access_token'];
|
||||||
|
// dd($token);
|
||||||
|
|
||||||
$url = 'https://ilesbapigee.insurancearticlez.com/health/ilservices/health/v1/enrollment/batchcreation';
|
$url = 'https://ilesbapigee.insurancearticlez.com/health/ilservices/health/v1/enrollment/batchcreation';
|
||||||
$headers = [
|
$headers = [
|
||||||
'Authorization: Bearer ' . $token,
|
'Authorization: Bearer ' . $token,
|
||||||
'Content-Type: application/json'
|
'Content-Type: application/json',
|
||||||
|
//'Scope: esbgpabatchcreation'
|
||||||
];
|
];
|
||||||
|
|
||||||
$body = [
|
$body = [
|
||||||
@ -107,9 +108,11 @@ class ICICILombardController extends AdminController
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
// Kint::dump($body);
|
||||||
$response = call_third_party_api($url, 'POST', $headers, json_encode($body), true); // true = raw body mode
|
print_rr(json_encode($body));
|
||||||
|
// dd();
|
||||||
|
$response = call_third_party_api($url, 'POST', $headers, ($body),true); // true = raw body mode
|
||||||
|
print_rr(json_encode($response));die();
|
||||||
return $this->response->setJSON($response);
|
return $this->response->setJSON($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
30
app/Controllers/TestBusinessController.php
Normal file
30
app/Controllers/TestBusinessController.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
// use CodeIgniter\Controller;
|
||||||
|
// use App\Traits\Traceable;
|
||||||
|
use App\Controllers\TraceableController;
|
||||||
|
class TestBusinessController extends AdminController
|
||||||
|
{
|
||||||
|
// use Traceable;
|
||||||
|
|
||||||
|
public function a()
|
||||||
|
{
|
||||||
|
print_rr(debug_backtrace(0));
|
||||||
|
// dd('sdjk');
|
||||||
|
// $r = $this->callWithTrace('b',50,10);
|
||||||
|
$r = $this->b(50,10);
|
||||||
|
|
||||||
|
return json_encode(['a' => $r]);
|
||||||
|
// return view('welcome_message');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function b($x, $y)
|
||||||
|
{
|
||||||
|
// print_rr(debug_backtrace(0));
|
||||||
|
return $x + $y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -152,6 +152,88 @@ class TicketController extends BaseController
|
|||||||
53 => ['cancel_remark'],
|
53 => ['cancel_remark'],
|
||||||
58 => ['cancel_remark'],
|
58 => ['cancel_remark'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$this->extraFieldsDisplayForFrontend = [
|
||||||
|
1 => [ 'non_id_reason' => 'Non ID Reason' ],
|
||||||
|
10 => [ 'pay_initiate_date' => 'Payment Initiated Date' ],
|
||||||
|
3 => [ 'raised_date' => 'Raised Date' ],
|
||||||
|
4 => [ 'raised_date' => 'Raised Date' ],
|
||||||
|
5 => [
|
||||||
|
'claim_number' => 'Claim Number',
|
||||||
|
'registration_date' => 'Registration Date'
|
||||||
|
],
|
||||||
|
7 => [ 'query_received_date' => 'Query Received Date' ],
|
||||||
|
8 => [
|
||||||
|
'denial_reason' => 'Denial Reason',
|
||||||
|
'denial_date' => 'Denial Date'
|
||||||
|
],
|
||||||
|
9 => [
|
||||||
|
'approved_amount' => 'Approved Amount',
|
||||||
|
'approved_date' => 'Approved Date',
|
||||||
|
'approved_letter' => 'Approved Letter',
|
||||||
|
'approved_description' => 'Approved Description'
|
||||||
|
],
|
||||||
|
11 => [
|
||||||
|
'utr_details' => 'UTR Details',
|
||||||
|
'settled_date' => 'Settled Date',
|
||||||
|
'settle_letter' => 'Settle Letter'
|
||||||
|
],
|
||||||
|
40 => [
|
||||||
|
'approved_amount' => 'Approved Amount',
|
||||||
|
'approved_date' => 'Approved Date',
|
||||||
|
'approved_letter' => 'Approved Letter',
|
||||||
|
'approved_description' => 'Approved Description'
|
||||||
|
],
|
||||||
|
44 => [
|
||||||
|
'utr_details' => 'UTR Details',
|
||||||
|
'settled_date' => 'Settled Date',
|
||||||
|
'settle_letter' => 'Settle Letter'
|
||||||
|
],
|
||||||
|
30 => [
|
||||||
|
'approved_amount' => 'Approved Amount',
|
||||||
|
'approved_date' => 'Approved Date',
|
||||||
|
'approved_letter' => 'Approved Letter',
|
||||||
|
'approved_description' => 'Approved Description'
|
||||||
|
],
|
||||||
|
34 => [
|
||||||
|
'utr_details' => 'UTR Details',
|
||||||
|
'settled_date' => 'Settled Date',
|
||||||
|
'settle_letter' => 'Settle Letter'
|
||||||
|
],
|
||||||
|
20 => [
|
||||||
|
'approved_amount' => 'Approved Amount',
|
||||||
|
'approved_date' => 'Approved Date',
|
||||||
|
'approved_letter' => 'Approved Letter',
|
||||||
|
'approved_description' => 'Approved Description'
|
||||||
|
],
|
||||||
|
24 => [
|
||||||
|
'utr_details' => 'UTR Details',
|
||||||
|
'settled_date' => 'Settled Date',
|
||||||
|
'settle_letter' => 'Settle Letter'
|
||||||
|
],
|
||||||
|
14 => [
|
||||||
|
'return_remark' => 'Return Remark',
|
||||||
|
'awb_no_courier_name' => 'AWB No Courier Name'
|
||||||
|
],
|
||||||
|
48 => [
|
||||||
|
'return_remark' => 'Return Remark',
|
||||||
|
'awb_no_courier_name' => 'AWB No Courier Name'
|
||||||
|
],
|
||||||
|
59 => [
|
||||||
|
'return_remark' => 'Return Remark',
|
||||||
|
'awb_no_courier_name' => 'AWB No Courier Name'
|
||||||
|
],
|
||||||
|
54 => [
|
||||||
|
'return_remark' => 'Return Remark',
|
||||||
|
'awb_no_courier_name' => 'AWB No Courier Name'
|
||||||
|
],
|
||||||
|
13 => [ 'cancel_remark' => 'Cancel Remark' ],
|
||||||
|
47 => [ 'cancel_remark' => 'Cancel Remark' ],
|
||||||
|
53 => [ 'cancel_remark' => 'Cancel Remark' ],
|
||||||
|
58 => [ 'cancel_remark' => 'Cancel Remark' ]
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
$this->nonIDReason = [
|
$this->nonIDReason = [
|
||||||
"Newborn Baby" => "Newborn Baby",
|
"Newborn Baby" => "Newborn Baby",
|
||||||
"Newly Wedded Spouse" => "Newly Wedded Spouse",
|
"Newly Wedded Spouse" => "Newly Wedded Spouse",
|
||||||
@ -1863,6 +1945,7 @@ class TicketController extends BaseController
|
|||||||
$this->myLogger->logme("error", "Ticket ID : " . $ticket_id);
|
$this->myLogger->logme("error", "Ticket ID : " . $ticket_id);
|
||||||
|
|
||||||
$fields = $this->extraFields;
|
$fields = $this->extraFields;
|
||||||
|
$displayFields = $this->extraFieldsDisplayForFrontend;
|
||||||
$data_to_send = [];
|
$data_to_send = [];
|
||||||
|
|
||||||
// Get ticket data
|
// Get ticket data
|
||||||
@ -1878,16 +1961,18 @@ class TicketController extends BaseController
|
|||||||
->groupBy("th.old_value, tcs.claim_status")
|
->groupBy("th.old_value, tcs.claim_status")
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
// dd($ticket_previous_status);
|
||||||
// Loop through previous status and gather the required data
|
// Loop through previous status and gather the required data
|
||||||
foreach ($ticket_previous_status as $status) {
|
foreach ($ticket_previous_status as $status) {
|
||||||
$this->myLogger->logme("error", "Status : " . json_encode($status));
|
// $this->myLogger->logme("error", "Status : " . json_encode($status));
|
||||||
|
|
||||||
if (isset($fields[$status['old_value']])) {
|
if (isset($fields[$status['old_value']])) {
|
||||||
$field = $fields[$status['old_value']];
|
$field = $fields[$status['old_value']];
|
||||||
|
// print_r($field);
|
||||||
// Ensure claim_status is a scalar value (string or int)
|
// Ensure claim_status is a scalar value (string or int)
|
||||||
$claim_status = (string)$status['claim_status']; // Cast to string to avoid issues
|
$claim_status = (string)$status['claim_status']; // Cast to string to avoid issues
|
||||||
|
// echo $claim_status;
|
||||||
|
// dd($displayFields[$status['old_value']]);
|
||||||
|
|
||||||
// Initialize claim_status if it doesn't exist in the array
|
// Initialize claim_status if it doesn't exist in the array
|
||||||
if (!isset($data_to_send[$claim_status])) {
|
if (!isset($data_to_send[$claim_status])) {
|
||||||
@ -1897,31 +1982,34 @@ class TicketController extends BaseController
|
|||||||
// Handle case where $field is an array
|
// Handle case where $field is an array
|
||||||
if (is_array($field)) {
|
if (is_array($field)) {
|
||||||
foreach ($field as $f) {
|
foreach ($field as $f) {
|
||||||
|
// dd($displayFields[$status['old_value']]);
|
||||||
// Check if the field exists in the ticket data
|
// Check if the field exists in the ticket data
|
||||||
$data_to_send[$claim_status][$f] = isset($ticket_data[$f]) ? $ticket_data[$f] : null;
|
$data_to_send[$claim_status][$f] = ['display_name' => $displayFields[$status['old_value']][$f] ,'display_value' => isset($ticket_data[$f]) ? $ticket_data[$f] : null];
|
||||||
|
// dd($data_to_send);
|
||||||
// Check if the field contains a date and format it
|
// Check if the field contains a date and format it
|
||||||
if ($this->isDate($data_to_send[$claim_status][$f])) {
|
if ($this->isDate($data_to_send[$claim_status][$f]['display_value'])) {
|
||||||
$data_to_send[$claim_status][$f] = date('d-m-Y', strtotime($data_to_send[$claim_status][$f]));
|
$data_to_send[$claim_status][$f] = ['display_name' => $displayFields[$status['old_value']][$f] ,'display_value' => date('d-m-Y', strtotime($data_to_send[$claim_status][$f]['display_value']))];
|
||||||
|
// $data_to_send[$claim_status][$f] = date('d-m-Y', strtotime($data_to_send[$claim_status][$f]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme("error", "Data for field {$f}: " . json_encode($data_to_send[$claim_status][$f]));
|
// $this->myLogger->logme("error", "Data for field {$f}: " . json_encode($data_to_send[$claim_status][$f]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If field is not an array, handle it as a single field
|
// If field is not an array, handle it as a single field
|
||||||
$data_to_send[$claim_status][$field] = isset($ticket_data[$field]) ? $ticket_data[$field] : null;
|
// Check if the field exists in the ticket data
|
||||||
|
$data_to_send[$claim_status][$f] = ['display_name' => $displayFields[$status['old_value']][$f] ,'display_value' => isset($ticket_data[$f]) ? $ticket_data[$f] : null];
|
||||||
|
|
||||||
// Check if the field contains a date and format it
|
// Check if the field contains a date and format it
|
||||||
if ($this->isDate($data_to_send[$claim_status][$field])) {
|
if ($this->isDate($data_to_send[$claim_status][$field])) {
|
||||||
$data_to_send[$claim_status][$field] = date('d-m-Y', strtotime($data_to_send[$claim_status][$field]));
|
$data_to_send[$claim_status][$f] = ['display_name' => $displayFields[$status['old_value']][$f] ,'display_value' => date('d-m-Y', strtotime($data_to_send[$claim_status][$f]['display_value']))];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme("error", "Data for field {$field}: " . json_encode($data_to_send[$claim_status][$field]));
|
// $this->myLogger->logme("error", "Data for field {$field}: " . json_encode($data_to_send[$claim_status][$field]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error', "Total data: " . json_encode($data_to_send));
|
// $this->myLogger->logme('error', "Total data: " . json_encode($data_to_send));
|
||||||
|
|
||||||
if($requestFrom == 'rest'){
|
if($requestFrom == 'rest'){
|
||||||
return $data_to_send;
|
return $data_to_send;
|
||||||
|
|||||||
127
app/Controllers/TraceableController.php
Normal file
127
app/Controllers/TraceableController.php
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class DeepLogger
|
||||||
|
{
|
||||||
|
private $logFile;
|
||||||
|
private static $currentUuid;
|
||||||
|
private static $callDepth = 0;
|
||||||
|
|
||||||
|
public function __construct($logFile = 'function_calls.log')
|
||||||
|
{
|
||||||
|
$this->logFile = $logFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function wrap($instance)
|
||||||
|
{
|
||||||
|
$handler = $this;
|
||||||
|
$class = new ReflectionClass($instance);
|
||||||
|
|
||||||
|
foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
|
||||||
|
if ($method->isConstructor() || $method->isStatic()) continue;
|
||||||
|
|
||||||
|
$methodName = $method->getName();
|
||||||
|
$instance->$methodName = function(...$args) use ($handler, $instance, $methodName) {
|
||||||
|
return $handler->logCall($instance, $methodName, $args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return $instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logCall($instance, $method, $args)
|
||||||
|
{
|
||||||
|
$isRootCall = (self::$callDepth === 0);
|
||||||
|
if ($isRootCall) {
|
||||||
|
self::$currentUuid = $this->generateUuid();
|
||||||
|
}
|
||||||
|
self::$callDepth++;
|
||||||
|
|
||||||
|
$reflection = new ReflectionMethod($instance, $method);
|
||||||
|
|
||||||
|
// Log IN
|
||||||
|
$this->writeLog([
|
||||||
|
'timestamp' => date('Y-m-d H:i:s'),
|
||||||
|
'uuid' => self::$currentUuid,
|
||||||
|
'direction' => 'IN',
|
||||||
|
'function' => get_class($instance) . '::' . $method,
|
||||||
|
'line' => $reflection->getStartLine(),
|
||||||
|
'params' => $this->getParameterValues($reflection, $args)
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$result = $reflection->invokeArgs($instance, $args);
|
||||||
|
|
||||||
|
// Log OUT
|
||||||
|
$this->writeLog([
|
||||||
|
'timestamp' => date('Y-m-d H:i:s'),
|
||||||
|
'uuid' => self::$currentUuid,
|
||||||
|
'direction' => 'OUT',
|
||||||
|
'function' => get_class($instance) . '::' . $method,
|
||||||
|
'line' => $reflection->getEndLine(),
|
||||||
|
'result' => $result
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
} finally {
|
||||||
|
self::$callDepth--;
|
||||||
|
if ($isRootCall) {
|
||||||
|
self::$currentUuid = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getParameterValues($reflection, $args)
|
||||||
|
{
|
||||||
|
$params = [];
|
||||||
|
foreach ($reflection->getParameters() as $i => $param) {
|
||||||
|
$params[$param->name] = $args[$i] ?? ($param->isDefaultValueAvailable()
|
||||||
|
? $param->getDefaultValue()
|
||||||
|
: null);
|
||||||
|
}
|
||||||
|
return $params;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function writeLog($data)
|
||||||
|
{
|
||||||
|
file_put_contents($this->logFile, json_encode($data) . PHP_EOL, FILE_APPEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function generateUuid()
|
||||||
|
{
|
||||||
|
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||||
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
||||||
|
mt_rand(0, 0xffff),
|
||||||
|
mt_rand(0, 0x0fff) | 0x4000,
|
||||||
|
mt_rand(0, 0x3fff) | 0x8000,
|
||||||
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestBusinessController
|
||||||
|
{
|
||||||
|
public function a($a = 10)
|
||||||
|
{
|
||||||
|
$r = $this->b(50, $a);
|
||||||
|
return json_encode(['a' => $r]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function b($x, $y)
|
||||||
|
{
|
||||||
|
$r = $this->c($x + $y);
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function c($x)
|
||||||
|
{
|
||||||
|
return $x * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usage:
|
||||||
|
$logger = new DeepLogger();
|
||||||
|
$controller = new TestBusinessController();
|
||||||
|
$loggedController = $logger->wrap($controller);
|
||||||
|
|
||||||
|
// This will now log all calls (a, b, and c)
|
||||||
|
echo $loggedController->a(10);
|
||||||
42
app/Libraries/CustomTraceLogger.php
Normal file
42
app/Libraries/CustomTraceLogger.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Libraries;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class CustomTraceLogger
|
||||||
|
{
|
||||||
|
protected $logFile;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$logDir = WRITEPATH . 'trace_logs/';
|
||||||
|
if (!is_dir($logDir)) {
|
||||||
|
mkdir($logDir, 0777, true);
|
||||||
|
}
|
||||||
|
$this->logFile = $logDir . 'trace-' . date('Y-m-d') . '.log';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function log($direction, $functionName, $lineNo, $params = [])
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$uuid = get_session_uuid();
|
||||||
|
|
||||||
|
$logEntry = [
|
||||||
|
'timestamp' => date('c'),
|
||||||
|
'uuid' => $uuid,
|
||||||
|
'direction' => $direction, // IN or OUT
|
||||||
|
'function' => $functionName,
|
||||||
|
'line' => $lineNo,
|
||||||
|
'params' => $params,
|
||||||
|
];
|
||||||
|
|
||||||
|
file_put_contents(
|
||||||
|
$this->logFile,
|
||||||
|
json_encode($logEntry) . PHP_EOL,
|
||||||
|
FILE_APPEND | LOCK_EX
|
||||||
|
);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
// Don’t break anything if logging fails
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
app/Traits/Traceable.php
Normal file
23
app/Traits/Traceable.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Traits;
|
||||||
|
|
||||||
|
use App\Libraries\CustomTraceLogger;
|
||||||
|
|
||||||
|
trait Traceable
|
||||||
|
{
|
||||||
|
public function __call($method, $params)
|
||||||
|
{
|
||||||
|
$logger = new CustomTraceLogger();
|
||||||
|
$reflector = new \ReflectionClass($this);
|
||||||
|
$function = $reflector->getMethod($method);
|
||||||
|
$line = $function->getStartLine();
|
||||||
|
|
||||||
|
$logger->log('IN', get_class($this) . "::$method", $line, $params);
|
||||||
|
|
||||||
|
$result = $function->invokeArgs($this, $params);
|
||||||
|
|
||||||
|
$logger->log('OUT', get_class($this) . "::$method", $line, $result);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -394,8 +394,8 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#cd_ac_no').change(function(){
|
$('#cd_ac_no').keyup(function(){
|
||||||
|
console.log('key chnage detected');
|
||||||
var cd_ac_no = $(this).val();
|
var cd_ac_no = $(this).val();
|
||||||
console.log(cd_ac_no +'-'+cd_ac_no.length);
|
console.log(cd_ac_no +'-'+cd_ac_no.length);
|
||||||
cd_ac_no = cd_ac_no.trim();
|
cd_ac_no = cd_ac_no.trim();
|
||||||
@ -411,8 +411,11 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
console.log(res)
|
console.log(res)
|
||||||
if(res.status == true){
|
if(res.status == true){
|
||||||
toastr.warning(res.message, 'warning');
|
toastr.warning(res.message, 'warning');
|
||||||
$('#cd_ac_no').val('');
|
// $('#cd_ac_no').val('');
|
||||||
|
$('#btnSubmit').prop('disabled',true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
$('#btnSubmit').prop('disabled',false);
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user