gnucash maint: Bug 797188 - Default invoice prints credit note as invoice

Christopher Lam clam at code.gnucash.org
Thu Apr 11 06:59:42 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/6e7a4ccc (commit)
	from  https://github.com/Gnucash/gnucash/commit/19bbeaa6 (commit)



commit 6e7a4ccc77972e94003b1040bde11a23c4429d83
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Apr 11 18:05:43 2019 +0800

    Bug 797188 - Default invoice prints credit note as invoice
    
    Error in guile code. Using (case var (datum ...)) means that datum are
    symbols, so if datum is (GNC-INVOICE-VEND-INVOICE) it would try
    (eqv? type 'GNC-INVOICE-VEND-INVOICE) which would never be true. We
    need (eqv? type GNC-INVOICE-VEND-INVOICE). Using (cond) is more
    appropriate here.

diff --git a/gnucash/report/business-reports/invoice.scm b/gnucash/report/business-reports/invoice.scm
index a020c600d..0a6db327f 100644
--- a/gnucash/report/business-reports/invoice.scm
+++ b/gnucash/report/business-reports/invoice.scm
@@ -787,15 +787,17 @@ for styling the invoice. Please see the exported report for the CSS class names.
                (orders (if references? (delete-duplicates (map gncEntryGetOrder (gncInvoiceGetEntries invoice))) '()))
                (cust-doc? (memv type (list GNC-INVOICE-CUST-INVOICE GNC-INVOICE-CUST-CREDIT-NOTE)))
                (credit-note? (memv type (list GNC-INVOICE-CUST-CREDIT-NOTE GNC-INVOICE-VEND-CREDIT-NOTE GNC-INVOICE-EMPL-CREDIT-NOTE)))
-               (default-title (case type
-                                ((GNC-INVOICE-VEND-INVOICE)
-                                 (_ "Bill"))
-                                ((GNC-INVOICE-EMPL-INVOICE)
-                                 (_ "Expense Voucher"))
-                                ((GNC-INVOICE-CUST-CREDIT-NOTE GNC-INVOICE-VEND-CREDIT-NOTE GNC-INVOICE-EMPL-CREDIT-NOTE)
-                                 (_ "Credit Note"))
-                                (else
-                                 (_ "Invoice"))))
+               (default-title (cond
+                               ((eqv? type GNC-INVOICE-VEND-INVOICE)
+                                (_ "Bill"))
+                               ((eqv? type GNC-INVOICE-EMPL-INVOICE)
+                                (_ "Expense Voucher"))
+                               ((memv type (list GNC-INVOICE-CUST-CREDIT-NOTE
+                                                 GNC-INVOICE-VEND-CREDIT-NOTE
+                                                 GNC-INVOICE-EMPL-CREDIT-NOTE))
+                                (_ "Credit Note"))
+                               (else
+                                (_ "Invoice"))))
                (title (if (string-null? custom-title) default-title custom-title))
                ;; Translators: This is the format of the invoice title.
                ;; The first ~a is "Invoice", "Credit Note"... and the second the number.



Summary of changes:
 gnucash/report/business-reports/invoice.scm | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)



More information about the gnucash-changes mailing list