mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug #519988: Update QIF importer bug detection and error messaging to use the
proper Gnome functions. These are g_warning and g_critical for C, and gnc:warn for Scheme. BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17032 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
081b8b6b7f
commit
b4afeb06aa
@ -69,7 +69,7 @@ acct_tree_add_accts(SCM accts,
|
|||||||
current = SCM_CAR(accts);
|
current = SCM_CAR(accts);
|
||||||
|
|
||||||
if(SCM_NULLP(current)) {
|
if(SCM_NULLP(current)) {
|
||||||
printf(" ** BUG in acct tree .. grib fix me! (everybody else ignore)\n");
|
g_critical("QIF import: BUG DETECTED in acct_tree_add_accts!");
|
||||||
accts = SCM_CDR(accts);
|
accts = SCM_CDR(accts);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ get_next_druid_page(QIFImportWindow * wind, GnomeDruidPage * page)
|
|||||||
if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
|
if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
|
||||||
if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
|
if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
|
||||||
/* Where are we? */
|
/* Where are we? */
|
||||||
printf("QIF import: I'm lost!\n");
|
g_critical("QIF import: BUG DETECTED in get_next_druid_page! I'm lost!");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -253,7 +253,7 @@ get_next_druid_page(QIFImportWindow * wind, GnomeDruidPage * page)
|
|||||||
next = wind->post_comm_pages;
|
next = wind->post_comm_pages;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("QIF import: something fishy.\n");
|
g_critical("QIF import: BUG DETECTED in get_next_druid_page!");
|
||||||
next = NULL;
|
next = NULL;
|
||||||
if (where > 3)
|
if (where > 3)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -287,7 +287,7 @@ get_prev_druid_page(QIFImportWindow * wind, GnomeDruidPage * page)
|
|||||||
if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
|
if((current = g_list_find(wind->commodity_pages, page)) == NULL) {
|
||||||
if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
|
if((current = g_list_find(wind->post_comm_pages, page)) == NULL) {
|
||||||
/* Where are we? */
|
/* Where are we? */
|
||||||
printf("QIF import: I'm lost!\n");
|
g_critical("QIF import: BUG DETECTED in get_prev_druid_page! I'm lost!");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -340,7 +340,7 @@ get_prev_druid_page(QIFImportWindow * wind, GnomeDruidPage * page)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (wind->show_doc_pages)
|
if (wind->show_doc_pages)
|
||||||
printf("QIF import: something fishy.\n");
|
g_critical("QIF import: BUG DETECTED in get_prev_druid_page!");
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
if (where < 1)
|
if (where < 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1718,7 +1718,7 @@ gnc_ui_qif_import_commodity_prepare_cb(GnomeDruidPage * page,
|
|||||||
/* this shouldn't happen, but DTRT if it does */
|
/* this shouldn't happen, but DTRT if it does */
|
||||||
if (SCM_NULLP(wind->new_stocks))
|
if (SCM_NULLP(wind->new_stocks))
|
||||||
{
|
{
|
||||||
printf("somehow got to commodity doc page with nothing to do... BUG!\n");
|
g_warning("QIF import: BUG DETECTED! Reached commodity doc page with nothing to do!");
|
||||||
gnc_ui_qif_import_convert(wind);
|
gnc_ui_qif_import_convert(wind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,9 +140,9 @@
|
|||||||
(if (string-match "^option:"
|
(if (string-match "^option:"
|
||||||
(symbol->string qstate-type))
|
(symbol->string qstate-type))
|
||||||
(begin
|
(begin
|
||||||
(display "qif-file:read-file ignoring ")
|
(gnc:warn "qif-file:read-file:"
|
||||||
(write qstate-type)
|
" ignoring '" qstate-type
|
||||||
(newline)
|
"' option.")
|
||||||
(set! qstate-type old-qstate))))))
|
(set! qstate-type old-qstate))))))
|
||||||
|
|
||||||
|
|
||||||
@ -314,10 +314,9 @@
|
|||||||
(set! current-xtn (make-qif-class)))
|
(set! current-xtn (make-qif-class)))
|
||||||
|
|
||||||
(else
|
(else
|
||||||
(display "qif-file:read-file : unknown Class slot ")
|
(gnc:warn "qif-file:read-file:"
|
||||||
(display tag)
|
" ignoring class '" tag "' line."
|
||||||
(display " .. continuing anyway.")
|
"\nLine content: [" line "]"))))
|
||||||
(newline))))
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;
|
||||||
@ -385,9 +384,9 @@
|
|||||||
(set! current-xtn (make-qif-cat)))
|
(set! current-xtn (make-qif-cat)))
|
||||||
|
|
||||||
(else
|
(else
|
||||||
(display "qif-file:read-file : unknown Cat slot ")
|
(gnc:warn "qif-file:read-file:"
|
||||||
(display tag)
|
" ignoring category '" tag "' line."
|
||||||
(display " .. continuing anyway") (newline))))
|
"\nLine content: [" line "]"))))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;
|
||||||
@ -418,10 +417,9 @@
|
|||||||
(set! current-xtn (make-qif-stock-symbol)))
|
(set! current-xtn (make-qif-stock-symbol)))
|
||||||
|
|
||||||
(else
|
(else
|
||||||
(display "qif-file:read-file : unknown Security slot ")
|
(gnc:warn "qif-file:read-file:"
|
||||||
(display tag)
|
" ignoring security '" tag "' line."
|
||||||
(display " .. continuing anyway.")
|
"\nLine content: [" line "]"))))
|
||||||
(newline))))
|
|
||||||
|
|
||||||
|
|
||||||
;; trying to sneak one by, eh?
|
;; trying to sneak one by, eh?
|
||||||
@ -429,10 +427,9 @@
|
|||||||
(if (and (not qstate-type)
|
(if (and (not qstate-type)
|
||||||
(not (string=? (string-trim line) "")))
|
(not (string=? (string-trim line) "")))
|
||||||
(begin
|
(begin
|
||||||
(display "line = ") (display line) (newline)
|
(gnc:warn "qif-file:read-file:"
|
||||||
(display "qif-file:read-file : ")
|
" file does not appear to be a QIF."
|
||||||
(display "file does not appear to be a QIF file.")
|
"\nLine content: [" line "]")
|
||||||
(newline)
|
|
||||||
(set! return-val
|
(set! return-val
|
||||||
(list #f "File does not appear to be a QIF file."))
|
(list #f "File does not appear to be a QIF file."))
|
||||||
(set! heinous-error #t))))))
|
(set! heinous-error #t))))))
|
||||||
|
@ -218,7 +218,8 @@
|
|||||||
(gnc-commodity-get-namespace value)
|
(gnc-commodity-get-namespace value)
|
||||||
(gnc-commodity-get-mnemonic value))
|
(gnc-commodity-get-mnemonic value))
|
||||||
table))
|
table))
|
||||||
(display "write-commodities: something funny in hash table.\n"))
|
(gnc:warn "qif-import:write-commodities:"
|
||||||
|
" something funny in hash table."))
|
||||||
#f) #f hashtab)
|
#f) #f hashtab)
|
||||||
(write table)))
|
(write table)))
|
||||||
|
|
||||||
|
@ -64,8 +64,7 @@
|
|||||||
#f))))
|
#f))))
|
||||||
rv)
|
rv)
|
||||||
(begin
|
(begin
|
||||||
(display "qif-split:parse-category : can't parse ")
|
(gnc:warn "qif-split:parse-category: can't parse [" value "].")
|
||||||
(display value) (newline)
|
|
||||||
(list "" #f #f)))))
|
(list "" #f #f)))))
|
||||||
|
|
||||||
|
|
||||||
@ -85,9 +84,8 @@
|
|||||||
;; thanks dave p for reporting this.
|
;; thanks dave p for reporting this.
|
||||||
(if (eq? (string-ref year-string 0) #\')
|
(if (eq? (string-ref year-string 0) #\')
|
||||||
(begin
|
(begin
|
||||||
(display "qif-file:fix-year : found a weird QIF Y2K year : |")
|
(gnc:warn "qif-file:fix-year: found weird QIF Y2K year ["
|
||||||
(display year-string)
|
year-string "].")
|
||||||
(display "|") (newline)
|
|
||||||
(set! fixed-string
|
(set! fixed-string
|
||||||
(substring year-string 2 (string-length year-string))))
|
(substring year-string 2 (string-length year-string))))
|
||||||
(set! fixed-string year-string))
|
(set! fixed-string year-string))
|
||||||
@ -129,9 +127,8 @@
|
|||||||
|
|
||||||
;; No idea what the string represents. Maybe a new bug in Quicken!
|
;; No idea what the string represents. Maybe a new bug in Quicken!
|
||||||
(#t
|
(#t
|
||||||
(display "qif-file:fix-year : ay caramba! What is this? |")
|
(gnc:warn "qif-file:fix-year: ay caramba! What is this? ["
|
||||||
(display year-string)
|
year-string "].")))
|
||||||
(display "|") (newline)))
|
|
||||||
|
|
||||||
y2k-fixed-value))
|
y2k-fixed-value))
|
||||||
|
|
||||||
@ -165,10 +162,9 @@
|
|||||||
((string=? mangled-string "mutual")
|
((string=? mangled-string "mutual")
|
||||||
(list GNC-BANK-TYPE))
|
(list GNC-BANK-TYPE))
|
||||||
(#t
|
(#t
|
||||||
(display "qif-parse:parse-acct-type : unhandled account type ")
|
(gnc:warn "qif-parse:parse-acct-type: unrecognized account type ["
|
||||||
(display read-value)
|
read-value
|
||||||
(display "... substituting Bank.")
|
"]... substituting Bank.")
|
||||||
(newline)
|
|
||||||
(list GNC-BANK-TYPE)))))
|
(list GNC-BANK-TYPE)))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@ -464,10 +460,8 @@
|
|||||||
;; if the date parts list doesn't have 3 parts, we're in
|
;; if the date parts list doesn't have 3 parts, we're in
|
||||||
;; trouble
|
;; trouble
|
||||||
(if (not (eq? 3 (length date-parts)))
|
(if (not (eq? 3 (length date-parts)))
|
||||||
(begin
|
(gnc:warn "qif-parse:parse-date/format: can't interpret date ["
|
||||||
(display "qif-parse:parse-date/format : can't interpret date ")
|
date-string "]\nDate parts: " date-parts)
|
||||||
(display date-string) (display " ") (write date-parts)(newline))
|
|
||||||
|
|
||||||
(case format
|
(case format
|
||||||
((d-m-y)
|
((d-m-y)
|
||||||
(let ((d (car numeric-date-parts))
|
(let ((d (car numeric-date-parts))
|
||||||
@ -476,10 +470,9 @@
|
|||||||
(if (and (integer? d) (integer? m) (integer? y)
|
(if (and (integer? d) (integer? m) (integer? y)
|
||||||
(<= m 12) (<= d 31))
|
(<= m 12) (<= d 31))
|
||||||
(set! retval (list d m y))
|
(set! retval (list d m y))
|
||||||
(begin
|
(gnc:warn "qif-parse:parse-date/format: "
|
||||||
(display "qif-parse:parse-date/format : ")
|
"format is d/m/y, but date is ["
|
||||||
(display "format is d/m/y, but date is ")
|
date-string "]."))))
|
||||||
(display date-string) (newline)))))
|
|
||||||
|
|
||||||
((m-d-y)
|
((m-d-y)
|
||||||
(let ((m (car numeric-date-parts))
|
(let ((m (car numeric-date-parts))
|
||||||
@ -488,10 +481,9 @@
|
|||||||
(if (and (integer? d) (integer? m) (integer? y)
|
(if (and (integer? d) (integer? m) (integer? y)
|
||||||
(<= m 12) (<= d 31))
|
(<= m 12) (<= d 31))
|
||||||
(set! retval (list d m y))
|
(set! retval (list d m y))
|
||||||
(begin
|
(gnc:warn "qif-parse:parse-date/format: "
|
||||||
(display "qif-parse:parse-date/format : ")
|
"format is m/d/y, but date is ["
|
||||||
(display " format is m/d/y, but date is ")
|
date-string "]."))))
|
||||||
(display date-string) (newline)))))
|
|
||||||
|
|
||||||
((y-m-d)
|
((y-m-d)
|
||||||
(let ((y (qif-parse:fix-year (car date-parts) 50))
|
(let ((y (qif-parse:fix-year (car date-parts) 50))
|
||||||
@ -500,10 +492,9 @@
|
|||||||
(if (and (integer? d) (integer? m) (integer? y)
|
(if (and (integer? d) (integer? m) (integer? y)
|
||||||
(<= m 12) (<= d 31))
|
(<= m 12) (<= d 31))
|
||||||
(set! retval (list d m y))
|
(set! retval (list d m y))
|
||||||
(begin
|
(gnc:warn "qif-parse:parse-date/format: "
|
||||||
(display "qif-parse:parse-date/format :")
|
"format is y/m/d, but date is ["
|
||||||
(display " format is y/m/d, but date is ")
|
date-string "]."))))
|
||||||
(display date-string) (newline)))))
|
|
||||||
|
|
||||||
((y-d-m)
|
((y-d-m)
|
||||||
(let ((y (qif-parse:fix-year (car date-parts) 50))
|
(let ((y (qif-parse:fix-year (car date-parts) 50))
|
||||||
@ -512,10 +503,9 @@
|
|||||||
(if (and (integer? d) (integer? m) (integer? y)
|
(if (and (integer? d) (integer? m) (integer? y)
|
||||||
(<= m 12) (<= d 31))
|
(<= m 12) (<= d 31))
|
||||||
(set! retval (list d m y))
|
(set! retval (list d m y))
|
||||||
(begin
|
(gnc:warn "qif-parse:parse-date/format: "
|
||||||
(display "qif-parse:parse-date/format : ")
|
"format is y/d/m, but date is ["
|
||||||
(display " format is y/m/d, but date is ")
|
date-string "]."))))))
|
||||||
(display date-string) (newline)))))))
|
|
||||||
retval))
|
retval))
|
||||||
|
|
||||||
|
|
||||||
|
@ -608,9 +608,8 @@
|
|||||||
;; I don't think this should ever happen, but I want
|
;; I don't think this should ever happen, but I want
|
||||||
;; to keep this check just in case.
|
;; to keep this check just in case.
|
||||||
(if (> (length splits) 1)
|
(if (> (length splits) 1)
|
||||||
(begin
|
(gnc:warn "qif-import:qif-xtn-to-gnc-xtn: "
|
||||||
(display "qif-import:qif-xtn-to-gnc-xtn : ")
|
"splits in stock transaction!"))
|
||||||
(display "splits in stock transaction!") (newline)))
|
|
||||||
|
|
||||||
(set! qif-accts
|
(set! qif-accts
|
||||||
(qif-split:accounts-affected (car (qif-xtn:splits qif-xtn))
|
(qif-split:accounts-affected (car (qif-xtn:splits qif-xtn))
|
||||||
|
Loading…
Reference in New Issue
Block a user