BUGFIX: invoice posted-date is no longer 0 for unposted invoices

This commit fixes business reports caused by 91f4b19039
whereby the posted-date for unposted invoice was changed
from 0 to MAXINT. Now we need to use (gncInvoiceIsPosted)
or (gncInvoiceDateExists) instead.
This commit is contained in:
Christopher Lam
2018-01-30 19:29:04 +08:00
parent 00c4bac65b
commit 862956a760
8 changed files with 31 additions and 39 deletions

View File

@@ -776,12 +776,11 @@
(add-html! document "</tr></table>")
)
; add the date
;; add the date
(if (gncInvoiceIsPosted invoice)
(let ((date-table #f)
(post-date (gncInvoiceGetDatePosted invoice))
(due-date (gncInvoiceGetDateDue invoice)))
(if (not (zero? post-date))
(begin
(set! date-table (make-date-table))
(make-date-row! date-table (_ "Date") post-date date-format)
(if (opt-val "Display" "Due Date")
@@ -790,7 +789,7 @@
(add-html! document
(string-append "<font color='red'>"
(_ "INVOICE NOT POSTED")
"</font>"))))
"</font>")))
(make-break! document)

View File

@@ -857,14 +857,12 @@
'attribute (list "cellpadding" 0)
'attribute (list "width" "100%"))
(set! date-object (let ((date-table #f)
(set! date-object
(if (gncInvoiceIsPosted invoice)
(let ((date-table #f)
(post-date (gncInvoiceGetDatePosted invoice))
(due-date (gncInvoiceGetDateDue invoice)))
(if (not (zero? post-date))
(begin
(set! date-table (make-date-table))
;; oli-custom - moved invoice number here
(gnc:html-table-append-row!
;; Translators: %s below is "Invoice" or "Bill" or even the
;; custom title from the options. The next column contains
@@ -879,10 +877,8 @@
(make-date-row! date-table (_ "Due&nbsp;Date") due-date date-format)
date-table)
(gnc:make-html-text
;; oli-custom - FIXME: I have a feeling I broke a
;; translation by not using string-expand for &nbsp;
(string-append title "<br>"
(_ "Invoice in progress..."))))))
(_ "Invoice in progress...")))))
(gnc:html-table-append-row!
helper-table

View File

@@ -708,12 +708,10 @@
document
(make-myname-table book date-format))
(if (gncInvoiceIsPosted invoice)
(let ((date-table #f)
(post-date (gncInvoiceGetDatePosted invoice))
(due-date (gncInvoiceGetDateDue invoice)))
(if (not (zero? post-date))
(begin
(set! date-table (make-date-table))
(make-date-row! date-table (string-append title " " (_ "Date")) post-date date-format)
(make-date-row! date-table (_ "Due Date") due-date date-format)
@@ -721,9 +719,7 @@
(gnc:html-document-add-object!
document
(gnc:make-html-text
(_ "Invoice in progress...")))))
(_ "Invoice in progress..."))))
(make-break! document)
(make-break! document)

View File

@@ -193,7 +193,7 @@
(if (date-due-col column-vector)
(addto! row-contents
(if (and due-date
(not (zero? due-date)))
(gncInvoiceDateExists due-date))
(qof-print-date due-date)
"")))
(if (num-col column-vector)

View File

@@ -291,7 +291,7 @@
(if (date-due-col column-vector)
(addto! row-contents
(if (and due-date
(not (zero? due-date)))
(gncInvoiceDateExists due-date))
(qof-print-date due-date)
"")))
(if (num-col column-vector)

View File

@@ -246,7 +246,7 @@
<td align="right" class="invnum"><big><strong><?scm:d invoiceid ?></strong></big></td>
</tr>
<?scm )) ?>
<?scm (if (zero? postdate) (begin ?>
<?scm (if (not (gncInvoiceDateExists postdate)) (begin ?>
<tr>
<td colspan="2" align="right"><?scm:d (_ "Invoice in progress...") ?></td>
</tr>

View File

@@ -1856,7 +1856,7 @@ gncInvoiceApplyPayment (const GncInvoice *invoice, Transaction *txn,
gncOwnerAutoApplyPaymentsWithLots (owner, selected_lots);
}
static gboolean gncInvoiceDateExists (time64 date)
gboolean gncInvoiceDateExists (time64 date)
{
return date != INT64_MAX;
}

View File

@@ -275,6 +275,7 @@ static inline GncInvoice * gncInvoiceLookup (const QofBook *book, const GncGUID
void gncInvoiceBeginEdit (GncInvoice *invoice);
void gncInvoiceCommitEdit (GncInvoice *invoice);
int gncInvoiceCompare (const GncInvoice *a, const GncInvoice *b);
gboolean gncInvoiceDateExists (time64 date);
gboolean gncInvoiceIsPosted (const GncInvoice *invoice);
gboolean gncInvoiceIsPaid (const GncInvoice *invoice);