From dcd79d88edb34e0c2862d00fa77cc9f4880b3fae Mon Sep 17 00:00:00 2001 From: PowerChaos Date: Wed, 16 Jul 2025 03:56:50 +0200 Subject: [PATCH 1/2] Update db.sql added not null value to prevent error 500 on CWP when value is null for company currency --- db.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db.sql b/db.sql index 651117df..93af4d99 100644 --- a/db.sql +++ b/db.sql @@ -554,7 +554,7 @@ CREATE TABLE `companies` ( `company_website` varchar(200) DEFAULT NULL, `company_logo` varchar(250) DEFAULT NULL, `company_locale` varchar(200) DEFAULT NULL, - `company_currency` varchar(200) DEFAULT 'USD', + `company_currency` varchar(200) NOT NULL DEFAULT 'USD', `company_tax_id` varchar(200) DEFAULT NULL, `company_created_at` datetime NOT NULL DEFAULT current_timestamp(), `company_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(), From bf68feb7a3373e68ade479e8ea88595b96cf9222 Mon Sep 17 00:00:00 2001 From: PowerChaos Date: Wed, 16 Jul 2025 03:58:35 +0200 Subject: [PATCH 2/2] Update inc_set_timezone.php fixed timezone that does not exist yet in database, so it trows null and now it is hard coded to set a value --- includes/inc_set_timezone.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/inc_set_timezone.php b/includes/inc_set_timezone.php index e81e950f..0519dac8 100644 --- a/includes/inc_set_timezone.php +++ b/includes/inc_set_timezone.php @@ -2,7 +2,14 @@ $result = mysqli_query($mysqli, "SELECT config_timezone FROM settings WHERE company_id = 1"); $row = mysqli_fetch_array($result); -$_SESSION['session_timezone'] = $row['config_timezone']; +$config_timezone = trim($row['config_timezone'] ?? ''); + +// Fallback naar geldige tijdzone als deze leeg of ongeldig is +if (empty($config_timezone) || !in_array($config_timezone, timezone_identifiers_list())) { + $config_timezone = 'Europe/Brussels'; +} + +$_SESSION['session_timezone'] = $config_timezone; // Set PHP timezone date_default_timezone_set($_SESSION['session_timezone']);