FIX_inside find() string value convert into int type
This commit is contained in:
parent
76b47428c0
commit
cb2cc27d98
@ -57,7 +57,7 @@ class AgentController extends ResourceController
|
||||
|
||||
$id = $this->request->getGet('id');
|
||||
|
||||
$record = $this->AgentModel->find($id);
|
||||
$record = $this->AgentModel->find((int)$id);
|
||||
|
||||
if (!$record) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200);
|
||||
@ -126,7 +126,7 @@ class AgentController extends ResourceController
|
||||
$id = $data['id'];
|
||||
|
||||
// check if agent exists
|
||||
$agent = $this->AgentModel->find($id);
|
||||
$agent = $this->AgentModel->find((int)$id);
|
||||
if (!$agent) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'Date Not Found'], 200);
|
||||
}
|
||||
@ -177,7 +177,7 @@ class AgentController extends ResourceController
|
||||
$id = $data['id'];
|
||||
|
||||
// check if agent exists
|
||||
$agent = $this->AgentModel->find($id);
|
||||
$agent = $this->AgentModel->find((int)$id);
|
||||
if (!$agent) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'Date Not Found'], 200);
|
||||
}
|
||||
@ -213,7 +213,7 @@ class AgentController extends ResourceController
|
||||
$status = ($is_active == 1) ? 0 : 1;
|
||||
|
||||
// check if agent exists
|
||||
$agent = $this->AgentModel->find($id);
|
||||
$agent = $this->AgentModel->find((int)$id);
|
||||
if (!$agent) {
|
||||
return $this->respond(['status' => 'failed','code' => 200, 'data' => 'Agent not found'], 200);
|
||||
}
|
||||
@ -240,7 +240,7 @@ class AgentController extends ResourceController
|
||||
}
|
||||
|
||||
// Fetch record from DB
|
||||
$fileRecord = $this->AgentModel->where('is_active',1)->find($id);
|
||||
$fileRecord = $this->AgentModel->where('is_active',1)->find((int)$id);
|
||||
|
||||
if (!$fileRecord) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => 'File not found'], 200);
|
||||
@ -329,7 +329,7 @@ class AgentController extends ResourceController
|
||||
|
||||
|
||||
// check if agent exists
|
||||
$file = $this->AgentIncentiveFileModel->find($id);
|
||||
$file = $this->AgentIncentiveFileModel->find((int)$id);
|
||||
if (!$file) {
|
||||
return $this->respond(['status' => 'failed','code' => 200, 'data' => 'File not found'], 200);
|
||||
}
|
||||
@ -356,7 +356,7 @@ class AgentController extends ResourceController
|
||||
}
|
||||
|
||||
// Fetch record from DB
|
||||
$fileRecord = $this->AgentIncentiveFileModel->where('is_active',1)->find($id);
|
||||
$fileRecord = $this->AgentIncentiveFileModel->where('is_active',1)->find((int)$id);
|
||||
|
||||
if (!$fileRecord) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => 'File not found'], 200);
|
||||
|
||||
@ -1033,8 +1033,8 @@ class DashboardController extends ResourceController
|
||||
pa.name AS agent_name,
|
||||
pa.agent_code,
|
||||
CASE
|
||||
WHEN pa.is_active = 1 THEN 'Active Agent'
|
||||
ELSE 'Inactive Agent'
|
||||
WHEN pa.is_active = 1 THEN 'Active'
|
||||
ELSE 'Inactive'
|
||||
END AS agent_status,
|
||||
MAX(pp.issued_date) AS last_business_date,
|
||||
CONCAT('₹ ', FORMAT(SUM(pp.premium_amount), 2, 'en_IN')) AS display_premium,
|
||||
|
||||
@ -170,7 +170,7 @@ class EndorsementController extends ResourceController
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
// Fetch existing record
|
||||
$endorsement = $this->EndorsementModel->find($endorsementId);
|
||||
$endorsement = $this->EndorsementModel->find((int)$endorsementId);
|
||||
|
||||
if (empty($endorsement)) {
|
||||
return $this->respond([ 'status' => 'failed', 'code' => 404, 'data' => 'Endorsement not found' ], 200);
|
||||
@ -239,7 +239,7 @@ class EndorsementController extends ResourceController
|
||||
}
|
||||
|
||||
// Fetch record from DB
|
||||
$fileRecord = $this->EndorsementModel->find($id);
|
||||
$fileRecord = $this->EndorsementModel->find((int)$id);
|
||||
|
||||
if (!$fileRecord) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => 'File not found'], 200);
|
||||
|
||||
@ -402,7 +402,7 @@ class EnquiryController extends ResourceController
|
||||
}
|
||||
|
||||
$id = $data['id'];
|
||||
$enquiry = $this->enquiryModel->find($id);
|
||||
$enquiry = $this->enquiryModel->find((int)$id);
|
||||
|
||||
if (!$enquiry) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 200, 'error' => 'Data Not Found'], 200);
|
||||
@ -465,7 +465,7 @@ class EnquiryController extends ResourceController
|
||||
|
||||
$this->enquiryModel->update($id, $updateData);
|
||||
|
||||
$enquiryData = $this->enquiryModel->find($id);
|
||||
$enquiryData = $this->enquiryModel->find((int)$id);
|
||||
if($enquiryData['assigned_to'] != 0 && $enquiryData['enquiry_status'] == 'To be assigned'){
|
||||
$this->enquiryModel->update($id, ['enquiry_status' => 'Assigned']);
|
||||
}
|
||||
@ -494,7 +494,7 @@ class EnquiryController extends ResourceController
|
||||
}
|
||||
|
||||
$id = $data['id'];
|
||||
$enquiry = $this->enquiryModel->find($id);
|
||||
$enquiry = $this->enquiryModel->find((int)$id);
|
||||
|
||||
if (!$enquiry) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 200, 'error' => 'Data Not Found'], 200);
|
||||
@ -549,7 +549,7 @@ class EnquiryController extends ResourceController
|
||||
$folder = $fileMap[$fileType]['folder'];
|
||||
|
||||
// Fetch record from DB
|
||||
$fileRecord = $this->enquiryModel->where('is_active', 1)->find($enquiryId);
|
||||
$fileRecord = $this->enquiryModel->where('is_active', 1)->find((int)$enquiryId);
|
||||
|
||||
if (!$fileRecord || empty($fileRecord[$fileColumn])) {
|
||||
return $this->respond([ 'status' => 'failed','code' => 404,'data' => 'File not found in database'], 200);
|
||||
@ -623,7 +623,7 @@ class EnquiryController extends ResourceController
|
||||
|
||||
$fileId = $this->request->getGet('file_id');
|
||||
|
||||
$file = $this->FilesModel->find($fileId);
|
||||
$file = $this->FilesModel->find((int)$fileId);
|
||||
|
||||
if (!$file) {
|
||||
return $this->respond(['status' => 'failed','message' => 'Invalid file id'], 404);
|
||||
@ -651,7 +651,7 @@ class EnquiryController extends ResourceController
|
||||
return $this->respond(['status' => 'failed','message' => 'file_id is required'], 400);
|
||||
}
|
||||
|
||||
$file = $this->FilesModel->find($fileId);
|
||||
$file = $this->FilesModel->find((int)$fileId);
|
||||
|
||||
if (!$file) {
|
||||
return $this->respond(['status' => 'failed','message' => 'Invalid file id'], 404);
|
||||
@ -808,7 +808,7 @@ class EnquiryController extends ResourceController
|
||||
}
|
||||
|
||||
$id = $data['id'];
|
||||
$enquiry = $this->enquiryModel->find($id);
|
||||
$enquiry = $this->enquiryModel->find((int)$id);
|
||||
|
||||
if (!$enquiry) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 200, 'error' => 'Data Not Found'], 200);
|
||||
|
||||
@ -1203,7 +1203,7 @@ class ExcelExportController extends ResourceController
|
||||
$reports = [
|
||||
'Monthly_Policies_Details.xlsx' => ['data' => $monthlyData, 'header' => ['Received Date', 'Assigned To', 'Insurer', 'Short Name', 'Insured', 'Reg No', 'Mode', 'Plan', 'Agent', 'Code', 'Policy #', 'Issued Date', 'Premium'], 'title' => "Monthly Report",'showTotal' => true],
|
||||
'Low_Premium_Policies_Details.xlsx' => ['data' => $lowPremiumData, 'header' => ['Received Date', 'Assigned To', 'Insurer', 'Short Name', 'Insured', 'Reg No', 'Mode', 'Plan', 'Agent', 'Code', 'Status', 'Policy #', 'Issued Date', 'Premium'], 'title' => "Low Premium Report",'showTotal' => true],
|
||||
'Partners_Without_Policies_Details.xlsx' => ['data' => $inactiveData, 'header' => ['Partner Name', 'Partner Code', 'Email', 'Mobile'], 'title' => "Inactive Agents",'showTotal' => false]
|
||||
'Partners_Without_Policies_Details.xlsx' => ['data' => $inactiveData, 'header' => ['Partner Name', 'Partner Code', 'Email', 'Mobile'], 'title' => "Inactive Partners",'showTotal' => false]
|
||||
];
|
||||
|
||||
// 4. Initialize Zip
|
||||
@ -2137,8 +2137,8 @@ class ExcelExportController extends ResourceController
|
||||
pa.agent_code,
|
||||
pa.name AS agent_name,
|
||||
CASE
|
||||
WHEN pa.is_active = 1 THEN 'Active Agent'
|
||||
ELSE 'Inactive Agent'
|
||||
WHEN pa.is_active = 1 THEN 'Active'
|
||||
ELSE 'Inactive'
|
||||
END AS agent_status,
|
||||
MAX(pp.issued_date) AS last_business_date,
|
||||
CONCAT('₹ ', FORMAT(SUM(pp.premium_amount), 2, 'en_IN')) AS display_premium,
|
||||
|
||||
@ -174,7 +174,7 @@ class MasterController extends ResourceController
|
||||
{
|
||||
$input = $this->request->getJSON(true);
|
||||
|
||||
if (!$this->VehicleTypeMasterModel->find($id)) {
|
||||
if (!$this->VehicleTypeMasterModel->find((int)$id)) {
|
||||
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||
}
|
||||
|
||||
@ -216,14 +216,14 @@ class MasterController extends ResourceController
|
||||
]);
|
||||
}
|
||||
|
||||
$record = $this->VehicleTypeMasterModel->find($id);
|
||||
$record = $this->VehicleTypeMasterModel->find((int)$id);
|
||||
if (!$record) {
|
||||
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||
}
|
||||
|
||||
$status = ($input['is_active'] == 1) ? 0 : 1;
|
||||
|
||||
$this->VehicleTypeMasterModel->update($id, [
|
||||
$this->VehicleTypeMasterModel->update((int)$id, [
|
||||
'is_active' => $status,
|
||||
'updated_by' => $input['updated_by'] ?? null,
|
||||
]);
|
||||
@ -284,7 +284,7 @@ class MasterController extends ResourceController
|
||||
{
|
||||
$input = $this->request->getJSON(true);
|
||||
|
||||
if (!$this->PartnerBrokerModel->find($id)) {
|
||||
if (!$this->PartnerBrokerModel->find((int)$id)) {
|
||||
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||
}
|
||||
|
||||
@ -327,7 +327,7 @@ class MasterController extends ResourceController
|
||||
]);
|
||||
}
|
||||
|
||||
$record = $this->PartnerBrokerModel->find($id);
|
||||
$record = $this->PartnerBrokerModel->find((int)$id);
|
||||
if (!$record) {
|
||||
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||
}
|
||||
@ -394,7 +394,7 @@ class MasterController extends ResourceController
|
||||
{
|
||||
$input = $this->request->getJSON(true);
|
||||
|
||||
if (!$this->PaymentModeModel->find($id)) {
|
||||
if (!$this->PaymentModeModel->find((int)$id)) {
|
||||
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||
}
|
||||
|
||||
@ -436,7 +436,7 @@ class MasterController extends ResourceController
|
||||
]);
|
||||
}
|
||||
|
||||
$record = $this->PaymentModeModel->find($id);
|
||||
$record = $this->PaymentModeModel->find((int)$id);
|
||||
if (!$record) {
|
||||
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||
}
|
||||
@ -519,7 +519,7 @@ class MasterController extends ResourceController
|
||||
{
|
||||
$input = $this->request->getJSON(true);
|
||||
|
||||
if (!$this->EndorsementTypeModel->find($id)) {
|
||||
if (!$this->EndorsementTypeModel->find((int)$id)) {
|
||||
return $this->respond([
|
||||
'status' => 404,
|
||||
'message' => 'Record not found'
|
||||
@ -563,7 +563,7 @@ class MasterController extends ResourceController
|
||||
]);
|
||||
}
|
||||
|
||||
$record = $this->EndorsementTypeModel->find($id);
|
||||
$record = $this->EndorsementTypeModel->find((int)$id);
|
||||
if (!$record) {
|
||||
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ class PolicyController extends ResourceController
|
||||
->join('partner_insurance_plan_type_master ipti', 'ipti.id = pq.insurance_plan_type_id', 'left')
|
||||
->join('partner_agent A', 'A.id = partner_policy.agent_id', 'left')
|
||||
->join('partner_staff S', 'S.id = partner_policy.manager_id', 'left')
|
||||
->find($id);
|
||||
->find((int)$id);
|
||||
|
||||
$record['issued_date'] = format_date_for_client($record['issued_date']);
|
||||
$record['start_date'] = format_date_for_client($record['start_date']);
|
||||
@ -234,7 +234,7 @@ class PolicyController extends ResourceController
|
||||
}
|
||||
|
||||
$id = $data['id'];
|
||||
$policy = $this->PolicyModel->find($id);
|
||||
$policy = $this->PolicyModel->find((int)$id);
|
||||
if (!$policy) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'Data Not Found'], 200);
|
||||
}
|
||||
@ -456,7 +456,7 @@ class PolicyController extends ResourceController
|
||||
$folder = $fileMap[$fileType]['folder'];
|
||||
|
||||
// Fetch record from DB
|
||||
$fileRecord = $this->PolicyModel->where('is_active', 1)->find($policyId);
|
||||
$fileRecord = $this->PolicyModel->where('is_active', 1)->find((int)$policyId);
|
||||
|
||||
if (!$fileRecord || empty($fileRecord[$fileColumn])) {
|
||||
return $this->respond([ 'status' => 'failed','code' => 404,'data' => 'File not found in database'], 200);
|
||||
@ -500,7 +500,7 @@ class PolicyController extends ResourceController
|
||||
$folder = $fileMap[$fileType]['folder'];
|
||||
|
||||
// Fetch record from DB
|
||||
$fileRecord = $this->PolicyModel->where('is_active', 1)->find($policyId);
|
||||
$fileRecord = $this->PolicyModel->where('is_active', 1)->find((int)$policyId);
|
||||
|
||||
if (!$fileRecord || empty($fileRecord[$fileColumn])) {
|
||||
return $this->respond([ 'status' => 'failed','code' => 404,'data' => 'File not found in database'], 200);
|
||||
@ -648,7 +648,7 @@ class PolicyController extends ResourceController
|
||||
// $model = "gemini-1.5-pro";
|
||||
$url = "https://generativelanguage.googleapis.com/v1beta/models/{$model}:generateContent?key={$apiKey}";
|
||||
|
||||
$record = $this->PolicyModel->find($policyId);
|
||||
$record = $this->PolicyModel->find((int)$policyId);
|
||||
$uploadedPath = WRITEPATH . 'uploads/policy/policy_pdf/';
|
||||
$filePath = $uploadedPath.$record['policy_pdf_file_name'];
|
||||
// dd($filePath);
|
||||
|
||||
@ -125,7 +125,7 @@ class QuotationController extends ResourceController
|
||||
}
|
||||
|
||||
$id = $data['id'];
|
||||
$quotation = $this->QuotationModel->find($id);
|
||||
$quotation = $this->QuotationModel->find((int)$id);
|
||||
if (!$quotation) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'Data Not Found'], 200);
|
||||
}
|
||||
@ -178,7 +178,7 @@ class QuotationController extends ResourceController
|
||||
|
||||
$id = $data['id'];
|
||||
|
||||
$quotation = $this->QuotationModel->find($id);
|
||||
$quotation = $this->QuotationModel->find((int)$id);
|
||||
if (!$quotation) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'Data Not Found'], 200);
|
||||
}
|
||||
@ -234,7 +234,7 @@ class QuotationController extends ResourceController
|
||||
}
|
||||
|
||||
// Fetch record from DB
|
||||
$fileRecord = $this->QuotationModel->where('is_active',1)->find($id);
|
||||
$fileRecord = $this->QuotationModel->where('is_active',1)->find((int)$id);
|
||||
|
||||
if (!$fileRecord) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => 'File not found'], 200);
|
||||
|
||||
@ -41,7 +41,7 @@ class SalesExecutive extends ResourceController
|
||||
|
||||
$id = $this->request->getGet('id');
|
||||
|
||||
$record = $this->salesExecutiveModel->find($id);
|
||||
$record = $this->salesExecutiveModel->find((int)$id);
|
||||
|
||||
if (!$record) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200);
|
||||
@ -110,7 +110,7 @@ class SalesExecutive extends ResourceController
|
||||
$id = $data['id'];
|
||||
|
||||
// check if Sales Executive exists
|
||||
$salesExecutive = $this->salesExecutiveModel->find($id);
|
||||
$salesExecutive = $this->salesExecutiveModel->find((int)$id);
|
||||
if (!$salesExecutive) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'Date Not Found'], 200);
|
||||
}
|
||||
@ -166,7 +166,7 @@ class SalesExecutive extends ResourceController
|
||||
$status = ($is_active == 1) ? 0 : 1;
|
||||
|
||||
// check if agent exists
|
||||
$agent = $this->salesExecutiveModel->find($id);
|
||||
$agent = $this->salesExecutiveModel->find((int)$id);
|
||||
if (!$agent) {
|
||||
return $this->respond(['status' => 'failed','code' => 200, 'data' => 'Agent not found'], 200);
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ class StaffController extends ResourceController
|
||||
|
||||
$id = $this->request->getGet('id');
|
||||
|
||||
$record = $this->StaffModel->find($id);
|
||||
$record = $this->StaffModel->find((int)$id);
|
||||
|
||||
if (!$record) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200);
|
||||
@ -280,7 +280,7 @@ class StaffController extends ResourceController
|
||||
$id = $data['id'];
|
||||
|
||||
// check if Staff exists
|
||||
$Staff = $this->StaffModel->find($id);
|
||||
$Staff = $this->StaffModel->find((int)$id);
|
||||
if (!$Staff) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'Date Not Found'], 200);
|
||||
}
|
||||
@ -320,7 +320,7 @@ class StaffController extends ResourceController
|
||||
$status = ($is_active == 1) ? 0 : 1;
|
||||
|
||||
// check if Staff exists
|
||||
$Staff = $this->StaffModel->find($id);
|
||||
$Staff = $this->StaffModel->find((int)$id);
|
||||
if (!$Staff) {
|
||||
return $this->respond(['status' => 'failed','code' => 200, 'data' => 'Staff not found'], 200);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user