gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Wed Jan 15 06:05:16 EST 2020
Updated via https://github.com/Gnucash/gnucash/commit/8618c25d (commit)
via https://github.com/Gnucash/gnucash/commit/1dac9e1f (commit)
via https://github.com/Gnucash/gnucash/commit/c4ab772d (commit)
via https://github.com/Gnucash/gnucash/commit/3db69978 (commit)
from https://github.com/Gnucash/gnucash/commit/08d685f4 (commit)
commit 8618c25d50d6bcbc919865fbdfe533bbe8cc657a
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Wed Jan 15 14:51:35 2020 +0800
Bug 797572 - part 2 - swap Debits/Credits, can show informal headers
Previously Credits was rendered before Debits. Change to formal
accounting convention. Can swap to informal headers if set by global
preference.
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 09c63e623..c724dfc68 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -36,6 +36,7 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash utilities)) ; for gnc:debug
(use-modules (gnucash gettext))
+(use-modules (sw_core_utils)) ; for gnc-prefs-get-bool
(gnc:module-load "gnucash/report/report-system" 0)
(use-modules (gnucash report standard-reports))
@@ -56,7 +57,7 @@
(define tax-header (N_ "Tax"))
(define credit-header (N_ "Credits"))
(define debit-header (N_ "Debits"))
-(define amount-header (N_ "Balance"))
+(define balance-header (N_ "Balance"))
(define linked-txns-header (N_ "Links"))
;; Depending on the report type we want to set up some lists/cases
@@ -125,9 +126,9 @@
(vector-ref columns-used 5))
(define (tax-col columns-used)
(vector-ref columns-used 6))
-(define (credit-col columns-used)
- (vector-ref columns-used 7))
(define (debit-col columns-used)
+ (vector-ref columns-used 7))
+(define (credit-col columns-used)
(vector-ref columns-used 8))
(define (bal-col columns-used)
(vector-ref columns-used 9))
@@ -179,13 +180,15 @@
(set-col (opt-val "Display Columns" desc-header) 4)
(set-col (opt-val "Display Columns" sale-header) 5)
(set-col (opt-val "Display Columns" tax-header) 6)
- (set-col (opt-val "Display Columns" credit-header) 7)
- (set-col (opt-val "Display Columns" debit-header) 8)
- (set-col (opt-val "Display Columns" amount-header) 9)
+ (set-col (opt-val "Display Columns" debit-header) 7)
+ (set-col (opt-val "Display Columns" credit-header) 8)
+ (set-col (opt-val "Display Columns" balance-header) 9)
col-vector))
-(define (make-heading-list column-vector link-option)
- (let ((heading-list '()))
+(define (make-heading-list column-vector link-option acct-type)
+ (let ((heading-list '())
+ (formal? (gnc-prefs-get-bool GNC-PREFS-GROUP-GENERAL
+ GNC-PREF-ACCOUNTING-LABELS)))
(if (date-col column-vector)
(addto! heading-list (_ date-header)))
(if (date-due-col column-vector)
@@ -200,12 +203,14 @@
(addto! heading-list (_ sale-header)))
(if (tax-col column-vector)
(addto! heading-list (_ tax-header)))
- (if (credit-col column-vector)
- (addto! heading-list (_ credit-header)))
(if (debit-col column-vector)
- (addto! heading-list (_ debit-header)))
+ (addto! heading-list
+ (if formal? debit-header (gnc:get-debit-string acct-type))))
+ (if (credit-col column-vector)
+ (addto! heading-list
+ (if formal? credit-header (gnc:get-credit-string acct-type))))
(if (bal-col column-vector)
- (addto! heading-list (_ amount-header)))
+ (addto! heading-list (_ balance-header)))
(case link-option
((simple)
(addto! heading-list (_ linked-txns-header)))
@@ -402,8 +407,8 @@
(append
(addif (sale-col column-vector) (cell sale))
(addif (tax-col column-vector) (cell tax))
- (addif (credit-col column-vector) (cell-anchor credit))
- (addif (debit-col column-vector) (cell-anchor (and debit (- debit))))
+ (addif (debit-col column-vector) (cell-anchor debit))
+ (addif (credit-col column-vector) (cell-anchor (and credit (- credit))))
(addif (bal-col column-vector) (cell amt))))
(addif (< 0 mid-span) cell-nohoriz)
(link-data->cols (car link-rows))))
@@ -442,9 +447,9 @@
1 (1- period-span) #f))
(addif (sale-col used-columns) (make-cell sale))
(addif (tax-col used-columns) (make-cell tax))
+ (addif (debit-col used-columns) (make-cell debit))
(addif (credit-col used-columns) (make-cell credit))
- (addif (debit-col used-columns) (make-cell (- debit)))
- (addif (bal-col used-columns) (make-cell (+ credit debit)))
+ (addif (bal-col used-columns) (make-cell total))
(addif (< 0 rhs-cols) (gnc:make-html-table-cell/size
1 (+ mid-span rhs-cols) #f)))))
@@ -710,7 +715,8 @@
(let* ((split (car splits))
(txn (xaccSplitGetParent split))
(date (xaccTransGetDate txn))
- (value (AP-negate (xaccTransGetAccountAmount txn acc)))
+ (orig-value (xaccTransGetAccountAmount txn acc))
+ (value (AP-negate orig-value))
(invoice (gncInvoiceGetInvoiceFromTxn txn)))
(cond
@@ -736,7 +742,8 @@
((txn-is-invoice? txn) (list split))
((txn-is-payment? txn) (txn->assetliab-splits txn))))
currency (+ total value)
- (and (>= value 0) value) (and (< value 0) value)
+ (and (< orig-value 0) orig-value)
+ (and (>= orig-value 0) orig-value)
(invoice->sale invoice) (invoice->tax invoice)
(txn->transfer-split txn)
link-option
@@ -754,8 +761,8 @@
(else '(()))))
(lp printed? (not odd-row?) (cdr splits) (+ total value)
- (if (negative? value) (+ debit value) debit)
- (if (negative? value) credit (+ credit value))
+ (if (< 0 orig-value) (+ debit orig-value) debit)
+ (if (< 0 orig-value) credit (- credit orig-value))
(+ tax (or (invoice->tax invoice) 0))
(+ sale (or (invoice->sale invoice) 0))))))))))
@@ -818,18 +825,18 @@
(gnc:register-inv-option
(gnc:make-simple-boolean-option
- (N_ "Display Columns") credit-header
- "hac" (N_ "Display the period credits column?") #t))
+ (N_ "Display Columns") debit-header
+ "hac" (N_ "Display the period debits column?") #t))
(gnc:register-inv-option
(gnc:make-simple-boolean-option
- (N_ "Display Columns") debit-header
- "had" (N_ "Display a period debits column?") #t))
+ (N_ "Display Columns") credit-header
+ "had" (N_ "Display a period credits column?") #t))
(gnc:register-inv-option
(gnc:make-simple-boolean-option
- (N_ "Display Columns") amount-header
- "hb" (N_ "Display the transaction amount?") #t))
+ (N_ "Display Columns") balance-header
+ "hb" (N_ "Display a running balance?") #t))
(gnc:register-inv-option
(gnc:make-multichoice-option
@@ -951,7 +958,12 @@ invoices and amounts.")))))
(document (gnc:make-html-document))
(table (gnc:make-html-table))
(section-headings (make-section-heading-list used-columns owner-descr))
- (headings (make-heading-list used-columns link-option))
+ (headings (make-heading-list
+ used-columns link-option
+ (if (eqv? (gncOwnerGetType (gncOwnerGetEndOwner owner))
+ GNC-OWNER-CUSTOMER)
+ ACCT-TYPE-RECEIVABLE
+ ACCT-TYPE-PAYABLE)))
(report-title (string-append (_ owner-descr) " " (_ "Report"))))
(cond
commit 1dac9e1fc2ba46e3287f430bb0c14da7a7521c1e
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Wed Jan 15 12:43:22 2020 +0800
Bug 797572 - part 1 - don't accumulate Dr/Cr totals unless printed
diff --git a/gnucash/report/business-reports/new-owner-report.scm b/gnucash/report/business-reports/new-owner-report.scm
index 957eda6dd..09c63e623 100644
--- a/gnucash/report/business-reports/new-owner-report.scm
+++ b/gnucash/report/business-reports/new-owner-report.scm
@@ -717,9 +717,7 @@
;; txn-date < start-date. skip display, accumulate amounts
((< date start-date)
(lp printed? odd-row? (cdr splits) (+ total value)
- (if (negative? value) (+ debit value) debit)
- (if (negative? value) credit (+ credit value))
- tax sale))
+ debit credit tax sale))
;; if balance row hasn't been rendered, consider
;; adding here. skip if value=0.
commit c4ab772d4b3f6006c576010815799821602e4d9a
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Wed Jan 15 14:58:08 2020 +0800
Bug 797576 - xaccAccountOrder shouldn't sort account codes as base-36
Thanks to yegor for discovering it is unreliable for sorting. It has
been present since 50646f04
diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp
index fcacf1862..194976dbd 100644
--- a/libgnucash/engine/Account.cpp
+++ b/libgnucash/engine/Account.cpp
@@ -2239,18 +2239,6 @@ xaccAccountOrder (const Account *aa, const Account *ab)
da = priv_aa->accountCode;
db = priv_ab->accountCode;
- /* If accountCodes are both base 36 integers do an integer sort */
- la = strtoul (da, &endptr, 36);
- if ((*da != '\0') && (*endptr == '\0'))
- {
- lb = strtoul (db, &endptr, 36);
- if ((*db != '\0') && (*endptr == '\0'))
- {
- if (la < lb) return -1;
- if (la > lb) return +1;
- }
- }
-
/* Otherwise do a string sort */
result = g_strcmp0 (da, db);
if (result)
commit 3db699786fac9a8ab58023feea7c5e4258f07f96
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Wed Jan 15 17:39:03 2020 +0800
[core-utils.i] declare prefs as ENUMs
diff --git a/libgnucash/core-utils/core-utils.i b/libgnucash/core-utils/core-utils.i
index 54558fc2b..875cdcf1d 100644
--- a/libgnucash/core-utils/core-utils.i
+++ b/libgnucash/core-utils/core-utils.i
@@ -93,6 +93,46 @@ const char * gnc_locale_default_iso_currency_code (void);
scm_c_eval_string(tmp);
/* Enum conversions go here */
+ SET_ENUM ("GNC-PREFS-GROUP-GENERAL");
+ SET_ENUM ("GNC-PREFS-GROUP-GENERAL-REGISTER");
+ SET_ENUM ("GNC-PREFS-GROUP-GENERAL-REPORT");
+ SET_ENUM ("GNC-PREFS-GROUP-WARNINGS");
+ SET_ENUM ("GNC-PREFS-GROUP-WARNINGS-TEMP");
+ SET_ENUM ("GNC-PREFS-GROUP-WARNINGS-PERM");
+ SET_ENUM ("GNC-PREFS-GROUP-ACCT-SUMMARY");
+
+ SET_ENUM ("GNC-PREF-VERSION");
+ SET_ENUM ("GNC-PREF-SAVE-GEOMETRY");
+ SET_ENUM ("GNC-PREF-LAST-PATH");
+ SET_ENUM ("GNC-PREF-USE-NEW");
+ SET_ENUM ("GNC-PREF-ACCOUNTING-LABELS");
+ SET_ENUM ("GNC-PREF-ACCOUNT-SEPARATOR");
+ SET_ENUM ("GNC-PREF-NEGATIVE-IN-RED");
+ SET_ENUM ("GNC-PREF-NUM-SOURCE");
+ SET_ENUM ("GNC-PREF-DATE-FORMAT");
+ SET_ENUM ("GNC-PREF-DATE-COMPL-THISYEAR");
+ SET_ENUM ("GNC-PREF-DATE-COMPL-SLIDING");
+ SET_ENUM ("GNC-PREF-DATE-BACKMONTHS");
+ SET_ENUM ("GNC-PREF-SHOW-LEAF-ACCT-NAMES");
+ SET_ENUM ("GNC-PREF-ENTER-MOVES-TO-END");
+ SET_ENUM ("GNC-PREF-DRAW-HOR-LINES");
+ SET_ENUM ("GNC-PREF-DRAW-VERT-LINES");
+ SET_ENUM ("GNC-PREF-ALT-COLOR-BY-TRANS");
+ SET_ENUM ("GNC-PREF-USE-THEME-COLORS");
+ SET_ENUM ("GNC-PREF-USE-GNUCASH-COLOR-THEME");
+ SET_ENUM ("GNC-PREF-TAB-TRANS-MEMORISED");
+ SET_ENUM ("GNC-PREF-FUTURE-AFTER-BLANK");
+ SET_ENUM ("GNC-PREF-START-CHOICE-ABS");
+ SET_ENUM ("GNC-PREF-START-CHOICE-REL");
+ SET_ENUM ("GNC-PREF-START-DATE");
+ SET_ENUM ("GNC-PREF-START-PERIOD");
+ SET_ENUM ("GNC-PREF-END-CHOICE-ABS");
+ SET_ENUM ("GNC-PREF-END-CHOICE-REL");
+ SET_ENUM ("GNC-PREF-END-DATE");
+ SET_ENUM ("GNC-PREF-END-PERIOD");
+ SET_ENUM ("GNC-PREF-CURRENCY-OTHER");
+ SET_ENUM ("GNC-PREF-CURRENCY-CHOICE-LOCALE");
+ SET_ENUM ("GNC-PREF-CURRENCY-CHOICE-OTHER");
#undef SET_ENUM
}
Summary of changes:
.../report/business-reports/new-owner-report.scm | 70 ++++++++++++----------
libgnucash/core-utils/core-utils.i | 40 +++++++++++++
libgnucash/engine/Account.cpp | 12 ----
3 files changed, 80 insertions(+), 42 deletions(-)
More information about the gnucash-changes
mailing list