! -> Note
$ -> Affected files
-2-Dec-2010 Janusz Dobrowolski
+27-Dec-2010 Janusz Dobrowolski
+ Option for allowing negative prices for dummy/service items [0000343]
$ /config.default.php
/sales/sales_order_entry.php
$ /admin/db/transactions_db.inc
# [0000380] Database error during direct invoice processing in mysql strict mode.
$ /sales/includes/db/cust_trans_db.inc
+! Added balance limit for payments made from cash accounts
+$ /gl/gl_bank.php
+ /gl/includes/db/gl_db_bank_accounts.inc
+ /purchasing/supplier_payment.php
19-Dec-2010 Janusz Dobrowolski
# Supressed strict warnings in reporting
$input_error = 1;
}
+ $limit = get_bank_account_limit($_POST['bank_account'], $_POST['date_']);
+
+ if ($limit != null && ($limit < $_SESSION['pay_items']->gl_items_total()))
+ {
+ display_error(sprintf(_("The total bank amount exceeds allowed limit (%s)."), price_format($limit)));
+ set_focus('code_id');
+ $input_error = 1;
+ }
+
if (!$Refs->is_valid($_POST['ref']))
{
display_error( _("You must enter a reference."));
display_error(_("The entered date is not in fiscal year."));
set_focus('date_');
$input_error = 1;
- }
+ }
if (get_post('PayType')==PT_CUSTOMER && (!get_post('person_id') || !get_post('PersonDetailID'))) {
display_error(_("You have to select customer and customer branch."));
return db_fetch($result);
}
+//---------------------------------------------------------------------------------------------
+//
+// This function returns current allowed bank payment limit, or null if limit is not set.
+// As of FA 2.3 check is done only on cash account, for which limit is bank amount as of the date selected.
+//
+function get_bank_account_limit($account, $date, $user=null)
+{
+// $user = current_user();
+
+ $bankacc = get_bank_account($account);
+ if ($bankacc['account_type'] != BT_CASH)
+ return null;
+ return get_balance_before_for_bank_account($account, $date);
+}
+
?>
\ No newline at end of file
set_focus('DatePaid');
return false;
}
+
+ $limit = get_bank_account_limit($_POST['bank_account'], $_POST['DatePaid']);
+
+ if ($limit != null && ($limit < input_num('amount')))
+ {
+ display_error(sprintf(_("The total bank amount exceeds allowed limit (%s)."), price_format($limit)));
+ set_focus('amount');
+ return false;
+ }
+
if (!$Refs->is_valid($_POST['ref']))
{
display_error(_("You must enter a reference."));