Bug #141003: QIF Import: Allow the British Pound symbol and the dollar symbol to be used interchangeably.

BP


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17489 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Charles Day 2008-09-02 20:20:09 +00:00
parent a1d189431e
commit b55b08e4cf
3 changed files with 11 additions and 10 deletions

View File

@ -287,7 +287,8 @@
(qif-split:set-memo! current-split value)))
;; $ : split amount (if there are splits)
((#\$)
;; Also allowing pound symbol just in case (#141003)
((#\$ #\£)
(if (and current-split
(not-bad-numeric-string? value))
(qif-split:set-amount! current-split value)))

View File

@ -177,7 +177,7 @@
;; [Y] name of security
;; [O] commission (parsed)
;; [L] category : string
;; [S]/[E]/[$] splits : a list of <qif-split>
;; [S]/[E]/[$]/[£] splits : a list of <qif-split>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <qif-xtn>

View File

@ -19,13 +19,13 @@
(define decimal-radix-regexp
(make-regexp
"^ *\\$?[+-]?\\$?[0-9]+$|^ *\\$?[+-]?\\$?[0-9]?[0-9]?[0-9]?([,'][0-9][0-9][0-9])*(\\.[0-9]*)? *$|^ *\\$?[+-]?\\$?[0-9]+\\.[0-9]* *$"))
"^ *[$£]?[+-]?[$£]?[0-9]+$|^ *[$£]?[+-]?[$£]?[0-9]?[0-9]?[0-9]?([,'][0-9][0-9][0-9])*(\\.[0-9]*)? *$|^ *[$£]?[+-]?[$£]?[0-9]+\\.[0-9]* *$"))
(define comma-radix-regexp
(make-regexp
"^ *\\$?[+-]?\\$?[0-9]+$|^ *\\$?[+-]?\\$?[0-9]?[0-9]?[0-9]?([\\.'][0-9][0-9][0-9])*(,[0-9]*)? *$|^ *\\$?[+-]?\\$?[0-9]+,[0-9]* *$"))
"^ *[$£]?[+-]?[$£]?[0-9]+$|^ *[$£]?[+-]?[$£]?[0-9]?[0-9]?[0-9]?([\\.'][0-9][0-9][0-9])*(,[0-9]*)? *$|^ *[$£]?[+-]?[$£]?[0-9]+,[0-9]* *$"))
(define integer-regexp (make-regexp "^\\$?[+-]?\\$?[0-9]+ *$"))
(define integer-regexp (make-regexp "^[$£]?[+-]?[$£]?[0-9]+ *$"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; qif-split:parse-category
@ -549,7 +549,7 @@
(define (qif-parse:parse-number/format value-string format)
(case format
((decimal)
(let* ((filtered-string (gnc:string-delete-chars value-string ",$'"))
(let* ((filtered-string (gnc:string-delete-chars value-string ",$£'"))
(read-val (with-input-from-string filtered-string
(lambda () (read)))))
(if (number? read-val)
@ -561,7 +561,7 @@
(gnc-numeric-zero))))
((comma)
(let* ((filtered-string (gnc:string-replace-char
(gnc:string-delete-chars value-string ".$'")
(gnc:string-delete-chars value-string ".$£'")
#\, #\.))
(read-val (with-input-from-string filtered-string
(lambda () (read)))))
@ -573,9 +573,9 @@
GNC-RND-ROUND))
(gnc-numeric-zero))))
((integer)
(let ((read-val (with-input-from-string (string-remove-char value-string
#\$)
(lambda () (read)))))
(let ((read-val (with-input-from-string
(gnc:string-delete-chars value-string "$£'")
(lambda () (read)))))
(if (number? read-val)
(double-to-gnc-numeric
(+ 0.0 read-val) 1 GNC-RND-ROUND)