Iterative destination account matching

BenoitGrégoire bock at step.polymtl.ca
Thu Feb 6 20:57:14 CST 2003


Following our conversation on IRC about 
http://bugzilla.gnome.org/show_bug.cgi?id=104091,  


Here is what I think you have to do to implement this (I'm busy with real 
work, so I may have forgotten something, but this should help you not get 
lost):

*Note that the backend doesn't hold a list of transactions, only the data 
itself.  The only list is in the gui.

--1--Write a refresh function in the backend that will look something like 
this:
gboolean
gnc_import_TransInfo_refresh_destacc (GNCImportTransInfo *transaction_info, 
GncImportMatchMap *matchmap)
{
  g_assert (transaction_info);
  g_assert (matchmap);

 Account * orig_destacc = gnc_import_TransInfo_get_destacc (info)
Account * new_destacc = NULL;

if(gnc_import_TransInfo_get_destacc_selected_manually(transaction_info)==FALSE)
{
  /* Try to find a previously selected destination account
     string match for the ADD action */
new_destacc = matchmap_find_destination (matchmap, transaction_info)
  gnc_import_TransInfo_set_destacc (transaction_info,
				    new_destacc,
				    FALSE);
 }
else
{
new_destacc=orig_destacc;
}

if(new_destacc!=orig_destacc)
{/*account has changed*/
 return TRUE;
}
else
{
return FALSE;
}
}

--2--

In import-main-matcher.c, you need a refresh function that will iterate over 
each transaction in the window, call gnc_import_TransInfo_refresh_destacc, 
and trigger a screen refresh if it returns TRUE.

That function should be triggered in run_account_picker_dialog(), when the 
account changes.

Your refresh function must be configurable so the user can select if ALL the 
transactions are to be refreshed (default) or only the transactions AFTER the 
current one (So that those users that receive all there transactions with the 
same memo don't kill us).  If you don't want to figure out how  
import-settings.c and generic-import.scm work, just define a constant at the 
top of the file, I'll plug it in later.

Good luck,

-- 
Benoit Grégoire
http://step.polymtl.ca/~bock/


More information about the gnucash-devel mailing list