From 19be59309583e17fe486bfd3327ecf5e444dac75 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Tue, 28 Oct 2008 08:27:10 +0000 Subject: [PATCH] [000009] Delivery Note/Sales Invoice should not be editable after it has been voided. --- CHANGELOG.txt | 6 ++++++ admin/db/voiding_db.inc | 4 +--- sales/inquiry/customer_inquiry.php | 20 +++++++++++++------- sales/inquiry/sales_deliveries_view.php | 5 ++++- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8d9b29ac..769d6141 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,12 @@ Legend: ! -> Note $ -> Affected files +28-Oct-2008 Joe Hunt +# [000009] Delivery Note/Sales Invoice should not be editable after it has been voided. +$ /admin/db/voiding_db.inc + /sales/inquiry/sales_deliveries_view.php + /sales/inquiry/customer_inquiry.php + 27-Oct-2008 Joe Hunt ! [0000078] Opened Exchange rate for editing (without storing) in sales/purchasing module payment # Fixed exchange rate display bugs in Supplier Payment (earlier dates). diff --git a/admin/db/voiding_db.inc b/admin/db/voiding_db.inc index e81dd1b0..692080e0 100644 --- a/admin/db/voiding_db.inc +++ b/admin/db/voiding_db.inc @@ -40,9 +40,7 @@ function void_transaction($type, $type_no, $date_, $memo_) $delivery = get_customer_trans($type_no, $type); if ($delivery['trans_link'] != 0) { - $inv = get_customer_trans($delivery['trans_link'], 10); - if ($inv['ov_amount'] != 0 || $inv['ov_discount'] != 0 || $inv['ov_gst'] != 0 || - $inv['ov_freight'] != 0 || $inv['ov_freight_tax'] != 0 || $inv['alloc'] != 0) + if (get_voided_entry(10, $delivery['trans_link']) === false) return false; } } diff --git a/sales/inquiry/customer_inquiry.php b/sales/inquiry/customer_inquiry.php index 8632c837..08b8f0d1 100644 --- a/sales/inquiry/customer_inquiry.php +++ b/sales/inquiry/customer_inquiry.php @@ -215,22 +215,28 @@ if (db_num_rows($result) == 0) // only allow crediting if it's not been totally allocated if ($myrow["TotalAmount"] - $myrow["Allocated"] > 0) $credit_me_str = "" . _("Credit This") . ""; - $edit_page= $path_to_root.'/sales/customer_invoice.php?ModifyInvoice=' + if (get_voided_entry(10, $myrow["trans_no"]) === false) + $edit_page= $path_to_root.'/sales/customer_invoice.php?ModifyInvoice=' . $myrow['trans_no']; break; case 11: - if ($myrow['order_']==0) // free-hand credit note - $edit_page= $path_to_root.'/sales/credit_note_entry.php?ModifyCredit=' + if (get_voided_entry(11, $myrow["trans_no"]) === false) + { + if ($myrow['order_']==0) // free-hand credit note + $edit_page= $path_to_root.'/sales/credit_note_entry.php?ModifyCredit=' . $myrow['trans_no']; - else // credit invoice - $edit_page= $path_to_root.'/sales/customer_credit_invoice.php?ModifyCredit=' + else // credit invoice + $edit_page= $path_to_root.'/sales/customer_credit_invoice.php?ModifyCredit=' . $myrow['trans_no']; + } break; case 13: - $edit_page= $path_to_root.'/sales/customer_delivery.php?ModifyDelivery=' - . $myrow['trans_no']; break; + if (get_voided_entry(13, $myrow["trans_no"]) === false) + $edit_page= $path_to_root.'/sales/customer_delivery.php?ModifyDelivery=' + . $myrow['trans_no']; + break; } $date = sql2date($myrow["tran_date"]); diff --git a/sales/inquiry/sales_deliveries_view.php b/sales/inquiry/sales_deliveries_view.php index 98d17a74..0bae13e7 100644 --- a/sales/inquiry/sales_deliveries_view.php +++ b/sales/inquiry/sales_deliveries_view.php @@ -259,7 +259,10 @@ if ($result) { $modify_page = $path_to_root . "/sales/customer_delivery.php?" . SID . "ModifyDelivery=" . $myrow["trans_no"]; $invoice_page = $path_to_root . "/sales/customer_invoice.php?" . SID . "DeliveryNumber=" .$myrow["trans_no"]; - label_cell("" . _("Edit") . ""); + if (get_voided_entry(13, $myrow["trans_no"]) === false) + label_cell("" . _("Edit") . ""); + else + label_cell(""); label_cell(print_document_link($myrow['trans_no'], _("Print"))); label_cell($not_closed ? "" . _("Invoice") . "" : ''); -- 2.30.2