From 44508cfa7c15409347b4ebcfc9cc0128e916ca05 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Thu, 7 Sep 2023 15:22:16 -0400 Subject: [PATCH] Moved Company Details settings localiztion settings to its own seperate settings called localiztion --- post/setting.php | 20 ++++++++- post/setting_company_model.php | 2 - settings_company.php | 30 ------------- settings_localization.php | 59 ++++++++++++++++++++++++ settings_side_nav.php | 82 +++++++++++++++++++--------------- 5 files changed, 123 insertions(+), 70 deletions(-) create mode 100644 settings_localization.php diff --git a/post/setting.php b/post/setting.php index bb571458..ca76f778 100644 --- a/post/setting.php +++ b/post/setting.php @@ -39,7 +39,7 @@ if (isset($_POST['edit_company'])) { } } - 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_locale = '$locale', company_currency = '$currency_code' 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' 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"); @@ -50,6 +50,24 @@ if (isset($_POST['edit_company'])) { } +if (isset($_POST['edit_localization'])) { + + validateAdminRole(); + + $locale = sanitizeInput($_POST['locale']); + $currency_code = sanitizeInput($_POST['currency_code']); + + mysqli_query($mysqli,"UPDATE companies SET company_locale = '$locale', company_currency = '$currency_code' WHERE company_id = 1"); + + //Logging + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Company', log_action = 'Edit', log_description = '$session_name edited company $name localization settings', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); + + $_SESSION['alert_message'] = "Company localization updated"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} + if (isset($_POST['edit_mail_smtp_settings'])) { validateAdminRole(); diff --git a/post/setting_company_model.php b/post/setting_company_model.php index 49154caa..6ca8a801 100644 --- a/post/setting_company_model.php +++ b/post/setting_company_model.php @@ -8,5 +8,3 @@ $country = sanitizeInput($_POST['country']); $phone = preg_replace("/[^0-9]/", '',$_POST['phone']); $email = sanitizeInput($_POST['email']); $website = sanitizeInput($_POST['website']); -$locale = sanitizeInput($_POST['locale']); -$currency_code = sanitizeInput($_POST['currency_code']); diff --git a/settings_company.php b/settings_company.php index 8acd297f..61e6ddff 100644 --- a/settings_company.php +++ b/settings_company.php @@ -134,36 +134,6 @@ $company_initials = nullable_htmlentities(initials($company_name)); -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
-
diff --git a/settings_localization.php b/settings_localization.php new file mode 100644 index 00000000..2d8b0ff3 --- /dev/null +++ b/settings_localization.php @@ -0,0 +1,59 @@ + + +
+
+

Localization

+
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ + + +
+
+
+ + + + + + + + + + + + + + @@ -170,14 +214,6 @@ - - - - - - - - -