r17981 - gnucash/trunk/src/import-export/qif-import - QIF Import: Allow "R" or "r" for reconciled, and "C" or "c" for cleared.
Charles Day
cedayiv at cvs.gnucash.org
Sun Mar 8 14:58:17 EDT 2009
Author: cedayiv
Date: 2009-03-08 14:58:17 -0400 (Sun, 08 Mar 2009)
New Revision: 17981
Trac: http://svn.gnucash.org/trac/changeset/17981
Modified:
gnucash/trunk/src/import-export/qif-import/file-format.txt
gnucash/trunk/src/import-export/qif-import/qif-parse.scm
Log:
QIF Import: Allow "R" or "r" for reconciled, and "C" or "c" for cleared.
Modified: gnucash/trunk/src/import-export/qif-import/file-format.txt
===================================================================
--- gnucash/trunk/src/import-export/qif-import/file-format.txt 2009-03-07 19:48:06 UTC (rev 17980)
+++ gnucash/trunk/src/import-export/qif-import/file-format.txt 2009-03-08 18:58:17 UTC (rev 17981)
@@ -365,7 +365,9 @@
in the line, if present, may be any of:
* Cleared
+C Cleared
X Reconciled
+R Reconciled
? Budgeted
! Budgeted
Modified: gnucash/trunk/src/import-export/qif-import/qif-parse.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-parse.scm 2009-03-07 19:48:06 UTC (rev 17980)
+++ gnucash/trunk/src/import-export/qif-import/qif-parse.scm 2009-03-08 18:58:17 UTC (rev 17981)
@@ -275,25 +275,29 @@
#f))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; parse-cleared-field : in a C (cleared) field in a QIF transaction,
-;; * means cleared, x or X means reconciled, and ! or ? mean some
-;; budget related stuff I don't understand.
+;; parse-cleared-field : In a "C" (cleared status) QIF line,
+;; * or C means cleared, X or R means reconciled, and ! or ?
+;; mean some budget related stuff I don't understand.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (qif-parse:parse-cleared-field read-value errorproc errortype)
(if (and (string? read-value)
- (> (string-length read-value) 0))
+ (not (string-null? read-value)))
(let ((secondchar (string-ref read-value 0)))
- (cond ((eq? secondchar #\*)
- 'cleared)
- ((or (eq? secondchar #\x)
- (eq? secondchar #\X))
- 'reconciled)
- ((or (eq? secondchar #\?)
- (eq? secondchar #\!))
- 'budgeted)
- (else
- #f)))
+ (case secondchar
+ ;; Reconciled is the most likely, especially for large imports,
+ ;; so check that first. Also allow for lowercase.
+ ((#\X #\x #\R #\r)
+ 'reconciled)
+ ((#\* #\C #\c)
+ 'cleared)
+ ((#\? #\!)
+ 'budgeted)
+ (else
+ (errorproc errortype
+ (sprintf #f (_ "Unrecognized status '%s'. Defaulting to uncleared.")
+ read-value))
+ #f)))
#f))
More information about the gnucash-changes
mailing list