diff --git a/check_login.php b/check_login.php index 4549c857a..df99616e7 100644 --- a/check_login.php +++ b/check_login.php @@ -52,10 +52,10 @@ $session_company_country = $row['company_country']; $session_company_locale = $row['company_locale']; $session_company_currency = $row['company_currency']; -$session_timezone = $row['settings_timezone']; +$session_timezone = $row['company_timezone']; // Set Timezone to the companies timezone -date_default_timezone_set('$session_timezone'); +date_default_timezone_set($session_timezone); //Set Currency Format $currency_format = numfmt_create($session_company_locale, NumberFormatter::CURRENCY); diff --git a/database_updates.php b/database_updates.php index 8407e94ca..f4a9157e0 100644 --- a/database_updates.php +++ b/database_updates.php @@ -1405,11 +1405,23 @@ // Please add this same comment block to the bottom of this file, and update the version number. // Uncomment Below Lines, to add additional database updates // - //if (CURRENT_DATABASE_VERSION == '0.8.8') { + if (CURRENT_DATABASE_VERSION == '0.8.8') { // Insert queries here required to update to DB version 0.8.9 + mysqli_query($mysqli, "ALTER TABLE `companies` ADD `company_timezone` VARCHAR(200) NULL DEFAULT NULL AFTER `company_phone`"); + // Then, update the database to the next sequential version + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.8.9'"); + } + // + + // Be sure to change database_version.php to reflect the version you are updating to here + // Please add this same comment block to the bottom of this file, and update the version number. + // Uncomment Below Lines, to add additional database updates + // + //if (CURRENT_DATABASE_VERSION == '0.8.9') { + // Insert queries here required to update to DB version 0.8.10 // // Then, update the database to the next sequential version - //mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.8.9'"); + //mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.8.10'"); //} // diff --git a/db.sql b/db.sql index a3ea42410..2920e09ed 100644 --- a/db.sql +++ b/db.sql @@ -303,6 +303,7 @@ CREATE TABLE `companies` ( `company_zip` varchar(200) DEFAULT NULL, `company_country` varchar(200) DEFAULT NULL, `company_phone` varchar(200) DEFAULT NULL, + `company_timezone` varchar(200) DEFAULT NULL, `company_email` varchar(200) DEFAULT NULL, `company_website` varchar(200) DEFAULT NULL, `company_logo` varchar(250) DEFAULT NULL, diff --git a/post/setting.php b/post/setting.php index 88382214a..869cc73d3 100644 --- a/post/setting.php +++ b/post/setting.php @@ -13,6 +13,16 @@ $sql = mysqli_query($mysqli,"SELECT company_logo FROM companies WHERE company_id = 1"); $row = mysqli_fetch_array($sql); $existing_file_name = sanitizeInput($row['company_logo']); + $name = sanitizeInput($_POST['name']); + $address = sanitizeInput($_POST['address']); + $city = sanitizeInput($_POST['city']); + $state = sanitizeInput($_POST['state']); + $zip = sanitizeInput($_POST['zip']); + $country = sanitizeInput($_POST['country']); + $phone = sanitizeInput($_POST['phone']); + $email = sanitizeInput($_POST['email']); + $website = sanitizeInput($_POST['website']); + $timezone = sanitizeInput($_POST['timezone']); // Check to see if a file is attached if ($_FILES['file']['tmp_name'] != '') { @@ -39,7 +49,7 @@ } } - mysqli_query($mysqli,"UPDATE companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website' WHERE company_id = 1"); + mysqli_query($mysqli,"UPDATE companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website', company_timezone = '$timezone' WHERE company_id = 1"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Company', log_action = 'Modify', log_description = '$session_name modified company $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); diff --git a/settings_company.php b/settings_company.php index 61e6ddff3..d1f8c4668 100644 --- a/settings_company.php +++ b/settings_company.php @@ -17,9 +17,12 @@ $company_logo = nullable_htmlentities($row['company_logo']); $company_locale = nullable_htmlentities($row['company_locale']); $company_currency = nullable_htmlentities($row['company_currency']); - +$company_timezone = nullable_htmlentities($row['company_timezone']); $company_initials = nullable_htmlentities(initials($company_name)); +$timezones = DateTimeZone::listIdentifiers(); + + ?>
@@ -104,6 +107,26 @@
+ + +
+ +
+
+ + +
+ +
+
+ + +
diff --git a/setup.php b/setup.php index ade3c930c..1ca5ce96a 100644 --- a/setup.php +++ b/setup.php @@ -960,7 +960,7 @@ $currency_code = sanitizeInput($_POST['currency_code']); $timezone = sanitizeInput($_POST['timezone']); - mysqli_query($mysqli,"INSERT INTO companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website', company_locale = '$locale', company_currency = '$currency_code'"); + mysqli_query($mysqli,"INSERT INTO companies SET company_name = '$name', company_address = '$address', company_city = '$city', company_state = '$state', company_zip = '$zip', company_country = '$country', company_phone = '$phone', company_email = '$email', company_website = '$website', company_locale = '$locale', company_currency = '$currency_code', company_timezone = '$timezone'"); //Check to see if a file is attached if ($_FILES['file']['tmp_name'] != '') {