Bug in the sequence in sales price pickup
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 25 Jan 2010 11:00:40 +0000 (11:00 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 25 Jan 2010 11:00:40 +0000 (11:00 +0000)
CHANGELOG.txt
sales/includes/sales_db.inc

index 67434e3b67e203291595ebac241bfcf3feeab9fa..97e87261f8e0d1902dd2750db618cc0c6dd2d8a4 100644 (file)
@@ -20,6 +20,9 @@ Legend:
 $ -> Affected files
 
 25-Jan-2010 Joe Hunt
+# Bug in the sequence in sales price pickup
+$ /sales/includes/sales_db.inc
+
 + Added document Receipt and small rearrangements and bugfixes
 $ /includes/types.inc
   /includes/ui/ui_view.inc
index 7a7d1e32d33739a45d7371b1805c8a7703ff3dff..cd5d99974937178f2be12cb64b5de3acf89142e8 100644 (file)
@@ -113,6 +113,23 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu
            $prices[$myrow['sales_type_id']][$myrow['curr_abrev']] = $myrow['price'];
        }
        $price = false;
+       if (isset($prices[$sales_type_id][$currency])) 
+       {
+           $price = $prices[$sales_type_id][$currency];
+       }
+       elseif (isset($prices[$base_id][$currency])) 
+       {
+           $price = $prices[$base_id][$currency] * $factor;
+       }
+       elseif (isset($prices[$sales_type_id][$home_curr])) 
+       {
+           $price = $prices[$sales_type_id][$home_curr] / $rate;
+       }
+       elseif (isset($prices[$base_id][$home_curr])) 
+       {
+           $price = $prices[$base_id][$home_curr] * $factor / $rate;
+       }
+/*
        if (isset($prices[$sales_type_id][$home_curr])) 
        {
            $price = $prices[$sales_type_id][$home_curr] / $rate;
@@ -125,6 +142,7 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu
        {
            $price = $prices[$base_id][$home_curr] * $factor / $rate;
        }
+*/     
        elseif ($num_rows == 0 && $add_pct != -1)
        {
                $price = get_calculated_price($stock_id, $add_pct);