From b55b08e4cf23a0f8fd01afe6593162c2803ace8e Mon Sep 17 00:00:00 2001 From: Charles Day Date: Tue, 2 Sep 2008 20:20:09 +0000 Subject: [PATCH] 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 --- src/import-export/qif-import/qif-file.scm | 3 ++- src/import-export/qif-import/qif-objects.scm | 2 +- src/import-export/qif-import/qif-parse.scm | 16 ++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/import-export/qif-import/qif-file.scm b/src/import-export/qif-import/qif-file.scm index d2ea73c819..f25941a94c 100644 --- a/src/import-export/qif-import/qif-file.scm +++ b/src/import-export/qif-import/qif-file.scm @@ -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))) diff --git a/src/import-export/qif-import/qif-objects.scm b/src/import-export/qif-import/qif-objects.scm index e62dd79538..fbbd6628ee 100644 --- a/src/import-export/qif-import/qif-objects.scm +++ b/src/import-export/qif-import/qif-objects.scm @@ -177,7 +177,7 @@ ;; [Y] name of security ;; [O] commission (parsed) ;; [L] category : string -;; [S]/[E]/[$] splits : a list of +;; [S]/[E]/[$]/[£] splits : a list of ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define diff --git a/src/import-export/qif-import/qif-parse.scm b/src/import-export/qif-import/qif-parse.scm index 2b6d37b748..96e1016473 100644 --- a/src/import-export/qif-import/qif-parse.scm +++ b/src/import-export/qif-import/qif-parse.scm @@ -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)