From 8ab8df671a81d8b4f0a4d13a8d52e471563a03ed Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Fri, 23 Jan 2026 15:54:08 +0000 Subject: [PATCH] fixed error - Error saving job statuses --- includes/helpers.php | 8 ++++---- index.php | 6 +++--- job_detail.php | 4 ++-- onboarding.php | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/includes/helpers.php b/includes/helpers.php index d436020..0e102f7 100644 --- a/includes/helpers.php +++ b/includes/helpers.php @@ -1,7 +1,7 @@ prepare("INSERT INTO activity_logs (job_id, company_id, user_id, user_name, event_type, field_name, old_value, new_value) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->execute([ @@ -206,4 +206,4 @@ function deleteJobFile($file_id, $job_id, $company_id) { $pdo->rollBack(); return ['success' => FALSE, 'message' => 'Database error: ' . $e->getMessage()]; } -} +} \ No newline at end of file diff --git a/index.php b/index.php index 6088ff5..2c12723 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ require_once 'includes/helpers.php'; // Get current user and company ID -$user = get_current_user(); +$user = getCurrentAppUser(); // If no user or company ID, redirect to a login/error page (to be implemented later) if (!$user || !($company_id = get_current_company_id())) { @@ -73,7 +73,7 @@ $clients = getClients($company_id);
Repairs Pro
- +
@@ -185,4 +185,4 @@ $clients = getClients($company_id); - + \ No newline at end of file diff --git a/job_detail.php b/job_detail.php index 033d9ee..f9e55d8 100644 --- a/job_detail.php +++ b/job_detail.php @@ -1,6 +1,6 @@ - \ No newline at end of file + diff --git a/onboarding.php b/onboarding.php index 6778d8c..8f6ae06 100644 --- a/onboarding.php +++ b/onboarding.php @@ -3,7 +3,7 @@ require_once __DIR__ . '/includes/helpers.php'; // Placeholder for company ID - in a real app, this would come from the session after login $company_id = get_current_company_id(); -$current_user = get_current_user(); +$current_user = getCurrentAppUser(); if (!$company_id) { // Redirect to login or error page if no company is identified @@ -45,7 +45,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $insert_stmt = $pdo->prepare("INSERT INTO job_statuses (company_id, name, is_default) VALUES (?, ?, ?)"); foreach ($statuses as $index => $status_name) { - $is_default = ($index == $default_status_index); + $is_default = (int)($index == $default_status_index); // Explicitly cast to int (0 or 1) $insert_stmt->execute([$company_id, $status_name, $is_default]); } @@ -259,4 +259,4 @@ if (isset($_GET['message'])) { - + \ No newline at end of file