Merged last changes from stable.
[fa-stable.git] / includes / ui / allocation_cart.inc
index 1be54f5ca61442256d3eedde74d47efbf7172178..37c436a0ac3a96b2daa447f0f64985c4d7b014d9 100644 (file)
@@ -171,6 +171,7 @@ class allocation
 
                while ($myrow = db_fetch($trans_items))
                {
+//_vd($myrow);
                        $this->add_or_update_item ($myrow["type"], $myrow["trans_no"],
                                sql2date($myrow["tran_date"]),
                                sql2date($myrow["due_date"]),
@@ -188,7 +189,7 @@ class allocation
                if ($this->person_type == PT_SUPPLIER)
                        clear_supp_alloctions($this->type, $this->trans_no, $this->date_);
                else
-                       clear_cust_alloctions($this->type, $this->trans_no, $this->date_);
+                       clear_cust_alloctions($this->type, $this->trans_no);
 
                // now add the new allocations
                $total_allocated = 0;
@@ -213,7 +214,8 @@ class allocation
                                        update_debtor_trans_allocation($alloc_item->type, $alloc_item->type_no);
                                }
                                // Exchange Variations Joe Hunt 2008-09-20 ////////////////////
-                               exchange_variation($this->type, $this->trans_no,
+                               if (!in_array($alloc_item->type, array(ST_SALESQUOTE, ST_SALESORDER, ST_PURCHORDER)))
+                                exchange_variation($this->type, $this->trans_no,
                                        $alloc_item->type, $alloc_item->type_no, $this->date_,
                                        $amount, $this->person_type);
 
@@ -357,6 +359,7 @@ function check_allocations()
        for ($counter = 0; $counter < get_post("TotalNumberOfAllocs"); $counter++)
        {
                if (!isset($_POST['amount'.$counter])) continue;
+
                if (!check_num('amount' . $counter, 0))
                {
                        display_error(_("The entry for one or more amounts is invalid or negative."));