mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 19:04:52 +00:00
Remove old item ordering logic for invoice, recurring invoice and quote
This commit is contained in:
@@ -1749,78 +1749,6 @@ if (isset($_POST['export_payments_csv'])) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($_POST['update_recurring_item_order'])) {
|
||||
|
||||
$item_id = intval($_POST['item_id']);
|
||||
$item_recurring_id = intval($_POST['item_recurring_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_id = $item_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$current_order = intval($row['item_order']);
|
||||
$update_direction = sanitizeInput($_POST['update_recurring_item_order']);
|
||||
|
||||
switch ($update_direction)
|
||||
{
|
||||
case 'up':
|
||||
$new_order = $current_order - 1;
|
||||
break;
|
||||
case 'down':
|
||||
$new_order = $current_order + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
//Find item_id of current item in $new_order
|
||||
$other_sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_id = $item_recurring_id AND item_order = $new_order");
|
||||
$other_row = mysqli_fetch_array($other_sql);
|
||||
$other_item_id = intval($other_row['item_id']);
|
||||
$other_row_str = strval($other_row['item_name']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE invoice_items SET item_order = $new_order WHERE item_id = $item_id");
|
||||
|
||||
mysqli_query($mysqli,"UPDATE invoice_items SET item_order = $current_order WHERE item_id = $other_item_id");
|
||||
|
||||
$_SESSION['alert_message'] = "recurring Item Order Updated";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_POST['update_invoice_item_order'])) {
|
||||
|
||||
$item_id = intval($_POST['item_id']);
|
||||
$item_invoice_id = intval($_POST['item_invoice_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_id = $item_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$current_order = intval($row['item_order']);
|
||||
$update_direction = sanitizeInput($_POST['update_invoice_item_order']);
|
||||
|
||||
switch ($update_direction)
|
||||
{
|
||||
case 'up':
|
||||
$new_order = $current_order - 1;
|
||||
break;
|
||||
case 'down':
|
||||
$new_order = $current_order + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
//Find item_id of current item in $new_order
|
||||
$other_sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $item_invoice_id AND item_order = $new_order");
|
||||
$other_row = mysqli_fetch_array($other_sql);
|
||||
$other_item_id = intval($other_row['item_id']);
|
||||
$other_row_str = strval($other_row['item_name']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE invoice_items SET item_order = $new_order WHERE item_id = $item_id");
|
||||
|
||||
mysqli_query($mysqli,"UPDATE invoice_items SET item_order = $current_order WHERE item_id = $other_item_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Invoice Item Order Updated";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_GET['recurring_invoice_email_notify'])) {
|
||||
$recurring_invoice_email_notify = intval($_GET['recurring_invoice_email_notify']);
|
||||
$recurring_id = intval($_GET['recurring_id']);
|
||||
|
||||
Reference in New Issue
Block a user