mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add some more sanity checking in common importer module.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20412 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -269,7 +269,7 @@ Account * gnc_import_select_account(GtkWidget *parent,
|
||||
}
|
||||
else
|
||||
{
|
||||
retval_name = xaccAccountGetName(retval);
|
||||
retval_name = retval ? xaccAccountGetName(retval) : NULL;
|
||||
ok_pressed_retval = TRUE; /* There was no dialog involved, so the computer "pressed" ok */
|
||||
}
|
||||
/*FIXME: DEBUG("WRITEME: gnc_import_select_account() Here we should check if account type is compatible, currency matches, etc.\n"); */
|
||||
|
||||
@@ -1124,6 +1124,7 @@ gboolean gnc_import_exists_online_id (Transaction *trans)
|
||||
|
||||
/* Look for an online_id in the first split */
|
||||
source_split = xaccTransGetSplit(trans, 0);
|
||||
g_assert(source_split);
|
||||
|
||||
/* DEBUG("%s%d%s","Checking split ",i," for duplicates"); */
|
||||
dest_acct = xaccSplitGetAccount(source_split);
|
||||
@@ -1151,13 +1152,16 @@ GNCImportTransInfo *
|
||||
gnc_import_TransInfo_new (Transaction *trans, GncImportMatchMap *matchmap)
|
||||
{
|
||||
GNCImportTransInfo *transaction_info;
|
||||
Split *split;
|
||||
g_assert (trans);
|
||||
|
||||
transaction_info = g_new0(GNCImportTransInfo, 1);
|
||||
|
||||
transaction_info->trans = trans;
|
||||
/* Only use first split, the source split */
|
||||
transaction_info->first_split = xaccTransGetSplit(trans, 0);
|
||||
split = xaccTransGetSplit(trans, 0);
|
||||
g_assert(split);
|
||||
transaction_info->first_split = split;
|
||||
|
||||
/* Try to find a previously selected destination account
|
||||
string match for the ADD action */
|
||||
|
||||
@@ -611,6 +611,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
|
||||
GtkTreeSelection *selection;
|
||||
gchar *tmp, *imbalance, *text, *color;
|
||||
const gchar *ro_text;
|
||||
Split *split;
|
||||
g_assert (gui);
|
||||
g_assert (model);
|
||||
g_assert (info);
|
||||
@@ -620,8 +621,9 @@ refresh_model_row (GNCImportMainMatcher *gui,
|
||||
gtk_list_store_set(store, iter, DOWNLOADED_COL_DATA, info, -1);
|
||||
|
||||
/*Account:*/
|
||||
ro_text =
|
||||
xaccAccountGetName(xaccSplitGetAccount(gnc_import_TransInfo_get_fsplit (info)));
|
||||
split = gnc_import_TransInfo_get_fsplit (info);
|
||||
g_assert(split); // Must not be NULL
|
||||
ro_text = xaccAccountGetName(xaccSplitGetAccount(split));
|
||||
gtk_list_store_set(store, iter, DOWNLOADED_COL_ACCOUNT, ro_text, -1);
|
||||
|
||||
/*Date*/
|
||||
@@ -633,8 +635,8 @@ refresh_model_row (GNCImportMainMatcher *gui,
|
||||
|
||||
/*Amount*/
|
||||
ro_text = xaccPrintAmount
|
||||
(xaccSplitGetAmount (gnc_import_TransInfo_get_fsplit(info) ),
|
||||
gnc_split_amount_print_info(gnc_import_TransInfo_get_fsplit(info), TRUE)
|
||||
(xaccSplitGetAmount (split),
|
||||
gnc_split_amount_print_info(split, TRUE)
|
||||
);
|
||||
gtk_list_store_set(store, iter, DOWNLOADED_COL_AMOUNT, ro_text, -1);
|
||||
|
||||
@@ -643,7 +645,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
|
||||
gtk_list_store_set(store, iter, DOWNLOADED_COL_DESCRIPTION, ro_text, -1);
|
||||
|
||||
/*Memo*/
|
||||
ro_text = xaccSplitGetMemo(gnc_import_TransInfo_get_fsplit(info) );
|
||||
ro_text = xaccSplitGetMemo(split);
|
||||
gtk_list_store_set(store, iter, DOWNLOADED_COL_MEMO, ro_text, -1);
|
||||
|
||||
/*Actions*/
|
||||
@@ -860,4 +862,10 @@ automatch_store_transactions (GNCImportMainMatcher *info,
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *gnc_gen_trans_list_widget (GNCImportMainMatcher *info)
|
||||
{
|
||||
g_assert(info);
|
||||
return info->dialog;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -108,5 +108,9 @@ void gnc_gen_trans_list_add_trans_with_ref_id(GNCImportMainMatcher *gui, Transac
|
||||
*/
|
||||
gboolean gnc_gen_trans_list_run (GNCImportMainMatcher *info);
|
||||
|
||||
/** Returns the widget of this dialog.
|
||||
*/
|
||||
GtkWidget *gnc_gen_trans_list_widget (GNCImportMainMatcher *info);
|
||||
|
||||
#endif
|
||||
/**@}*/
|
||||
|
||||
Reference in New Issue
Block a user