2002-13-6 Benoit Gr�goire <bock@step.polymtl.ca>

* src/import-export/ofx/gnc-ofx-import.c:  Do the "right"
	thing for setting split amount and value.
	* src/import-export/import-main-matcher.c: Cosmetic
	improvements for balance display and window resizing.
	* All other affected files:  Doxygenify everything.  Take a
	look, run make doc, and open src/doc/html/index.html


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7637 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Benoit Grégoire 2002-12-07 08:13:46 +00:00
parent e68a9bbe19
commit aa30d872e7
22 changed files with 282 additions and 166 deletions

View File

@ -1,3 +1,9 @@
2002-12-6 Benoit Grégoire <bock@step.polymtl.ca>
* src/import-export/import-backend.c: Fix for gcc2
2002-12-6 Benoit Grégoire <bock@step.polymtl.ca>
* src/import-export/import-backend.c: Fix for gcc2
2002-12-06 Derek Atkins <derek@ihtfp.com> 2002-12-06 Derek Atkins <derek@ihtfp.com>
* revert patch in src/engine/Transaction.c -- imbalance is computed * revert patch in src/engine/Transaction.c -- imbalance is computed

View File

@ -28,9 +28,9 @@
<modal>False</modal> <modal>False</modal>
<default_width>800</default_width> <default_width>800</default_width>
<default_height>600</default_height> <default_height>600</default_height>
<allow_shrink>True</allow_shrink> <allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow> <allow_grow>True</allow_grow>
<auto_shrink>True</auto_shrink> <auto_shrink>False</auto_shrink>
<auto_close>False</auto_close> <auto_close>False</auto_close>
<hide_on_close>False</hide_on_close> <hide_on_close>False</hide_on_close>
@ -244,9 +244,9 @@
<modal>False</modal> <modal>False</modal>
<default_width>800</default_width> <default_width>800</default_width>
<default_height>600</default_height> <default_height>600</default_height>
<allow_shrink>True</allow_shrink> <allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow> <allow_grow>True</allow_grow>
<auto_shrink>True</auto_shrink> <auto_shrink>False</auto_shrink>
<auto_close>False</auto_close> <auto_close>False</auto_close>
<hide_on_close>False</hide_on_close> <hide_on_close>False</hide_on_close>
@ -531,9 +531,9 @@
<modal>False</modal> <modal>False</modal>
<default_width>800</default_width> <default_width>800</default_width>
<default_height>600</default_height> <default_height>600</default_height>
<allow_shrink>True</allow_shrink> <allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow> <allow_grow>True</allow_grow>
<auto_shrink>True</auto_shrink> <auto_shrink>False</auto_shrink>
<auto_close>True</auto_close> <auto_close>True</auto_close>
<hide_on_close>True</hide_on_close> <hide_on_close>True</hide_on_close>
@ -781,9 +781,9 @@ click &quot;Ok&quot;.</label>
<modal>False</modal> <modal>False</modal>
<default_width>800</default_width> <default_width>800</default_width>
<default_height>600</default_height> <default_height>600</default_height>
<allow_shrink>True</allow_shrink> <allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow> <allow_grow>True</allow_grow>
<auto_shrink>True</auto_shrink> <auto_shrink>False</auto_shrink>
<auto_close>False</auto_close> <auto_close>False</auto_close>
<hide_on_close>False</hide_on_close> <hide_on_close>False</hide_on_close>

View File

@ -16,7 +16,8 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @internal
@file
@brief Christian Stimming's matcher @brief Christian Stimming's matcher
@author Copyright (C) 2002 Christian Stimming @author Copyright (C) 2002 Christian Stimming
*/ */

View File

@ -1,4 +1,5 @@
/**@file /**@internal
@file
\brief module definition/initialization for the generic import infrastructure \brief module definition/initialization for the generic import infrastructure
\author Copyright (c) 2002 Benoit Grégoire bock@step.polymtl.ca \author Copyright (c) 2002 Benoit Grégoire bock@step.polymtl.ca
*/ */

View File

@ -16,8 +16,11 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/**@file /** @addtogroup Import_Export
* \brief Account-matcher.h: A very generic and flexible account matcher/picker @{ */
/**@internal
@file import-account-matcher.c
* \brief A very generic and flexible account matcher/picker
\author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> \author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca>
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -302,3 +305,4 @@ Account * gnc_import_select_account(char * account_online_id_value,
DEBUG("Return value: %p%s%s%s",retval,", account name:",xaccAccountGetName(retval),"\n"); DEBUG("Return value: %p%s%s%s",retval,", account name:",xaccAccountGetName(retval),"\n");
return retval; return retval;
} }
/**@}*/

View File

