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.
This commit is contained in:
Christopher Lam 2019-04-11 18:05:43 +08:00
parent 19bbeaa67a
commit 6e7a4ccc77

View File

@ -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.