X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fincludes%2Fdb%2Fgl_db_rates.inc;h=924587d8ab9da210f814e004d718732e79837c50;hb=4deaa6ba6e084655989c30cfb7d9dd307408c7dc;hp=4118492ef7e7cdd7e56e4323954e2aa95942eab5;hpb=dc72612432d1e44cd7d1269083c3670f721d5161;p=fa-stable.git diff --git a/gl/includes/db/gl_db_rates.inc b/gl/includes/db/gl_db_rates.inc index 4118492e..924587d8 100644 --- a/gl/includes/db/gl_db_rates.inc +++ b/gl/includes/db/gl_db_rates.inc @@ -63,12 +63,16 @@ function update_exchange_rate($curr_code, $date_, $buy_rate, $sell_rate) if (is_company_currency($curr_code)) display_db_error("Exchange rates cannot be set for company currency", "", true); + begin_transaction(__FUNCTION__, func_get_args()); + $date = date2sql($date_); $sql = "UPDATE ".TB_PREF."exchange_rates SET rate_buy=$buy_rate, rate_sell=".db_escape($sell_rate) ." WHERE curr_code=".db_escape($curr_code)." AND date_='$date'"; db_query($sql, "could not add exchange rate for $curr_code"); + + commit_transaction(); } //--------------------------------------------------------------------------------------------- @@ -78,12 +82,14 @@ function add_exchange_rate($curr_code, $date_, $buy_rate, $sell_rate) if (is_company_currency($curr_code)) display_db_error("Exchange rates cannot be set for company currency", "", true); + begin_transaction(__FUNCTION__, func_get_args()); $date = date2sql($date_); $sql = "INSERT INTO ".TB_PREF."exchange_rates (curr_code, date_, rate_buy, rate_sell) VALUES (".db_escape($curr_code).", '$date', ".db_escape($buy_rate) .", ".db_escape($sell_rate).")"; db_query($sql, "could not add exchange rate for $curr_code"); + commit_transaction(); } //--------------------------------------------------------------------------------------------- @@ -101,8 +107,12 @@ function add_new_exchange_rate($curr_code, $date_, $ex_rate) function delete_exchange_rate($rate_id) { + begin_transaction(__FUNCTION__, func_get_args()); + $sql = "DELETE FROM ".TB_PREF."exchange_rates WHERE id=".db_escape($rate_id); db_query($sql, "could not delete exchange rate $rate_id"); + + commit_transaction(); } //-----------------------------------------------------------------------------