From dc4a004b113b7fba1fa77ca1919a40a58c2941a7 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Fri, 15 Jan 2021 21:58:13 +0800 Subject: [PATCH] Bug 798085 - Incorrect transactions import of deposit with large number amount Quicken 2005 introduces U amount which sometimes differs from T amount. U amount has larger range, and must override T amount whenever they're not equal. --- gnucash/import-export/qif-imp/qif-file.scm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gnucash/import-export/qif-imp/qif-file.scm b/gnucash/import-export/qif-imp/qif-file.scm index db3e290927..1429b54835 100644 --- a/gnucash/import-export/qif-imp/qif-file.scm +++ b/gnucash/import-export/qif-imp/qif-file.scm @@ -135,6 +135,12 @@ (unread-char c1) #f)))) + (define (qif-split-set-amount split value override?) + (when (and split + (not-bad-numeric-string? value) + (or override? (not (qif-split:amount split)))) + (qif-split:set-amount! split value))) + (qif-file:set-path! self path) (if (not (access? path R_OK)) ;; A UTF-8 encoded path won't succeed on some systems, such as @@ -261,9 +267,13 @@ ;; T : total amount ((#\T) - (if (and default-split - (not-bad-numeric-string? value)) - (qif-split:set-amount! default-split value))) + (qif-split-set-amount default-split value #f)) + + ;; U : total amount (handle larger amount + ;; than T; present in Quicken 2005 + ;; exports). See bug 798085 + ((#\U) + (qif-split-set-amount default-split value #t)) ;; P : payee ((#\P)