Fixed new db pager generation on first display of exchange_rates page.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 16 Jan 2009 18:18:55 +0000 (18:18 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 16 Jan 2009 18:18:55 +0000 (18:18 +0000)
CHANGELOG.txt
gl/manage/exchange_rates.php

index 53e0b1a1ab84206f61830af478a3cafc840dd72b..ea20a760f1e9659c3c635418fd25aa65a79fadb8 100644 (file)
@@ -19,6 +19,10 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+16-Jan-2009 Janusz Dobrowolski
+! Fixed new pager generation on first display.
+$ /gl/manage/exchange_rates.php
+
 15-Jan-2009 Joe Hunt
 ! Adjustment of db pager width. Copyright notes. 
 $ All files with db pager
index 5381831a52025e5c70eeb655f21fc37decaee129..39ad4bea02df38c6895200205ee54fdaf97eac6c 100644 (file)
@@ -93,24 +93,6 @@ function display_rates($curr_code)
 {
        global $table_style;
 
-       $sql = "SELECT date_, rate_buy, id FROM "
-               .TB_PREF."exchange_rates "
-               ."WHERE curr_code='$curr_code'
-                ORDER BY date_ DESC";
-
-       $cols = array(
-               _("Date to Use From") => 'date', 
-               _("Exchange Rate") => 'rate',
-               array('insert'=>true, 'fun'=>'edit_link'),
-               array('insert'=>true, 'fun'=>'del_link'),
-       );
-       $table =& new_db_pager('orders_tbl', $sql, $cols);
-       if (list_updated('curr_abrev')) {
-               $table->set_sql($sql);
-               $table->set_columns($cols);
-       }
-       $table->width = "40%";
-       display_db_pager($table);
 }
 
 //---------------------------------------------------------------------------------------------
@@ -201,6 +183,19 @@ if ($_POST['curr_abrev'] != get_global_curr_code())
 
 set_global_curr_code($_POST['curr_abrev']);
 
+$sql = "SELECT date_, rate_buy, id FROM "
+       .TB_PREF."exchange_rates "
+       ."WHERE curr_code='".$_POST['curr_abrev']."'
+        ORDER BY date_ DESC";
+
+$cols = array(
+       _("Date to Use From") => 'date', 
+       _("Exchange Rate") => 'rate',
+       array('insert'=>true, 'fun'=>'edit_link'),
+       array('insert'=>true, 'fun'=>'del_link'),
+);
+$table =& new_db_pager('orders_tbl', $sql, $cols);
+
 if (is_company_currency($_POST['curr_abrev']))
 {
 
@@ -211,7 +206,12 @@ else
 {
 
        br(1);
-    display_rates($_POST['curr_abrev']);
+       if (list_updated('curr_abrev')) {
+               $table->set_sql($sql);
+               $table->set_columns($cols);
+       }
+       $table->width = "40%";
+       display_db_pager($table);
        br(1);
     display_rate_edit();
 }