Skip to content

Commit

Permalink
Bug 798448 - Column 'num' cannot be null
Browse files Browse the repository at this point in the history
Convert libofx's data.check_number and data.reference_number to "" if
they are any case variation of "null".

Note that SQL backends will not permit the word NULL as a value for the
number field if it's entered from the GUI, but this can be worked around
by quoting it as in Scheme: 'Null *will* work.
  • Loading branch information
jralls committed Mar 3, 2022
1 parent 8ef8d38 commit 4890c25
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gnucash/import-export/ofx/gnc-ofx-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,14 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void *user_data)
/* set tran-num and/or split-action per book option */
if (data.check_number_valid)
{
gnc_set_num_action(transaction, split, data.check_number, NULL);
/* SQL will correctly interpret the string "null", but
* the transaction num field is declared to be
* non-null so substitute the empty string.
*/
const char *num_value =
strcasecmp (data.check_number, "null") == 0 ? "" :
data.check_number;
gnc_set_num_action(transaction, split, num_value, NULL);
}
else if (data.reference_number_valid)
{
Expand Down

0 comments on commit 4890c25

Please sign in to comment.