r16892 - gnucash/branches/2.2/src/import-export/qif-import - [r16872] Throw a better warning for dates before 1970 (#106242)
Andreas Köhler
andi5 at cvs.gnucash.org
Wed Jan 30 15:24:39 EST 2008
Author: andi5
Date: 2008-01-30 15:24:39 -0500 (Wed, 30 Jan 2008)
New Revision: 16892
Trac: http://svn.gnucash.org/trac/changeset/16892
Modified:
gnucash/branches/2.2/src/import-export/qif-import/qif-to-gnc.scm
Log:
[r16872] Throw a better warning for dates before 1970 (#106242)
Patch by Charles Day.
Modified: gnucash/branches/2.2/src/import-export/qif-import/qif-to-gnc.scm
===================================================================
--- gnucash/branches/2.2/src/import-export/qif-import/qif-to-gnc.scm 2008-01-30 00:13:55 UTC (rev 16891)
+++ gnucash/branches/2.2/src/import-export/qif-import/qif-to-gnc.scm 2008-01-30 20:24:39 UTC (rev 16892)
@@ -379,6 +379,7 @@
(qif-security (qif-xtn:security-name qif-xtn))
(qif-default-split (qif-xtn:default-split qif-xtn))
(qif-memo #f)
+ (qif-date (qif-xtn:date qif-xtn))
(qif-from-acct (qif-xtn:from-acct qif-xtn))
(qif-cleared (qif-xtn:cleared qif-xtn))
(n- (lambda (n) (gnc-numeric-neg n)))
@@ -387,8 +388,24 @@
(n* (lambda (a b) (gnc-numeric-mul a b 0 GNC-DENOM-REDUCE)))
(n/ (lambda (a b) (gnc-numeric-div a b 0 GNC-DENOM-REDUCE))))
- ;; set properties of the whole transaction
- (apply xaccTransSetDate gnc-xtn (qif-xtn:date qif-xtn))
+ ;; Set properties of the whole transaction.
+
+ ;; Set the transaction date.
+ (cond
+ ((not qif-date)
+ (throw 'bad-date
+ "qif-import:qif-xtn-to-gnc-xtn"
+ "Missing transaction date."
+ #f
+ #f))
+ ((< (list-ref qif-date 2) 1970)
+ (throw 'bad-date
+ "qif-import:qif-xtn-to-gnc-xtn"
+ "Invalid transaction year (~A)."
+ (list (list-ref qif-date 2))
+ #f))
+ (else
+ (apply xaccTransSetDate gnc-xtn (qif-xtn:date qif-xtn))))
;; fixme: bug #105
(if qif-payee
More information about the gnucash-changes
mailing list