X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Fmanage%2Fcurrencies.php;h=971dbf3b123ca6a38047314c12084ce2f47fbbeb;hb=c9cb6e8b05e007305888f244807abda14632205e;hp=b14b79fde4c4e7a4114a73e008a51b93fd107812;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/gl/manage/currencies.php b/gl/manage/currencies.php index b14b79fd..971dbf3b 100644 --- a/gl/manage/currencies.php +++ b/gl/manage/currencies.php @@ -80,22 +80,20 @@ function handle_submit() //--------------------------------------------------------------------------------------------- -function check_can_delete() +function check_can_delete($curr) { - global $selected_id; - - if ($selected_id == "") + + if ($curr == "") return false; - $curr = db_escape($selected_id); // PREVENT DELETES IF DEPENDENT RECORDS IN debtors_master - if (key_in_foreign_table($curr, 'debtors_master', 'curr_code', true)) + if (key_in_foreign_table($curr, 'debtors_master', 'curr_code')) { display_error(_("Cannot delete this currency, because customer accounts have been created referring to this currency.")); return false; } - if (key_in_foreign_table($curr, 'suppliers', 'curr_code', true)) + if (key_in_foreign_table($curr, 'suppliers', 'curr_code')) { display_error(_("Cannot delete this currency, because supplier accounts have been created referring to this currency.")); return false; @@ -108,7 +106,7 @@ function check_can_delete() } // see if there are any bank accounts that use this currency - if (key_in_foreign_table($curr, 'bank_accounts', 'bank_curr_code', true)) + if (key_in_foreign_table($curr, 'bank_accounts', 'bank_curr_code')) { display_error(_("Cannot delete this currency, because thre are bank accounts that use this currency.")); return false; @@ -122,7 +120,7 @@ function check_can_delete() function handle_delete() { global $selected_id, $Mode; - if (check_can_delete()) { + if (check_can_delete($selected_id)) { //only delete if used in neither customer or supplier, comp prefs, bank trans accounts delete_currency($selected_id); display_notification(_('Selected currency has been deleted')); @@ -246,4 +244,3 @@ end_form(); end_page(); -?>