Bug [0000111] Accounts on Credit Hold can still process delivery notes on sales order...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 13 Jan 2009 00:32:09 +0000 (00:32 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 13 Jan 2009 00:32:09 +0000 (00:32 +0000)
CHANGELOG.txt
sales/customer_delivery.php
sales/customer_invoice.php
sales/includes/ui/sales_order_ui.inc

index 95a39e31b933969cc07157cf403439f1ea377fa6..1fc3b204f8a680662a9507f5a341174882690da7 100644 (file)
@@ -19,6 +19,12 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+13-Jan-2009 Joe Hunt
+# Bug [0000111] Accounts on Credit Hold can still process delivery notes on sales order and invoicing.
+$ /sales/customer_delivery.php
+  /sales/customer_invoice.php
+  /sales/includes/ui/sales_order_ui.inc
+  
 08-Jan-2009 Janusz Dobrowolski
 # Numeric check on class id added.
 $ /gl/manage/gl_account_classes.php
index 6de7f08a000768bcdbebce993bb4d27b14376628..0909fd3cb2e0631696ad22ac544d7923afc65d37 100644 (file)
@@ -360,6 +360,14 @@ end_table();
 echo "</td></tr>";
 end_table(1); // outer table
 
+$row = get_customer_to_order($_SESSION['Items']->customer_id);
+if ($row['dissallow_invoices'] == 1)
+{
+       display_error(_("The selected customer account is currently on hold. Please contact the credit control personnel to discuss."));
+       end_form();
+       end_page();
+       exit();
+}      
 display_heading(_("Delivery Items"));
 div_start('Items');
 start_table("$table_style width=80%");
index a903b9277a92b8a3f9538f835bbe79456a534f0a..5c0b5121583ff52b7892bb47cfbe1bd2e9740dd9 100644 (file)
@@ -349,6 +349,15 @@ date_cells(_("Due Date"), 'due_date', '', $_POST['due_date'], 0, 0, 0, "class='t
 end_row();
 end_table();
 
+$row = get_customer_to_order($_SESSION['Items']->customer_id);
+if ($row['dissallow_invoices'] == 1)
+{
+       display_error(_("The selected customer account is currently on hold. Please contact the credit control personnel to discuss."));
+       end_form();
+       end_page();
+       exit();
+}      
+
 display_heading(_("Invoice Items"));
 
 div_start('Items');
index e9fd0a8f51a69f290f6b57d60c1d355a9807e272..997e2dd9948c3d31f97fe74fc7d95ee9a8d9b477 100644 (file)
@@ -182,24 +182,26 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group
                customer_branches_list_row(_("Branch:"),
                  $_POST['customer_id'], 'branch_id', null, false, true, true);
 
-       if( ($order->customer_id != get_post('customer_id', -1)) ||
+               $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']);
+               if( ($order->customer_id != get_post('customer_id', -1)) ||
                        ($order->Branch != get_post('branch_id', -1)) ||
-                       list_updated('customer_id')) {
-
-               if (!isset($_POST['branch_id']) || $_POST['branch_id'] == "")
+                       list_updated('customer_id')) 
                {
-                       // ignore errors on customer search box call
-                       if ($_POST['customer_id'] == '')
-                           $customer_error = _("No customer found for entered text.");
+
+                       if (!isset($_POST['branch_id']) || $_POST['branch_id'] == "")
+                       {
+                               // ignore errors on customer search box call
+                               if ($_POST['customer_id'] == '')
+                                       $customer_error = _("No customer found for entered text.");
+                               else
+                                       $customer_error = _("The selected customer does not have any branches. Please create at least one branch.");
+                               unset($_POST['branch_id']);
+                               $order->Branch = 0;
+                       } 
                        else
-                           $customer_error = _("The selected customer does not have any branches. Please create at least one branch.");
-                   unset($_POST['branch_id']);
-                   $order->Branch = 0;
-               } else
-               {
+                       {
 
                                $old_order = (PHP_VERSION<5) ? $order : clone( $order );
-                               $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']);
 
                                $_POST['Location'] = $order->Location;
                                $_POST['deliver_to'] = $order->deliver_to;
@@ -217,17 +219,17 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group
                                // change prices if necessary
                                // what about discount in template case?
                                if ($old_order->customer_currency != $order->customer_currency) {
-                                   $change_prices = 1;
+                                       $change_prices = 1;
                                }
                                if ($old_order->sales_type != $order->sales_type) {
                                //  || $old_order->default_discount!=$order->default_discount
                                        $_POST['sales_type'] = $order->sales_type;
-                                   $Ajax->activate('sales_type');
-                                   $change_prices = 1;
+                                       $Ajax->activate('sales_type');
+                                       $change_prices = 1;
                                }
                                unset($old_order);
                        }
-               set_global_customer($_POST['customer_id']);
+                       set_global_customer($_POST['customer_id']);
                } // changed branch
        }