AUDIT: r17489 - gnucash/trunk/src/import-export/qif-import - Bug #141003: QIF Import: Allow the British Pound symbol and the dollar symbol to be used interchangeably.

Charles Day cedayiv at cvs.gnucash.org
Tue Sep 2 16:20:09 EDT 2008


Author: cedayiv
Date: 2008-09-02 16:20:09 -0400 (Tue, 02 Sep 2008)
New Revision: 17489
Trac: http://svn.gnucash.org/trac/changeset/17489

Modified:
   gnucash/trunk/src/import-export/qif-import/qif-file.scm
   gnucash/trunk/src/import-export/qif-import/qif-objects.scm
   gnucash/trunk/src/import-export/qif-import/qif-parse.scm
Log:
Bug #141003: QIF Import: Allow the British Pound symbol and the dollar symbol to be used interchangeably.
BP


Modified: gnucash/trunk/src/import-export/qif-import/qif-file.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-file.scm	2008-09-02 07:13:13 UTC (rev 17488)
+++ gnucash/trunk/src/import-export/qif-import/qif-file.scm	2008-09-02 20:20:09 UTC (rev 17489)
@@ -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)))

Modified: gnucash/trunk/src/import-export/qif-import/qif-objects.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-objects.scm	2008-09-02 07:13:13 UTC (rev 17488)
+++ gnucash/trunk/src/import-export/qif-import/qif-objects.scm	2008-09-02 20:20:09 UTC (rev 17489)
@@ -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>

Modified: gnucash/trunk/src/import-export/qif-import/qif-parse.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-parse.scm	2008-09-02 07:13:13 UTC (rev 17488)
+++ gnucash/trunk/src/import-export/qif-import/qif-parse.scm	2008-09-02 20:20:09 UTC (rev 17489)
@@ -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)



More information about the gnucash-changes mailing list