@ -16,18 +16,18 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/**@file /** @addtogroup Import_Export
* \brief Account-matcher.h: A very generic and flexible account matcher/picker @{ */
\author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> /**@file import-account-matcher.h
@brief Generic and very flexible account matcher/picker
@author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca>
*/ */
#ifndef ACCOUNT_MATCHER_H #ifndef ACCOUNT_MATCHER_H
#define ACCOUNT_MATCHER_H #define ACCOUNT_MATCHER_H
#include "Account.h" #include "Account.h"
/* The gnc_import_select_account(): /** Must be called with a string containing a unique identifier for the
Must be called with a string containing a unique identifier for the
account. If an account with a matching online_id kvp_frame is account. If an account with a matching online_id kvp_frame is
found, the function immediately returns with a pointer to that found, the function immediately returns with a pointer to that
account. Otherwise, the user is prompted to select a GnuCash account. Otherwise, the user is prompted to select a GnuCash
@ -36,9 +36,7 @@
again). If the user refuses to select or create an account, NULL is again). If the user refuses to select or create an account, NULL is
returned. returned.
Params: @param account_online_id_value The string containing your unique account_id
account_online_id_value: The string containing your unique account_id
coming from some string of your module. This is the normal mode of coming from some string of your module. This is the normal mode of
operation. operation.
@ -49,33 +47,35 @@
kvp_frame of the found account will not be touched. To use this mode, kvp_frame of the found account will not be touched. To use this mode,
auto_create must NOT be set to 0. auto_create must NOT be set to 0.
gchar * account_human_description: A human-readable description of @param account_human_description
A human-readable description of
the account. Can be NULL. If it is not NULL, it will be shown before the account. Can be NULL. If it is not NULL, it will be shown before
the id in the account matching dialog. It will also be used as the id in the account matching dialog. It will also be used as
the default account name if a new account is created. the default account name if a new account is created.
gnc_commodity * new_account_default_currenc: Default commodity of @param new_account_default_commodity
Default commodity of
the new account. Can be NULL. If not NULL, it will be the the new account. Can be NULL. If not NULL, it will be the
account's commodity if a new account is created. Also, if not account's commodity if a new account is created. Also, if not
NULL, the function will also warn the user if the found or created NULL, the function will also warn the user if the found or created
account's commodity doesn't match. account's commodity doesn't match.
GNCAccountType new_account_default_type: Default account type of a @param new_account_default_type
Default account type of a
new account. Can be NULL. If not NO_TYPE, it will be the new account. Can be NULL. If not NO_TYPE, it will be the
account's type if a new account is created. If not NO_TYPE, the account's type if a new account is created. If not NO_TYPE, the
function will also warn the user if the found or created account's function will also warn the user if the found or created account's
commodity doesn't match. commodity doesn't match.
char auto_create: If 0, if the account_online_id_value in unknown, @param auto_create If 0, if the account_online_id_value in unknown,
the function returns NULL, otherwise, the user will be asked to the function returns NULL, otherwise, the user will be asked to
create a new account. create a new account.
Account * default_selection: If not NULL, that account will be @param default_selection If not NULL, that account will be
pre-selected by default. pre-selected by default.
Return: A pointer to the found or created Account, or NULL if no @return A pointer to the found or created Account, or NULL if no
account was found or created. account was found or created.
*/ */
Account * gnc_import_select_account(char * account_online_id_value, Account * gnc_import_select_account(char * account_online_id_value,
char auto_create, char auto_create,
@ -85,3 +85,4 @@ Account * gnc_import_select_account(char * account_online_id_value,
Account * default_selection); Account * default_selection);
#endif #endif
/**@}*/

View File

@ -16,9 +16,13 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@{ */
/** @internal
@file import-backend.c
@brief import-backend.c: Generic importer backend implementation (duplicate matching algorithm, action handling, etc.) @brief import-backend.c: Generic importer backend implementation (duplicate matching algorithm, action handling, etc.)
@author Copyright (C) 2002 Benoit Grégoire, Christian Stimming @author Copyright (C) 2002 Benoit Grégoire
@author Christian Stimming
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -203,7 +207,6 @@ gnc_import_MatchInfo_get_probability (const GNCImportMatchInfo * info)
{ {
if(info) if(info)
{ {
g_assert (info);
return info->probability; return info->probability;
} }
else else
@ -398,7 +401,7 @@ matchmap_store_destination (GncImportMatchMap *matchmap,
/** /brief The transaction matching heuristics are here. /** @brief The transaction matching heuristics are here.
*/ */
static void split_find_match (GNCImportTransInfo * trans_info, static void split_find_match (GNCImportTransInfo * trans_info,
Split * split, Split * split,
@ -863,3 +866,4 @@ gnc_import_TransInfo_init_matches (GNCImportTransInfo *trans_info,
trans_info->previous_action=trans_info->action; trans_info->previous_action=trans_info->action;
} }
/** @} */

View File

@ -1,10 +1,4 @@
/********************************************************************\ /********************************************************************\
* Transaction-matcher.h -- *
* See file generic-import-design.txt for *
* description *
* (GnuCash) *
* Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> *
* *
* This program is free software; you can redistribute it and/or * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as * * modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of * * published by the Free Software Foundation; either version 2 of *
@ -22,9 +16,12 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@brief import-backend.h: Generic importer backend interface @{ */
@author Copyright (C) 2002 Benoit Grégoire, Christian Stimming /** @file import-backend.h
@brief Generic importer backend interface
@author Copyright (C) 2002 Benoit Grégoire
@author Christian Stimming
*/ */
#ifndef TRANSACTION_MATCHER_H #ifndef TRANSACTION_MATCHER_H
@ -46,7 +43,6 @@ typedef enum _action {
GNCImport_LAST_ACTION, GNCImport_LAST_ACTION,
GNCImport_INVALID_ACTION GNCImport_INVALID_ACTION
} GNCImportAction; } GNCImportAction;
/* Note: If you modify this, modify also get_next_action(). */
/************************************************************************ /************************************************************************
* @name Non-GUI Functions * @name Non-GUI Functions
@ -224,20 +220,23 @@ gnc_import_TransInfo_set_destacc (GNCImportTransInfo *info,
gboolean gboolean
gnc_import_TransInfo_get_destacc_selected_manually (const GNCImportTransInfo *info); gnc_import_TransInfo_get_destacc_selected_manually (const GNCImportTransInfo *info);
/*@}*/ /**@}*/
/** @name Getters/Setters for GNCImportMatchInfo */ /** @name Getters/Setters for GNCImportMatchInfo */
/*@{*/ /**@{*/
/* Get the split ('this-side split') of this MatchInfo. */ /** Get the split ('this-side split') of this MatchInfo. */
Split * Split *
gnc_import_MatchInfo_get_split (const GNCImportMatchInfo * info); gnc_import_MatchInfo_get_split (const GNCImportMatchInfo * info);
/* Get the probability (confidence level) of this MatchInfo. /** Get the probability (confidence level) of this MatchInfo.
@param info Can be NULL, in which case the function returns 0*/ @param info Can be NULL, in which case the function returns 0*/
gint gint
gnc_import_MatchInfo_get_probability (const GNCImportMatchInfo * info); gnc_import_MatchInfo_get_probability (const GNCImportMatchInfo * info);
/*@}*/ /**@}*/
#endif #endif
/** @} */

View File

@ -16,8 +16,11 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@brief import-commodity-matcher.h: A Generic commodity matcher/picker @{ */
/**@internal
@file import-commodity-matcher.c
@brief A Generic commodity matcher/picker
@author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> @author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca>
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -126,4 +129,4 @@ gnc_commodity * gnc_import_select_commodity(char * exchange_code,
} }
return retval; return retval;
}; };
/**@}*/

View File

@ -16,8 +16,10 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@brief import-commodity-matcher.h: A Generic commodity matcher/picker @{ */
/** @file import-commodity-matcher.h
@brief A Generic commodity matcher/picker
@author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> @author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca>
*/ */
#ifndef IMPORT_COMMODITY_MATCHER_H #ifndef IMPORT_COMMODITY_MATCHER_H
@ -25,8 +27,7 @@
#include "gnc-commodity.h" #include "gnc-commodity.h"
/* The gnc_import_select_commodity(): /**
Must be called with a string containing a unique identifier for the Must be called with a string containing a unique identifier for the
commodity. If an commodity with a matching exchange_code is commodity. If an commodity with a matching exchange_code is
found, the function immediately returns with a pointer to that found, the function immediately returns with a pointer to that
@ -35,28 +36,25 @@
written to the commodity's exchange_code field, overwriting anything that written to the commodity's exchange_code field, overwriting anything that
was there before. was there before.
Params: @param exchange_code The string containing the code for which you
char * exchange_code: The string containing the code for which you
want a matching commodity. A CUISP code or similar UNIQUE code. want a matching commodity. A CUISP code or similar UNIQUE code.
The stock ticker is NOT appropriate, unless you have no other option. The stock ticker is NOT appropriate, unless you have no other option.
char auto_create: If 0, if the exchange_code value in unknown, @param auto_create If 0, if the exchange_code value in unknown,
the function returns NULL, otherwise, the user will be asked to the function returns NULL, otherwise, the user will be asked to
create a new account. create a new account.
char * default_fullname: A human-readable description of the commodity, such @param default_fullname A human-readable description of the commodity, such
as the stock name. Can be NULL. If it is not NULL, it will be shown as the stock name. Can be NULL. If it is not NULL, it will be shown
to the user when selecting a commodity. It will also be used as to the user when selecting a commodity. It will also be used as
the default if a new commodity is created. the default if a new commodity is created.
char * default_mnemonic: Usually the stock ticker or similar. Can be NULL. @param default_mnemonic Usually the stock ticker or similar. Can be NULL.
If it is not NULL, it will be shown If it is not NULL, it will be shown
to the user when selecting a commodity. It will also be used as to the user when selecting a commodity. It will also be used as
the default if a new commodity is created. the default if a new commodity is created.
@return A pointer to the found or created commodity, or NULL if no
Return: A pointer to the found or created commodity, or NULL if no
account was found or created. account was found or created.
*/ */
@ -66,3 +64,4 @@ gnc_commodity * gnc_import_select_commodity(char * exchange_code,
char * default_mnemonic); char * default_mnemonic);
#endif #endif
/**@}*/

View File

@ -16,9 +16,13 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/**@file /** @addtogroup Import_Export
@brief import-main-mathcer.c: Transaction matcher main window @{ */
@author Copyright (C) 2002 Benoit Grégoire, Christian Stimming /** @internal
@file import-main-matcher.c
@brief Transaction matcher main window
@author Copyright (C) 2002 Benoit Grégoire
@author Christian Stimming
*/ */
#include "config.h" #include "config.h"
@ -61,7 +65,6 @@ struct _generic_transaction_info
#define DOWNLOADED_CLIST_ACTION_INFO 9 #define DOWNLOADED_CLIST_ACTION_INFO 9
static short module = MOD_IMPORT; static short module = MOD_IMPORT;
/* XPM */
static char * fleche_xpm[] = { static char * fleche_xpm[] = {
"17 22 41 1", "17 22 41 1",
" c None", " c None",
@ -128,7 +131,6 @@ static char * fleche_xpm[] = {
"+0%%%%%%%%%%%%%a+", "+0%%%%%%%%%%%%%a+",
"b+++++++++++++++b"}; "b+++++++++++++++b"};
/* XPM */
static char * checkbox_checked_xpm[] = { static char * checkbox_checked_xpm[] = {
"16 16 28 1", "16 16 28 1",
" c None", " c None",
@ -176,8 +178,6 @@ static char * checkbox_checked_xpm[] = {
"................", "................",
" .............. "}; " .............. "};
/* XPM */
static char * checkbox_unchecked_xpm[] = { static char * checkbox_unchecked_xpm[] = {
"12 12 14 1", "12 12 14 1",
" c None", " c None",
@ -493,25 +493,25 @@ trans_clist_row_destroy_cb (gpointer data)
} }
static void free_clist_row_text (GNCGenTransaction *gui, /*static void free_clist_row_text (GNCGenTransaction *gui,
int row_number) int row_number)
{ {
gchar *tmp; gchar *tmp;
gint i; gint i;
DEBUG("Begin"); DEBUG("Begin");
g_assert (gui); g_assert (gui);
for (i = 0; i < NUM_COLUMNS_DOWNLOADED_CLIST; i++) for (i = 0; i < NUM_COLUMNS_DOWNLOADED_CLIST; i++)
{ {
tmp=NULL; tmp=NULL;
if(gtk_clist_get_text (GTK_CLIST (gui->clist), row_number, if(gtk_clist_get_text (GTK_CLIST (gui->clist), row_number,
i, i,
&tmp)==1) &tmp)==1)
{ {
g_free(tmp); g_free(tmp);
} }
} }
} }*/
static char ** gen_clist_row_text (GNCImportTransInfo *info) static char ** gen_clist_row_text (GNCImportTransInfo *info)
{ {
@ -553,9 +553,17 @@ static char ** gen_clist_row_text (GNCImportTransInfo *info)
text[DOWNLOADED_CLIST_MEMO] = g_strdup(xaccSplitGetMemo(gnc_import_TransInfo_get_fsplit(info) ) ); text[DOWNLOADED_CLIST_MEMO] = g_strdup(xaccSplitGetMemo(gnc_import_TransInfo_get_fsplit(info) ) );
/*Imbalance*/ /*Imbalance*/
text[DOWNLOADED_CLIST_IMBALANCE]=g_strdup(xaccPrintAmount (xaccTransGetImbalance(gnc_import_TransInfo_get_trans(info) ), if(gnc_import_TransInfo_is_balanced(info)==TRUE)
gnc_default_print_info (TRUE) ) {
); text[DOWNLOADED_CLIST_IMBALANCE]=g_strdup("");
}
else
{
text[DOWNLOADED_CLIST_IMBALANCE]=g_strdup(xaccPrintAmount (xaccTransGetImbalance(gnc_import_TransInfo_get_trans(info) ),
gnc_commodity_print_info (xaccTransGetCurrency(gnc_import_TransInfo_get_trans (info)),TRUE) )
);
}
/*Actions*/ /*Actions*/
text[DOWNLOADED_CLIST_ACTION_ADD] = g_strdup(""); text[DOWNLOADED_CLIST_ACTION_ADD] = g_strdup("");
text[DOWNLOADED_CLIST_ACTION_CLEAR] = g_strdup(""); text[DOWNLOADED_CLIST_ACTION_CLEAR] = g_strdup("");
@ -571,21 +579,22 @@ static char ** gen_clist_row_text (GNCImportTransInfo *info)
} }
else else
{ {
if (gnc_import_TransInfo_get_destacc (info) != NULL) { if (gnc_import_TransInfo_get_destacc (info) != NULL)
tmp = xaccAccountGetFullName {
(gnc_import_TransInfo_get_destacc (info), tmp = xaccAccountGetFullName
gnc_get_account_separator ()); (gnc_import_TransInfo_get_destacc (info),
if(gnc_import_TransInfo_get_destacc_selected_manually(info)==TRUE) gnc_get_account_separator ());
{ if(gnc_import_TransInfo_get_destacc_selected_manually(info)==TRUE)
select_origin=MANUALY_SELECTED_TEXT; {
} select_origin=MANUALY_SELECTED_TEXT;
else }
{ else
select_origin=AUTO_SELECTED_TEXT; {
} select_origin=AUTO_SELECTED_TEXT;
text[DOWNLOADED_CLIST_ACTION_INFO] = g_strdup_printf(_("Add with balancing split into (%s) account \"%s\""),select_origin,tmp); }
free (tmp); text[DOWNLOADED_CLIST_ACTION_INFO] = g_strdup_printf(_("Add with balancing split into (%s) account \"%s\""),select_origin,tmp);
} free (tmp);
}
else else
{ {
text[DOWNLOADED_CLIST_ACTION_INFO] = g_strdup(_("Add UNBALANCED!")); text[DOWNLOADED_CLIST_ACTION_INFO] = g_strdup(_("Add UNBALANCED!"));
@ -784,3 +793,4 @@ void gnc_gen_trans_list_add_trans(GNCGenTransaction *gui, Transaction *trans)
return; return;
}/* end gnc_import_add_trans() */ }/* end gnc_import_add_trans() */
/** @} */

View File

@ -16,9 +16,12 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/**@file /** @addtogroup Import_Export
@brief import-main-mathcer.h: Transaction matcher main window @{ */
@author Copyright (C) 2002 Benoit Grégoire, Christian Stimming /**@file import-main-matcher.h
@brief Transaction matcher main window
@author Copyright (C) 2002 Benoit Grégoire
@author Christian Stimming
*/ */
#ifndef GNC_GEN_TRANSACTION_H #ifndef GNC_GEN_TRANSACTION_H
@ -53,19 +56,20 @@ void gnc_gen_trans_list_delete (GNCGenTransaction *info);
void gnc_gen_trans_list_add_trans(GNCGenTransaction *gui, Transaction *trans); void gnc_gen_trans_list_add_trans(GNCGenTransaction *gui, Transaction *trans);
/** Run this dialog and return only after the user pressed Ok, Cancel, /** Run this dialog and return only after the user pressed Ok, Cancel,
* or closed the window. This means that all actual importing will or closed the window. This means that all actual importing will
* have been finished upon returning. have been finished upon returning.
*/ */
gboolean gnc_gen_trans_list_run (GNCGenTransaction *info); gboolean gnc_gen_trans_list_run (GNCGenTransaction *info);
/** Freeze the underlying GtkCList. Do this before you add a lot of /** Freeze the underlying GtkCList. Do this before you add a lot of
* transactions. */ transactions. */
void gnc_gen_trans_list_freeze (GNCGenTransaction *gui); void gnc_gen_trans_list_freeze (GNCGenTransaction *gui);
/** Thaw the underlying GtkCList. Do this after you added a lot of /** Thaw the underlying GtkCList. Do this after you added a lot of
* transactions. */ transactions. */
void gnc_gen_trans_list_thaw (GNCGenTransaction *gui); void gnc_gen_trans_list_thaw (GNCGenTransaction *gui);
#endif #endif
/**@}*/

View File

@ -16,10 +16,13 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@{ */
/** @internal
@file import-match-map.c
@brief Generic import mapper service, maps strings->accounts @brief Generic import mapper service, maps strings->accounts
* *
import-match-map.c: An import mapper service that stores Account Maps for the An import mapper service that stores Account Maps for the
generic importer. This allows importers to map various generic importer. This allows importers to map various
"strings" to Gnucash accounts in a generic manner. "strings" to Gnucash accounts in a generic manner.
@author Copyright (C) 2002 Derek Atkins <derek@ihtfp.com> @author Copyright (C) 2002 Derek Atkins <derek@ihtfp.com>
@ -138,3 +141,5 @@ void gnc_imap_add_account (GncImportMatchMap *imap, const char *category,
/* XXX Mark the account (or book) as dirty! */ /* XXX Mark the account (or book) as dirty! */
} }
/** @} */

View File

@ -16,10 +16,12 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@{ */
/** @file import-match-map.h
@brief Generic import mapper service, maps strings->accounts @brief Generic import mapper service, maps strings->accounts
* *
import-match-map.h: An import mapper service that stores Account Maps for the An import mapper service that stores Account Maps for the
generic importer. This allows importers to map various generic importer. This allows importers to map various
"strings" to Gnucash accounts in a generic manner. "strings" to Gnucash accounts in a generic manner.
@author Copyright (C) 2002 Derek Atkins <derek@ihtfp.com> @author Copyright (C) 2002 Derek Atkins <derek@ihtfp.com>
@ -32,37 +34,42 @@ typedef struct _GncImportMatchMap GncImportMatchMap;
#include "Account.h" #include "Account.h"
#include "gnc-book.h" #include "gnc-book.h"
/* Obtain an ImportMatchMap object from an Account or a Book */ /** @{
Obtain an ImportMatchMap object from an Account or a Book */
GncImportMatchMap * gnc_imap_create_from_account (Account *acc); GncImportMatchMap * gnc_imap_create_from_account (Account *acc);
GncImportMatchMap * gnc_imap_create_from_book (GNCBook *book); GncImportMatchMap * gnc_imap_create_from_book (GNCBook *book);
/*@}*/
/* Destroy an import map. But all stored entries will still continue /** Destroy an import map. But all stored entries will still continue
* to exist in the underlying kvp frame of the account or book. */ to exist in the underlying kvp frame of the account or book. */
void gnc_imap_destroy (GncImportMatchMap *imap); void gnc_imap_destroy (GncImportMatchMap *imap);
/* Clear an import map -- this removes ALL entries in the map */ /** Clear an import map -- this removes ALL entries in the map */
void gnc_imap_clear (GncImportMatchMap *imap); void gnc_imap_clear (GncImportMatchMap *imap);
/* Look up an Account in the map */ /** Look up an Account in the map */
Account * gnc_imap_find_account (GncImportMatchMap *imap, const char *category, Account * gnc_imap_find_account (GncImportMatchMap *imap, const char *category,
const char *key); const char *key);
/* Store an Account in the map. This mapping is immediatly stored in /** Store an Account in the map. This mapping is immediatly stored in
* the underlying kvp frame, regardless of whether the MatchMap is the underlying kvp frame, regardless of whether the MatchMap is
* destroyed later or not. */ destroyed later or not. */
void gnc_imap_add_account (GncImportMatchMap *imap, const char *category, void gnc_imap_add_account (GncImportMatchMap *imap, const char *category,
const char *key, Account *acc); const char *key, Account *acc);
/* some well-known categories /** @name Some well-known categories
*
* NOTE: You DO NOT have to use these values in your importer -- these NOTE: You DO NOT have to use these values in your importer -- these
* are just "well known" values, not "mandatory" values. You are free are just "well known" values, not "mandatory" values. You are free
* to use these if they apply, map your own fields to these labels, or to use these if they apply, map your own fields to these labels, or
* create your own category strings. create your own category strings.
*/ */
/** @{*/
#define GNCIMPORT_DESC "desc" #define GNCIMPORT_DESC "desc"
#define GNCIMPORT_MEMO "memo" #define GNCIMPORT_MEMO "memo"
#define GNCIMPORT_PAYEE "payee" #define GNCIMPORT_PAYEE "payee"
/**@}*/
#endif /* GNC_IMPORT_MATCH_MAP_H */ #endif /* GNC_IMPORT_MATCH_MAP_H */
/**@}*/

View File

@ -16,8 +16,11 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@brief import-match-picker.c: The transaction match picker dialog @{ */
/** @internal
@file import-match-picker.c
@brief The transaction match picker dialog
implementation implementation
@author Copyright (C) 2002 Benoit Grégoire @author Copyright (C) 2002 Benoit Grégoire
*/ */
@ -368,3 +371,4 @@ gnc_import_match_picker_run_and_close (GNCImportTransInfo *transaction_info)
} }
} }
/** @} */

View File

@ -16,8 +16,10 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@brief import-match-picker.h -- THe transaction match picker dialog interface @{ */
/** @file import-match-picker.h
@brief The transaction match picker dialog interface
@author Copyright (C) 2002 Benoit Grégoire @author Copyright (C) 2002 Benoit Grégoire
*/ */
@ -32,14 +34,9 @@ typedef struct _transpickerdialog GNCImportMatchPicker;
* GUI Functions * GUI Functions
************************************************************************/ ************************************************************************/
/** @name Match_Picker Dialog
*
* A dialog where the user should pick the best match for *one* given
* transaction.
*/
/*@{*/
/** /**
* Run a match_picker dialog so that the selected-MatchInfo in the * Run a match_picker dialog where the user should pick the best match for 'one' given
* transaction, so that the selected-MatchInfo in the
* given trans_info is updated accordingly. This functions will only * given trans_info is updated accordingly. This functions will only
* return after the user clicked Ok, Cancel, or Window-Close. * return after the user clicked Ok, Cancel, or Window-Close.
* *
@ -54,7 +51,7 @@ typedef struct _transpickerdialog GNCImportMatchPicker;
* pick a matching transaction. */ * pick a matching transaction. */
void void
gnc_import_match_picker_run_and_close (GNCImportTransInfo *trans_info); gnc_import_match_picker_run_and_close (GNCImportTransInfo *trans_info);
/*@}*/ /**@}*/

View File

@ -16,8 +16,11 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/**@file /** @addtogroup Import_Export
@brief import-settings.c: User preference handling for @{ */
/**@internal
@file import-settings.c
@brief User preference handling for
transaction matching (for both the gui and the backend) transaction matching (for both the gui and the backend)
@author Copyright (C) 2002 Benoit Grégoire @author Copyright (C) 2002 Benoit Grégoire
*/ */
@ -177,3 +180,5 @@ gint gnc_import_Settings_get_display_threshold (GNCImportSettings *settings)
g_assert (settings); g_assert (settings);
return settings->display_threshold; return settings->display_threshold;
}; };
/**@}*/

View File

@ -16,8 +16,11 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/**@file /** @addtogroup Import_Export
\brief import-settings.h: User preference interface for @{ */
/**@file import-settings.h
\brief Import preference handling.
*User preference interface for
transaction matching (for both the gui and the backend) transaction matching (for both the gui and the backend)
\author Copyright (C) 2002 Benoit Grégoire \author Copyright (C) 2002 Benoit Grégoire
*/ */
@ -31,8 +34,7 @@ typedef struct _genimportsettings GNCImportSettings;
* Getter/Setter Functions for the Data Types. * Getter/Setter Functions for the Data Types.
************************************************************************/ ************************************************************************/
/** @name Getters/Setters for GNCImportSettings */
/*@{*/
/** Allocates a new GNCImportSettings object, and initialize it with the /** Allocates a new GNCImportSettings object, and initialize it with the
appropriate user prefs. appropriate user prefs.
@ -44,6 +46,8 @@ gnc_import_Settings_new (void);
void gnc_import_Settings_delete (GNCImportSettings *settings); void gnc_import_Settings_delete (GNCImportSettings *settings);
/** @name Getters/Setters for GNCImportSettings */
/*@{*/
/** Return the allowed amount range for fuzzy amount matching. /** Return the allowed amount range for fuzzy amount matching.
@return The allowed amount range for fuzzy amount matching, @return The allowed amount range for fuzzy amount matching,
@ -79,7 +83,7 @@ gint gnc_import_Settings_get_add_threshold (GNCImportSettings *settings);
/** Return the selected threshold. /** Return the selected threshold.
*/ */
gint gnc_import_Settings_get_display_threshold (GNCImportSettings *settings); gint gnc_import_Settings_get_display_threshold (GNCImportSettings *settings);
/**@}*/
/*@}*/ /**@}*/
#endif #endif

View File

@ -16,8 +16,11 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@brief import-utilities.h: Utility functions for writing import modules. @{ */
/** @internal
@file import-utilities.c
@brief Utility functions for writing import modules.
@author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> @author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca>
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -106,3 +109,4 @@ void gnc_import_set_trans_online_id(Transaction * transaction,
return; return;
} }
/* @} */

View File

@ -16,8 +16,10 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@brief import-utilities.h: Utility functions for writing import modules. @{ */
/** @file import-utilities.h
@brief Utility functions for writing import modules.
@author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca> @author Copyright (C) 2002 Benoit Grégoire <bock@step.polymtl.ca>
*/ */
#ifndef IMPORT_UTILITIES_H #ifndef IMPORT_UTILITIES_H
@ -25,14 +27,27 @@
#include "Account.h" #include "Account.h"
/* Setter and getter functions for the online_id kvp_frame for /** @name Setter-getters
Accounts and Transactions. Setter and getter functions for the online_id kvp_frame for
Accounts.
@{
*/ */
const gchar * gnc_import_get_acc_online_id(Account * account); const gchar * gnc_import_get_acc_online_id(Account * account);
void gnc_import_set_acc_online_id(Account * account, void gnc_import_set_acc_online_id(Account * account,
const gchar * string_value); const gchar * string_value);
/** @} */
/** @name Setter-getters
Setter and getter functions for the online_id kvp_frame for
Transactions.
@{
*/
const gchar * gnc_import_get_trans_online_id(Transaction * transaction); const gchar * gnc_import_get_trans_online_id(Transaction * transaction);
void gnc_import_set_trans_online_id(Transaction * transaction, void gnc_import_set_trans_online_id(Transaction * transaction,
const gchar * string_value); const gchar * string_value);
/** @} */
#endif #endif
/** @} */

View File

@ -16,10 +16,11 @@
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org * * Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
/** @file /** @addtogroup Import_Export
@{ */
/** @internal
@file gnc-ofx-import.c
@brief Ofx import module code @brief Ofx import module code
*
gnc-ofx-import.c
@author Copyright (c) 2002 Benoit Grégoire <bock@step.polymtl.ca> @author Copyright (c) 2002 Benoit Grégoire <bock@step.polymtl.ca>
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -157,6 +158,7 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data)
gchar *investment_account_text; gchar *investment_account_text;
gnc_commodity *currency=NULL; gnc_commodity *currency=NULL;
gnc_commodity *investment_commodity=NULL; gnc_commodity *investment_commodity=NULL;
gnc_numeric gnc_amount, gnc_units;
GNCBook *book; GNCBook *book;
Transaction *transaction; Transaction *transaction;
Split *split; Split *split;
@ -363,10 +365,12 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data)
split=xaccMallocSplit(book); split=xaccMallocSplit(book);
xaccTransAppendSplit(transaction,split); xaccTransAppendSplit(transaction,split);
xaccAccountInsertSplit(account,split); xaccAccountInsertSplit(account,split);
/*gnc_amount = double_to_gnc_numeric(data.amount,xaccAccountGetCommoditySCU(account),GNC_RND_ROUND);*/
gnc_amount = double_to_gnc_numeric (data.amount,
gnc_commodity_get_fraction(xaccTransGetCurrency(transaction)),
GNC_RND_ROUND);
xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction));
DxaccSplitSetBaseValue(split, data.amount, currency);
/* Also put the ofx transaction's memo in the split's memo field */ /* Also put the ofx transaction's memo in the split's memo field */
if(data.memo_valid==true){ if(data.memo_valid==true){
xaccSplitSetMemo(split, data.memo); xaccSplitSetMemo(split, data.memo);
@ -404,7 +408,15 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data)
split=xaccMallocSplit(book); split=xaccMallocSplit(book);
xaccTransAppendSplit(transaction,split); xaccTransAppendSplit(transaction,split);
xaccAccountInsertSplit(investment_account,split); xaccAccountInsertSplit(investment_account,split);
DxaccSplitSetSharePriceAndAmount(split, data.unitprice,data.units);
gnc_amount = double_to_gnc_numeric (-(data.amount),
gnc_commodity_get_fraction(investment_commodity),
GNC_RND_ROUND);
gnc_units = double_to_gnc_numeric (data.units,
gnc_commodity_get_fraction(investment_commodity),
GNC_RND_ROUND);
xaccSplitSetAmount(split, gnc_units);
xaccSplitSetValue(split, gnc_amount);
if(data.security_data_ptr->memo_valid==true) if(data.security_data_ptr->memo_valid==true)
{ {
@ -475,7 +487,11 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data)
split=xaccMallocSplit(book); split=xaccMallocSplit(book);
xaccTransAppendSplit(transaction,split); xaccTransAppendSplit(transaction,split);
xaccAccountInsertSplit(income_account,split); xaccAccountInsertSplit(income_account,split);
DxaccSplitSetBaseValue(split, data.amount, currency);
gnc_amount = double_to_gnc_numeric (data.amount,
gnc_commodity_get_fraction(xaccTransGetCurrency(transaction)),
GNC_RND_ROUND);
xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction));
/* Also put the ofx transaction name in the splits memo field, or ofx memo if name is unavailable */ /* Also put the ofx transaction name in the splits memo field, or ofx memo if name is unavailable */
if(data.name_valid==true){ if(data.name_valid==true){
@ -493,8 +509,11 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data)
split=xaccMallocSplit(book); split=xaccMallocSplit(book);
xaccTransAppendSplit(transaction,split); xaccTransAppendSplit(transaction,split);
xaccAccountInsertSplit(account,split); xaccAccountInsertSplit(account,split);
/*gnc_amount = double_to_gnc_numeric(data.amount,xaccAccountGetCommoditySCU(account),GNC_RND_ROUND);*/
DxaccSplitSetBaseValue(split, data.amount,currency); gnc_amount = double_to_gnc_numeric (data.amount,
gnc_commodity_get_fraction(xaccTransGetCurrency(transaction)),
GNC_RND_ROUND);
xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction));
/* Also put the ofx transaction name in the splits memo field, or ofx memo if name is unavailable */ /* Also put the ofx transaction name in the splits memo field, or ofx memo if name is unavailable */
if(data.name_valid==true){ if(data.name_valid==true){
@ -610,3 +629,5 @@ int ofx_proc_account_cb(struct OfxAccountData data)
return 0; return 0;
} }
/** @} */

View File

@ -1,6 +1,27 @@
/**@file /********************************************************************\
\brief module definition/initialization for the ofx importer * This program is free software; you can redistribute it and/or *
\author Copyright (c) 2002 Benoit Grégoire bock@step.polymtl.ca * modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
/** @addtogroup Import_Export
@{ */
/**@internal
@file gncmod-ofx-import.c
@brief module definition/initialization for the ofx importer
@author Copyright (c) 2002 Benoit Grégoire bock@step.polymtl.ca
*/ */
#include <glib.h> #include <glib.h>
#include <guile/gh.h> #include <guile/gh.h>
@ -66,3 +87,4 @@ libgncmod_ofx_LTX_gnc_module_end(int refcount)
{ {
return TRUE; return TRUE;
} }
/** @}*/