- Only show the options to edit quotes/invoices if they aren't finalized/paid
- General tidy
This commit is contained in:
+14
-8
@@ -6,7 +6,9 @@ if (isset($_GET['invoice_id'])) {
|
||||
|
||||
$invoice_id = intval($_GET['invoice_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoices
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM invoices
|
||||
LEFT JOIN clients ON invoice_client_id = client_id
|
||||
LEFT JOIN locations ON primary_location = location_id
|
||||
LEFT JOIN contacts ON primary_contact = contact_id
|
||||
@@ -15,8 +17,10 @@ if (isset($_GET['invoice_id'])) {
|
||||
);
|
||||
|
||||
if (mysqli_num_rows($sql) == 0) {
|
||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1></center>";
|
||||
} else {
|
||||
echo '<h1 class="text-secondary mt-5" style="text-align: center">Nothing to see here</h1>';
|
||||
require_once("footer.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$invoice_id = $row['invoice_id'];
|
||||
@@ -260,8 +264,10 @@ if (isset($_GET['invoice_id'])) {
|
||||
|
||||
<tr>
|
||||
<td class="text-center d-print-none">
|
||||
<?php if ($invoice_status !== "Paid" && $invoice_status !== "Cancelled") { ?>
|
||||
<a class="text-secondary" href="#" data-toggle="modal" data-target="#editItemModal<?php echo $item_id; ?>"><i class="fa fa-fw fa-edit"></i></a>
|
||||
<a class="text-danger" href="post.php?delete_invoice_item=<?php echo $item_id; ?>"><i class="fa fa-fw fa-trash-alt"></i></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td><?php echo $item_name; ?></td>
|
||||
<td><div style="white-space:pre-line"><?php echo $item_description; ?></div></td>
|
||||
@@ -273,13 +279,15 @@ if (isset($_GET['invoice_id'])) {
|
||||
|
||||
<?php
|
||||
|
||||
include("item_edit_modal.php");
|
||||
if ($invoice_status !== "Paid" && $invoice_status !== "Cancelled") {
|
||||
require("item_edit_modal.php");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr class="d-print-none">
|
||||
<tr class="d-print-none" <?php if ($invoice_status == "Paid" || $invoice_status == "Cancelled") { echo "hidden"; } ?>>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>">
|
||||
<td></td>
|
||||
@@ -477,11 +485,9 @@ if (isset($_GET['invoice_id'])) {
|
||||
include_once("invoice_edit_modal.php");
|
||||
include_once("invoice_note_modal.php");
|
||||
include_once("category_quick_add_modal.php");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
include("footer.php");
|
||||
require_once("footer.php");
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ if (isset($_GET['quote_id'])) {
|
||||
|
||||
$quote_id = intval($_GET['quote_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM quotes
|
||||
LEFT JOIN clients ON quote_client_id = client_id
|
||||
LEFT JOIN locations ON primary_location = location_id
|
||||
LEFT JOIN contacts ON primary_contact = contact_id
|
||||
@@ -13,6 +15,12 @@ if (isset($_GET['quote_id'])) {
|
||||
WHERE quote_id = $quote_id"
|
||||
);
|
||||
|
||||
if (mysqli_num_rows($sql) == 0) {
|
||||
echo '<h1 class="text-secondary mt-5" style="text-align: center">Nothing to see here</h1>';
|
||||
require_once("footer.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$quote_id = $row['quote_id'];
|
||||
$quote_prefix = htmlentities($row['quote_prefix']);
|
||||
@@ -235,8 +243,10 @@ if (isset($_GET['quote_id'])) {
|
||||
|
||||
<tr>
|
||||
<td class="text-center d-print-none">
|
||||
<?php if ($quote_status !== "Invoiced" && $quote_status !== "Accepted" && $quote_status !== "Declined") { ?>
|
||||
<a class="text-secondary" href="#" data-toggle="modal" data-target="#editItemModal<?php echo $item_id; ?>"><i class="fa fa-fw fa-edit"></i></a>
|
||||
<a class="text-danger" href="post.php?delete_quote_item=<?php echo $item_id; ?>"><i class="fa fa-fw fa-trash-alt"></i></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td><?php echo $item_name; ?></td>
|
||||
<td><div style="white-space:pre-line"><?php echo $item_description; ?></div></td>
|
||||
@@ -248,13 +258,15 @@ if (isset($_GET['quote_id'])) {
|
||||
|
||||
<?php
|
||||
|
||||
include("item_edit_modal.php");
|
||||
if ($quote_status !== "Invoiced" && $quote_status !== "Accepted" && $quote_status !== "Declined" ) {
|
||||
require("item_edit_modal.php");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr class="d-print-none">
|
||||
<tr class="d-print-none" <?php if ($quote_status == "Invoiced" || $quote_status == "Accepted" || $quote_status == "Declined" ) { echo "hidden"; } ?>>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="quote_id" value="<?php echo $quote_id; ?>">
|
||||
<td></td>
|
||||
|
||||
Reference in New Issue
Block a user