Added hook support for localized functions.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 19 May 2009 15:15:01 +0000 (15:15 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 19 May 2009 15:15:01 +0000 (15:15 +0000)
gl/includes/db/gl_db_rates.inc
gl/manage/exchange_rates.php
includes/session.inc

index 0c9ae6863b5d81d572f404ddff4789bbf7c37322..fa5926b6559fa04a67d548c1eefc4f6302f18405 100644 (file)
@@ -69,7 +69,19 @@ function delete_exchange_rate($rate_id)
        db_query($sql, "could not delete exchange rate $rate_id");              
 }
 
-//---------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//     Retrieve exchange rate as of date $date from external source (usually inet)
+//
+function retrieve_exrate($curr_b, $date)
+{
+       global $Hooks;
+
+       if (method_exists($Hooks, 'retrieve_exrate'))
+               return $Hooks->retrieve_exrate($curr_b, $date);
+       else
+               return get_ecb_rate($curr_b);
+}
+//-----------------------------------------------------------------------------
 
 function get_ecb_rate($curr_b) 
 {
index 2592b0cc01eaa93cb6a01ef9e7c5e4dc45cbfd6e..528b42030d6a74fde6a1c196f37c6e13a6cb22f9 100644 (file)
@@ -128,7 +128,8 @@ function display_rate_edit()
        }
        if (isset($_POST['get_rate']))
        {
-               $_POST['BuyRate'] = exrate_format(get_ecb_rate($_POST['curr_abrev']));
+               $_POST['BuyRate'] = 
+                       exrate_format(retrieve_exrate($_POST['curr_abrev'], $_POST['date_']));
                $Ajax->activate('BuyRate');
        }
        small_amount_row(_("Exchange Rate:"), 'BuyRate', null, '',
index 236d90e2245a2a7167fce39c23057669c269cd3a..f8d8c1e6253b786906c1c0a86af5ace4aa5d1054 100644 (file)
@@ -125,6 +125,12 @@ if (!isset($_SESSION['languages']))
 
 language::set_language($_SESSION['language']->code);
 
+// include $Hooks object if locale file exists
+if(@include_once($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc")) 
+{
+       $Hooks = new Hooks();
+}
+
 include_once($path_to_root . "/config.php");
 include_once($path_to_root . "/includes/main.inc");