X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=taxes%2Ftax_types.php;h=20369be770dfdd5bc06a8bae6d672822393a5c98;hb=61c780745e4743d3bf4c8ef8d23ad2f34ddc121b;hp=6639e05a8eddaaeebe8588b6df010506d83b2523;hpb=d567a10b7925c8bb97c734e213d6651a979af29d;p=fa-stable.git diff --git a/taxes/tax_types.php b/taxes/tax_types.php index 6639e05a..20369be7 100644 --- a/taxes/tax_types.php +++ b/taxes/tax_types.php @@ -23,6 +23,8 @@ simple_page_mode(true); function can_process() { + global $selected_id; + if (strlen($_POST['name']) == 0) { display_error(_("The tax type name cannot be empty.")); @@ -36,6 +38,11 @@ function can_process() return false; } + if (!is_tax_gl_unique(get_post('sales_gl_code', 'purchasing_gl_code', $selected_id))) { + display_error( _("Selected GL Accounts cannot be used by another tax type.")); + set_focus('sales_gl_code'); + return false; + } return true; } @@ -45,7 +52,7 @@ if ($Mode=='ADD_ITEM' && can_process()) { add_tax_type($_POST['name'], $_POST['sales_gl_code'], - $_POST['purchasing_gl_code'], input_num('rate')); + $_POST['purchasing_gl_code'], input_num('rate', 0)); display_notification(_('New tax type has been added')); $Mode = 'RESET'; } @@ -102,6 +109,8 @@ if ($Mode == 'RESET') $result = get_all_tax_types(); start_form(); + +display_note(_("To avoid problems with manual journal entry all tax types should have unique Sales/Purchasing GL accounts.")); start_table($table_style); $th = array(_("Description"), _("Default Rate (%)"),