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

pull/398/head
Christopher Lam 8 years ago
parent 89f8c8dc12
commit cb01c93a0f

@ -487,14 +487,14 @@
;; resolve the exchange rate to this currency.
(warn "gnc:resolve-unknown-comm:"
"can't calculate rate for "
(gnc-commodity-value->string
(list (car pair) ((caadr pair) 'total #f)))
(gnc:monetary->string
(gnc:make-gnc-monetary (car pair) ((caadr pair) 'total #f)))
" = "
(gnc-commodity-value->string
(list (car otherlist) ((cdadr pair) 'total #f)))
(gnc:monetary->string
(gnc:make-gnc-monetary (car otherlist) ((cdadr pair) 'total #f)))
" to "
(gnc-commodity-value->string
(list report-commodity (gnc-numeric-zero))))
(gnc:monetary->string
(gnc:make-gnc-monetary report-commodity (gnc-numeric-zero))))
(if (and pair-a pair-b)
;; If both currencies are found then something
;; went wrong inside
@ -502,11 +502,11 @@
;; better thing to do in this case.
(warn "gnc:resolve-unknown-comm:"
"Oops - exchange rate ambiguity error: "
(gnc-commodity-value->string
(list (car pair) ((caadr pair) 'total #f)))
(gnc:monetary->string
(gnc:make-gnc-monetary (car pair) ((caadr pair) 'total #f)))
" = "
(gnc-commodity-value->string
(list (car otherlist)
(gnc:monetary->string
(gnc:make-gnc-monetary (car otherlist)
((cdadr pair) 'total #f))))
(let
;; Usual case: one of pair-{a,b} was found
@ -520,23 +520,12 @@
(list (car pair)
(make-newrate (caadr pair)
(cdadr pair) pair-a)))))
;; (warn "created new rate: "
;; (gnc-commodity-value->string (list (car
;; newrate) ((caadr newrate) 'total #f))) "
;; = " (gnc-commodity-value->string (list
;; report-commodity ((cdadr newrate) 'total
;; #f))))
(set! reportlist (cons newrate reportlist))))))
;; Huh, the report-currency showed up on the wrong side
;; -- we will just add it to the reportlist on the
;; right side.
(let ((newrate (list (car otherlist)
(cons (cdadr pair) (caadr pair)))))
;; (warn "created new rate: "
;; (gnc-commodity-value->string (list (car newrate)
;; ((caadr newrate) 'total #f))) " = "
;; (gnc-commodity-value->string (list
;; report-commodity ((cdadr newrate) 'total #f))))
(set! reportlist (cons newrate reportlist)))))
(cadr otherlist))))
sumlist)

@ -41,6 +41,7 @@
;; pair is a list of one gnc:commodity and one gnc:numeric
;; value. Deprecated -- use <gnc-monetary> instead.
(define (gnc-commodity-value->string pair)
(issue-deprecation-warning "gnc-commodity-value->string deprecated")
(xaccPrintAmount
(cadr pair) (gnc-commodity-print-info (car pair) #t)))

@ -473,10 +473,10 @@ by preventing negative stock balances.<br/>")
(exchange-fn fromunits tocurrency)))
(gnc:debug "Starting account " (xaccAccountGetName current) ", initial price: "
(if price
(gnc-commodity-value->string
(list (gnc-price-get-currency price) (gnc-price-get-value price)))
#f))
(and price
(gnc:monetary->string
(gnc:make-gnc-monetary
(gnc-price-get-currency price) (gnc-price-get-value price)))))
;; If we have a price that can't be converted to the report currency
;; don't use it

Loading…
Cancel
Save