[000009] Delivery Note/Sales Invoice should not be editable after it has been voided.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 28 Oct 2008 08:27:10 +0000 (08:27 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 28 Oct 2008 08:27:10 +0000 (08:27 +0000)
CHANGELOG.txt
admin/db/voiding_db.inc
sales/inquiry/customer_inquiry.php
sales/inquiry/sales_deliveries_view.php

index 8d9b29ac9dbc207a1bbfcbe83be0b6077a682636..769d6141254e74c3a634f166e0669724748fe575 100644 (file)
@@ -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).
index e81dd1b0dfc848376edd0fd44b27269cf05fb4f4..692080e0308515e313eee29dbf43a3dbf9d470d4 100644 (file)
@@ -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;
                                }
                        }       
index 8632c83704bc46c8c55788321045940099216079..08b8f0d1b6d70b4403bebc7c63e2456f23989bba 100644 (file)
@@ -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 = "<a href='$path_to_root/sales/customer_credit_invoice.php?InvoiceNumber=" . $myrow["trans_no"] . "'>" . _("Credit This") . "</a>";
-               $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"]);
index 98d17a7490b51efce0f4fcec9d66a4bfb859e2e2..0bae13e7b037b0a06df878b647b67e833e395669 100644 (file)
@@ -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("<a href='$modify_page'>" . _("Edit") . "</a>");
+               if (get_voided_entry(13, $myrow["trans_no"]) === false)
+                       label_cell("<a href='$modify_page'>" . _("Edit") . "</a>");
+               else
+                       label_cell("");
                        label_cell(print_document_link($myrow['trans_no'], _("Print")));
 
                label_cell($not_closed ? "<a href='$invoice_page'>" . _("Invoice") . "</a>" : '');