Fixed POS parameters retrieval in cart_class
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 22 Jun 2010 09:54:01 +0000 (09:54 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 22 Jun 2010 09:54:01 +0000 (09:54 +0000)
CHANGELOG.txt
sales/includes/cart_class.inc

index 754e57427bd0808a38bbccfafa1d82bc34523f56..00171693cf822d1d90ca8946bc95effc2e1761b5 100644 (file)
@@ -19,6 +19,10 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+24-Jun-2010 Janusz Dobrowolski
+# Fixed pos parameters retrieval in direct invoice
+$ /sales/includes/cart_class.inc
+
 24-Jun-2010 Janusz Dobrowolski
 + Support for current credit display
 $ /includes/ui/ui_input.inc
index f5a120583b7653046d263e9b4ae15259960cdd63..4831c4a4f46f61618b9d25dbcb8f858ee45a74d5 100644 (file)
@@ -229,22 +229,12 @@ class cart
                                if ($type == ST_SALESINVOICE) {
                                        $this->due_date =
                                                get_invoice_duedate($this->payment, $this->document_date);
-                                       $this->cash = $this->payment_terms['cash_sale'];
-                                       if ($this->cash) {
-                                               $this->Location = $pos['pos_location'];
-                                               $this->location_name = $pos['location_name'];
-                                               $this->cash_account = $pos['pos_account'];
-                                               $this->account_name = $pos['bank_account_name'];
-                                       }
                                } else
                                        $this->due_date =
                                                add_days($this->document_date, $SysPrefs->default_delivery_required_by());
+                       $this->pos = user_pos();
                        }
                $this->credit = get_current_cust_credit($this->customer_id);
-               $this->pos = user_pos();
-               $pos = get_sales_point($this->pos);
-               if (!$pos['cash_sale'] && !$pos['credit_sale']) 
-                       $this->pos = -1; // mark not editable payment type
        }
 
        //-------------------------------------------------------------------------
@@ -308,6 +298,16 @@ class cart
                $this->payment_terms = get_payment_terms($payment);
                $this->cash = $this->payment_terms['cash_sale'];
                $this->cash_discount = $cdiscount;
+
+               $pos = get_sales_point($this->pos);
+               if (!$pos['cash_sale'] || !$pos['credit_sale']) 
+                       $this->pos = -1; // mark not editable payment type
+               if ($this->cash) {
+                       $this->Location = $pos['pos_location'];
+                       $this->location_name = $pos['location_name'];
+                       $this->cash_account = $pos['pos_account'];
+                       $this->account_name = $pos['bank_account_name'];
+               }
                $this->credit = get_current_cust_credit($customer_id);
        }