Skip to content

setup.php fix #1230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
9 changes: 8 additions & 1 deletion includes/inc_set_timezone.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down