Don't let users post negative invoices. (#166864)

Pop up an error dialog and prevent the post.



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13304 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins
2006-02-19 22:43:28 +00:00
parent 0c33f64499
commit 4908c23154
2 changed files with 18 additions and 0 deletions

View File

@@ -53,6 +53,10 @@
- Prefer QUERY_AND and QUERY_OR over NAND, NOR, XOR
- Don't randomly generate a gnc_numeric with a 0 denominator.
* src/business/business-gnome/dialog-invoice.c:
Don't let users post negative invoices. (#166864)
Pop up an error dialog and prevent the post.
2006-02-18 Derek Atkins <derek@ihtfp.com>
* intl-scm/xgettext.scm: remove the absolute path from filenames

View File

@@ -610,6 +610,20 @@ gnc_invoice_window_postCB (GtkWidget *widget, gpointer data)
return;
}
/* Make sure that the invoice has a positive balance */
if (gnc_numeric_negative_p(gncInvoiceGetTotal(invoice))) {
gnc_error_dialog(iw_get_window(iw),
_("You may not post an invoice with a negative total value."));
return;
}
if (iw->total_cash_label &&
gnc_numeric_negative_p(gncInvoiceGetTotalOf(invoice, GNC_PAYMENT_CASH))) {
gnc_error_dialog(iw_get_window(iw),
_("You may not post an expense voucher with a negative total cash value."));
return;
}
/* Ok, we can post this invoice. Ask for verification, set the due date,
* post date, and posted account
*/