Feature: Added Start Page functionality

This commit is contained in:
johnnyq 2023-08-16 13:23:30 -04:00
parent f93dc32241
commit fda0d203ed
6 changed files with 26 additions and 12 deletions

View File

@ -1180,11 +1180,18 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.6.6'");
}
//if (CURRENT_DATABASE_VERSION == '0.6.6') {
//Insert queries here required to update to DB version 0.6.7
if (CURRENT_DATABASE_VERSION == '0.6.6') {
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_start_page` VARCHAR(200) DEFAULT 'clients.php' AFTER `config_current_database_version`");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.6.7'");
}
//if (CURRENT_DATABASE_VERSION == '0.6.7') {
//Insert queries here required to update to DB version 0.6.8
// Then, update the database to the next sequential version
//mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.6.7'");
//mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.6.8'");
//}
} else {

View File

@ -5,4 +5,4 @@
* It is used in conjunction with database_updates.php
*/
DEFINE("LATEST_DATABASE_VERSION", "0.6.6");
DEFINE("LATEST_DATABASE_VERSION", "0.6.7");

View File

@ -27,6 +27,7 @@ $config_imap_username = $row['config_imap_username'];
$config_imap_password = $row['config_imap_password'];
// Defaults
$config_start_page = $row['config_start_page'];
$config_default_transfer_from_account = intval($row['config_default_transfer_from_account']);
$config_default_transfer_to_account = intval($row['config_default_transfer_to_account']);
$config_default_payment_account = intval($row['config_default_payment_account']);

View File

@ -36,6 +36,7 @@ $row = mysqli_fetch_array($sql_settings);
// Company info
$company_name = $row['company_name'];
$company_logo = $row['company_logo'];
$config_start_page = nullable_htmlentities($row['config_start_page']);
// Mail
$config_smtp_host = $row['config_smtp_host'];
@ -165,13 +166,7 @@ if (isset($_POST['login'])) {
}
}
// Show start page/dashboard depending on role
if ($row['user_role'] == 2) {
header("Location: dashboard_technical.php");
} else {
header("Location: dashboard_financial.php");
}
header("Location: $config_start_page");
} else {

View File

@ -223,6 +223,7 @@ if (isset($_POST['edit_default_settings'])) {
validateAdminRole();
$start_page = sanitizeInput($_POST['start_page']);
$expense_account = intval($_POST['expense_account']);
$payment_account = intval($_POST['payment_account']);
$payment_method = sanitizeInput($_POST['payment_method']);
@ -232,7 +233,7 @@ if (isset($_POST['edit_default_settings'])) {
$calendar = intval($_POST['calendar']);
$net_terms = intval($_POST['net_terms']);
mysqli_query($mysqli,"UPDATE settings SET config_default_expense_account = $expense_account, config_default_payment_account = $payment_account, config_default_payment_method = '$payment_method', config_default_expense_payment_method = '$expense_payment_method', config_default_transfer_from_account = $transfer_from_account, config_default_transfer_to_account = $transfer_to_account, config_default_calendar = $calendar, config_default_net_terms = $net_terms WHERE company_id = 1");
mysqli_query($mysqli,"UPDATE settings SET config_start_page = '$start_page', config_default_expense_account = $expense_account, config_default_payment_account = $payment_account, config_default_payment_method = '$payment_method', config_default_expense_payment_method = '$expense_payment_method', config_default_transfer_from_account = $transfer_from_account, config_default_transfer_to_account = $transfer_to_account, config_default_calendar = $calendar, config_default_net_terms = $net_terms WHERE company_id = 1");
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name modified default settings', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");

View File

@ -9,6 +9,16 @@ require_once("inc_all_settings.php"); ?>
<div class="card-body">
<form action="post.php" method="post" autocomplete="off">
<div class="form-group">
<label>Start Page</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-home"></i></span>
</div>
<input type="text" class="form-control" name="start_page" value="<?php echo nullable_htmlentities($config_start_page); ?>">
</div>
</div>
<div class="form-group">
<label>Transfer From Account</label>
<div class="input-group">