r21394 - gnucash/trunk/src/business/business-gnome - Use GncInvoiceType in query for bills due reminder

Geert Janssens gjanssens at code.gnucash.org
Sat Oct 8 12:59:10 EDT 2011


Author: gjanssens
Date: 2011-10-08 12:59:10 -0400 (Sat, 08 Oct 2011)
New Revision: 21394
Trac: http://svn.gnucash.org/trac/changeset/21394

Modified:
   gnucash/trunk/src/business/business-gnome/dialog-invoice.c
Log:
Use GncInvoiceType in query for bills due reminder
At the same time, prepare for credit notes.

Modified: gnucash/trunk/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2011-10-08 16:59:01 UTC (rev 21393)
+++ gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2011-10-08 16:59:10 UTC (rev 21394)
@@ -2833,7 +2833,8 @@
     /* We want to find all invoices where:
      *      invoice -> is_posted == TRUE
      * AND  invoice -> lot -> is_closed? == FALSE
-     * AND  invoice -> type != _("Invoice") // note: currently the translated form
+     * AND  invoice -> type != customer invoice
+     * AND  invoice -> type != customer credit note
      * AND  invoice -> due >= (today - days_in_advance)
      */
 
@@ -2843,15 +2844,12 @@
     qof_query_add_boolean_match (q, g_slist_prepend(g_slist_prepend(NULL, LOT_IS_CLOSED),
                                  INVOICE_POST_LOT), FALSE, QOF_QUERY_AND);
 
-    /* Bug#602091, #639365: The INVOICE_TYPE_STRING string unfortunately is
-     * stored in translated form due to the usage of gncInvoiceGetTypeString
-     * for user-visible strings as well. Hence, as an exception we
-     * must also search for the translated here even though it's an
-     * internal flag. */
-    pred_data = qof_query_string_predicate (QOF_COMPARE_NEQ, _("Invoice"),
-                                            QOF_STRING_MATCH_NORMAL, FALSE);
-    qof_query_add_term (q, g_slist_prepend(NULL, INVOICE_TYPE_STRING), pred_data, QOF_QUERY_AND);
+    pred_data = qof_query_int32_predicate (QOF_COMPARE_NEQ, GNC_INVOICE_CUST_INVOICE);
+    qof_query_add_term (q, g_slist_prepend(NULL, INVOICE_TYPE), pred_data, QOF_QUERY_AND);
 
+    pred_data = qof_query_int32_predicate (QOF_COMPARE_NEQ, GNC_INVOICE_CUST_CREDIT_NOTE);
+    qof_query_add_term (q, g_slist_prepend(NULL, INVOICE_TYPE), pred_data, QOF_QUERY_AND);
+
     end_date = time(NULL);
     if (days_in_advance < 0)
         days_in_advance = 0;



More information about the gnucash-changes mailing list