[0000643] Error during delivery note read for edition.
[fa-stable.git] / gl / bank_transfer.php
index 5ed84c08e4528c12537c456bc4a9fa94d9ab17ec..a9f99defde024ad686a20eccedb874177cf8c2e5 100644 (file)
@@ -122,6 +122,20 @@ function check_valid_entries()
                set_focus('amount');
                return false;
        }
+       if (input_num('amount') == 0) {
+               display_error(_("The total bank amount cannot be 0."));
+               set_focus('amount');
+               return false;
+       }
+
+       $limit = get_bank_account_limit($_POST['FromBankAccount'], $_POST['DatePaid']);
+
+       if ($limit != null && ($limit < (input_num('charge') + input_num('amount'))))
+       {
+               display_error(sprintf(_("The total bank amount exceeds allowed limit (%s) for source account."), price_format($limit)));
+               set_focus('amount');
+               return false;
+       }
 
        if (isset($_POST['charge']) && !check_num('charge', 0)) 
        {