[obsolete api] gnc-commodity-numeric->string to gnc:monetary->string

This commit is contained in:
Christopher Lam 2018-08-31 23:19:12 +08:00
parent cb01c93a0f
commit b21874df0b
3 changed files with 23 additions and 32 deletions

View File

@ -94,6 +94,7 @@
;; Helper for warnings below.
(define (gnc-commodity-numeric->string commodity numeric)
(issue-deprecation-warning "gnc-commodity-numeric->string deprecated.")
(gnc:monetary->string
(gnc:make-gnc-monetary commodity numeric)))
@ -157,13 +158,6 @@
value-amount share-amount))
#f)))
;;(warn "gnc:get-commodity-totalavg-prices: value "
;; (gnc-commodity-numeric->string
;;(first foreignlist) (second foreignlist))
;; " bought shares "
;; (gnc-commodity-numeric->string
;;price-commodity (third foreignlist)))
;; Try EURO exchange if necessary
(if (and foreignlist
(not (gnc-commodity-equiv (first foreignlist)
@ -185,14 +179,17 @@
(begin
(warn "gnc:get-commodity-totalavg-prices: "
"Sorry, currency exchange not yet implemented:"
(gnc-commodity-numeric->string
(first foreignlist) (second foreignlist))
(gnc:monetary->string
(gnc:make-gnc-monetary
(first foreignlist) (second foreignlist)))
" (buying "
(gnc-commodity-numeric->string
price-commodity (third foreignlist))
(gnc:monetary->string
(gnc:make-gnc-monetary
price-commodity (third foreignlist)))
") =? "
(gnc-commodity-numeric->string
report-currency (gnc-numeric-zero)))
(gnc:monetary->string
(gnc:make-gnc-monetary
report-currency (gnc-numeric-zero))))
(gnc-numeric-zero))
(begin
(set! total-foreign (gnc-numeric-add total-foreign
@ -272,13 +269,6 @@
(list transaction-comm
value-amount share-amount))))
;;(warn "get-commodity-inst-prices: value "
;; (gnc-commodity-numeric->string
;; (first foreignlist) (second foreignlist))
;; " bought shares "
;;(gnc-commodity-numeric->string
;; price-commodity (third foreignlist)))
;; Try EURO exchange if necessary
(if (not (gnc-commodity-equiv (first foreignlist)
report-currency))
@ -298,14 +288,17 @@
(begin
(warn "get-commodity-inst-prices: "
"Sorry, currency exchange not yet implemented:"
(gnc-commodity-numeric->string
(first foreignlist) (second foreignlist))
" (buying "
(gnc-commodity-numeric->string
price-commodity (third foreignlist))
") =? "
(gnc-commodity-numeric->string
report-currency (gnc-numeric-zero)))
(gnc:monetary->string
(gnc:make-gnc-monetary
(first foreignlist) (second foreignlist)))
" (buying "
(gnc:monetary->string
(gnc:make-gnc-monetary
price-commodity (third foreignlist)))
") =? "
(gnc:monetary->string
(gnc:make-gnc-monetary
report-currency (gnc-numeric-zero))))
(gnc-numeric-zero))
(if (not (zero? (third foreignlist)))
(gnc-numeric-div

View File

@ -675,9 +675,6 @@
(acct-comm (xaccAccountGetCommodity acct))
(shares (xaccSplitGetAmount split))
(hash (hash-ref hash-table guid)))
; (gnc:debug "Merging split for " (xaccAccountGetName acct) " for "
; (gnc-commodity-numeric->string acct-comm shares)
; " into hash entry " hash)
(if (not hash)
(begin (set! hash (gnc:make-commodity-collector))
(hash-set! hash-table guid hash)))

View File

@ -535,7 +535,8 @@ by preventing negative stock balances.<br/>")
;; Now that we have a pricing transaction if needed, set the value of the asset
(set! value (my-exchange-fn (gnc:make-gnc-monetary commodity units) currency))
(gnc:debug "Value " (gnc:monetary->string value)
" from " (gnc-commodity-numeric->string commodity units))
" from " (gnc:monetary->string
(gnc:make-gnc-monetary commodity units)))
(for-each
;; we're looking at each split we find in the account. these splits