mirror of
https://github.com/itflow-org/itflow
synced 2026-03-03 12:24:51 +00:00
Fix if Tables doesnt exist dont break script
This commit is contained in:
@@ -69,16 +69,18 @@ $currency_format = numfmt_create($session_company_locale, NumberFormatter::CURRE
|
|||||||
|
|
||||||
|
|
||||||
// Get User Client Access Permissions
|
// Get User Client Access Permissions
|
||||||
$user_client_access_sql = mysqli_query($mysqli, "SELECT client_id FROM user_permissions WHERE user_id = $session_user_id");
|
$user_client_access_sql = "SELECT client_id FROM user_permissions WHERE user_id = $session_user_id";
|
||||||
|
$user_client_access_result = mysqli_query($mysqli, $user_client_access_sql);
|
||||||
|
|
||||||
$access_client_ids = [];
|
$access_client_ids = [];
|
||||||
if ($user_client_access_sql) { // This ensures the codes wont break if user_permissions table does not exist. This can be removed once all ITFlow instances are updated
|
if ($user_client_access_result) {
|
||||||
while($row = mysqli_fetch_assoc($user_client_access_sql)) {
|
while($row = mysqli_fetch_assoc($user_client_access_result)) {
|
||||||
$access_client_ids[] = $row['client_id'];
|
$access_client_ids[] = $row['client_id'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Handle error in query execution (e.g., table doesn't exist)
|
// Log the error and set access client IDs to an empty array
|
||||||
error_log('Error fetching client IDs: ' . mysqli_error($mysqli));
|
error_log('Error fetching client IDs: ' . mysqli_error($mysqli));
|
||||||
|
$access_client_ids = []; // Ensure the array is empty and defined
|
||||||
}
|
}
|
||||||
|
|
||||||
$client_access_string = implode(',', $access_client_ids);
|
$client_access_string = implode(',', $access_client_ids);
|
||||||
@@ -90,6 +92,7 @@ if ($session_user_role < 3 && !empty($client_access_string)) {
|
|||||||
$access_permission_query = "";
|
$access_permission_query = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Include the settings vars
|
// Include the settings vars
|
||||||
require_once "get_settings.php";
|
require_once "get_settings.php";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user