Bug not deleting refs record when deleting Sales Order, Quotation
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 25 Jan 2010 15:37:21 +0000 (15:37 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 25 Jan 2010 15:37:21 +0000 (15:37 +0000)
A couple of redirecting bugs

CHANGELOG.txt
sales/includes/db/sales_order_db.inc
sales/sales_order_entry.php

index 6a6dbddbd95230693d127f2cbb02678ed8691a83..5974387a79b66a15e1e47643d798af8418bf5213 100644 (file)
@@ -20,6 +20,10 @@ Legend:
 $ -> Affected files
 
 25-Jan-2010 Joe Hunt
+# Bug not deleting refs record when deleting Sales Order, Quotation
+# A couple of redirecting bugs
+$ /sales/sales_order_entry.php
+  /sales/includes/db/sales_order_db.inc
 # Bug in the sequence in sales price pickup
 $ /sales/includes/sales_db.inc
 + Added document Receipt and small rearrangements and bugfixes
index 0d8c618aaae685396a96ceb2c3951214febd3256..2d8808770fea36f018ffae4d3d919a3a20211338 100644 (file)
@@ -127,6 +127,8 @@ function delete_sales_order($order_no, $trans_type)
                .db_escape($order_no) . " AND trans_type=".db_escape($trans_type);
        db_query($sql, "order Detail Delete");
 
+       delete_reference($trans_type, $order_no);
+
        add_audit_trail($trans_type, $order_no, Today(), _("Deleted."));
        commit_transaction();
 }
index 475548abed7c2a66f267060c9dfdde033fb8aa40..0b578aef8e75e857fe6d0141b9765e3c7fc827ca 100644 (file)
@@ -496,26 +496,27 @@ function  handle_cancel_order()
 
        if ($_SESSION['Items']->trans_type == ST_CUSTDELIVERY) {
                display_note(_("Direct delivery entry has been cancelled as requested."), 1);
-               submenu_option(_("Enter a New Sales Delivery"), $_SERVER['PHP_SELF']."?NewDelivery=0");
+               submenu_option(_("Enter a New Sales Delivery"), "/sales/sales_order_entry.php?NewDelivery=1");
 
        } elseif ($_SESSION['Items']->trans_type == ST_SALESINVOICE) {
                display_note(_("Direct invoice entry has been cancelled as requested."), 1);
-               submenu_option(_("Enter a New Sales Invoice"),  $_SERVER['PHP_SELF']."?NewInvoice=0");
+               submenu_option(_("Enter a New Sales Invoice"),  "/sales/sales_order_entry.php?NewInvoice=1");
        } else {
                if ($_SESSION['Items']->trans_no != 0) {
-                       if (sales_order_has_deliveries(key($_SESSION['Items']->trans_no)))
+                       if ($_SESSION['Items']->trans_type == ST_SALESORDER && 
+                               sales_order_has_deliveries(key($_SESSION['Items']->trans_no)))
                                display_error(_("This order cannot be cancelled because some of it has already been invoiced or dispatched. However, the line item quantities may be modified."));
                        else {
                                delete_sales_order(key($_SESSION['Items']->trans_no), $_SESSION['Items']->trans_type);
                                if ($_SESSION['Items']->trans_type == ST_SALESQUOTE)
                                {
                                        display_note(_("This sales quotation has been cancelled as requested."), 1);
-                                       submenu_option(_("Enter a New Sales Quotation"), $_SERVER['PHP_SELF']."?NewQuotation=Yes");
+                                       submenu_option(_("Enter a New Sales Quotation"), "/sales/sales_order_entry.php?NewQuotation=Yes");
                                }
                                else
                                {
                                        display_note(_("This sales order has been cancelled as requested."), 1);
-                                       submenu_option(_("Enter a New Sales Order"), $_SERVER['PHP_SELF']."?NewOrder=Yes");
+                                       submenu_option(_("Enter a New Sales Order"), "/sales/sales_order_entry.php?NewOrder=Yes");
                                }
                        }       
                } else {
@@ -525,9 +526,7 @@ function  handle_cancel_order()
        }
        $Ajax->activate('_page_body');
        processing_end();
-       br(1);
-       end_page();
-       exit;
+       display_footer_exit();
 }
 
 //--------------------------------------------------------------------------------