mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[commodity-utilities] deprecate gnc-commodity-collector-commodity-count
this function is only used twice in exported functions. inline and refactor to be simpler.
This commit is contained in:
parent
058ef28849
commit
eab4eecac8
@ -1018,6 +1018,8 @@ construct with gnc:make-gnc-monetary and gnc:monetary->string instead.")
|
||||
balance)))
|
||||
|
||||
(define (gnc-commodity-collector-commodity-count collector)
|
||||
(issue-deprecation-warning
|
||||
"gnc-commodity-collector-commodity-count is deprecated. please inline.")
|
||||
(length (collector 'format (lambda (comm amt) comm) #f)))
|
||||
|
||||
(define (gnc-commodity-collector-contains-commodity? collector commodity)
|
||||
@ -1030,9 +1032,9 @@ construct with gnc:make-gnc-monetary and gnc:monetary->string instead.")
|
||||
(define (gnc:uniform-commodity? amt report-commodity)
|
||||
;; function to see if the commodity-collector amt
|
||||
;; contains any foreign commodities
|
||||
(let ((elts (gnc-commodity-collector-commodity-count amt)))
|
||||
(or (zero? elts)
|
||||
(and (= elts 1)
|
||||
(let ((elts (amt 'format (lambda (comm amt) comm) #f)))
|
||||
(or (null? elts)
|
||||
(and (null? (cdr elts))
|
||||
(member report-commodity
|
||||
(amt 'format (lambda (comm amt) comm) #f)
|
||||
elts
|
||||
gnc-commodity-equiv)))))
|
||||
|
@ -395,9 +395,10 @@ construct gnc:make-gnc-monetary and use gnc:monetary->string instead.")
|
||||
;; usage: (gnc:monetaries-add monetary1 monetary2 ...)
|
||||
;; output: a monetary object
|
||||
(define (gnc:monetary+ . monetaries)
|
||||
(let ((coll (apply gnc:monetaries-add monetaries)))
|
||||
(if (= 1 (gnc-commodity-collector-commodity-count coll))
|
||||
(car (coll 'format gnc:make-gnc-monetary #f))
|
||||
(let* ((coll (apply gnc:monetaries-add monetaries))
|
||||
(list-of-monetaries (coll 'format gnc:make-gnc-monetary #f)))
|
||||
(if (null? (cdr list-of-monetaries))
|
||||
(car list-of-monetaries)
|
||||
(throw "gnc:monetary+ expects 1 currency " (gnc:strify monetaries)))))
|
||||
|
||||
;; get the account balance at the specified date. if include-children?
|
||||
|
Loading…
Reference in New Issue
Block a user