gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Fri Nov 1 21:05:39 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/158b5caf (commit)
via https://github.com/Gnucash/gnucash/commit/2df672bd (commit)
via https://github.com/Gnucash/gnucash/commit/b1e32c8a (commit)
via https://github.com/Gnucash/gnucash/commit/5f6413c6 (commit)
from https://github.com/Gnucash/gnucash/commit/56882041 (commit)
commit 158b5caf6375348f7334c9e2598090db6b25759d
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Fri Nov 1 18:52:24 2019 +0800
[new-aging] restore display of owner address
diff --git a/gnucash/report/business-reports/new-aging.scm b/gnucash/report/business-reports/new-aging.scm
index 1ef00c521..0896b66a7 100644
--- a/gnucash/report/business-reports/new-aging.scm
+++ b/gnucash/report/business-reports/new-aging.scm
@@ -45,6 +45,22 @@
(define optname-show-zeros (N_ "Show zero balance items"))
(define optname-date-driver (N_ "Due or Post Date"))
+;; Display tab options
+(define optname-addr-source (N_ "Address Source"))
+
+(define addr-options-list
+ (list (list (N_ "Address Name") "b"
+ (N_ "Display Address Name. This, and other fields, may be useful if \
+copying this report to a spreadsheet for use in a mail merge."))
+ (list (N_ "Address 1") "c" (N_ "Display Address 1."))
+ (list (N_ "Address 2") "d" (N_ "Display Address 2."))
+ (list (N_ "Address 3") "e" (N_ "Display Address 3."))
+ (list (N_ "Address 4") "f" (N_ "Display Address 4."))
+ (list (N_ "Address Phone") "g" (N_ "Display Phone."))
+ (list (N_ "Address Fax") "h" (N_ "Display Fax."))
+ (list (N_ "Address Email") "i" (N_ "Display Email."))
+ (list (N_ "Active") "j" (N_ "Display Active status."))))
+
(define no-APAR-account (_ "No valid A/Payable or A/Receivable \
account found. Please ensure valid AP/AR account exists."))
@@ -101,8 +117,41 @@ exist but have no suitable transactions."))
(N_ "Post date is leading.")))))
(gnc:options-set-default-section options "General")
+
+ (for-each
+ (lambda (opt)
+ (add-option
+ (gnc:make-simple-boolean-option
+ gnc:pagename-display (car opt) (cadr opt) (caddr opt) #f)))
+ addr-options-list)
+
options))
+(define (options->address options receivable? owner)
+ (define (op-value name)
+ (gnc:option-value (gnc:lookup-option options gnc:pagename-display name)))
+ (let* ((address-list-names (map car addr-options-list))
+ (address-list-options (map op-value address-list-names))
+ (addr-source (if receivable? (op-value optname-addr-source) 'billing))
+ (result-list
+ (cond
+ (owner
+ (let ((addr (if (eq? addr-source 'shipping)
+ (gncCustomerGetShipAddr (gncOwnerGetCustomer owner))
+ (gncOwnerGetAddr owner))))
+ (list (gncAddressGetName addr)
+ (gncAddressGetAddr1 addr)
+ (gncAddressGetAddr2 addr)
+ (gncAddressGetAddr3 addr)
+ (gncAddressGetAddr4 addr)
+ (gncAddressGetPhone addr)
+ (gncAddressGetFax addr)
+ (gncAddressGetEmail addr)
+ (if (gncOwnerGetActive owner) (_ "Y") (_ "N")))))
+ (else address-list-names))))
+ (fold-right (lambda (opt elt prev) (if opt (cons elt prev) prev))
+ '() address-list-options result-list)))
+
(define (txn-is-invoice? txn)
(eqv? (xaccTransGetTxnType txn) TXN-TYPE-INVOICE))
@@ -138,9 +187,9 @@ exist but have no suitable transactions."))
owner))
(define (aging-renderer report-obj receivable)
+ (define options (gnc:report-options report-obj))
(define (op-value section name)
- (gnc:option-value
- (gnc:lookup-option (gnc:report-options report-obj) section name)))
+ (gnc:option-value (gnc:lookup-option options section name)))
(define make-heading-list
(list ""
@@ -201,7 +250,9 @@ exist but have no suitable transactions."))
splits)))
(cond
((null? accounts)
- (gnc:html-table-set-col-headers! table make-heading-list)
+ (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)
@@ -277,7 +328,8 @@ exist but have no suitable transactions."))
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:owner-report-text owner account)
- (gnc:make-gnc-monetary comm aging-total))))))))
+ (gnc:make-gnc-monetary comm aging-total)))))
+ (options->address options receivable owner))))
(lp (cdr acc-owners)
other-owner-splits
(map + acc-totals
@@ -289,7 +341,21 @@ exist but have no suitable transactions."))
(aging-options-generator (gnc:new-options)))
(define (receivable-options-generator)
- (aging-options-generator (gnc:new-options)))
+ (let ((options (aging-options-generator (gnc:new-options))))
+ (define (add-option new-option)
+ (gnc:register-option options new-option))
+
+ (add-option
+ (gnc:make-multichoice-option
+ gnc:pagename-display optname-addr-source "a" (N_ "Address source.") 'billing
+ (list
+ (vector 'billing
+ (N_ "Billing")
+ (N_ "Address fields from billing address."))
+ (vector 'shipping
+ (N_ "Shipping")
+ (N_ "Address fields from shipping address.")))))
+ options))
(define (payables-renderer report-obj)
(aging-renderer report-obj #f))
commit 2df672bdb2ba34dbe59560c05c498d021312b8d8
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Fri Nov 1 19:37:33 2019 +0800
[gncOwner] i18n gncOwnerGetTypeString types
diff --git a/libgnucash/engine/gncOwner.c b/libgnucash/engine/gncOwner.c
index 93a8211e5..32d5e0de4 100644
--- a/libgnucash/engine/gncOwner.c
+++ b/libgnucash/engine/gncOwner.c
@@ -210,17 +210,17 @@ const char * gncOwnerGetTypeString (const GncOwner *owner)
switch (type)
{
case GNC_OWNER_NONE:
- return "None";
+ return N_("None");
case GNC_OWNER_UNDEFINED:
- return "Undefined";
+ return N_("Undefined");
case GNC_OWNER_CUSTOMER:
- return "Customer";
+ return N_("Customer");
case GNC_OWNER_JOB:
- return "Job";
+ return N_("Job");
case GNC_OWNER_VENDOR:
- return "Vendor";
+ return N_("Vendor");
case GNC_OWNER_EMPLOYEE:
- return "Employee";
+ return N_("Employee");
default:
PWARN ("Unknown owner type");
return NULL;
commit b1e32c8a9defbe240bc165b5b8fa7ec8d4a7f1c5
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Fri Nov 1 19:35:58 2019 +0800
[report-utilities] minor refinements
diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 2180b3734..825928834 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -1184,7 +1184,9 @@ flawed. see report-utilities.scm. please update reports.")
(xaccTransGetCurrency txn)
(xaccSplitGetValue spl))))))
(define (trans->str txn)
- (format #f "Txn<d:~a>" (qof-print-date (xaccTransGetDate txn))))
+ (format #f "Txn<d:~a,desc:~a>"
+ (qof-print-date (xaccTransGetDate txn))
+ (xaccTransGetDescription txn)))
(define (account->str acc)
(format #f "Acc<~a>" (xaccAccountGetName acc)))
(define (monetary-collector->str coll)
@@ -1213,7 +1215,7 @@ flawed. see report-utilities.scm. please update reports.")
(gncInvoiceGetTotal inv)))))
(define (lot->str lot)
(format #f "Lot<Acc:~a,Title:~a,Notes:~a,Balance:~a,NSplits:~a>"
- (gnc:strify (xaccAccountGetName (gnc-lot-get-account lot)))
+ (xaccAccountGetName (gnc-lot-get-account lot))
(gnc-lot-get-title lot)
(gnc-lot-get-notes lot)
(gnc-lot-get-balance lot)
commit 5f6413c6c5bf323d6998ea4fced545429e7c7e02
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Fri Nov 1 19:15:35 2019 +0800
[report-utilities] tiny reordering to remove unnecessary reference
instead of split->txn->invoice->lot->invoice
grab split->txn->invoice->lot directly
diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 2eec572b8..2180b3734 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -1124,10 +1124,9 @@ flawed. see report-utilities.scm. please update reports.")
;; reduce the lot balance automatically.
((eqv? (xaccTransGetTxnType (xaccSplitGetParent (car splits)))
TXN-TYPE-INVOICE)
- (let* ((lot (gncInvoiceGetPostedLot
- (gncInvoiceGetInvoiceFromTxn
- (xaccSplitGetParent (car splits)))))
- (invoice (gncInvoiceGetInvoiceFromLot lot))
+ (let* ((invoice (gncInvoiceGetInvoiceFromTxn
+ (xaccSplitGetParent (car splits))))
+ (lot (gncInvoiceGetPostedLot invoice))
(bal (gnc-lot-get-balance lot))
(bal (if receivable? bal (- bal)))
(date (if (eq? date-type 'postdate)
Summary of changes:
gnucash/report/business-reports/new-aging.scm | 76 +++++++++++++++++++++--
gnucash/report/report-system/report-utilities.scm | 13 ++--
libgnucash/engine/gncOwner.c | 12 ++--
3 files changed, 84 insertions(+), 17 deletions(-)
More information about the gnucash-changes
mailing list