[Gnucash-changes] r13304 - gnucash/trunk - Don't let users post negative invoices. (#166864)

Derek Atkins warlord at cvs.gnucash.org
Sun Feb 19 17:43:29 EST 2006


Author: warlord
Date: 2006-02-19 17:43:28 -0500 (Sun, 19 Feb 2006)
New Revision: 13304
Trac: http://svn.gnucash.org/trac/changeset/13304

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/business/business-gnome/dialog-invoice.c
Log:
Don't let users post negative invoices.  (#166864)
Pop up an error dialog and prevent the post.



Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-02-19 22:16:49 UTC (rev 13303)
+++ gnucash/trunk/ChangeLog	2006-02-19 22:43:28 UTC (rev 13304)
@@ -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 at ihtfp.com>
 
 	* intl-scm/xgettext.scm: remove the absolute path from filenames

Modified: gnucash/trunk/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2006-02-19 22:16:49 UTC (rev 13303)
+++ gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2006-02-19 22:43:28 UTC (rev 13304)
@@ -610,6 +610,20 @@
     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
    */



More information about the gnucash-changes mailing list