diff --git a/ajax/ajax_item_edit.php b/ajax/ajax_item_edit.php new file mode 100644 index 00000000..a3c567ed --- /dev/null +++ b/ajax/ajax_item_edit.php @@ -0,0 +1,104 @@ + + + +
+ + + + + +
+ +>Move down - Edit + + Edit + Delete @@ -414,9 +420,6 @@ if (isset($_GET['invoice_id'])) { > @@ -690,7 +693,6 @@ if (isset($_GET['invoice_id'])) { diff --git a/post/user/invoice.php b/post/user/invoice.php index 1b8fc774..6237c6d5 100644 --- a/post/user/invoice.php +++ b/post/user/invoice.php @@ -599,9 +599,6 @@ if (isset($_POST['invoice_note'])) { if (isset($_POST['edit_item'])) { - $invoice_id = intval($_POST['invoice_id']); - $quote_id = intval($_POST['quote_id']); - $recurring_id = intval($_POST['recurring_id']); $item_id = intval($_POST['item_id']); $name = sanitizeInput($_POST['name']); $description = sanitizeInput($_POST['description']); @@ -624,6 +621,13 @@ if (isset($_POST['edit_item'])) { mysqli_query($mysqli,"UPDATE invoice_items SET item_name = '$name', item_description = '$description', item_quantity = $qty, item_price = $price, item_subtotal = $subtotal, item_tax = $tax_amount, item_total = $total, item_tax_id = $tax_id WHERE item_id = $item_id"); + // Determine what type of line item + $sql = mysqli_query($mysqli,"SELECT item_invoice_id, item_quote_id, item_recurring_id FROM invoice_items WHERE item_id = $item_id"); + $row = mysqli_fetch_array($sql); + $invoice_id = intval($row['item_invoice_id']); + $quote_id = intval($row['item_quote_id']); + $recurring_id = intval($row['item_recurring_id']); + if ($invoice_id > 0) { //Get Discount Amount $sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_id = $invoice_id"); diff --git a/quote.php b/quote.php index 23f719a0..c9a144c9 100644 --- a/quote.php +++ b/quote.php @@ -354,7 +354,11 @@ if (isset($_GET['quote_id'])) { - + Edit @@ -375,9 +379,6 @@ if (isset($_GET['quote_id'])) { diff --git a/recurring_invoice.php b/recurring_invoice.php index 2a66a1f9..eebb9c14 100644 --- a/recurring_invoice.php +++ b/recurring_invoice.php @@ -305,7 +305,13 @@ if (isset($_GET['recurring_id'])) { - Edit + + Edit + Delete @@ -323,9 +329,6 @@ if (isset($_GET['recurring_id'])) {