mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 03:14:52 +00:00
DB Update add User settings to enable / disable Dashboard Items Financial and Technical
This commit is contained in:
@@ -44,6 +44,8 @@ if ($session_user_role == 3) {
|
|||||||
}
|
}
|
||||||
$session_user_config_force_mfa = intval($row['user_config_force_mfa']);
|
$session_user_config_force_mfa = intval($row['user_config_force_mfa']);
|
||||||
$user_config_records_per_page = intval($row['user_config_records_per_page']);
|
$user_config_records_per_page = intval($row['user_config_records_per_page']);
|
||||||
|
$user_config_dashboard_financial_enable = intval($row['user_config_dashboard_financial_enable']);
|
||||||
|
$user_config_dashboard_technical_enable = intval($row['user_config_dashboard_technical_enable']);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE settings.company_id = companies.company_id AND companies.company_id = 1");
|
$sql = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE settings.company_id = companies.company_id AND companies.company_id = 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
|
|||||||
@@ -7,12 +7,16 @@ if (isset($_GET['year'])) {
|
|||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['show_financial']) == 1) {
|
if (isset($_GET['enable_financial']) == 1) {
|
||||||
$show_financial = 1;
|
mysqli_query($mysqli, "UPDATE user_settings SET user_config_dashboard_financial_enable = 1 WHERE user_id = $session_user_id");
|
||||||
|
} else {
|
||||||
|
mysqli_query($mysqli, "UPDATE user_settings SET user_config_dashboard_financial_enable = 0 WHERE user_id = $session_user_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['show_technical']) == 1) {
|
if (isset($_GET['enable_technical']) == 1) {
|
||||||
$show_technical = 1;
|
mysqli_query($mysqli, "UPDATE user_settings SET user_config_dashboard_technical_enable = 1 WHERE user_id = $session_user_id");
|
||||||
|
} else {
|
||||||
|
mysqli_query($mysqli, "UPDATE user_settings SET user_config_dashboard_technical_enable = 0 WHERE user_id = $session_user_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
//GET unique years from expenses, payments invoices and revenues
|
//GET unique years from expenses, payments invoices and revenues
|
||||||
@@ -50,14 +54,14 @@ $sql_years_select = mysqli_query(
|
|||||||
|
|
||||||
<?php if ($session_user_role == 1 || $session_user_role == 3 && $config_module_enable_accounting == 1) { ?>
|
<?php if ($session_user_role == 1 || $session_user_role == 3 && $config_module_enable_accounting == 1) { ?>
|
||||||
<div class="custom-control custom-switch mr-sm-3 mb-3">
|
<div class="custom-control custom-switch mr-sm-3 mb-3">
|
||||||
<input type="checkbox" onchange="this.form.submit()" class="custom-control-input" id="customSwitch1" name="show_financial" value="1" <?php if($show_financial == 1) { echo "checked"; } ?>>
|
<input type="checkbox" onchange="this.form.submit()" class="custom-control-input" id="customSwitch1" name="enable_financial" value="1" <?php if($user_config_dashboard_financial_enable == 1) { echo "checked"; } ?>>
|
||||||
<label class="custom-control-label" for="customSwitch1">Toggle Financial</label>
|
<label class="custom-control-label" for="customSwitch1">Toggle Financial</label>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($session_user_role >= 2 && $config_module_enable_ticketing == 1) { ?>
|
<?php if ($session_user_role >= 2 && $config_module_enable_ticketing == 1) { ?>
|
||||||
<div class="custom-control custom-switch mb-3">
|
<div class="custom-control custom-switch mb-3">
|
||||||
<input type="checkbox" onchange="this.form.submit()" class="custom-control-input" id="customSwitch2" name="show_technical" value="1" <?php if($show_technical == 1) { echo "checked"; } ?>>
|
<input type="checkbox" onchange="this.form.submit()" class="custom-control-input" id="customSwitch2" name="enable_technical" value="1" <?php if($user_config_dashboard_technical_enable == 1) { echo "checked"; } ?>>
|
||||||
<label class="custom-control-label" for="customSwitch2">Toggle Technical</label>
|
<label class="custom-control-label" for="customSwitch2">Toggle Technical</label>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -66,7 +70,7 @@ $sql_years_select = mysqli_query(
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ($show_financial == 1) {
|
if ($user_config_dashboard_financial_enable == 1) {
|
||||||
|
|
||||||
// Enforce accountant / admin role for the financial dashboard
|
// Enforce accountant / admin role for the financial dashboard
|
||||||
if ($_SESSION['user_role'] != 3 && $_SESSION['user_role'] != 1) {
|
if ($_SESSION['user_role'] != 3 && $_SESSION['user_role'] != 1) {
|
||||||
@@ -528,7 +532,7 @@ $vendors_added = intval($row['vendors_added']);
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ($show_technical == 1) {
|
if ($user_config_dashboard_technical_enable == 1) {
|
||||||
|
|
||||||
// Get Total Clients added
|
// Get Total Clients added
|
||||||
$sql_clients = mysqli_fetch_assoc(mysqli_query(
|
$sql_clients = mysqli_fetch_assoc(mysqli_query(
|
||||||
|
|||||||
@@ -1515,14 +1515,23 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.7'");
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.7'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CURRENT_DATABASE_VERSION == '0.9.7') {
|
||||||
|
// Insert queries here required to update to DB version 0.9.8
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `user_settings` ADD `user_config_dashboard_financial_enable` TINYINT(1) NOT NULL DEFAULT 0 AFTER `user_config_records_per_page`");
|
||||||
|
mysqli_query($mysqli, "ALTER TABLE `user_settings` ADD `user_config_dashboard_technical_enable` TINYINT(1) NOT NULL DEFAULT 0 AFTER `user_config_dashboard_financial_enable`");
|
||||||
|
//set all invoice id
|
||||||
|
// Then, update the database to the next sequential version
|
||||||
|
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.8'");
|
||||||
|
}
|
||||||
|
|
||||||
// Be sure to change database_version.php to reflect the version you are updating to here
|
// 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.
|
// 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
|
// Uncomment Below Lines, to add additional database updates
|
||||||
//
|
//
|
||||||
// if (CURRENT_DATABASE_VERSION == '0.9.7') {
|
// if (CURRENT_DATABASE_VERSION == '0.9.8') {
|
||||||
// // Insert queries here required to update to DB version 0.9.8
|
// // Insert queries here required to update to DB version 0.9.9
|
||||||
// // Then, update the database to the next sequential version
|
// // Then, update the database to the next sequential version
|
||||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.8'");
|
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.9'");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -5,5 +5,5 @@
|
|||||||
* It is used in conjunction with database_updates.php
|
* It is used in conjunction with database_updates.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEFINE("LATEST_DATABASE_VERSION", "0.9.7");
|
DEFINE("LATEST_DATABASE_VERSION", "0.9.8");
|
||||||
|
|
||||||
|
|||||||
4
db.sql
4
db.sql
@@ -1637,6 +1637,8 @@ CREATE TABLE `user_settings` (
|
|||||||
`user_config_remember_me_token` varchar(255) DEFAULT NULL,
|
`user_config_remember_me_token` varchar(255) DEFAULT NULL,
|
||||||
`user_config_force_mfa` tinyint(1) NOT NULL DEFAULT 0,
|
`user_config_force_mfa` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
`user_config_records_per_page` int(11) NOT NULL DEFAULT 10,
|
`user_config_records_per_page` int(11) NOT NULL DEFAULT 10,
|
||||||
|
`user_config_dashboard_financial_enable` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
|
`user_config_dashboard_technical_enable` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (`user_id`)
|
PRIMARY KEY (`user_id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
@@ -1749,4 +1751,4 @@ CREATE TABLE `vendors` (
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
-- Dump completed on 2023-12-01 11:52:50
|
-- Dump completed on 2023-12-21 16:35:50
|
||||||
|
|||||||
Reference in New Issue
Block a user