gnucash master: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Sun Nov 10 08:03:20 EST 2019
Updated via https://github.com/Gnucash/gnucash/commit/7e5784ff (commit)
via https://github.com/Gnucash/gnucash/commit/a482c250 (commit)
via https://github.com/Gnucash/gnucash/commit/6f7c6b9d (commit)
via https://github.com/Gnucash/gnucash/commit/97798f9f (commit)
via https://github.com/Gnucash/gnucash/commit/b7205213 (commit)
via https://github.com/Gnucash/gnucash/commit/72c20a07 (commit)
via https://github.com/Gnucash/gnucash/commit/9f4677e3 (commit)
via https://github.com/Gnucash/gnucash/commit/f0701da8 (commit)
via https://github.com/Gnucash/gnucash/commit/a4773d2b (commit)
via https://github.com/Gnucash/gnucash/commit/2bc7d314 (commit)
via https://github.com/Gnucash/gnucash/commit/32ff31fe (commit)
via https://github.com/Gnucash/gnucash/commit/952c6561 (commit)
via https://github.com/Gnucash/gnucash/commit/ee191083 (commit)
via https://github.com/Gnucash/gnucash/commit/21d60803 (commit)
via https://github.com/Gnucash/gnucash/commit/e991fe85 (commit)
via https://github.com/Gnucash/gnucash/commit/910cdbfd (commit)
via https://github.com/Gnucash/gnucash/commit/1a9825fe (commit)
via https://github.com/Gnucash/gnucash/commit/c8d1e7c1 (commit)
via https://github.com/Gnucash/gnucash/commit/d0743cd0 (commit)
via https://github.com/Gnucash/gnucash/commit/1a404b8d (commit)
via https://github.com/Gnucash/gnucash/commit/6e354d8a (commit)
from https://github.com/Gnucash/gnucash/commit/47b6d05b (commit)
commit 7e5784ffa2e8a0f5a15bba58b6122ab8aac73766
Merge: c8d1e7c19 a482c2507
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Nov 10 20:11:51 2019 +0800
Merge branch 'maint'
commit a482c250726fe35447165625a8e74fcc81bbdd6f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Nov 10 13:32:50 2019 +0800
[new-aging] step 4 - prepended lists must be reversed
after building lists by prepending in b72052137 we need to process
them in reverse to obtain the original sorting of accounts and
owner-list.
diff --git a/gnucash/report/business-reports/new-aging.scm b/gnucash/report/business-reports/new-aging.scm
index 6331a147d..231d9c333 100644
--- a/gnucash/report/business-reports/new-aging.scm
+++ b/gnucash/report/business-reports/new-aging.scm
@@ -286,6 +286,7 @@ exist but have no suitable transactions."))
(let ((owner (car owner-and-aging))
(aging (cadr owner-and-aging))
(aging-total (caddr owner-and-aging)))
+
(gnc:html-table-append-row!
table
(append
@@ -308,7 +309,8 @@ exist but have no suitable transactions."))
(gnc:owner-report-text owner account)
(gnc:make-gnc-monetary comm aging-total)))))
(options->address options receivable owner)))))
- owners-and-aging)
+ (reverse owners-and-aging))
+
(gnc:html-table-append-row!
table
(append
@@ -320,7 +322,8 @@ exist but have no suitable transactions."))
(gnc:make-html-table-cell/markup
"total-number-cell" (gnc:make-gnc-monetary comm amt)))
acc-totals)))))
- accounts-and-owners)
+ (reverse accounts-and-owners))
+
(for-each gncOwnerFree tofree)
(gnc:html-document-add-object! document table)))))
commit 6f7c6b9de3326d27bfaa0857069b8df4a2d22c74
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Nov 10 03:50:55 2019 +0800
[new-aging] step 3 - only render APAR details if APAR-accounts>1
This commit will hide the APAR account anchor if there's only one
found. So, for majority of users with single AP/AR accounts, the aging
report will be very similar to old one. For users with multi APAR
accounts, each one will be shown with header (and anchor) and
indenting to highlight grouping.
diff --git a/gnucash/report/business-reports/new-aging.scm b/gnucash/report/business-reports/new-aging.scm
index 1e451b8f0..6331a147d 100644
--- a/gnucash/report/business-reports/new-aging.scm
+++ b/gnucash/report/business-reports/new-aging.scm
@@ -192,8 +192,7 @@ exist but have no suitable transactions."))
(gnc:option-value (gnc:lookup-option options section name)))
(define make-heading-list
- (list ""
- (_ "Company")
+ (list (_ "Company")
(_ "Prepayments")
(_ "Current")
(_ "0-30 days")
@@ -258,10 +257,12 @@ exist but have no suitable transactions."))
document (gnc:make-html-text empty-APAR-accounts)))
(else
- (let ((table (gnc:make-html-table)))
+ (let ((table (gnc:make-html-table))
+ (accounts>1? (> (length accounts-and-owners) 1)))
(gnc:html-table-set-col-headers!
- table (append make-heading-list
+ table (append (if accounts>1? '(#f) '())
+ make-heading-list
(options->address options receivable #f)))
(for-each
@@ -271,13 +272,14 @@ exist but have no suitable transactions."))
(acc-totals (caddr account-and-owners))
(comm (xaccAccountGetCommodity account)))
- (gnc:html-table-append-row!
- table (list (gnc:make-html-table-cell/size
- 1 (+ 2 num-buckets)
- (gnc:make-html-text
- (gnc:html-markup-anchor
- (gnc:account-anchor-text account)
- (xaccAccountGetName account))))))
+ (when accounts>1?
+ (gnc:html-table-append-row!
+ table (list (gnc:make-html-table-cell/size
+ 1 (+ 2 num-buckets)
+ (gnc:make-html-text
+ (gnc:html-markup-anchor
+ (gnc:account-anchor-text account)
+ (xaccAccountGetName account)))))))
(for-each
(lambda (owner-and-aging)
@@ -287,7 +289,7 @@ exist but have no suitable transactions."))
(gnc:html-table-append-row!
table
(append
- (list #f)
+ (if accounts>1? '(#f) '())
(cons
(gnc:make-html-text
(gnc:html-markup-anchor
@@ -309,14 +311,15 @@ exist but have no suitable transactions."))
owners-and-aging)
(gnc:html-table-append-row!
table
- (cons* #f
- (gnc:make-html-table-cell/markup
- "total-label-cell" (_ "Total"))
- (map
- (lambda (amt)
- (gnc:make-html-table-cell/markup
- "total-number-cell" (gnc:make-gnc-monetary comm amt)))
- acc-totals)))))
+ (append
+ (if accounts>1? '(#f) '())
+ (list (gnc:make-html-table-cell/markup
+ "total-label-cell" (_ "Total")))
+ (map
+ (lambda (amt)
+ (gnc:make-html-table-cell/markup
+ "total-number-cell" (gnc:make-gnc-monetary comm amt)))
+ acc-totals)))))
accounts-and-owners)
(for-each gncOwnerFree tofree)
(gnc:html-document-add-object! document table)))))
commit 97798f9fd1b5c7864b359e84b9f76f2d8915c2c9
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Nov 10 04:07:08 2019 +0800
[new-aging] step 2 - reduce indentation level by 1
merge two let* together
diff --git a/gnucash/report/business-reports/new-aging.scm b/gnucash/report/business-reports/new-aging.scm
index e4a0a6b07..1e451b8f0 100644
--- a/gnucash/report/business-reports/new-aging.scm
+++ b/gnucash/report/business-reports/new-aging.scm
@@ -325,50 +325,45 @@ exist but have no suitable transactions."))
(let* ((account (car accounts))
(splits-acc-others (list-split splits split-from-acct? account))
(acc-splits (car splits-acc-others))
- (other-acc-splits (cdr splits-acc-others)))
-
- (gnc:debug 'account account)
-
- (let* ((split-owners (map split->owner acc-splits))
- (acc-owners (sort (sort-and-delete-duplicates
- split-owners ownerGUID<? gnc-owner-equal?)
- owner<?)))
-
- (gnc:debug 'owners acc-owners)
-
- ;; loop into each APAR account split
- (let lp ((acc-owners acc-owners)
- (acc-splits acc-splits)
- (acc-totals (make-list (1+ num-buckets) 0))
- (owners-and-aging '()))
- (cond
- ((null? acc-owners)
- (loop (cdr accounts)
- other-acc-splits
- (if (null? owners-and-aging)
- accounts-and-owners
- (cons (list account owners-and-aging acc-totals)
- accounts-and-owners))
- (append-reverse tofree split-owners)))
-
- (else
- (let* ((owner (car acc-owners))
- (splits-own-others (list-split acc-splits split-has-owner?
- owner))
- (owner-splits (car splits-own-others))
- (other-owner-splits (cdr splits-own-others))
- (aging (gnc:owner-splits->aging-list
- owner-splits num-buckets report-date
- date-type receivable))
- (aging-total (apply + aging)))
- (lp (cdr acc-owners)
- other-owner-splits
- (map + acc-totals
- (reverse (cons aging-total aging)))
- (if (or show-zeros (not (every zero? aging)))
- (cons (list owner aging aging-total)
- owners-and-aging)
- owners-and-aging))))))))))))))
+ (other-acc-splits (cdr splits-acc-others))
+ (split-owners (map split->owner acc-splits))
+ (acc-owners (sort (sort-and-delete-duplicates
+ split-owners ownerGUID<? gnc-owner-equal?)
+ owner<?)))
+
+ ;; loop into each APAR account split
+ (let lp ((acc-owners acc-owners)
+ (acc-splits acc-splits)
+ (acc-totals (make-list (1+ num-buckets) 0))
+ (owners-and-aging '()))
+ (cond
+ ((null? acc-owners)
+ (loop (cdr accounts)
+ other-acc-splits
+ (if (null? owners-and-aging)
+ accounts-and-owners
+ (cons (list account owners-and-aging acc-totals)
+ accounts-and-owners))
+ (append-reverse tofree split-owners)))
+
+ (else
+ (let* ((owner (car acc-owners))
+ (splits-own-others (list-split acc-splits split-has-owner?
+ owner))
+ (owner-splits (car splits-own-others))
+ (other-owner-splits (cdr splits-own-others))
+ (aging (gnc:owner-splits->aging-list
+ owner-splits num-buckets report-date
+ date-type receivable))
+ (aging-total (apply + aging)))
+ (lp (cdr acc-owners)
+ other-owner-splits
+ (map + acc-totals
+ (reverse (cons aging-total aging)))
+ (if (or show-zeros (not (every zero? aging)))
+ (cons (list owner aging aging-total)
+ owners-and-aging)
+ owners-and-aging)))))))))))))
(gnc:report-finished)
document))
commit b72052137b562888421fdc9d4e7c7d05867c0186
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Nov 9 17:19:50 2019 +0800
[new-aging] step 1 - split loops into processing vs building table
Instead of rendering html-table all incrementally, build
account-and-owners and owners-and-aging lists first, leaving building
the html-table for the end. tofree is a list of owners which are
generated and must be freed after use.
diff --git a/gnucash/report/business-reports/new-aging.scm b/gnucash/report/business-reports/new-aging.scm
index 36d99c986..e4a0a6b07 100644
--- a/gnucash/report/business-reports/new-aging.scm
+++ b/gnucash/report/business-reports/new-aging.scm
@@ -237,8 +237,7 @@ exist but have no suitable transactions."))
(setup-query query accounts report-date)
(let* ((splits (qof-query-run query))
(accounts (sort-and-delete-duplicates (map xaccSplitGetAccount splits)
- gnc:account-path-less-p equal?))
- (table (gnc:make-html-table)))
+ gnc:account-path-less-p equal?)))
(qof-query-destroy query)
;; loop into each APAR account
@@ -247,32 +246,88 @@ exist but have no suitable transactions."))
(lambda (split)
(or (txn-is-invoice? (xaccSplitGetParent split))
(txn-is-payment? (xaccSplitGetParent split))))
- splits)))
+ splits))
+ (accounts-and-owners '())
+ (tofree '()))
(cond
((null? accounts)
- (gnc:html-table-set-col-headers!
- table (append make-heading-list
- (options->address options receivable #f)))
- (gnc:html-document-add-object!
- document (if (null? (gnc:html-table-data table))
- (gnc:make-html-text empty-APAR-accounts)
- table)))
+
+ (cond
+ ((null? accounts-and-owners)
+ (gnc:html-document-add-object!
+ document (gnc:make-html-text empty-APAR-accounts)))
+
+ (else
+ (let ((table (gnc:make-html-table)))
+
+ (gnc:html-table-set-col-headers!
+ table (append make-heading-list
+ (options->address options receivable #f)))
+
+ (for-each
+ (lambda (account-and-owners)
+ (let* ((account (car account-and-owners))
+ (owners-and-aging (cadr account-and-owners))
+ (acc-totals (caddr account-and-owners))
+ (comm (xaccAccountGetCommodity account)))
+
+ (gnc:html-table-append-row!
+ table (list (gnc:make-html-table-cell/size
+ 1 (+ 2 num-buckets)
+ (gnc:make-html-text
+ (gnc:html-markup-anchor
+ (gnc:account-anchor-text account)
+ (xaccAccountGetName account))))))
+
+ (for-each
+ (lambda (owner-and-aging)
+ (let ((owner (car owner-and-aging))
+ (aging (cadr owner-and-aging))
+ (aging-total (caddr owner-and-aging)))
+ (gnc:html-table-append-row!
+ table
+ (append
+ (list #f)
+ (cons
+ (gnc:make-html-text
+ (gnc:html-markup-anchor
+ (gnc:owner-anchor-text owner)
+ (gncOwnerGetName owner)))
+ (map
+ (lambda (amt)
+ (gnc:make-html-table-cell/markup
+ "number-cell" (gnc:make-gnc-monetary comm amt)))
+ (reverse aging)))
+ (list
+ (gnc:make-html-table-cell/markup
+ "number-cell"
+ (gnc:make-html-text
+ (gnc:html-markup-anchor
+ (gnc:owner-report-text owner account)
+ (gnc:make-gnc-monetary comm aging-total)))))
+ (options->address options receivable owner)))))
+ owners-and-aging)
+ (gnc:html-table-append-row!
+ table
+ (cons* #f
+ (gnc:make-html-table-cell/markup
+ "total-label-cell" (_ "Total"))
+ (map
+ (lambda (amt)
+ (gnc:make-html-table-cell/markup
+ "total-number-cell" (gnc:make-gnc-monetary comm amt)))
+ acc-totals)))))
+ accounts-and-owners)
+ (for-each gncOwnerFree tofree)
+ (gnc:html-document-add-object! document table)))))
(else
(let* ((account (car accounts))
- (comm (xaccAccountGetCommodity account))
(splits-acc-others (list-split splits split-from-acct? account))
(acc-splits (car splits-acc-others))
(other-acc-splits (cdr splits-acc-others)))
(gnc:debug 'account account)
- (gnc:html-table-append-row!
- table (list (gnc:make-html-table-cell/size
- 1 (+ 2 num-buckets)
- (gnc:make-html-text
- (gnc:html-markup-anchor
- (gnc:account-anchor-text account)
- (xaccAccountGetName account))))))
(let* ((split-owners (map split->owner acc-splits))
(acc-owners (sort (sort-and-delete-duplicates
@@ -284,22 +339,17 @@ exist but have no suitable transactions."))
;; loop into each APAR account split
(let lp ((acc-owners acc-owners)
(acc-splits acc-splits)
- (acc-totals (make-list (1+ num-buckets) 0)))
+ (acc-totals (make-list (1+ num-buckets) 0))
+ (owners-and-aging '()))
(cond
((null? acc-owners)
- (for-each gncOwnerFree split-owners)
- (gnc:html-table-append-row!
- table
- (cons* #f
- (gnc:make-html-table-cell/markup
- "total-label-cell" (_ "Total"))
- (map
- (lambda (amt)
- (gnc:make-html-table-cell/markup
- "total-number-cell" (gnc:make-gnc-monetary comm amt)))
- acc-totals)))
(loop (cdr accounts)
- other-acc-splits))
+ other-acc-splits
+ (if (null? owners-and-aging)
+ accounts-and-owners
+ (cons (list account owners-and-aging acc-totals)
+ accounts-and-owners))
+ (append-reverse tofree split-owners)))
(else
(let* ((owner (car acc-owners))
@@ -311,33 +361,14 @@ exist but have no suitable transactions."))
owner-splits num-buckets report-date
date-type receivable))
(aging-total (apply + aging)))
- (when (or show-zeros (not (every zero? aging)))
- (gnc:html-table-append-row!
- table
- (append
- (list #f)
- (cons
- (gnc:make-html-text
- (gnc:html-markup-anchor
- (gnc:owner-anchor-text owner)
- (gncOwnerGetName owner)))
- (map
- (lambda (amt)
- (gnc:make-html-table-cell/markup
- "number-cell" (gnc:make-gnc-monetary comm amt)))
- (reverse aging)))
- (list
- (gnc:make-html-table-cell/markup
- "number-cell"
- (gnc:make-html-text
- (gnc:html-markup-anchor
- (gnc:owner-report-text owner account)
- (gnc:make-gnc-monetary comm aging-total)))))
- (options->address options receivable owner))))
(lp (cdr acc-owners)
other-owner-splits
(map + acc-totals
- (reverse (cons aging-total aging))))))))))))))))
+ (reverse (cons aging-total aging)))
+ (if (or show-zeros (not (every zero? aging)))
+ (cons (list owner aging aging-total)
+ owners-and-aging)
+ owners-and-aging))))))))))))))
(gnc:report-finished)
document))
commit 72c20a07c36fbf719691f5cc35e2df4037218d23
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Nov 9 14:45:11 2019 +0800
[new-owner-report] merge setup-query and setup-job-query
They were very similar.
and remove html-document-set-title! because the document headline will
override title in the renderer.
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index f702a9ab4..ee8263f70 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -622,33 +622,17 @@ invoices and amounts.")))))
(loop (cdr list-of-substrings)
(cons* (gnc:html-markup-br) (car list-of-substrings) result)))))
-(define (setup-job-query q owner accounts end-date)
- (let ((guid (gncOwnerReturnGUID owner)))
+(define (setup-query q owner accounts end-date job?)
+ (let ((guid (gncOwnerReturnGUID (if job? owner (gncOwnerGetEndOwner owner))))
+ (last-param (if job? QOF-PARAM-GUID OWNER-PARENTG)))
(qof-query-add-guid-match
- q (list SPLIT-TRANS INVOICE-FROM-TXN INVOICE-OWNER QOF-PARAM-GUID)
+ q (list SPLIT-TRANS INVOICE-FROM-TXN INVOICE-OWNER last-param)
guid QOF-QUERY-OR)
(qof-query-add-guid-match
- q (list SPLIT-LOT OWNER-FROM-LOT QOF-PARAM-GUID)
+ q (list SPLIT-LOT OWNER-FROM-LOT last-param)
guid QOF-QUERY-OR)
(qof-query-add-guid-match
- q (list SPLIT-LOT INVOICE-FROM-LOT INVOICE-OWNER QOF-PARAM-GUID)
- guid QOF-QUERY-OR)
- (xaccQueryAddAccountMatch q accounts QOF-GUID-MATCH-ANY QOF-QUERY-AND)
- (xaccQueryAddDateMatchTT q #f end-date #t end-date QOF-QUERY-AND)
- (qof-query-set-book q (gnc-get-current-book))
- (qof-query-set-sort-order q (list SPLIT-TRANS TRANS-DATE-POSTED) '() '())
- q))
-
-(define (setup-query q owner accounts end-date)
- (let ((guid (gncOwnerReturnGUID (gncOwnerGetEndOwner owner))))
- (qof-query-add-guid-match
- q (list SPLIT-TRANS INVOICE-FROM-TXN INVOICE-OWNER OWNER-PARENTG)
- guid QOF-QUERY-OR)
- (qof-query-add-guid-match
- q (list SPLIT-LOT OWNER-FROM-LOT OWNER-PARENTG)
- guid QOF-QUERY-OR)
- (qof-query-add-guid-match
- q (list SPLIT-LOT INVOICE-FROM-LOT INVOICE-OWNER OWNER-PARENTG)
+ q (list SPLIT-LOT INVOICE-FROM-LOT INVOICE-OWNER last-param)
guid QOF-QUERY-OR)
(xaccQueryAddAccountMatch q accounts QOF-GUID-MATCH-ANY QOF-QUERY-AND)
(xaccQueryAddDateMatchTT q #f end-date #t end-date QOF-QUERY-AND)
@@ -744,16 +728,11 @@ invoices and amounts.")))))
(_ "This report requires a valid AP/AR account to be available."))))
(else
- (if (eqv? GNC-OWNER-JOB type)
- (setup-job-query query owner accounts end-date)
- (setup-query query owner accounts end-date))
+ (setup-query query owner accounts end-date (eqv? GNC-OWNER-JOB type))
(let ((splits (xaccQueryGetSplitsUniqueTrans query)))
(qof-query-destroy query)
- (gnc:html-document-set-title!
- document (string-append report-title ": " (gncOwnerGetName owner)))
-
(gnc:html-document-set-headline!
document (gnc:html-markup
"span" (owner-string type) " " (_ "Report:") " "
commit 9f4677e34651a35b409a1fcdc967bbbd2b6e5020
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Nov 9 14:31:24 2019 +0800
[new-owner-report] apply total-label-cell to label
Previous used 'total-number-cell' thereby unnecessarily right-aligning
total label cells.
Also xaccTransGetAccountAmount is more appropriate than
xaccTransGetAccountValue because the latter may retrieve numbers in a
currency other than APAR currency.
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index c99dee194..f702a9ab4 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -252,7 +252,7 @@
(define link-cols (assq-ref '((none . 0) (simple . 1) (detailed . 3)) link-option))
(define (print-totals total debit credit tax sale)
(define (total-cell cell)
- (gnc:make-html-table-cell/markup "total-number-cell" cell))
+ (gnc:make-html-table-cell/markup "total-label-cell" cell))
(define (make-cell amt)
(total-cell (gnc:make-gnc-monetary currency amt)))
(define span
@@ -447,7 +447,7 @@
(let* ((split (car splits))
(txn (xaccSplitGetParent split))
(date (xaccTransGetDate txn))
- (value (xaccTransGetAccountValue txn acc))
+ (value (xaccTransGetAccountAmount txn acc))
(value (if payable? (- value) value))
(invoice (gncInvoiceGetInvoiceFromTxn txn))
(invoice-splits
commit f0701da8685ec0b8bbd593099a561fb9cc60503f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sat Nov 9 06:14:17 2019 +0800
[new-owner-report] modify report row->value accessor
Previously each owner-table row's value would access split's
amount. But this fails for payments spanning multiple invoices,
because these (with a single split to bank) will have a split for each
invoice. Hence split->amount gets only 1 invoice payment amount.
This change modifies to obtain the sum total of split->amounts in the
APAR account thus handles multi-invoice payments correctly.
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 549601f78..c99dee194 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -447,7 +447,7 @@
(let* ((split (car splits))
(txn (xaccSplitGetParent split))
(date (xaccTransGetDate txn))
- (value (xaccSplitGetAmount split))
+ (value (xaccTransGetAccountValue txn acc))
(value (if payable? (- value) value))
(invoice (gncInvoiceGetInvoiceFromTxn txn))
(invoice-splits
commit a4773d2ba7d05f973f44eb9be1af866576131150
Author: John Ralls <jralls at ceridwen.us>
Date: Fri Nov 8 13:12:05 2019 -0800
Ensure all uses of g_table_index are protected from NULL return values.
Including all of the convenience wrappers.
Also remove a few calls where the result is discarded, as it has no
side effects.
diff --git a/gnucash/register/ledger-core/gncEntryLedgerControl.c b/gnucash/register/ledger-core/gncEntryLedgerControl.c
index b36e44d83..f1e19f812 100644
--- a/gnucash/register/ledger-core/gncEntryLedgerControl.c
+++ b/gnucash/register/ledger-core/gncEntryLedgerControl.c
@@ -234,7 +234,6 @@ static void gnc_entry_ledger_move_cursor (VirtualLocation *p_new_virt_loc,
* then it may have moved. Find out where it is now. */
if (gnc_entry_ledger_find_entry (ledger, new_entry, &vcell_loc))
{
- gnc_table_get_virtual_cell (ledger->table, vcell_loc);
new_virt_loc.vcell_loc = vcell_loc;
}
else
diff --git a/gnucash/register/ledger-core/split-register-control.c b/gnucash/register/ledger-core/split-register-control.c
index 57be98e7c..00cc42999 100644
--- a/gnucash/register/ledger-core/split-register-control.c
+++ b/gnucash/register/ledger-core/split-register-control.c
@@ -543,7 +543,6 @@ gnc_split_register_move_cursor (VirtualLocation *p_new_virt_loc,
new_split, new_class, &vcell_loc))
{
- gnc_table_get_virtual_cell (reg->table, vcell_loc);
new_virt_loc.vcell_loc = vcell_loc;
}
else
diff --git a/gnucash/register/register-gnome/gnucash-header.c b/gnucash/register/register-gnome/gnucash-header.c
index 1b2de66d7..e5aceae8a 100644
--- a/gnucash/register/register-gnome/gnucash-header.c
+++ b/gnucash/register/register-gnome/gnucash-header.c
@@ -350,8 +350,8 @@ find_resize_col (GncHeader *header, int col)
/* skip to the right over zero-width columns */
while ((col + 1 < style->ncols) &&
(cd = gnucash_style_get_cell_dimensions (style, 0, col + 1)) &&
- (cd->pixel_width == 0))
- col++;
+ cd && (cd->pixel_width == 0))
+ ++col;
/* now go back left till we have a resizable column */
while (col >= start)
diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c
index 889e78077..fd5b8f6c5 100644
--- a/gnucash/register/register-gnome/gnucash-sheet.c
+++ b/gnucash/register/register-gnome/gnucash-sheet.c
@@ -564,7 +564,8 @@ gnucash_sheet_show_row (GnucashSheet *sheet, gint virt_row)
height = alloc.height;
block = gnucash_sheet_get_block (sheet, vcell_loc);
-
+ if (!block)
+ return;
y = block->origin_y;
block_height = block->style->dimensions->height;
@@ -644,6 +645,8 @@ gnucash_sheet_show_range (GnucashSheet *sheet,
start_block = gnucash_sheet_get_block (sheet, start_loc);
end_block = gnucash_sheet_get_block (sheet, end_loc);
+ if (!(start_block && end_block))
+ return;
y = start_block->origin_y;
block_height = (end_block->origin_y +
@@ -2228,7 +2231,7 @@ gnucash_sheet_block_set_from_table (GnucashSheet *sheet,
block = gnucash_sheet_get_block (sheet, vcell_loc);
style = gnucash_sheet_get_style_from_table (sheet, vcell_loc);
- if (block == NULL)
+ if (!block)
return FALSE;
table = sheet->table;
@@ -2275,6 +2278,9 @@ gnucash_sheet_col_max_width (GnucashSheet *sheet, gint virt_col, gint cell_col)
VirtualCellLocation vcell_loc = { virt_row, virt_col };
block = gnucash_sheet_get_block (sheet, vcell_loc);
+ if (!block)
+ continue;
+
style = block->style;
if (!style)
@@ -2410,6 +2416,9 @@ gnucash_sheet_recompute_block_offsets (GnucashSheet *sheet)
block = gnucash_sheet_get_block (sheet, vcell_loc);
+ if (!block)
+ continue;
+
block->origin_x = width;
block->origin_y = height;
diff --git a/gnucash/register/register-gnome/gnucash-style.c b/gnucash/register/register-gnome/gnucash-style.c
index 83ce8e4e8..13d801e4b 100644
--- a/gnucash/register/register-gnome/gnucash-style.c
+++ b/gnucash/register/register-gnome/gnucash-style.c
@@ -158,6 +158,10 @@ compute_row_width (BlockDimensions *dimensions, int row, int col1, int col2)
{
CellDimensions *cd;
cd = g_table_index (dimensions->cell_dimensions, row, j);
+
+ if (!cd)
+ continue;
+
width += cd->pixel_width;
}
@@ -190,7 +194,7 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
row, col);
cell = gnc_cellblock_get_cell (cursor, row, col);
- if (!cell)
+ if (!cell || !cd)
continue;
text = cell->sample_text;
@@ -228,7 +232,6 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
cd->pixel_width = MAX (cd->pixel_width, width);
}
- g_table_index (dimensions->cell_dimensions, row, 0);
dimensions->height += max_height;
}
@@ -238,6 +241,9 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
{
cd = g_table_index (dimensions->cell_dimensions,
row, col);
+ if (!cd)
+ continue;
+
cd->pixel_height = max_height;
}
}
@@ -277,6 +283,9 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
{
cd = g_table_index (cd_table, 0, col);
+ if (!cd)
+ continue;
+
widths[col] = cd->pixel_width;
width += cd->pixel_width;
}
@@ -293,6 +302,9 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
cd = g_table_index (cd_table, 0, col);
+ if (!cd)
+ continue;
+
cd->pixel_width += (default_width - width);
widths[col] = cd->pixel_width;
@@ -315,6 +327,9 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
cd = g_table_index (cd_table, 0, col);
+ if (!cd)
+ continue;
+
cd->pixel_width += (default_width - width);
text = cell->sample_text;
@@ -354,6 +369,9 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
{
cd = g_table_index (cd_table, row, col);
+ if (!cd)
+ continue;
+
cd->pixel_width = widths[col];
}
}
@@ -390,7 +408,7 @@ set_dimensions_pass_two (GnucashSheet *sheet, int default_width)
continue;
}
- if (!cd->can_span_over)
+ if (!cd || !cd->can_span_over)
continue;
if (cd_span == NULL)
@@ -440,6 +458,9 @@ compute_cell_origins_x (BlockDimensions *dimensions)
cd = g_table_index (dimensions->cell_dimensions, i, j);
+ if (!cd)
+ continue;
+
cd->origin_x = x;
x += cd->pixel_width;
}
@@ -458,9 +479,17 @@ compute_cell_origins_y (BlockDimensions *dimensions)
for (j = 0; j < dimensions->ncols; j++)
{
cd = g_table_index (dimensions->cell_dimensions, i, j);
+
+ if (!cd)
+ continue;
+
cd->origin_y = y;
}
cd = g_table_index (dimensions->cell_dimensions, i, 0);
+
+ if (!cd)
+ continue;
+
y += cd->pixel_height;
}
}
@@ -774,6 +803,9 @@ gnucash_sheet_get_style_from_table (GnucashSheet *sheet,
vcell = gnc_table_get_virtual_cell (table, vcell_loc);
+ if (!vcell)
+ return NULL;
+
cursor = vcell->cellblock;
style = gnucash_sheet_get_style_from_cursor (sheet,
commit 2bc7d314ed6b08eacc35adfca8ac1ac64f8ec3a7
Author: John Ralls <jralls at ceridwen.us>
Date: Fri Nov 8 12:33:00 2019 -0800
Bug 797481 - crash on close of unsaved tabs by pressing [X]
Pretty much the only place gnucash_sheet_get_block could crash is in
g_table_index, either because the GTable's GArray has been deleted or
the index is out of range. Add g_return_val_if_false tests for each
possibility.
diff --git a/gnucash/register/register-core/gtable.c b/gnucash/register/register-core/gtable.c
index 1c75fca05..b22ee6f18 100644
--- a/gnucash/register/register-core/gtable.c
+++ b/gnucash/register/register-core/gtable.c
@@ -83,7 +83,8 @@ g_table_destroy (GTable *gtable)
gpointer
g_table_index (GTable *gtable, int row, int col)
{
- guint index;
+ guint index = row * gtable->cols + col;
+ guint offset = index * gtable->entry_size;
if (gtable == NULL)
return NULL;
@@ -94,9 +95,9 @@ g_table_index (GTable *gtable, int row, int col)
if (col >= gtable->cols)
return NULL;
- index = ((row * gtable->cols) + col) * gtable->entry_size;
-
- return >able->array->data[index];
+ g_return_val_if_fail (gtable->array != NULL, NULL);
+ g_return_val_if_fail (gtable->array->len > index, NULL);
+ return >able->array->data[offset];
}
void
commit 32ff31feadaed6ec5a6902a690bf62651eed9fc2
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Fri Nov 8 14:51:30 2019 +0000
Bug 796945 - Search dialog update - follow up
For some reason on Ubuntu 18.04 that uses Gtk3.22.30 and maybe others
we have to set the scroll window content min height after the dialog
has been shown to get the correct scroll window height
diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index 39efe30d1..5d6400a18 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -1320,6 +1320,14 @@ gnc_search_dialog_create (GtkWindow *parent,
gtk_window_set_transient_for(GTK_WINDOW(sw->dialog), parent);
gtk_widget_show(sw->dialog);
+ /* For some reason on Ubuntu 18.04 that uses Gtk3.22.30 and maybe others we
+ * have to set the scroll window content min height after the dialog has been
+ * shown to get the correct scroll window height */
+ gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW(
+ sw->criteria_scroll_window),
+ gtk_widget_get_allocated_height (
+ GTK_WIDGET(sw->grouping_combo)) * 1.5);
+
// Set the style context for this dialog so it can be easily manipulated with css
if (style_class == NULL)
gnc_widget_set_style_context (GTK_WIDGET(sw->dialog), "GncSearchDialog");
commit 952c6561447a3ad560865af34d60dc7d05ab9f4f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Nov 4 06:52:30 2019 +0800
[dialog-payment] instead of tooltip, render in gtklabel
The warning icon is used to show blocking and non-blocking warnings in
a payment. Increase visibility by showing the warning as a gtklabel
instead of a tooltip.
diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index 244046b67..3c4ad9a4f 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -81,6 +81,7 @@ struct _payment_window
GtkWidget * dialog;
GtkWidget * payment_warning;
+ GtkWidget * conflict_message;
GtkWidget * ok_button;
GtkWidget * num_entry;
GtkWidget * memo_entry;
@@ -288,7 +289,7 @@ update_cleanup:
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(pw->print_check), pw->print_check_state);
/* Check if there are issues preventing a successful payment */
- gtk_widget_set_tooltip_text (pw->payment_warning, conflict_msg);
+ gtk_label_set_text (GTK_LABEL(pw->conflict_message), conflict_msg);
gtk_widget_set_sensitive (pw->ok_button, allow_payment);
if (conflict_msg)
{
@@ -1192,6 +1193,7 @@ new_payment_window (GtkWindow *parent, QofBook *book, InitialPaymentInfo *tx_inf
/* Grab the widgets and build the dialog */
pw->payment_warning = GTK_WIDGET (gtk_builder_get_object (builder, "payment_warning"));
+ pw->conflict_message = GTK_WIDGET (gtk_builder_get_object (builder, "conflict_message"));
pw->ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "okbutton"));
pw->num_entry = GTK_WIDGET (gtk_builder_get_object (builder, "num_entry"));
pw->memo_entry = GTK_WIDGET (gtk_builder_get_object (builder, "memo_entry"));
diff --git a/gnucash/gtkbuilder/dialog-payment.glade b/gnucash/gtkbuilder/dialog-payment.glade
index f0c866651..a500f2952 100644
--- a/gnucash/gtkbuilder/dialog-payment.glade
+++ b/gnucash/gtkbuilder/dialog-payment.glade
@@ -108,18 +108,6 @@
<property name="position">1</property>
</packing>
</child>
- <child>
- <object class="GtkImage" id="payment_warning">
- <property name="can_focus">False</property>
- <property name="icon_name">dialog-warning</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- <property name="secondary">True</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
@@ -761,6 +749,38 @@ In case of an over-payment or if no invoice was selected, GnuCash will automatic
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="table4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="column_spacing">5</property>
+ <child>
+ <object class="GtkImage" id="payment_warning">
+ <property name="can_focus">False</property>
+ <property name="icon_name">dialog-warning</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="conflict_message">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
commit ee19108321631931a386dc4d1018b8f295df3f80
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Nov 4 06:33:43 2019 +0800
[dialog-payment] tooltip warning if payment is unattached
Completing a payment for a customer without associating with an open
invoice is allowable and is used for prepayments.
Previously this was done silently.
This commit will enable a warning to inform that the payment does not
have an invoice/bill document attached. This warning does not block
the payment however.
diff --git a/gnucash/gnome/dialog-payment.c b/gnucash/gnome/dialog-payment.c
index b1f96523a..244046b67 100644
--- a/gnucash/gnome/dialog-payment.c
+++ b/gnucash/gnome/dialog-payment.c
@@ -218,6 +218,8 @@ gnc_payment_window_check_payment (PaymentWindow *pw)
const char *conflict_msg = NULL;
gnc_numeric amount_deb, amount_cred;
gboolean enable_xfer_acct = TRUE;
+ gboolean allow_payment = TRUE;
+ GtkTreeSelection *selection;
if (!pw)
return FALSE;
@@ -226,6 +228,7 @@ gnc_payment_window_check_payment (PaymentWindow *pw)
if (!pw->post_acct)
{
conflict_msg = _("You must enter a valid account name for posting.");
+ allow_payment = FALSE;
goto update_cleanup;
}
@@ -234,6 +237,7 @@ gnc_payment_window_check_payment (PaymentWindow *pw)
if (!gncOwnerIsValid(&pw->owner))
{
conflict_msg = _("You must select a company for payment processing.");
+ allow_payment = FALSE;
goto update_cleanup;
}
@@ -255,9 +259,21 @@ gnc_payment_window_check_payment (PaymentWindow *pw)
if (!pw->xfer_acct)
{
conflict_msg = _("You must select a transfer account from the account tree.");
+ allow_payment = FALSE;
+ goto update_cleanup;
}
}
+ /* this last test checks whether documents were selected. if none,
+ emit warning but still allow as an unattached payment. */
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
+ if (gtk_tree_selection_count_selected_rows (selection) == 0)
+ {
+ conflict_msg = _("No documents were selected to assign this payment to. This may create an unattached payment.");
+ allow_payment = TRUE;
+ }
+
+
update_cleanup:
gtk_widget_set_sensitive (pw->acct_tree, enable_xfer_acct);
@@ -273,19 +289,17 @@ update_cleanup:
/* Check if there are issues preventing a successful payment */
gtk_widget_set_tooltip_text (pw->payment_warning, conflict_msg);
+ gtk_widget_set_sensitive (pw->ok_button, allow_payment);
if (conflict_msg)
{
gtk_widget_show (pw->payment_warning);
- gtk_widget_set_sensitive (pw->ok_button, FALSE);
- return FALSE;
}
else
{
gtk_widget_hide (pw->payment_warning);
- gtk_widget_set_sensitive (pw->ok_button, TRUE);
}
- return TRUE;
+ return allow_payment;
}
static void
commit 21d608038eadbe573e52a47a99bd57c1ee000474
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Nov 4 20:12:36 2019 +0800
Addendum to UI Jump to Invoice at 535632b02
Previous trans->invoice strategy was flawed. A payment for multiple
invoices would always return the first invoice found.
A safer approach is to find split->invoice -- this enables a split
from a payment for multiple invoices to retrieve the corresponding
invoice.
The disadvantage is that we cannot jump from bank split to invoice
split anymore; this is acceptable because a payment which covers
multiple invoices would lead to ambiguity and would require UI to
select the invoice for jump.
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index d2de0dbb1..9f50b16ec 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -199,7 +199,7 @@ static void gnc_plugin_page_register_event_handler (QofInstance *entity,
GncPluginPageRegister *page,
GncEventData *ed);
-static GncInvoice * invoice_from_trans (Transaction *trans);
+static GncInvoice * invoice_from_split (Split *split);
/************************************************************/
/* Actions */
@@ -1025,7 +1025,7 @@ gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *pag
gtk_action_set_sensitive (GTK_ACTION(action), (uri && *uri));
/* Set 'ExecAssociatedInvoice' */
- inv = invoice_from_trans(trans);
+ inv = invoice_from_split (gnc_split_register_get_current_split (reg));
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
"JumpAssociatedInvoiceAction");
gtk_action_set_sensitive (GTK_ACTION(action), inv != NULL);
@@ -4328,37 +4328,23 @@ gnc_plugin_page_register_cmd_execassociated_transaction (GtkAction *action,
}
-static GncInvoice * invoice_from_trans (Transaction *trans)
+static GncInvoice * invoice_from_split (Split *split)
{
GncInvoice *invoice;
- SplitList *splits;
-
- g_return_val_if_fail (GNC_IS_TRANSACTION(trans), NULL);
- invoice = gncInvoiceGetInvoiceFromTxn(trans);
-
- if (invoice)
- return invoice;
-
- for (splits = xaccTransGetSplitList (trans); splits; splits = splits->next)
- {
- Split *split = splits->data;
- GNCLot *lot;
-
- if (!split)
- continue;
+ GNCLot *lot;
- lot = xaccSplitGetLot (split);
- if (!lot)
- continue;
+ if (!split)
+ return NULL;
- invoice = gncInvoiceGetInvoiceFromLot (lot);
- if (!invoice)
- continue;
+ lot = xaccSplitGetLot (split);
+ if (!lot)
+ return NULL;
- return invoice;
- }
+ invoice = gncInvoiceGetInvoiceFromLot (lot);
+ if (!invoice)
+ return NULL;
- return NULL;
+ return invoice;
}
static void
@@ -4374,8 +4360,7 @@ gnc_plugin_page_register_cmd_jump_associated_invoice (GtkAction *action,
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
reg = gnc_ledger_display_get_split_register (priv->gsr->ledger);
- invoice = invoice_from_trans (xaccSplitGetParent
- (gnc_split_register_get_current_split (reg)));
+ invoice = invoice_from_split (gnc_split_register_get_current_split (reg));
if (invoice)
gnc_ui_invoice_edit (NULL, invoice);
commit e991fe853caff678ec23cdeb41e9d1ea87403d6b
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Nov 5 09:14:14 2019 -0800
Bug 797086 - Import customer dialog â headers not translated
diff --git a/gnucash/import-export/customer-import/dialog-customer-import-gui.c b/gnucash/import-export/customer-import/dialog-customer-import-gui.c
index c2308de05..5b6fb6ea4 100644
--- a/gnucash/import-export/customer-import/dialog-customer-import-gui.c
+++ b/gnucash/import-export/customer-import/dialog-customer-import-gui.c
@@ -124,25 +124,25 @@ gnc_plugin_customer_import_showGUI(GtkWindow *parent)
column = gtk_tree_view_column_new_with_attributes (description, renderer, "text", column_id, NULL); \
gtk_tree_view_column_set_resizable (column, TRUE); \
gtk_tree_view_append_column (GTK_TREE_VIEW (gui->tree_view), column);
- CREATE_COLUMN ("id", CI_ID);
- CREATE_COLUMN ("company", CI_COMPANY);
- CREATE_COLUMN ("name", CI_NAME);
- CREATE_COLUMN ("addr1", CI_ADDR1);
- CREATE_COLUMN ("addr2", CI_ADDR2);
- CREATE_COLUMN ("addr3", CI_ADDR3);
- CREATE_COLUMN ("addr4", CI_ADDR4);
- CREATE_COLUMN ("phone", CI_PHONE);
- CREATE_COLUMN ("fax", CI_FAX);
- CREATE_COLUMN ("email", CI_EMAIL);
- CREATE_COLUMN ("notes", CI_NOTES);
- CREATE_COLUMN ("shipname", CI_SHIPNAME);
- CREATE_COLUMN ("shipaddr1", CI_SHIPADDR1);
- CREATE_COLUMN ("shipaddr2", CI_SHIPADDR2);
- CREATE_COLUMN ("shipaddr3", CI_SHIPADDR3);
- CREATE_COLUMN ("shipaddr4", CI_SHIPADDR4);
- CREATE_COLUMN ("shipphone", CI_SHIPPHONE);
- CREATE_COLUMN ("shipfax", CI_SHIPFAX);
- CREATE_COLUMN ("shipemail", CI_SHIPEMAIL);
+ CREATE_COLUMN (_("id"), CI_ID);
+ CREATE_COLUMN (_("company"), CI_COMPANY);
+ CREATE_COLUMN (_("name"), CI_NAME);
+ CREATE_COLUMN (_("addr1"), CI_ADDR1);
+ CREATE_COLUMN (_("addr2"), CI_ADDR2);
+ CREATE_COLUMN (_("addr3"), CI_ADDR3);
+ CREATE_COLUMN (_("addr4"), CI_ADDR4);
+ CREATE_COLUMN (_("phone"), CI_PHONE);
+ CREATE_COLUMN (_("fax"), CI_FAX);
+ CREATE_COLUMN (_("email"), CI_EMAIL);
+ CREATE_COLUMN (_("notes"), CI_NOTES);
+ CREATE_COLUMN (_("shipname"), CI_SHIPNAME);
+ CREATE_COLUMN (_("shipaddr1"), CI_SHIPADDR1);
+ CREATE_COLUMN (_("shipaddr2"), CI_SHIPADDR2);
+ CREATE_COLUMN (_("shipaddr3"), CI_SHIPADDR3);
+ CREATE_COLUMN (_("shipaddr4"), CI_SHIPADDR4);
+ CREATE_COLUMN (_("shipphone"), CI_SHIPPHONE);
+ CREATE_COLUMN (_("shipfax"), CI_SHIPFAX);
+ CREATE_COLUMN (_("shipemail"), CI_SHIPEMAIL);
gui->component_id = gnc_register_gui_component ("dialog-customer-import-gui",
NULL,
commit 910cdbfddc39eea3fc8e624eeda46f40543972e7
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Nov 5 09:12:17 2019 -0800
Fix compile error, missing return value.
And a condition, !(!inv) to cast inv as a bool is a bit too clever.
inv != NULL more clearly conveys the intent.
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index 308c40916..d2de0dbb1 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -1028,7 +1028,7 @@ gnc_plugin_page_register_ui_update (gpointer various, GncPluginPageRegister *pag
inv = invoice_from_trans(trans);
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
"JumpAssociatedInvoiceAction");
- gtk_action_set_sensitive (GTK_ACTION(action), (!(!inv)));
+ gtk_action_set_sensitive (GTK_ACTION(action), inv != NULL);
gnc_plugin_business_split_reg_ui_update (GNC_PLUGIN_PAGE(page));
@@ -4333,7 +4333,7 @@ static GncInvoice * invoice_from_trans (Transaction *trans)
GncInvoice *invoice;
SplitList *splits;
- g_return_if_fail (GNC_IS_TRANSACTION(trans));
+ g_return_val_if_fail (GNC_IS_TRANSACTION(trans), NULL);
invoice = gncInvoiceGetInvoiceFromTxn(trans);
if (invoice)
commit 1a9825febcaadbd17298a45d3d032f94e59ee6d7
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Nov 5 23:08:08 2019 +0800
[new-owner-report] job-reports reverse according to ownertype
Previously job-report assumed owner was customer and assumed use of
A/Receivable account.
This fix ensures the payable? boolean must be derived dynamically from
owner-type rather than from report-type. This commit will check
whether owner is vendor/employee and uses a/payable; otherwise uses
a/receivable.
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index d7cfa2589..549601f78 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -695,7 +695,7 @@ invoices and amounts.")))))
(gnc:make-html-text
(gnc:html-markup-br))))
-(define (reg-renderer report-obj type payable?)
+(define (reg-renderer report-obj type)
(define options (gnc:report-options report-obj))
(define (opt-val section name)
(gnc:option-value
@@ -719,6 +719,8 @@ invoices and amounts.")))))
(owner-descr (owner-string type))
(date-type (opt-val gnc:pagename-general optname-date-driver))
(owner (opt-val owner-page owner-descr))
+ (payable? (memv (gncOwnerGetType (gncOwnerGetEndOwner owner))
+ (list GNC-OWNER-VENDOR GNC-OWNER-EMPLOYEE)))
(query (qof-query-create-for-splits))
(document (gnc:make-html-document))
(table (gnc:make-html-table))
@@ -842,16 +844,16 @@ invoices and amounts.")))))
document))
(define (customer-renderer obj)
- (reg-renderer obj GNC-OWNER-CUSTOMER #f))
+ (reg-renderer obj GNC-OWNER-CUSTOMER))
(define (vendor-renderer obj)
- (reg-renderer obj GNC-OWNER-VENDOR #t))
+ (reg-renderer obj GNC-OWNER-VENDOR))
(define (employee-renderer obj)
- (reg-renderer obj GNC-OWNER-EMPLOYEE #t))
+ (reg-renderer obj GNC-OWNER-EMPLOYEE))
(define (job-renderer obj)
- (reg-renderer obj GNC-OWNER-JOB #f))
+ (reg-renderer obj GNC-OWNER-JOB))
(gnc:define-report
'version 1
commit c8d1e7c197a7868730739166b75621584c686a79
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Nov 5 20:59:18 2019 +0800
[html-table] Remove deprecated function
diff --git a/gnucash/report/html-table.scm b/gnucash/report/html-table.scm
index e7ea54288..5d47cfce6 100644
--- a/gnucash/report/html-table.scm
+++ b/gnucash/report/html-table.scm
@@ -328,21 +328,6 @@
(gnc:html-table-data table)))
new-num-rows))
-(define (gnc:html-table-remove-last-row! table)
- (issue-deprecation-warning "gnc:html-table-remove-last-row! is unused.")
- (if (> (gnc:html-table-num-rows table) 0)
- (begin
- (gnc:html-table-set-num-rows-internal!
- table
- (- (gnc:html-table-num-rows table) 1))
- (gnc:html-table-set-data!
- table
- ;; Note that the rows in html-table-data are stored in
- ;; reverse, i.e. the last appended table row is the first
- ;; list element.
- (cdr (gnc:html-table-data table))))
- '()))
-
(define (gnc:html-table-prepend-row! table newrow)
(let* ((new-num-rows (1+ (gnc:html-table-num-rows table)))
(newrow-list (if (list? newrow) newrow (list newrow)))
diff --git a/gnucash/report/report.scm b/gnucash/report/report.scm
index e5cd25f65..ff4755f6b 100644
--- a/gnucash/report/report.scm
+++ b/gnucash/report/report.scm
@@ -610,7 +610,6 @@
(export gnc:html-table-append-row/markup!)
(export gnc:html-table-prepend-row/markup!)
(export gnc:html-table-append-row!)
-(export gnc:html-table-remove-last-row!)
(export gnc:html-table-prepend-row!)
(export gnc:html-table-get-cell)
(export gnc:html-table-set-cell!)
diff --git a/gnucash/report/test/test-report-html.scm b/gnucash/report/test/test-report-html.scm
index a45f85332..fb85968e0 100644
--- a/gnucash/report/test/test-report-html.scm
+++ b/gnucash/report/test/test-report-html.scm
@@ -655,32 +655,6 @@ HTML Document Title</title></head><body></body>\n\
)
)
(test-end "HTML Table - Append Rows")
- (test-begin "HTML Table - Remove Rows")
- (let (
- (test-doc (gnc:make-html-document))
- (test-table (gnc:make-html-table))
- )
- ;; change the default settings just to see what effect it has
- ;;(gnc:html-table-set-col-headers! test-table #t)
- ;; -> this make (gnc:html-table-render test-table test-doc) crash
- ;; col-headers must be #f or a list
- (gnc:html-table-set-row-headers! test-table #t)
- (gnc:html-table-set-caption! test-table #t)
- (gnc:html-table-append-row! test-table "Row 1")
- (gnc:html-table-append-row! test-table "Row 2")
- (gnc:html-table-remove-last-row! test-table)
- (test-equal "HTML Table - Check Num Rows after remove row"
- 1
- (gnc:html-table-num-rows test-table)
- )
- (test-equal "HTML Table - Check data after remove row"
- '(("Row 1"))
- (gnc:html-table-data test-table)
- )
- (gnc:html-table-remove-last-row! test-table)
- (test-equal "HTML Table - Negative Test: Remove non-existing rows" '() (gnc:html-table-remove-last-row! test-table))
- )
- (test-end "HTML Table - Remove Rows")
(test-begin "HTML Table - Prepend Rows")
(let (
(test-doc (gnc:make-html-document))
commit d0743cd0fc2dfef7021704b40e8b1ffd605c36cd
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Nov 5 22:10:16 2019 +0800
[new-aging] restore html link to account register
Current aging-report includes a link to APAR account register. New
aging-report includes the APAR account prior to each section. Ensure
the link to register is offered.
diff --git a/gnucash/report/business-reports/new-aging.scm b/gnucash/report/business-reports/new-aging.scm
index 0896b66a7..36d99c986 100644
--- a/gnucash/report/business-reports/new-aging.scm
+++ b/gnucash/report/business-reports/new-aging.scm
@@ -268,7 +268,11 @@ exist but have no suitable transactions."))
(gnc:debug 'account account)
(gnc:html-table-append-row!
table (list (gnc:make-html-table-cell/size
- 1 (+ 2 num-buckets) (xaccAccountGetName account))))
+ 1 (+ 2 num-buckets)
+ (gnc:make-html-text
+ (gnc:html-markup-anchor
+ (gnc:account-anchor-text account)
+ (xaccAccountGetName account))))))
(let* ((split-owners (map split->owner acc-splits))
(acc-owners (sort (sort-and-delete-duplicates
commit 1a404b8d76127f6030c168b41f6966ddec51e1e5
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Nov 5 21:25:37 2019 +0800
[new-owner-report] fix signs for calling gnc:owner-splits->aging-list
gnc:owner-splits->aging-list revceives an argument 'receivable'
specifying whether the report is dealing with an AR-type account. The
renderers for the various business types (customer/vendor/employee)
define 'reverse?' to be #f for AR reports, and #t for AP
reports. Therefore we need to send '(not reverse?)' to
gnc:owner-splits->aging-list.
This commit performs 2 changes:
* rename 'reverse?' to 'payable?' to be more explicit throughout
* calls gnc:owner-splits->aging-list with '(not payable?)' instead of
the confusing '(not reverse?)'
The end result is that the signs for aging-list for
new-owner-report.scm is now fixed.
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 82cfef200..d7cfa2589 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -180,10 +180,10 @@
(define (txn-is-payment? txn)
(eqv? (xaccTransGetTxnType txn) TXN-TYPE-PAYMENT))
-(define (make-aging-table splits to-date reverse? date-type currency)
+(define (make-aging-table splits to-date payable? date-type currency)
(let ((table (gnc:make-html-table))
(aging-list (gnc:owner-splits->aging-list
- splits num-buckets to-date date-type reverse?)))
+ splits num-buckets to-date date-type (not payable?))))
(gnc:html-table-set-col-headers!
table (list (_ "Prepayments")
@@ -247,7 +247,7 @@
(lp (cdr link-rows) #f))))
(define (add-owner-table table splits acc start-date end-date date-type
- used-columns reverse? link-option)
+ used-columns payable? link-option)
(define currency (xaccAccountGetCommodity acc))
(define link-cols (assq-ref '((none . 0) (simple . 1) (detailed . 3)) link-option))
(define (print-totals total debit credit tax sale)
@@ -296,7 +296,7 @@
1 (+ columns-used-size link-cols)
(make-aging-table splits
end-date
- reverse? date-type currency)))))
+ payable? date-type currency)))))
(define (add-balance-row odd-row? total)
(add-row table odd-row? used-columns start-date #f "" (_ "Balance") ""
@@ -448,7 +448,7 @@
(txn (xaccSplitGetParent split))
(date (xaccTransGetDate txn))
(value (xaccSplitGetAmount split))
- (value (if reverse? (- value) value))
+ (value (if payable? (- value) value))
(invoice (gncInvoiceGetInvoiceFromTxn txn))
(invoice-splits
(and (txn-is-invoice? txn)
@@ -695,7 +695,7 @@ invoices and amounts.")))))
(gnc:make-html-text
(gnc:html-markup-br))))
-(define (reg-renderer report-obj type reverse?)
+(define (reg-renderer report-obj type payable?)
(define options (gnc:report-options report-obj))
(define (opt-val section name)
(gnc:option-value
@@ -801,7 +801,7 @@ invoices and amounts.")))))
(xaccAccountGetName account)))))))
(add-owner-table table splits account start-date end-date
- date-type used-columns reverse? link-option)))
+ date-type used-columns payable? link-option)))
accounts-and-splits))
(else
commit 6e354d8a49d730eba204224eac13af3c33d3a46f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Nov 5 18:41:39 2019 +0800
Remove html-utilities.scm deprecations
These functions were marked as deprecated in 3.x
diff --git a/gnucash/report/html-utilities.scm b/gnucash/report/html-utilities.scm
index 2c5d4957d..c3787441f 100644
--- a/gnucash/report/html-utilities.scm
+++ b/gnucash/report/html-utilities.scm
@@ -190,29 +190,10 @@
((null? colors) (lp (1+ i) (cons (car base-colors) result) (cdr base-colors)))
(else (lp (1+ i) (cons (car colors) result) (cdr colors))))))
-;; Appends a horizontal ruler to a html-table with the specified
-;; colspan at, optionally, the specified column.
-(define (gnc:html-table-append-ruler/at! table colskip colspan)
- (define empty-cell '())
- (gnc:html-table-append-row!
- table
- (append (make-list colskip empty-cell)
- (list
- (gnc:make-html-table-cell/size
- 1 colspan (gnc:make-html-text (gnc:html-markup-hr)))))))
-
-(define (gnc:html-table-append-ruler/at/markup! table markup colskip colspan)
- (define empty-cell "")
- (gnc:html-table-append-row/markup!
- table
- markup
- (append (make-list colskip empty-cell)
- (list
- (gnc:make-html-table-cell/size
- 1 colspan (gnc:make-html-text (gnc:html-markup-hr)))))))
-
(define (gnc:html-table-append-ruler! table colspan)
- (gnc:html-table-append-ruler/at! table 0 colspan))
+ (gnc:html-table-append-row!
+ table (list (gnc:make-html-table-cell/size
+ 1 colspan (gnc:make-html-text (gnc:html-markup-hr))))))
;; Create a html-table of all exchange rates. The report-commodity is
;; 'common-commodity', the exchange rates are given through the
Summary of changes:
gnucash/gnome-search/dialog-search.c | 8 +
gnucash/gnome/dialog-payment.c | 26 ++-
gnucash/gnome/gnc-plugin-page-register.c | 45 ++---
gnucash/gtkbuilder/dialog-payment.glade | 44 +++--
.../customer-import/dialog-customer-import-gui.c | 38 ++--
.../register/ledger-core/gncEntryLedgerControl.c | 1 -
.../register/ledger-core/split-register-control.c | 1 -
gnucash/register/register-core/gtable.c | 9 +-
gnucash/register/register-gnome/gnucash-header.c | 4 +-
gnucash/register/register-gnome/gnucash-sheet.c | 13 +-
gnucash/register/register-gnome/gnucash-style.c | 38 +++-
gnucash/report/html-table.scm | 15 --
gnucash/report/html-utilities.scm | 25 +--
gnucash/report/report.scm | 1 -
gnucash/report/reports/standard/new-aging.scm | 204 ++++++++++++---------
.../report/reports/standard/new-owner-report.scm | 63 +++----
gnucash/report/test/test-report-html.scm | 26 ---
17 files changed, 293 insertions(+), 268 deletions(-)
More information about the gnucash-changes
mailing list