Simplified Client URL Handling in global client header logic

This commit is contained in:
johnnyq
2025-02-19 15:58:43 -05:00
parent a2c77cf0c2
commit 2fe8adcfca
11 changed files with 69 additions and 45 deletions

View File

@@ -8,9 +8,11 @@ $order = "DESC";
if (isset($_GET['client_id'])) {
require_once "includes/inc_all_client.php";
$client_query = "AND invoice_client_id = $client_id";
$client_url = "client_id=$client_id&";
} else {
require_once "includes/inc_all.php";
$client_query = '';
$client_url = '';
}
// Perms
@@ -69,7 +71,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="card-body">
<form class="mb-4" autocomplete="off">
<?php if(isset($_GET['client_id'])) { ?>
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<div class="row">
@@ -174,7 +176,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
Invoice <?php if ($sort == 'invoice_number') { echo $order_icon; } ?>
</a>
</th>
<?php if(!isset($_GET['client_id'])) { ?>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
@@ -246,8 +248,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<tr>
<td><?php echo $payment_date; ?></td>
<td><?php echo $invoice_date; ?></td>
<td><a href="invoice.php?invoice_id=<?php echo $invoice_id; ?><?php if (isset($_GET['client_id'])) { echo "&client_id=$client_id"; } ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></td>
<?php if(!isset($_GET['client_id'])) { ?>
<td>
<a href="invoice.php?<?php echo $client_url; ?>invoice_id=<?php echo $invoice_id; ?>">
<?php echo "$invoice_prefix$invoice_number"; ?>
</a>
</td>
<?php if (!$client_url) { ?>
<td><a href="payments.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
<?php } ?>
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code); ?></td>