Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
3e575a9f3c
@ -17,6 +17,10 @@ class Acl
|
|||||||
'#^/swagger#' => ['roles' => [ADMIN_ROLE_ID]],
|
'#^/swagger#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
'#^/fedeploy#' => ['roles' => [ADMIN_ROLE_ID]],
|
'#^/fedeploy#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
'#^/visitOffBoardCheck#' => ['roles' => [ADMIN_ROLE_ID]],
|
'#^/visitOffBoardCheck#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
|
'#^/logs#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
|
'#^/util/log_list#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
|
'#^/util/view_log#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
|
'#^/util/download_log#' => ['roles' => [ADMIN_ROLE_ID]],
|
||||||
|
|
||||||
// ===================== PUBLIC DOWNLOADS / FORMS =====================
|
// ===================== PUBLIC DOWNLOADS / FORMS =====================
|
||||||
'#^/download-#' => ['public' => true],
|
'#^/download-#' => ['public' => true],
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class Filters extends BaseConfig
|
|||||||
'HttpRequestLog' => ['except' => 'cli/*'],
|
'HttpRequestLog' => ['except' => 'cli/*'],
|
||||||
'Cors',
|
'Cors',
|
||||||
// 'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','employeeRest/*','processjob','getCommission']],
|
// 'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','employeeRest/*','processjob','getCommission']],
|
||||||
'SecurityInputFilter' => ['except' => ['notification/create','/ticket/crud_mail_template/*','test_mail','leads/sendMail'] ],
|
'SecurityInputFilter' => ['except' => ['/client/notification/create','/ticket/crud_mail_template/*','test_mail','leads/sendMail'] ],
|
||||||
'GlobalPostFileUploadGuard'
|
'GlobalPostFileUploadGuard'
|
||||||
// 'csrf',
|
// 'csrf',
|
||||||
// 'invalidchars',
|
// 'invalidchars',
|
||||||
|
|||||||
@ -1809,7 +1809,7 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($insert) {
|
if ($insert) {
|
||||||
$branchData = $this->clientBranchModel->where('client_id', $sanitized_post_data('client_id'))->findAll();
|
$branchData = $this->clientBranchModel->where('client_id', $sanitized_post_data['client_id'])->findAll();
|
||||||
$branchData['role'] = get_role_id();
|
$branchData['role'] = get_role_id();
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => true,
|
'status' => true,
|
||||||
@ -1831,6 +1831,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$this->myLogger->logme('error', 'Client branch EDIT function called');
|
$this->myLogger->logme('error', 'Client branch EDIT function called');
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
|
|
||||||
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
|
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
|
||||||
$id = $sanitized_post_data['branch_id_primarykey'] ?? null;
|
$id = $sanitized_post_data['branch_id_primarykey'] ?? null;
|
||||||
$client_id = $sanitized_post_data['client_id'] ?? null;
|
$client_id = $sanitized_post_data['client_id'] ?? null;
|
||||||
@ -1838,7 +1839,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$data['pre_branch_id'] = $pre_branch_id;
|
$data['pre_branch_id'] = $pre_branch_id;
|
||||||
|
|
||||||
$units = $sanitized_post_data['units'] ?? null;
|
$raw_units = $this->request->getPost('units');
|
||||||
|
|
||||||
$emp_unit_count = 0;
|
$emp_unit_count = 0;
|
||||||
$rr_unit_count = 0;
|
$rr_unit_count = 0;
|
||||||
@ -1846,12 +1847,13 @@ class ClientController extends AdminController
|
|||||||
$total_count = 0;
|
$total_count = 0;
|
||||||
|
|
||||||
$list_of_branch_units = $this->clientBranchModel->find((int)$id);
|
$list_of_branch_units = $this->clientBranchModel->find((int)$id);
|
||||||
$units = json_decode($list_of_branch_units['units']);
|
$units = !empty($list_of_branch_units['units']) ? json_decode($list_of_branch_units['units'], true) : [];
|
||||||
|
|
||||||
if (!is_array($units) || empty($units)) {
|
if (!is_array($units) || empty($units)) {
|
||||||
$client_data = $this->clientModel->where('id', $sanitized_post_data['client_id'])->first();
|
$client_data = $this->clientModel->where('id', $sanitized_post_data['client_id'])->first();
|
||||||
$default_unit = trim(($client_data['short_name'] ?? '') . '-' . ($sanitized_post_data['branch_code'] ?? ''), '-');
|
$default_unit = trim(($client_data['short_name'] ?? '') . '-' . ($sanitized_post_data['branch_code'] ?? ''), '-');
|
||||||
$sanitized_post_data['units'] = json_encode([$default_unit]);
|
$sanitized_post_data['units'] = json_encode([$default_unit]);
|
||||||
|
$units = [$default_unit]; // Update local variable for counting
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($units)) {
|
if (!empty($units)) {
|
||||||
@ -1866,17 +1868,21 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$uncommonValues = [];
|
$uncommonValues = [];
|
||||||
|
|
||||||
|
|
||||||
if ($total_count > 0) {
|
if ($total_count > 0) {
|
||||||
$units = (string) $sanitized_post_data('units'); // Assuming 'units' is an array
|
|
||||||
|
|
||||||
$list_of_branch_units = $this->clientBranchModel->find((int)$id);
|
$post_units_raw = $sanitized_post_data['units'] ?? '[]';
|
||||||
$branch_units = json_decode($list_of_branch_units['units'], true);
|
|
||||||
$units = json_decode($units);
|
|
||||||
|
|
||||||
$uncommonValues = array_diff($branch_units, $units);
|
$branch_units = json_decode($list_of_branch_units['units'] ?? '[]', true);
|
||||||
|
|
||||||
|
// Ensure we handle both string-json and array types
|
||||||
|
$incoming_units = is_array($post_units_raw) ? $post_units_raw : json_decode($post_units_raw, true);
|
||||||
|
|
||||||
|
if (is_array($branch_units) && is_array($incoming_units)) {
|
||||||
|
$uncommonValues = array_diff($branch_units, $incoming_units);
|
||||||
|
}
|
||||||
|
|
||||||
if (count($uncommonValues) > 0) {
|
if (count($uncommonValues) > 0) {
|
||||||
|
|
||||||
$branchData = $this->clientBranchModel->where('client_id', $client_id)->findAll();
|
$branchData = $this->clientBranchModel->where('client_id', $client_id)->findAll();
|
||||||
|
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
@ -2035,7 +2041,7 @@ class ClientController extends AdminController
|
|||||||
$this->myLogger->logme('error', 'Client policy CREATE function called');
|
$this->myLogger->logme('error', 'Client policy CREATE function called');
|
||||||
|
|
||||||
$request_post_data = $this->request->getPost();
|
$request_post_data = $this->request->getPost();
|
||||||
$$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
|
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
|
||||||
|
|
||||||
$policy_type_id = $sanitized_post_data['policy_type_id'] ?? null;
|
$policy_type_id = $sanitized_post_data['policy_type_id'] ?? null;
|
||||||
$client_branch_id = $sanitized_post_data['client_branch_id'] ?? null;
|
$client_branch_id = $sanitized_post_data['client_branch_id'] ?? null;
|
||||||
@ -2069,9 +2075,11 @@ class ClientController extends AdminController
|
|||||||
$sanitized_post_data['earned_premium_date'] = change_date_format($sanitized_post_data['earned_premium_date'] ?? null, 'd-m-Y', 'Y-m-d') ?? null;
|
$sanitized_post_data['earned_premium_date'] = change_date_format($sanitized_post_data['earned_premium_date'] ?? null, 'd-m-Y', 'Y-m-d') ?? null;
|
||||||
$sanitized_post_data['claims_incurred_date'] = change_date_format($sanitized_post_data['claims_incurred_date'] ?? null, 'd-m-Y', 'Y-m-d') ?? null;
|
$sanitized_post_data['claims_incurred_date'] = change_date_format($sanitized_post_data['claims_incurred_date'] ?? null, 'd-m-Y', 'Y-m-d') ?? null;
|
||||||
|
|
||||||
$sanitized_post_dataa['base_policy'] = ($sanitized_post_data['base_policy'] === '' || $sanitized_post_data['base_policy'] == 0) ? null : $sanitized_post_data['base_policy'];
|
$sanitized_post_data['base_policy'] = ($sanitized_post_data['base_policy'] === '' || $sanitized_post_data['base_policy'] == 0) ? null : $sanitized_post_data['base_policy'];
|
||||||
$sanitized_post_data['policy_status'] = 1;
|
$sanitized_post_data['policy_status'] = 1;
|
||||||
$sanitized_post_data['inception_type'] = $sanitized_post_data['inception_type'] ? 2 : 1;
|
$sanitized_post_data['inception_type'] = (isset($sanitized_post_data['inception_type']) && $sanitized_post_data['inception_type'] !== "")
|
||||||
|
? $sanitized_post_data['inception_type']
|
||||||
|
: 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2103,7 +2111,7 @@ class ClientController extends AdminController
|
|||||||
$sanitized_post_data['policy_start_date'] = change_date_format($sanitized_post_data['policy_start_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
$sanitized_post_data['policy_start_date'] = change_date_format($sanitized_post_data['policy_start_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
||||||
$sanitized_post_data['policy_end_date'] = change_date_format($sanitized_post_data['policy_end_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
$sanitized_post_data['policy_end_date'] = change_date_format($sanitized_post_data['policy_end_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
||||||
$sanitized_post_data['policy_no'] = $sanitized_post_data['policy_no'] ?? null;
|
$sanitized_post_data['policy_no'] = $sanitized_post_data['policy_no'] ?? null;
|
||||||
if ($sanitized_post_data['inception_type'] == 2) {
|
if (isset($sanitized_post_data['inception_type']) && $sanitized_post_data['inception_type'] == 2) {
|
||||||
$sanitized_post_data['open_date'] = change_date_format($sanitized_post_data['open_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
$sanitized_post_data['open_date'] = change_date_format($sanitized_post_data['open_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
||||||
$sanitized_post_data['close_date'] = change_date_format($sanitized_post_data['close_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
$sanitized_post_data['close_date'] = change_date_format($sanitized_post_data['close_date'] ?? null, 'd-m-Y', 'Y-m-d');
|
||||||
// $data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d');
|
// $data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d');
|
||||||
@ -2120,7 +2128,7 @@ class ClientController extends AdminController
|
|||||||
if ($insert) {
|
if ($insert) {
|
||||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($sanitized_post_data['client_id']);
|
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($sanitized_post_data['client_id']);
|
||||||
$clientPoliceData['role'] = get_role_id();
|
$clientPoliceData['role'] = get_role_id();
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $clientPoliceData, 'client_id' => $client_id, 'method' => 'CERATE', 'post_data' => $insert_data], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $clientPoliceData, 'client_id' => $client_id, 'method' => 'CERATE', 'post_data' => $insert], 200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||||
}
|
}
|
||||||
@ -5613,32 +5621,25 @@ class ClientController extends AdminController
|
|||||||
],
|
],
|
||||||
|
|
||||||
'type' => [
|
'type' => [
|
||||||
'rules' => 'required|is_natural_no_zero',
|
'rules' => 'required',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Vehicle type is required'
|
'required' => 'Vehicle type is required'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'description' => [
|
'description' => [
|
||||||
'rules' => 'required|is_natural_no_zero',
|
'rules' => 'required',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Vehicle description is required'
|
'required' => 'Vehicle description is required'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'owner' => [
|
'owner' => [
|
||||||
'rules' => 'required|is_natural_no_zero',
|
'rules' => 'required',
|
||||||
'errors' => [
|
'errors' => [
|
||||||
'required' => 'Owner is required'
|
'required' => 'Owner is required'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'old_onwer' => [
|
|
||||||
'rules' => 'permit_empty|alpha_space',
|
|
||||||
'errors' => [
|
|
||||||
'alpha_space' => 'Old owner name can contain only letters and spaces'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
];
|
||||||
if (!$this->validate($rules)) {
|
if (!$this->validate($rules)) {
|
||||||
return $this->response->setStatusCode(400)->setJSON([
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
|||||||
@ -4477,9 +4477,9 @@ class EmployeeController extends AdminController
|
|||||||
public function visitOffBoard(array $params)
|
public function visitOffBoard(array $params)
|
||||||
{
|
{
|
||||||
// 1. Load credentials from .env
|
// 1. Load credentials from .env
|
||||||
$apiUrl = env('WELLNESS_ONBOARD_ENDPOINT_URL');
|
$apiUrl = env('WELLNESS_ONBOARD_ENDPOINT_URL').'delete-policy-with-dependents';
|
||||||
$apiToken = env('WELLNESS_ONBOARD_AUTHORIZATION');
|
$apiToken = env('WELLNESS_ONBOARD_AUTHORIZATION');
|
||||||
|
// echo $apiUrl;die();
|
||||||
// 2. Initialize the CI4 CURL service
|
// 2. Initialize the CI4 CURL service
|
||||||
$client = \Config\Services::curlrequest([
|
$client = \Config\Services::curlrequest([
|
||||||
'base_uri' => $apiUrl,
|
'base_uri' => $apiUrl,
|
||||||
|
|||||||
@ -2311,6 +2311,9 @@ class EmployeeRestController extends AdminController
|
|||||||
$emp_policy_status = 'active';
|
$emp_policy_status = 'active';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$emp_policy_status = $db->escape($emp_policy_status);
|
||||||
|
|
||||||
$ClientPolicyData = $this->clientPolicyModel
|
$ClientPolicyData = $this->clientPolicyModel
|
||||||
->select("
|
->select("
|
||||||
client_policy.id as client_policy_id ,
|
client_policy.id as client_policy_id ,
|
||||||
@ -2324,13 +2327,13 @@ class EmployeeRestController extends AdminController
|
|||||||
DATE_FORMAT(client_policy.policy_start_date, '%d-%m-%Y') AS policy_start_date,
|
DATE_FORMAT(client_policy.policy_start_date, '%d-%m-%Y') AS policy_start_date,
|
||||||
DATE_FORMAT(client_policy.policy_end_date, '%d-%m-%Y') AS policy_expiry_date,
|
DATE_FORMAT(client_policy.policy_end_date, '%d-%m-%Y') AS policy_expiry_date,
|
||||||
(
|
(
|
||||||
select round(sum(rata_premimum + gst))
|
select COALESCE(ROUND(SUM(rata_premimum + gst)), 0)
|
||||||
from employee_polices
|
from employee_polices
|
||||||
where is_active = 1
|
where is_active = 1
|
||||||
and status = $emp_policy_status
|
and status = $emp_policy_status
|
||||||
and client_policy_id = client_policy_id
|
and client_policy_id = client_policy.id
|
||||||
) as total_premium
|
) as total_premium
|
||||||
")
|
", false)
|
||||||
->where('md5(client_policy.client_id)', $this->request->getGet('client_id'))
|
->where('md5(client_policy.client_id)', $this->request->getGet('client_id'))
|
||||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id'))
|
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id'))
|
||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
@ -2470,6 +2473,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$data['claim_status'] = $this->claimStatusModel
|
$data['claim_status'] = $this->claimStatusModel
|
||||||
->select('id,ticket_type, display_name as claim_status')
|
->select('id,ticket_type, display_name as claim_status')
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
|
->where('display_name IS NOT NULL OR display_name <> ""')
|
||||||
->groupBy('display_name')
|
->groupBy('display_name')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
@ -2489,6 +2493,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
$client_id = isset($search_data['client_id']) ? (int) $search_data['client_id'] : 0;
|
$client_id = isset($search_data['client_id']) ? (int) $search_data['client_id'] : 0;
|
||||||
unset($search_data['client_id']);
|
unset($search_data['client_id']);
|
||||||
|
unset($search_data['client_branch_id']);
|
||||||
|
|
||||||
$from_date = isset($search_data['from_date']) ? $search_data['from_date'] : null;
|
$from_date = isset($search_data['from_date']) ? $search_data['from_date'] : null;
|
||||||
$to_date = isset($search_data['to_date']) ? $search_data['to_date'] : null;
|
$to_date = isset($search_data['to_date']) ? $search_data['to_date'] : null;
|
||||||
@ -5359,6 +5364,8 @@ class EmployeeRestController extends AdminController
|
|||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
->where('display_name', $claim_status_data_display_name['display_name'])
|
->where('display_name', $claim_status_data_display_name['display_name'])
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
|
$claim_status_data_id = array_column($claim_status_data_id, 'id');
|
||||||
return $claim_status_data_id;
|
return $claim_status_data_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class LoginController extends BaseController
|
|||||||
set_session_data($session_data);
|
set_session_data($session_data);
|
||||||
|
|
||||||
// Bind session to device
|
// Bind session to device
|
||||||
// set_session_data(['fingerprint' => generateFingerprint()]);
|
set_session_data(['fingerprint' => generateFingerprint()]);
|
||||||
|
|
||||||
log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
|
log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
|
||||||
log_message('error', 'User Login Sucessfully');
|
log_message('error', 'User Login Sucessfully');
|
||||||
|
|||||||
@ -449,7 +449,7 @@ class MasterController extends AdminController
|
|||||||
$insert = $this->insurerBranchModel->insert($sanitized_post_data);
|
$insert = $this->insurerBranchModel->insert($sanitized_post_data);
|
||||||
|
|
||||||
if($insert){
|
if($insert){
|
||||||
for ($i = 0; $i < count($sanitized_post_data('name')); $i++) {
|
for ($i = 0; $i < count($sanitized_post_data['name']); $i++) {
|
||||||
// Prepare data to insert
|
// Prepare data to insert
|
||||||
$sanitized_post_data_for_level = [
|
$sanitized_post_data_for_level = [
|
||||||
'contact_type' => 'insurer',
|
'contact_type' => 'insurer',
|
||||||
@ -465,7 +465,7 @@ class MasterController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($insert){
|
if($insert){
|
||||||
$branchData = $this->insurerBranchModel->where('insurer_id', $sanitized_post_data_for_level['insurer_id'])->findAll();
|
$branchData = $this->insurerBranchModel->where('insurer_id', $sanitized_post_data['insurer_id'])->findAll();
|
||||||
echo json_encode(array("status" => true , 'data' => $branchData));
|
echo json_encode(array("status" => true , 'data' => $branchData));
|
||||||
}else{
|
}else{
|
||||||
echo json_encode(array("status" => false));
|
echo json_encode(array("status" => false));
|
||||||
@ -2168,72 +2168,74 @@ class MasterController extends AdminController
|
|||||||
public function createCDMasterData()
|
public function createCDMasterData()
|
||||||
{
|
{
|
||||||
$this->myLogger->logme("error", 'Create CD Master Data API called.');
|
$this->myLogger->logme("error", 'Create CD Master Data API called.');
|
||||||
$rules = [
|
|
||||||
|
|
||||||
// ======================
|
|
||||||
// Client / Insurer Mapping
|
|
||||||
// ======================
|
|
||||||
'client_id' => [
|
|
||||||
'rules' => 'required|is_natural_no_zero',
|
|
||||||
'errors' => [
|
|
||||||
'required' => 'Client is required'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'insurer_id' => [
|
|
||||||
'rules' => 'required|is_natural_no_zero',
|
|
||||||
'errors' => [
|
|
||||||
'required' => 'Insurer is required'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'insurer_branch_id' => [
|
|
||||||
'rules' => 'required|is_natural_no_zero',
|
|
||||||
'errors' => [
|
|
||||||
'required' => 'Insurer branch is required'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
// ======================
|
|
||||||
// CD Account Details
|
|
||||||
// ======================
|
|
||||||
'opening_date' => [
|
|
||||||
'rules' => 'required|valid_date[d-m-Y]',
|
|
||||||
'errors' => [
|
|
||||||
'required' => 'Opening date is required',
|
|
||||||
'valid_date' => 'Opening date must be in DD-MM-YYYY format'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'cd_ac_no' => [
|
|
||||||
'rules' => 'required|trim',
|
|
||||||
'errors' => [
|
|
||||||
'required' => 'CD account number is required'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
|
|
||||||
'opening_bal' => [
|
|
||||||
'rules' => 'required|numeric|greater_than_equal_to[0]',
|
|
||||||
'errors' => [
|
|
||||||
'required' => 'Opening amount is required',
|
|
||||||
'numeric' => 'Opening amount must be numeric',
|
|
||||||
'greater_than_equal_to' => 'Opening amount cannot be negative'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
];
|
|
||||||
if (!$this->validate($rules)) {
|
|
||||||
return $this->response->setStatusCode(400)->setJSON([
|
|
||||||
'status' => false,
|
|
||||||
'message' => 'Input validation failed',
|
|
||||||
'code' => 400,
|
|
||||||
'errors' => $this->validator->getErrors()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
|
$sanitized_post_data = sanitizeInputArrayAdvanced($data);
|
||||||
|
$id = $sanitized_post_data['PrimaryKey'] ?? null;
|
||||||
|
if($id === null){
|
||||||
|
$rules = [
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// Client / Insurer Mapping
|
||||||
|
// ======================
|
||||||
|
'client_id' => [
|
||||||
|
'rules' => 'required|is_natural_no_zero',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Client is required'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'insurer_id' => [
|
||||||
|
'rules' => 'required|is_natural_no_zero',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Insurer is required'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'insurer_branch_id' => [
|
||||||
|
'rules' => 'required|is_natural_no_zero',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Insurer branch is required'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
// ======================
|
||||||
|
// CD Account Details
|
||||||
|
// ======================
|
||||||
|
'opening_date' => [
|
||||||
|
'rules' => 'required|valid_date[d-m-Y]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Opening date is required',
|
||||||
|
'valid_date' => 'Opening date must be in DD-MM-YYYY format'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'cd_ac_no' => [
|
||||||
|
'rules' => 'required|trim',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'CD account number is required'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'opening_bal' => [
|
||||||
|
'rules' => 'required|numeric|greater_than_equal_to[0]',
|
||||||
|
'errors' => [
|
||||||
|
'required' => 'Opening amount is required',
|
||||||
|
'numeric' => 'Opening amount must be numeric',
|
||||||
|
'greater_than_equal_to' => 'Opening amount cannot be negative'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
if (!$this->validate($rules)) {
|
||||||
|
return $this->response->setStatusCode(400)->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Input validation failed',
|
||||||
|
'code' => 400,
|
||||||
|
'errors' => $this->validator->getErrors()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->myLogger->logme("error", 'Received POST data: ' . json_encode($data));
|
$this->myLogger->logme("error", 'Received POST data: ' . json_encode($data));
|
||||||
|
|
||||||
$id = $sanitized_post_data['PrimaryKey'] ?? null;
|
|
||||||
$date = (string) ($sanitized_post_data['opening_date'] ?? '');
|
$date = (string) ($sanitized_post_data['opening_date'] ?? '');
|
||||||
$sanitized_post_data['opening_date'] = date('Y-m-d', strtotime($date));
|
$sanitized_post_data['opening_date'] = date('Y-m-d', strtotime($date));
|
||||||
$this->myLogger->logme("error", 'Formatted opening_date: ' . $data['opening_date']);
|
$this->myLogger->logme("error", 'Formatted opening_date: ' . $data['opening_date']);
|
||||||
|
|||||||
@ -23,11 +23,11 @@ class AuthMVC implements FilterInterface
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// Fingerprint validation
|
// Fingerprint validation
|
||||||
// $fp = generateFingerprint();
|
$fp = generateFingerprint();
|
||||||
// // log_message('error',$fp);
|
// log_message('error',$fp);
|
||||||
// if (session()->get('fingerprint') !== $fp) {
|
if (session()->get('fingerprint') !== $fp) {
|
||||||
// return AuthLogout::logout();
|
return AuthLogout::logout();
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1614,7 +1614,6 @@
|
|||||||
const formData = new FormData(form);
|
const formData = new FormData(form);
|
||||||
formData.append('template_name', template_name);
|
formData.append('template_name', template_name);
|
||||||
formData.append('client_id', client_id);
|
formData.append('client_id', client_id);
|
||||||
console.log(formData.template_name);
|
|
||||||
const fileInput = form.querySelector('input[type="file"]');
|
const fileInput = form.querySelector('input[type="file"]');
|
||||||
|
|
||||||
// Check if a file is selected
|
// Check if a file is selected
|
||||||
@ -1980,23 +1979,15 @@
|
|||||||
|
|
||||||
// Use the editor instance instead of unlayer directly
|
// Use the editor instance instead of unlayer directly
|
||||||
editor.exportHtml(function(data) {
|
editor.exportHtml(function(data) {
|
||||||
var formData = $('#account_maneger_summary_mail_form').serializeArray();
|
|
||||||
|
|
||||||
// Append Unlayer editor data
|
var formData = new FormData($('#account_maneger_summary_mail_form')[0]);
|
||||||
formData.push({
|
|
||||||
name: 'mailContent',
|
|
||||||
value: data.html
|
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'client_id',
|
|
||||||
value: $('#general_PrimaryKey').val()
|
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'mailJson',
|
|
||||||
value: JSON.stringify(data.design)
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(formData);
|
// Append Unlayer data
|
||||||
|
formData.append('mailContent', data.html);
|
||||||
|
formData.append('client_id', $('#general_PrimaryKey').val());
|
||||||
|
formData.append('mailJson', JSON.stringify(data.design));
|
||||||
|
|
||||||
|
console.log([...formData.entries()]);
|
||||||
|
|
||||||
// Show loading indicators
|
// Show loading indicators
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -2042,23 +2033,15 @@
|
|||||||
|
|
||||||
// Use the editor instance instead of unlayer directly
|
// Use the editor instance instead of unlayer directly
|
||||||
editor.exportHtml(function(data) {
|
editor.exportHtml(function(data) {
|
||||||
var formData = $('#member_welcome_mail_form').serializeArray();
|
|
||||||
|
|
||||||
// Append Unlayer editor data
|
var formData = new FormData($('#member_welcome_mail_form')[0]);
|
||||||
formData.push({
|
|
||||||
name: 'mailContent',
|
|
||||||
value: data.html
|
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'client_id',
|
|
||||||
value: $('#general_PrimaryKey').val()
|
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'mailJson',
|
|
||||||
value: JSON.stringify(data.design)
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(formData);
|
// Append Unlayer data
|
||||||
|
formData.append('mailContent', data.html);
|
||||||
|
formData.append('client_id', $('#general_PrimaryKey').val());
|
||||||
|
formData.append('mailJson', JSON.stringify(data.design));
|
||||||
|
|
||||||
|
console.log([...formData.entries()]);
|
||||||
|
|
||||||
// Show loading indicators
|
// Show loading indicators
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -2104,23 +2087,15 @@
|
|||||||
|
|
||||||
// Use the editor instance instead of unlayer directly
|
// Use the editor instance instead of unlayer directly
|
||||||
editor.exportHtml(function(data) {
|
editor.exportHtml(function(data) {
|
||||||
var formData = $('#member_reminder_mail_form').serializeArray();
|
|
||||||
|
|
||||||
// Append Unlayer editor data
|
var formData = new FormData($('#member_reminder_mail_form')[0]);
|
||||||
formData.push({
|
|
||||||
name: 'mailContent',
|
|
||||||
value: data.html
|
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'client_id',
|
|
||||||
value: $('#general_PrimaryKey').val()
|
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'mailJson',
|
|
||||||
value: JSON.stringify(data.design)
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(formData);
|
// Append Unlayer data
|
||||||
|
formData.append('mailContent', data.html);
|
||||||
|
formData.append('client_id', $('#general_PrimaryKey').val());
|
||||||
|
formData.append('mailJson', JSON.stringify(data.design));
|
||||||
|
|
||||||
|
console.log([...formData.entries()]);
|
||||||
|
|
||||||
// Show loading indicators
|
// Show loading indicators
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -2166,23 +2141,15 @@
|
|||||||
|
|
||||||
// Use the editor instance instead of unlayer directly
|
// Use the editor instance instead of unlayer directly
|
||||||
editor.exportHtml(function(data) {
|
editor.exportHtml(function(data) {
|
||||||
var formData = $('#member_ecard_mail_form').serializeArray();
|
|
||||||
|
|
||||||
// Append Unlayer editor data
|
var formData = new FormData($('#member_ecard_mail_form')[0]);
|
||||||
formData.push({
|
|
||||||
name: 'mailContent',
|
|
||||||
value: data.html
|
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'client_id',
|
|
||||||
value: $('#general_PrimaryKey').val()
|
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'mailJson',
|
|
||||||
value: JSON.stringify(data.design)
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(formData);
|
// Append Unlayer data
|
||||||
|
formData.append('mailContent', data.html);
|
||||||
|
formData.append('client_id', $('#general_PrimaryKey').val());
|
||||||
|
formData.append('mailJson', JSON.stringify(data.design));
|
||||||
|
|
||||||
|
console.log([...formData.entries()]);
|
||||||
|
|
||||||
// Show loading indicators
|
// Show loading indicators
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -2229,21 +2196,15 @@
|
|||||||
|
|
||||||
// Use the editor instance instead of unlayer directly
|
// Use the editor instance instead of unlayer directly
|
||||||
editor.exportHtml(function(data) {
|
editor.exportHtml(function(data) {
|
||||||
var formData = $('#member_common_mail_form').serializeArray();
|
|
||||||
|
|
||||||
// Append Unlayer editor data
|
var formData = new FormData($('#member_common_mail_form')[0]);
|
||||||
formData.push({
|
|
||||||
name: 'mailContent',
|
// Append Unlayer data
|
||||||
value: data.html
|
formData.append('mailContent', data.html);
|
||||||
});
|
formData.append('client_id', $('#general_PrimaryKey').val());
|
||||||
formData.push({
|
formData.append('mailJson', JSON.stringify(data.design));
|
||||||
name: 'client_id',
|
|
||||||
value: $('#general_PrimaryKey').val()
|
console.log([...formData.entries()]);
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'mailJson',
|
|
||||||
value: JSON.stringify(data.design)
|
|
||||||
});
|
|
||||||
|
|
||||||
// Show loading indicators
|
// Show loading indicators
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -2289,23 +2250,15 @@
|
|||||||
|
|
||||||
// Use the editor instance instead of unlayer directly
|
// Use the editor instance instead of unlayer directly
|
||||||
editor.exportHtml(function(data) {
|
editor.exportHtml(function(data) {
|
||||||
var formData = $('#member_review_and_summary_mail_form').serializeArray();
|
|
||||||
|
|
||||||
// Append Unlayer editor data
|
var formData = new FormData($('#member_review_and_summary_mail_form')[0]);
|
||||||
formData.push({
|
|
||||||
name: 'mailContent',
|
|
||||||
value: data.html
|
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'client_id',
|
|
||||||
value: $('#general_PrimaryKey').val()
|
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'mailJson',
|
|
||||||
value: JSON.stringify(data.design)
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(formData);
|
// Append Unlayer data
|
||||||
|
formData.append('mailContent', data.html);
|
||||||
|
formData.append('client_id', $('#general_PrimaryKey').val());
|
||||||
|
formData.append('mailJson', JSON.stringify(data.design));
|
||||||
|
|
||||||
|
console.log([...formData.entries()]);
|
||||||
|
|
||||||
// Show loading indicators
|
// Show loading indicators
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -2351,23 +2304,16 @@
|
|||||||
|
|
||||||
// Use the editor instance instead of unlayer directly
|
// Use the editor instance instead of unlayer directly
|
||||||
editor.exportHtml(function(data) {
|
editor.exportHtml(function(data) {
|
||||||
var formData = $('#client_hr_summary_mail_form').serializeArray();
|
|
||||||
|
|
||||||
// Append Unlayer editor data
|
var formData = new FormData($('#client_hr_summary_mail_form')[0]);
|
||||||
formData.push({
|
|
||||||
name: 'mailContent',
|
// Append Unlayer data
|
||||||
value: data.html
|
formData.append('mailContent', data.html);
|
||||||
});
|
formData.append('client_id', $('#general_PrimaryKey').val());
|
||||||
formData.push({
|
formData.append('mailJson', JSON.stringify(data.design));
|
||||||
name: 'client_id',
|
|
||||||
value: $('#general_PrimaryKey').val()
|
console.log([...formData.entries()]);
|
||||||
});
|
|
||||||
formData.push({
|
|
||||||
name: 'mailJson',
|
|
||||||
value: JSON.stringify(data.design)
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(formData);
|
|
||||||
|
|
||||||
// Show loading indicators
|
// Show loading indicators
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user