- if (($order->customer_id != $_POST['customer_id']) ||
- ($order->Branch != $_POST['branch_id']))
- $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']);
+ if (($order->customer_id != $_POST['customer_id']) ||
+ ($order->Branch != $_POST['branch_id'])) {
+ $old_order = $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;
+ $_POST['delivery_address'] = $order->delivery_address;
+ $_POST['phone'] = $order->phone;
+
+ // change prices if necessary
+ // what about discount in template case?
+ if ( $old_order->customer_currency!=$order->customer_currency
+ || $old_order->default_sales_type!=$order->default_sales_type
+ // || $old_order->default_discount!=$order->default_discount
+ ) {
+
+ foreach ($order->line_items as $line_no=>$item) {
+ $line = &$order->line_items[$line_no];
+ $line->price = get_price($line->stock_id, $order->customer_id);
+ // $line->discount_percent = $order->default_discount;
+ }
+ }
+
+ }
+ }
+ set_global_customer($_POST['customer_id']);
+ }