This commit is contained in:
wrongecho
2024-09-14 23:43:54 +01:00
parent 6975d6ef44
commit c65db3431d
33 changed files with 211 additions and 293 deletions
+1
View File
@@ -181,3 +181,4 @@ require_once "footer.php";
?> ?>
+4 -4
View File
@@ -16,10 +16,10 @@
<div class="form-group"> <div class="form-group">
<label>Account Type</label> <label>Account Type</label>
<select class="form-control select2" name="type" required> <select class="form-control select2" name="type" required>
<option value="" <?php if ($account_type == NULL) echo "selected"; ?>>- Select -</option> <option value="" <?php if ($account_type == NULL) { echo "selected"; } ?>>- Select -</option>
<option value="1" <?php if ($account_type == 'Assets') echo "selected"; ?>>Assets</option> <option value="1" <?php if ($account_type == 'Assets') { echo "selected"; } ?>>Assets</option>
<option value="2" <?php if ($account_type == 'Liabilities') echo "selected"; ?>>Liabilities</option> <option value="2" <?php if ($account_type == 'Liabilities') { echo "selected"; } ?>>Liabilities</option>
<option value="3" <?php if ($account_type == 'Equity') echo "selected"; ?>>Equity</option> <option value="3" <?php if ($account_type == 'Equity') { echo "selected"; } ?>>Equity</option>
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
+3 -3
View File
@@ -19,9 +19,9 @@
<div class="form-group"> <div class="form-group">
<label>Account Type</label> <label>Account Type</label>
<select class="form-control select2" name="type" required> <select class="form-control select2" name="type" required>
<option value="1" <?php if ($account_parent == 1) echo 'selected'; ?>>Assets</option> <option value="1" <?php if ($account_parent == 1) { echo 'selected'; } ?>>Assets</option>
<option value="2" <?php if ($account_parent == 2) echo 'selected'; ?>>Liabilities</option> <option value="2" <?php if ($account_parent == 2) { echo 'selected'; } ?>>Liabilities</option>
<option value="3" <?php if ($account_parent == 3) echo 'selected'; ?>>Equity</option> <option value="3" <?php if ($account_parent == 3) { echo 'selected'; } ?>>Equity</option>
</select> </select>
</div> </div>
-2
View File
@@ -113,8 +113,6 @@ function fetchDatabaseStructureFromServer() {
} }
} }
//$mysqli->close();
return $tables; return $tables;
} }
-11
View File
@@ -458,17 +458,6 @@ if (isset($_GET['get_client_contacts'])) {
echo json_encode($response); echo json_encode($response);
} }
/*
* Dynamic TOTP "resolver"
* When provided with a TOTP secret, returns a 6-digit code
* // TODO: Check if this can now be removed
*/
if (isset($_GET['get_totp_token'])) {
$otp = TokenAuth6238::getTokenCode(strtoupper($_GET['totp_secret']));
echo json_encode($otp);
}
/* /*
* NEW TOTP getter for client login/passwords page * NEW TOTP getter for client login/passwords page
* When provided with a login ID, checks permissions and returns the 6-digit code * When provided with a login ID, checks permissions and returns the 6-digit code
+2 -2
View File
@@ -7,8 +7,8 @@
*/ */
// Includes // Includes
require_once(__DIR__ . '../../../functions.php'); require_once __DIR__ . '../../../functions.php';
require_once(__DIR__ . "../../../config.php"); require_once __DIR__ . "../../../config.php";
// JSON header // JSON header
header('Content-Type: application/json'); header('Content-Type: application/json');
+1 -1
View File
@@ -50,7 +50,7 @@ $grandTotal = 0;
<div class="form-group"> <div class="form-group">
<select class="form-control" name="year" id="yearSelect" onchange="submit();"> <select class="form-control" name="year" id="yearSelect" onchange="submit();">
<?php foreach ($years as $year): ?> <?php foreach ($years as $year): ?>
<option value="<?php echo $year; ?>" <?php if ($year == $currentYear) echo 'selected'; ?>><?php echo $year; ?></option> <option value="<?php echo $year; ?>" <?php if ($year == $currentYear) { echo 'selected'; } ?>><?php echo $year; ?></option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
+1 -1
View File
@@ -696,7 +696,7 @@ while ($row = mysqli_fetch_array($sql_recurring_expenses)) {
// TELEMETRY // TELEMETRY
if ($config_telemetry > 0 OR $config_telemetry == 2) { if ($config_telemetry > 0 || $config_telemetry == 2) {
$current_version = exec("git rev-parse HEAD"); $current_version = exec("git rev-parse HEAD");
+2 -2
View File
@@ -345,7 +345,7 @@ function createMailboxFolder($client, $folderName) {
} }
// Function to subscribe to a folder in the mailbox // Function to subscribe to a folder in the mailbox
function subscribeMailboxFolder($client, $folder) { function subscribeMailboxFolder($folder) {
if ($folder) { if ($folder) {
try { try {
// Subscribe to the folder // Subscribe to the folder
@@ -378,7 +378,7 @@ $client->connect();
$folder = createMailboxFolder($client, 'ITFlow'); $folder = createMailboxFolder($client, 'ITFlow');
// Subscribe to the "ITFlow" mailbox folder // Subscribe to the "ITFlow" mailbox folder
subscribeMailboxFolder($client, $folder); subscribeMailboxFolder($folder);
// Possible names for the inbox folder // Possible names for the inbox folder
$inboxNames = ['Inbox', 'INBOX', 'inbox']; $inboxNames = ['Inbox', 'INBOX', 'inbox'];
+1 -62
View File
@@ -867,23 +867,6 @@ function roundToNearest15($time)
return number_format($decimalHours, 2); return number_format($decimalHours, 2);
} }
// Get the value of a setting from the database
function getSettingValue($mysqli, $setting_name)
{
//if starts with config_ then get from config table
if (substr($setting_name, 0, 7) == "config_") {
$sql = mysqli_query($mysqli, "SELECT $setting_name FROM settings");
$row = mysqli_fetch_array($sql);
return $row[$setting_name];
} elseif (substr($setting_name, 0, 7) == "company") {
$sql = mysqli_query($mysqli, "SELECT $setting_name FROM companies");
$row = mysqli_fetch_array($sql);
return $row[$setting_name];
} else {
return "Cannot Find Setting Name";
}
}
function getMonthlyTax($tax_name, $month, $year, $mysqli) function getMonthlyTax($tax_name, $month, $year, $mysqli)
{ {
// SQL to calculate monthly tax // SQL to calculate monthly tax
@@ -932,8 +915,7 @@ function getAccountCurrencyCode($mysqli, $account_id)
{ {
$sql = mysqli_query($mysqli, "SELECT account_currency_code FROM accounts WHERE account_id = $account_id"); $sql = mysqli_query($mysqli, "SELECT account_currency_code FROM accounts WHERE account_id = $account_id");
$row = mysqli_fetch_array($sql); $row = mysqli_fetch_array($sql);
$account_currency_code = nullable_htmlentities($row['account_currency_code']); return nullable_htmlentities($row['account_currency_code']);
return $account_currency_code;
} }
function calculateAccountBalance($mysqli, $account_id) function calculateAccountBalance($mysqli, $account_id)
@@ -1059,32 +1041,6 @@ function addToMailQueue($mysqli, $data) {
return true; return true;
} }
function calculateInvoiceBalance($mysqli, $invoice_id)
{
$invoice_id_int = intval($invoice_id);
$sql_invoice = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_id = $invoice_id_int");
$row = mysqli_fetch_array($sql_invoice);
$invoice_amount = floatval($row['invoice_amount']);
$sql_payments = mysqli_query(
$mysqli,
"SELECT SUM(payment_amount) AS total_payments FROM payments
WHERE payment_invoice_id = $invoice_id
"
);
$row = mysqli_fetch_array($sql_payments);
$total_payments = floatval($row['total_payments']);
$balance = $invoice_amount - $total_payments;
if ($balance == '') {
$balance = '0.00';
}
return $balance;
}
function createiCalStr($datetime, $title, $description, $location) function createiCalStr($datetime, $title, $description, $location)
{ {
require_once "plugins/zapcal/zapcallib.php"; require_once "plugins/zapcal/zapcallib.php";
@@ -1148,21 +1104,6 @@ function createiCalStrCancel($originaliCalStr) {
return $cal_event->export(); return $cal_event->export();
} }
function getTicketStatusColor($ticket_status) {
global $mysqli;
$status_id = intval($ticket_status);
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT ticket_status_color FROM ticket_statuses WHERE ticket_status_id = $status_id LIMIT 1"));
if ($row) {
return nullable_htmlentities($row['ticket_status_color']);
}
// Default return
return "Unknown";
}
function getTicketStatusName($ticket_status) { function getTicketStatusName($ticket_status) {
global $mysqli; global $mysqli;
@@ -1196,7 +1137,6 @@ function fetchUpdates() {
} }
$updates = new stdClass(); $updates = new stdClass();
$updates->output = $output; $updates->output = $output;
$updates->result = $result; $updates->result = $result;
@@ -1205,7 +1145,6 @@ function fetchUpdates() {
$updates->update_message = $update_message; $updates->update_message = $update_message;
return $updates; return $updates;
} }
-7
View File
@@ -2,13 +2,6 @@
require_once 'guest_header.php'; require_once 'guest_header.php';
function log_to_console($message) {
$message = date("H:i:s") . " - $message - ".PHP_EOL;
print($message);
flush();
ob_flush();
}
// Define wording // Define wording
DEFINE("WORDING_PAYMENT_FAILED", "<br><h2>There was an error verifying your payment. Please contact us for more information before attempting payment again.</h2>"); DEFINE("WORDING_PAYMENT_FAILED", "<br><h2>There was an error verifying your payment. Please contact us for more information before attempting payment again.</h2>");
-1
View File
@@ -59,7 +59,6 @@ if ($total_found_rows > 5) {
$next_class = "disabled"; $next_class = "disabled";
} }
$get_copy = $_GET; // create a copy of the $_GET array $get_copy = $_GET; // create a copy of the $_GET array
//unset($get_copy['page']);
// Unset Array Var to prevent Duplicate Get VARs // Unset Array Var to prevent Duplicate Get VARs
unset($get_copy['page']); unset($get_copy['page']);
$url_query_strings_page = http_build_query($get_copy); $url_query_strings_page = http_build_query($get_copy);
+1 -4
View File
@@ -18,10 +18,7 @@ header("X-Frame-Options: DENY"); // Legacy
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">
<!-- <!-- Favicon: If Fav Icon exists, else use the default one -->
Favicon
If Fav Icon exists else use the default one
-->
<?php if (file_exists('../uploads/favicon.ico')) { ?> <?php if (file_exists('../uploads/favicon.ico')) { ?>
<link rel="icon" type="image/x-icon" href="../uploads/favicon.ico"> <link rel="icon" type="image/x-icon" href="../uploads/favicon.ico">
<?php } ?> <?php } ?>
+1 -1
View File
@@ -335,7 +335,7 @@ if (isset($_GET['delete_custom_link'])) {
mysqli_query($mysqli,"DELETE FROM custom_links WHERE custom_link_id = $custom_link_id"); mysqli_query($mysqli,"DELETE FROM custom_links WHERE custom_link_id = $custom_link_id");
//Logging //Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Tag', log_action = '$session_name Deleted custom link', log_description = '$tag_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Custom Link', log_action = 'Delete', log_description = '$session_name deleted a custom link', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
$_SESSION['alert_message'] = "Cusatom Link deleted!"; $_SESSION['alert_message'] = "Cusatom Link deleted!";
$_SESSION['alert_type'] = "error"; $_SESSION['alert_type'] = "error";
+8 -6
View File
@@ -55,11 +55,13 @@
HAVING HAVING
balance > 0 AND months_behind >= 2 balance > 0 AND months_behind >= 2
ORDER BY ORDER BY
months_behind DESC;"; months_behind DESC";
$result_client_balance_report = mysqli_query($mysqli, $sql_client_balance_report); $result_client_balance_report = mysqli_query($mysqli, $sql_client_balance_report);
//get currency format from settings $currency_row = mysqli_fetch_array(mysqli_query($mysqli,"SELECT company_currency FROM companies WHERE company_id = 1"));
$config_currency_code = getSettingValue($mysqli, "company_currency"); $company_currency = nullable_htmlentities($currency_row['company_currency']);
?> ?>
<div class="card card-dark"> <div class="card card-dark">
@@ -102,9 +104,9 @@
$behind_amount = floatval($row['behind_amount']); $behind_amount = floatval($row['behind_amount']);
$months_behind = number_format($row['months_behind']); $months_behind = number_format($row['months_behind']);
$formatted_balance = numfmt_format_currency($currency_format, $balance, $config_currency_code); $formatted_balance = numfmt_format_currency($currency_format, $balance, $company_currency);
$formatted_recurring_monthly_total = numfmt_format_currency($currency_format, $recurring_monthly_total, $config_currency_code); $formatted_recurring_monthly_total = numfmt_format_currency($currency_format, $recurring_monthly_total, $company_currency);
$formatted_behind_amount = numfmt_format_currency($currency_format, $behind_amount, $config_currency_code); $formatted_behind_amount = numfmt_format_currency($currency_format, $behind_amount, $company_currency);
echo "<tr>"; echo "<tr>";
echo "<td><a href='client_statement.php?client_id=$client_id'>$client_name</a></td>"; echo "<td><a href='client_statement.php?client_id=$client_id'>$client_name</a></td>";
+3 -3
View File
@@ -23,7 +23,8 @@ $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS domains.*,
LEFT JOIN vendors AS webhost ON domains.domain_webhost = webhost.vendor_id LEFT JOIN vendors AS webhost ON domains.domain_webhost = webhost.vendor_id
WHERE domain_archived_at IS NULL WHERE domain_archived_at IS NULL
AND (domain_name LIKE '%$q%' OR domain_description LIKE '%$q%' OR registrar.vendor_name LIKE '%$q%' OR dnshost.vendor_name LIKE '%$q%' OR mailhost.vendor_name LIKE '%$q%' OR webhost.vendor_name LIKE '%$q%' OR client_name LIKE '%$q%') AND (domain_name LIKE '%$q%' OR domain_description LIKE '%$q%' OR registrar.vendor_name LIKE '%$q%' OR dnshost.vendor_name LIKE '%$q%' OR mailhost.vendor_name LIKE '%$q%' OR webhost.vendor_name LIKE '%$q%' OR client_name LIKE '%$q%')
ORDER BY $sort $order LIMIT $record_from, $record_to"); ORDER BY $sort $order LIMIT $record_from, $record_to"
);
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
@@ -148,7 +149,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div> </div>
</td> </td>
<td> <td>
<a class="text-dark" href="#" data-toggle="modal" onclick="populateDomainEditModal(<?php echo $client_id, ",", $domain_id ?>)" data-target="#editDomainModal"> <a class="text-dark">
<div class="media"> <div class="media">
<i class="fa fa-fw fa-2x fa-globe mr-3"></i> <i class="fa fa-fw fa-2x fa-globe mr-3"></i>
<div class="media-body"> <div class="media-body">
@@ -203,7 +204,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div> </div>
</div> </div>
<script src="js/domain_edit_modal.js"></script>
<script src="js/bulk_actions.js"></script> <script src="js/bulk_actions.js"></script>
<?php require_once "footer.php"; <?php require_once "footer.php";
+3 -4
View File
@@ -7,15 +7,14 @@ validateAccountantRole();
$year = isset($_GET['year']) ? intval($_GET['year']) : date('Y'); $year = isset($_GET['year']) ? intval($_GET['year']) : date('Y');
$view = isset($_GET['view']) ? $_GET['view'] : 'quarterly'; $view = isset($_GET['view']) ? $_GET['view'] : 'quarterly';
$company_currency = getSettingValue($mysqli, 'company_currency');
$currency_row = mysqli_fetch_array(mysqli_query($mysqli,"SELECT company_currency FROM companies WHERE company_id = 1"));
$company_currency = nullable_htmlentities($currency_row['company_currency']);
// GET unique years from expenses, payments and revenues // GET unique years from expenses, payments and revenues
$sql_all_years = mysqli_query($mysqli, "SELECT DISTINCT(YEAR(item_created_at)) AS all_years FROM invoice_items ORDER BY all_years DESC"); $sql_all_years = mysqli_query($mysqli, "SELECT DISTINCT(YEAR(item_created_at)) AS all_years FROM invoice_items ORDER BY all_years DESC");
$sql_tax = mysqli_query($mysqli, $sql_tax = mysqli_query($mysqli, "SELECT `tax_name` FROM `taxes`");
"SELECT `tax_name`
FROM `taxes`");
?> ?>
+1 -1
View File
@@ -121,7 +121,7 @@
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="domains.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "domains.php") { echo "active"; } ?>"> <a href="report_domains.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "report_domains.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-globe"></i> <i class="nav-icon fas fa-globe"></i>
<p>All Domains</p> <p>All Domains</p>
</a> </a>
+3 -2
View File
@@ -20,6 +20,8 @@ if (isset($_GET['status']) && is_array($_GET['status']) && !empty($_GET['status'
$sanitizedStatusesString = implode(",", $sanitizedStatuses); $sanitizedStatusesString = implode(",", $sanitizedStatuses);
$ticket_status_snippet = "ticket_status IN ($sanitizedStatusesString)"; $ticket_status_snippet = "ticket_status IN ($sanitizedStatusesString)";
var_dump($status);
} else { } else {
if (isset($_GET['status']) && ($_GET['status']) == 'Closed') { if (isset($_GET['status']) && ($_GET['status']) == 'Closed') {
@@ -27,7 +29,7 @@ if (isset($_GET['status']) && is_array($_GET['status']) && !empty($_GET['status'
$ticket_status_snippet = "ticket_resolved_at IS NOT NULL"; $ticket_status_snippet = "ticket_resolved_at IS NOT NULL";
} else { } else {
// Default - Show open tickets // Default - Show open tickets
$status = 'Open'; $status = 2;
$ticket_status_snippet = "ticket_resolved_at IS NULL"; $ticket_status_snippet = "ticket_resolved_at IS NULL";
} }
} }
@@ -125,7 +127,6 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
</div> </div>
<div class="card-body"> <div class="card-body">
<form autocomplete="off"> <form autocomplete="off">
<input type="hidden" name="status" value="<?php echo $status; ?>">
<div class="row"> <div class="row">
<div class="col-sm-4"> <div class="col-sm-4">
<div class="input-group"> <div class="input-group">