}
//-----------------------------------------------------------------------------------------------
-if (isset($_POST['Process']))
+function check_trans()
{
+ global $Refs;
$input_error = 0;
if (!db_has_currency_rates(get_bank_account_currency($_POST['bank_account']), $_POST['date_'], true))
$input_error = 1;
- if ($input_error == 1)
- unset($_POST['Process']);
+ if (in_array(get_post('PayType'), array(PT_SUPPLIER, PT_CUSTOMER)) && (input_num('settled_amount') <= 0)) {
+ display_error(_("Settled amount have to be positive number."));
+ set_focus('person_id');
+ $input_error = 1;
+ }
+ return $input_error;
}
-if (isset($_POST['Process']))
+if (isset($_POST['Process']) && !check_trans())
{
begin_transaction();