mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2002-10-03 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/gnc-hbci-gettrans.[hc]: Separate the Get-Transaction related HBCI functions into this file. Much more work here, so that most of transaction information is now filled into the right places. Requires totally up-to-date OpenHBCI CVS, though. * src/import-export/hbci/gnc-hbci-getbalance.[hc]: Separate the Get-Balance related functions to a seperate file. Add invocation of account reconcile upon successful balance retrieval. * src/import-export/hbci/hbci-progressmon.c: Change to a GnomeDialog here, and fix handling of parent window. * src/gnome/window-main-summarybar.c: Introduce lookup of currency symbol. However, this doesn't quite fix bug #91724, since that one is related to the currency_item->assets_label and not to the label in front of that. What a pity. * src/RecnWindow.h (recnWindowWithBalance), src/gnome/window-reconcile.c: Add function to invoke account reconciliation with balance and date given. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7264 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
dd59615084
commit
4e47975a10
24
ChangeLog
24
ChangeLog
@ -1,3 +1,27 @@
|
||||
2002-10-03 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/import-export/hbci/gnc-hbci-gettrans.[hc]: Separate the
|
||||
Get-Transaction related HBCI functions into this file. Much more
|
||||
work here, so that most of transaction information is now filled
|
||||
into the right places. Requires totally up-to-date OpenHBCI CVS,
|
||||
though.
|
||||
|
||||
* src/import-export/hbci/gnc-hbci-getbalance.[hc]: Separate the
|
||||
Get-Balance related functions to a seperate file. Add invocation
|
||||
of account reconcile upon successful balance retrieval.
|
||||
|
||||
* src/import-export/hbci/hbci-progressmon.c: Change to a
|
||||
GnomeDialog here, and fix handling of parent window.
|
||||
|
||||
* src/gnome/window-main-summarybar.c: Introduce lookup of currency
|
||||
symbol. However, this doesn't quite fix bug #91724, since that one
|
||||
is related to the currency_item->assets_label and not to the label
|
||||
in front of that. What a pity.
|
||||
|
||||
* src/RecnWindow.h (recnWindowWithBalance),
|
||||
src/gnome/window-reconcile.c: Add function to invoke account
|
||||
reconciliation with balance and date given.
|
||||
|
||||
2002-10-03 Derek Atkins <derek@ihtfp.com>
|
||||
* src/scm/main.scm -- move (setlocale ...) earlier in the startup.
|
||||
it needs to run before app-utils is loaded (because gnc_localeconv()
|
||||
|
@ -2,6 +2,7 @@
|
||||
* RecnWindow.h -- the reconcile window *
|
||||
* Copyright (C) 1997 Robin D. Clark *
|
||||
* Copyright (C) 1998-2000 Linas Vepstas *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -37,6 +38,34 @@ typedef struct _RecnWindow RecnWindow;
|
||||
|
||||
|
||||
/** PROTOTYPES ******************************************************/
|
||||
|
||||
/********************************************************************\
|
||||
* recnWindow *
|
||||
* opens up the window to reconcile an account *
|
||||
* *
|
||||
* Args: parent - the parent of this window *
|
||||
* account - the account to reconcile *
|
||||
*
|
||||
* Return: recnData - the instance of this RecnWindow, or NULL if the
|
||||
* user pressed Cancel in the initial date query.
|
||||
\********************************************************************/
|
||||
RecnWindow *recnWindow (gncUIWidget parent, Account *account);
|
||||
|
||||
/********************************************************************\
|
||||
* recnWindowWithBalance
|
||||
*
|
||||
* Opens up the window to reconcile an account, but with ending
|
||||
* balance and statement date already given.
|
||||
*
|
||||
* Args: parent - The parent widget of the new window
|
||||
* account - The account to reconcile
|
||||
* new_ending - The amount for ending balance
|
||||
* statement_date - The date of the statement
|
||||
* Return: recnData - the instance of this RecnWindow
|
||||
\********************************************************************/
|
||||
RecnWindow *recnWindowWithBalance (GtkWidget *parent,
|
||||
Account *account,
|
||||
gnc_numeric new_ending,
|
||||
time_t statement_date);
|
||||
|
||||
#endif
|
||||
|
@ -99,6 +99,9 @@ gnc_ui_build_currency_item(gnc_commodity * currency)
|
||||
GNCCurrencyItem *item;
|
||||
const char *mnemonic;
|
||||
char *label_str;
|
||||
struct lconv *lc;
|
||||
|
||||
lc = gnc_localeconv();
|
||||
|
||||
item = g_new0 (GNCCurrencyItem, 1);
|
||||
|
||||
@ -112,7 +115,13 @@ gnc_ui_build_currency_item(gnc_commodity * currency)
|
||||
gtk_widget_show(topbox);
|
||||
gtk_container_add(GTK_CONTAINER(listitem), topbox);
|
||||
|
||||
mnemonic = gnc_commodity_get_mnemonic (currency);
|
||||
if (gnc_commodity_equiv (currency, gnc_locale_default_currency ()))
|
||||
mnemonic = lc->currency_symbol;
|
||||
else
|
||||
mnemonic = gnc_commodity_get_mnemonic (currency);
|
||||
|
||||
if (mnemonic == NULL)
|
||||
mnemonic = "";
|
||||
|
||||
hbox = gtk_hbox_new(FALSE, 2);
|
||||
gtk_widget_show(hbox);
|
||||
|
@ -2,6 +2,7 @@
|
||||
* window-reconcile.c -- the reconcile window *
|
||||
* Copyright (C) 1997 Robin D. Clark *
|
||||
* Copyright (C) 1998-2000 Linas Vepstas *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -158,6 +159,8 @@ static gboolean find_by_account (gpointer find_data, gpointer user_data);
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
/* static short module = MOD_GUI; */
|
||||
|
||||
static time_t gnc_reconcile_last_statement_date = 0;
|
||||
|
||||
|
||||
/** IMPLEMENTATIONS *************************************************/
|
||||
|
||||
@ -1612,14 +1615,52 @@ close_handler (gpointer user_data)
|
||||
RecnWindow *
|
||||
recnWindow (GtkWidget *parent, Account *account)
|
||||
{
|
||||
static time_t last_statement_date = 0;
|
||||
gnc_numeric new_ending;
|
||||
time_t statement_date;
|
||||
|
||||
if (account == NULL)
|
||||
return NULL;
|
||||
|
||||
/* The last time reconciliation was attempted during the current
|
||||
* execution of gnucash, the date was stored. Use that date if
|
||||
* possible. This helps with balancing multiple accounts for which
|
||||
* statements are issued at the same time, like multiple bank
|
||||
* accounts on a single statement. */
|
||||
if (!gnc_reconcile_last_statement_date)
|
||||
statement_date = time (NULL);
|
||||
else
|
||||
statement_date = gnc_reconcile_last_statement_date;
|
||||
|
||||
gnc_get_reconcile_info (account, &new_ending, &statement_date);
|
||||
|
||||
/* Popup a little window to prompt the user to enter the
|
||||
* ending balance for his/her bank statement */
|
||||
if (!startRecnWindow (parent, account, &new_ending, &statement_date))
|
||||
return NULL;
|
||||
|
||||
return recnWindowWithBalance (parent, account, new_ending, statement_date);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
* recnWindowWithBalance
|
||||
*
|
||||
* Opens up the window to reconcile an account, but with ending
|
||||
* balance and statement date already given.
|
||||
*
|
||||
* Args: parent - The parent widget of the new window
|
||||
* account - The account to reconcile
|
||||
* new_ending - The amount for ending balance
|
||||
* statement_date - The date of the statement
|
||||
* Return: recnData - the instance of this RecnWindow
|
||||
\********************************************************************/
|
||||
RecnWindow *
|
||||
recnWindowWithBalance (GtkWidget *parent, Account *account,
|
||||
gnc_numeric new_ending, time_t statement_date)
|
||||
{
|
||||
RecnWindow *recnData;
|
||||
GtkWidget *statusbar;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *dock;
|
||||
gnc_numeric new_ending;
|
||||
time_t statement_date;
|
||||
|
||||
if (account == NULL)
|
||||
return NULL;
|
||||
@ -1633,25 +1674,6 @@ recnWindow (GtkWidget *parent, Account *account)
|
||||
|
||||
recnData->account = *xaccAccountGetGUID (account);
|
||||
|
||||
/* The last time reconciliation was attempted during the current
|
||||
* execution of gnucash, the date was stored. Use that date if
|
||||
* possible. This helps with balancing multiple accounts for which
|
||||
* statements are issued at the same time, like multiple bank
|
||||
* accounts on a single statement. */
|
||||
if (!last_statement_date)
|
||||
statement_date = time (NULL);
|
||||
else
|
||||
statement_date = last_statement_date;
|
||||
|
||||
gnc_get_reconcile_info (account, &new_ending, &statement_date);
|
||||
|
||||
/* Popup a little window to prompt the user to enter the
|
||||
* ending balance for his/her bank statement */
|
||||
if (!startRecnWindow (parent, account, &new_ending, &statement_date))
|
||||
{
|
||||
g_free (recnData);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
recnData->component_id =
|
||||
gnc_register_gui_component (WINDOW_RECONCILE_CM_CLASS,
|
||||
@ -1660,7 +1682,7 @@ recnWindow (GtkWidget *parent, Account *account)
|
||||
|
||||
recn_set_watches (recnData);
|
||||
|
||||
last_statement_date = statement_date;
|
||||
gnc_reconcile_last_statement_date = statement_date;
|
||||
|
||||
recnData->new_ending = new_ending;
|
||||
recnData->statement_date = statement_date;
|
||||
|
@ -11,6 +11,8 @@ libgncmod_hbci_la_SOURCES = \
|
||||
gnc-hbci-utils.c \
|
||||
gnc-hbci-cb.c \
|
||||
gnc-hbci-actions.c \
|
||||
gnc-hbci-getbalance.c \
|
||||
gnc-hbci-gettrans.c \
|
||||
hbci-interaction.c \
|
||||
hbci-progressmon.c \
|
||||
hbci-account-picker.c \
|
||||
|
@ -1611,599 +1611,6 @@ Press 'Finish' now.</text>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkDialog</class>
|
||||
<name>HBCI Connection Dialog</name>
|
||||
<title>HBCI Connection Dialog</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<allow_shrink>True</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<child_name>Dialog:vbox</child_name>
|
||||
<name>dialog-vbox1</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<child_name>Dialog:action_area</child_name>
|
||||
<name>dialog-action_area1</name>
|
||||
<border_width>10</border_width>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>5</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox115</name>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>abort_button</name>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>close_button</name>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox147</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame66</name>
|
||||
<border_width>10</border_width>
|
||||
<label>Progress</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table4</name>
|
||||
<rows>3</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8877420</name>
|
||||
<label>Current Job</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8877421</name>
|
||||
<label>Current Action</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8877422</name>
|
||||
<label>Progress</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkProgressBar</class>
|
||||
<name>action_progress</name>
|
||||
<value>0</value>
|
||||
<lower>0</lower>
|
||||
<upper>100</upper>
|
||||
<bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
|
||||
<orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
|
||||
<activity_mode>False</activity_mode>
|
||||
<show_text>True</show_text>
|
||||
<format>%P %%</format>
|
||||
<text_xalign>0.5</text_xalign>
|
||||
<text_yalign>0.5</text_yalign>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>job_entry</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>action_entry</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame67</name>
|
||||
<border_width>10</border_width>
|
||||
<label>Log Messages</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkScrolledWindow</class>
|
||||
<name>scrolledwindow29</name>
|
||||
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
|
||||
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
|
||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||
|
||||
<widget>
|
||||
<class>GtkText</class>
|
||||
<name>log_text</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>False</editable>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkWindow</class>
|
||||
<name>HBCI_connection_window</name>
|
||||
<title>HBCI Connection Window</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<default_width>400</default_width>
|
||||
<default_height>400</default_height>
|
||||
<allow_shrink>True</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox148</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<child_name>Dialog:action_area</child_name>
|
||||
<name>hbox116</name>
|
||||
<border_width>10</border_width>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>5</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox117</name>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>abort_button</name>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>close_button</name>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox149</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame68</name>
|
||||
<border_width>10</border_width>
|
||||
<label>Progress</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table5</name>
|
||||
<rows>3</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8877424</name>
|
||||
<label>Current Job</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8877425</name>
|
||||
<label>Current Action</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8877426</name>
|
||||
<label>Progress</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkProgressBar</class>
|
||||
<name>action_progress</name>
|
||||
<value>0</value>
|
||||
<lower>0</lower>
|
||||
<upper>100</upper>
|
||||
<bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
|
||||
<orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
|
||||
<activity_mode>False</activity_mode>
|
||||
<show_text>True</show_text>
|
||||
<format>%P %%</format>
|
||||
<text_xalign>0.5</text_xalign>
|
||||
<text_yalign>0.5</text_yalign>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>job_entry</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>action_entry</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame69</name>
|
||||
<border_width>10</border_width>
|
||||
<label>Log Messages</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkScrolledWindow</class>
|
||||
<name>scrolledwindow30</name>
|
||||
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
|
||||
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
|
||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||
|
||||
<widget>
|
||||
<class>GtkText</class>
|
||||
<name>log_text</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>False</editable>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>HBCI_trans_dialog</name>
|
||||
@ -2947,4 +2354,289 @@ Press 'Finish' now.</text>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>HBCI_connection_dialog</name>
|
||||
<title>HBCI Connection Window</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<default_width>350</default_width>
|
||||
<default_height>400</default_height>
|
||||
<allow_shrink>True</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
<auto_close>False</auto_close>
|
||||
<hide_on_close>False</hide_on_close>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<child_name>GnomeDialog:vbox</child_name>
|
||||
<name>dialog-vbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>8</spacing>
|
||||
<child>
|
||||
<padding>4</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<child_name>GnomeDialog:action_area</child_name>
|
||||
<name>dialog-action_area3</name>
|
||||
<layout_style>GTK_BUTTONBOX_END</layout_style>
|
||||
<spacing>8</spacing>
|
||||
<child_min_width>85</child_min_width>
|
||||
<child_min_height>27</child_min_height>
|
||||
<child_ipad_x>7</child_ipad_x>
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>close_button</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>abort_button</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox149</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame68</name>
|
||||
<border_width>10</border_width>
|
||||
<label>Progress</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table5</name>
|
||||
<rows>3</rows>
|
||||
<columns>2</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8877424</name>
|
||||
<label>Current Job</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8877425</name>
|
||||
<label>Current Action</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label8877426</name>
|
||||
<label>Progress</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkProgressBar</class>
|
||||
<name>action_progress</name>
|
||||
<value>0</value>
|
||||
<lower>0</lower>
|
||||
<upper>100</upper>
|
||||
<bar_style>GTK_PROGRESS_CONTINUOUS</bar_style>
|
||||
<orientation>GTK_PROGRESS_LEFT_TO_RIGHT</orientation>
|
||||
<activity_mode>False</activity_mode>
|
||||
<show_text>True</show_text>
|
||||
<format>%P %%</format>
|
||||
<text_xalign>0.5</text_xalign>
|
||||
<text_yalign>0.5</text_yalign>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>job_entry</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>action_entry</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame69</name>
|
||||
<border_width>10</border_width>
|
||||
<label>Log Messages</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkScrolledWindow</class>
|
||||
<name>scrolledwindow30</name>
|
||||
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
|
||||
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
|
||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||
|
||||
<widget>
|
||||
<class>GtkText</class>
|
||||
<name>log_text</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>False</editable>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
||||
|
@ -30,316 +30,11 @@
|
||||
#include "dialog-transfer.h"
|
||||
#include "date.h"
|
||||
#include "Transaction.h"
|
||||
#include "gnc-generic-import.h"
|
||||
|
||||
#include "hbci-interaction.h"
|
||||
#include "gnc-hbci-utils.h"
|
||||
#include "dialog-hbcitrans.h"
|
||||
|
||||
void
|
||||
gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
|
||||
{
|
||||
HBCI_API *api = NULL;
|
||||
const HBCI_Account *h_acc = NULL;
|
||||
GNCInteractor *interactor = NULL;
|
||||
const HBCI_Customer *customer = NULL;
|
||||
|
||||
g_assert(parent);
|
||||
g_assert(gnc_acc);
|
||||
|
||||
api = gnc_hbci_api_new_currentbook (parent, &interactor);
|
||||
g_assert (interactor);
|
||||
if (api == NULL) {
|
||||
printf("gnc_hbci_getbalance: Couldn't get HBCI API.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
h_acc = gnc_hbci_get_hbci_acc (api, gnc_acc);
|
||||
if (h_acc == NULL) {
|
||||
printf("gnc_hbci_getbalance: No HBCI account found.\n");
|
||||
return;
|
||||
}
|
||||
/* printf("gnc_hbci_getbalance: HBCI account no. %s found.\n",
|
||||
HBCI_Account_accountId (h_acc)); */
|
||||
|
||||
{
|
||||
/* Get one customer. */
|
||||
const list_HBCI_Customer *custlist;
|
||||
list_HBCI_Customer_iter *iter;
|
||||
|
||||
custlist = HBCI_Account_authorizedCustomers (h_acc);
|
||||
g_assert (custlist);
|
||||
switch (list_HBCI_Customer_size (custlist)) {
|
||||
case 0:
|
||||
printf("gnc_hbci_getbalance: No HBCI customer found.\n");
|
||||
return;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
gnc_warning_dialog_parented(gnc_ui_get_toplevel (),
|
||||
"Sorry, Choosing one out of several HBCI Customers not yet implemented.");
|
||||
return;
|
||||
}
|
||||
iter = list_HBCI_Customer_begin (custlist);
|
||||
customer = list_HBCI_Customer_iter_get (iter);
|
||||
list_HBCI_Customer_iter_delete (iter);
|
||||
}
|
||||
g_assert (customer);
|
||||
/* printf("gnc_hbci_getbalance: Customer id %s found.\n",
|
||||
HBCI_Customer_custId ((HBCI_Customer *)customer)); */
|
||||
|
||||
{
|
||||
/* Execute a GetBalance job. */
|
||||
HBCI_OutboxJobGetBalance *balance_job;
|
||||
HBCI_OutboxJob *job;
|
||||
HBCI_Error *err;
|
||||
|
||||
balance_job =
|
||||
HBCI_OutboxJobGetBalance_new (customer, (HBCI_Account *)h_acc);
|
||||
job = HBCI_OutboxJobGetBalance_OutboxJob (balance_job);
|
||||
g_assert (job);
|
||||
HBCI_API_addJob (api, job);
|
||||
|
||||
if (interactor)
|
||||
GNCInteractor_show (interactor);
|
||||
|
||||
HBCI_Hbci_setDebugLevel(1);
|
||||
err = HBCI_API_executeQueue (api, TRUE);
|
||||
g_assert (err);
|
||||
if (!HBCI_Error_isOk(err)) {
|
||||
char *errstr = g_strdup_printf("gnc_hbci_getbalance: Error at executeQueue: %s",
|
||||
HBCI_Error_message (err));
|
||||
printf("%s; status %d, result %d\n", errstr, HBCI_OutboxJob_status(job),
|
||||
HBCI_OutboxJob_result(job));
|
||||
HBCI_Interactor_msgStateResponse (HBCI_Hbci_interactor
|
||||
(HBCI_API_Hbci (api)), errstr);
|
||||
g_free (errstr);
|
||||
HBCI_Error_delete (err);
|
||||
gnc_hbci_debug_outboxjob (job);
|
||||
return;
|
||||
}
|
||||
/*HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE);*/
|
||||
HBCI_Error_delete (err);
|
||||
|
||||
{
|
||||
const HBCI_AccountBalance *acc_bal;
|
||||
const HBCI_Balance *bal1, *bal2;
|
||||
const HBCI_Value *val;
|
||||
struct tm tm1, tm2;
|
||||
time_t tt1, tt2;
|
||||
int choose1;
|
||||
Timespec ts1, ts2;
|
||||
|
||||
/*const HBCI_AccountBalance *accBal =
|
||||
HBCI_OutboxJobGetBalance_getBalance(balance_job);
|
||||
const HBCI_Balance *notedBal =
|
||||
HBCI_AccountBalance_notedBalance(accBal);
|
||||
const HBCI_Balance *bookedBal =
|
||||
HBCI_AccountBalance_bookedBalance(accBal);
|
||||
const HBCI_Value *resultvalue =
|
||||
HBCI_Balance_value(notedBal);
|
||||
printf("Noted balance: %s for account no. %s.\n",
|
||||
HBCI_Value_toReadableString(resultvalue), // this ought to be free'd
|
||||
HBCI_Account_accountId (h_acc));
|
||||
resultvalue = HBCI_Balance_value(bookedBal);
|
||||
printf("Booked balance: %s for account no. %s \n",
|
||||
HBCI_Value_toReadableString(resultvalue),
|
||||
HBCI_Account_accountId (h_acc));*/
|
||||
|
||||
|
||||
acc_bal = HBCI_OutboxJobGetBalance_getBalance (balance_job);
|
||||
bal1 = HBCI_AccountBalance_notedBalance (acc_bal);
|
||||
bal2 = HBCI_AccountBalance_bookedBalance (acc_bal);
|
||||
tm1 = HBCI_DateTime_to_tm (HBCI_Balance_date (bal1),
|
||||
HBCI_Balance_time (bal1));
|
||||
tt1 = mktime (&tm1);
|
||||
timespecFromTime_t (&ts1, tt1);
|
||||
tm2 = HBCI_DateTime_to_tm (HBCI_Balance_date (bal2),
|
||||
HBCI_Balance_time (bal2));
|
||||
tt2 = mktime (&tm2);
|
||||
timespecFromTime_t (&ts2, tt2);
|
||||
choose1 = (timespec_cmp (&ts1, &ts2) == 1);
|
||||
|
||||
val = HBCI_Balance_value (choose1 ? bal1 : bal2);
|
||||
|
||||
gnc_verify_dialog(TRUE,
|
||||
"Result of HBCI job: \nAccount %s balance is %f\n.",
|
||||
(choose1 ? "noted" : "booked"),
|
||||
HBCI_Value_getValue (val));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void *trans_list_cb (const HBCI_Transaction *trans, void *user_data);
|
||||
struct trans_list_data
|
||||
{
|
||||
Account *gnc_acc;
|
||||
};
|
||||
|
||||
void
|
||||
gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc)
|
||||
{
|
||||
HBCI_API *api = NULL;
|
||||
const HBCI_Account *h_acc = NULL;
|
||||
GNCInteractor *interactor = NULL;
|
||||
const HBCI_Customer *customer = NULL;
|
||||
|
||||
g_assert(parent);
|
||||
g_assert(gnc_acc);
|
||||
|
||||
api = gnc_hbci_api_new_currentbook (parent, &interactor);
|
||||
g_assert (interactor);
|
||||
if (api == NULL) {
|
||||
printf("gnc_hbci_gettrans: Couldn't get HBCI API.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
h_acc = gnc_hbci_get_hbci_acc (api, gnc_acc);
|
||||
if (h_acc == NULL) {
|
||||
printf("gnc_hbci_gettrans: No HBCI account found.\n");
|
||||
return;
|
||||
}
|
||||
/* printf("gnc_hbci_gettrans: HBCI account no. %s found.\n",
|
||||
HBCI_Account_accountId (h_acc)); */
|
||||
|
||||
{
|
||||
/* Get one customer. */
|
||||
const list_HBCI_Customer *custlist;
|
||||
list_HBCI_Customer_iter *iter;
|
||||
|
||||
custlist = HBCI_Account_authorizedCustomers (h_acc);
|
||||
g_assert (custlist);
|
||||
switch (list_HBCI_Customer_size (custlist)) {
|
||||
case 0:
|
||||
printf("gnc_hbci_gettrans: No HBCI customer found.\n");
|
||||
return;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
gnc_warning_dialog_parented(gnc_ui_get_toplevel (),
|
||||
"Sorry, Choosing one out of several HBCI Customers not yet implemented.");
|
||||
return;
|
||||
}
|
||||
iter = list_HBCI_Customer_begin (custlist);
|
||||
customer = list_HBCI_Customer_iter_get (iter);
|
||||
list_HBCI_Customer_iter_delete (iter);
|
||||
}
|
||||
g_assert (customer);
|
||||
/* printf("gnc_hbci_gettrans: Customer id %s found.\n",
|
||||
HBCI_Customer_custId ((HBCI_Customer *)customer)); */
|
||||
|
||||
{
|
||||
/* Execute a GetTransactions job. */
|
||||
HBCI_OutboxJobGetTransactions *trans_job;
|
||||
HBCI_OutboxJob *job;
|
||||
HBCI_Error *err;
|
||||
HBCI_Date *blank_date = HBCI_Date_new_blank();
|
||||
|
||||
trans_job =
|
||||
HBCI_OutboxJobGetTransactions_new (customer,
|
||||
(HBCI_Account *)h_acc,
|
||||
blank_date,
|
||||
blank_date);
|
||||
job = HBCI_OutboxJobGetTransactions_OutboxJob (trans_job);
|
||||
g_assert (job);
|
||||
HBCI_API_addJob (api, job);
|
||||
|
||||
if (interactor)
|
||||
GNCInteractor_show (interactor);
|
||||
|
||||
HBCI_Hbci_setDebugLevel(1);
|
||||
err = HBCI_API_executeQueue (api, TRUE);
|
||||
g_assert (err);
|
||||
if (!HBCI_Error_isOk(err)) {
|
||||
char *errstr = g_strdup_printf("gnc_hbci_gettrans: Error at executeQueue: %s",
|
||||
HBCI_Error_message (err));
|
||||
printf("%s; status %d, result %d\n", errstr, HBCI_OutboxJob_status(job),
|
||||
HBCI_OutboxJob_result(job));
|
||||
HBCI_Interactor_msgStateResponse (HBCI_Hbci_interactor
|
||||
(HBCI_API_Hbci (api)), errstr);
|
||||
g_free (errstr);
|
||||
HBCI_Error_delete (err);
|
||||
gnc_hbci_debug_outboxjob (job);
|
||||
return;
|
||||
}
|
||||
/*HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE);*/
|
||||
HBCI_Error_delete (err);
|
||||
HBCI_Date_delete (blank_date);
|
||||
|
||||
{
|
||||
const list_HBCI_Transaction *trans_list;
|
||||
struct trans_list_data data;
|
||||
|
||||
data.gnc_acc = gnc_acc;
|
||||
|
||||
trans_list = HBCI_OutboxJobGetTransactions_transactions (trans_job);
|
||||
list_HBCI_Transaction_foreach (trans_list, trans_list_cb, &data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* list_HBCI_Transaction_foreach callback */
|
||||
static void *trans_list_cb (const HBCI_Transaction *trans, void *user_data)
|
||||
{
|
||||
time_t current_time;
|
||||
Account *gnc_acc;
|
||||
GNCBook *book;
|
||||
Transaction *transaction;
|
||||
Split *split;
|
||||
gnc_numeric gnc_amount;
|
||||
struct trans_list_data *data = user_data;
|
||||
g_assert(data);
|
||||
|
||||
gnc_acc = data->gnc_acc;
|
||||
g_assert(gnc_acc);
|
||||
|
||||
book = xaccAccountGetBook(gnc_acc);
|
||||
transaction = xaccMallocTransaction(book);
|
||||
xaccTransBeginEdit(transaction);
|
||||
|
||||
/*if(data.fi_id_valid==true){
|
||||
gnc_import_set_trans_online_id(transaction, data.fi_id);
|
||||
}*/
|
||||
|
||||
/* Date / Time */
|
||||
xaccTransSetDateSecs(transaction,
|
||||
HBCI_Date_to_time_t (HBCI_Transaction_date (trans)));
|
||||
/*xaccTransSetDatePostedSecs(transaction,
|
||||
HBCI_Date_to_time_t
|
||||
(HBCI_Transaction_valutaDate (trans)));*/
|
||||
current_time = time(NULL);
|
||||
xaccTransSetDateEnteredSecs(transaction, mktime(localtime(¤t_time)));
|
||||
|
||||
/* Description */
|
||||
/*xaccTransSetNum(transaction, data.check_number);*/
|
||||
xaccTransSetDescription(transaction,
|
||||
HBCI_Transaction_transactionText (trans));
|
||||
|
||||
/* Amount */
|
||||
xaccTransSetCurrency(transaction, xaccAccountGetCommodity(gnc_acc));
|
||||
|
||||
split=xaccMallocSplit(book);
|
||||
xaccTransAppendSplit(transaction, split);
|
||||
xaccAccountInsertSplit(gnc_acc, split);
|
||||
|
||||
gnc_amount = double_to_gnc_numeric
|
||||
(HBCI_Value_getValue (HBCI_Transaction_value (trans)),
|
||||
xaccAccountGetCommoditySCU(gnc_acc),
|
||||
GNC_RND_ROUND);
|
||||
xaccSplitSetBaseValue(split, gnc_amount, xaccAccountGetCommodity(gnc_acc));
|
||||
|
||||
/* Also put the ofx transaction name in the splits memo field, or
|
||||
* ofx memo if name is unavailable */
|
||||
xaccSplitSetMemo(split, HBCI_Transaction_transactionText (trans));
|
||||
/* xaccTransCommitEdit(transaction); */
|
||||
|
||||
gnc_import_add_trans(transaction);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
|
@ -26,12 +26,6 @@
|
||||
#include <gnome.h>
|
||||
#include "Account.h"
|
||||
|
||||
void
|
||||
gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc);
|
||||
|
||||
void
|
||||
gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc);
|
||||
|
||||
void
|
||||
gnc_hbci_maketrans (GtkWidget *parent, Account *gnc_acc);
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "window-register.h"
|
||||
|
||||
#include "gnc-hbci-actions.h"
|
||||
#include "gnc-hbci-getbalance.h"
|
||||
#include "gnc-hbci-gettrans.h"
|
||||
|
||||
void
|
||||
gnc_hbci_acct_tree_menu_getbalance_cb (GtkWidget * widget,
|
||||
@ -81,8 +83,9 @@ gnc_hbci_register_menu_getbalance_cb (GtkWidget * widget,
|
||||
ledger = gnc_RegWindow_ledger (regData);
|
||||
g_assert (ledger);
|
||||
account = gnc_ledger_display_leader (ledger);
|
||||
g_assert (account);
|
||||
|
||||
if (!account)
|
||||
return;
|
||||
|
||||
gnc_hbci_getbalance (gnc_RegWindow_window (regData), account);
|
||||
}
|
||||
|
||||
@ -98,8 +101,9 @@ gnc_hbci_register_menu_gettrans_cb (GtkWidget * widget,
|
||||
ledger = gnc_RegWindow_ledger (regData);
|
||||
g_assert (ledger);
|
||||
account = gnc_ledger_display_leader (ledger);
|
||||
g_assert (account);
|
||||
|
||||
if (!account)
|
||||
return;
|
||||
|
||||
gnc_hbci_gettrans (gnc_RegWindow_window (regData), account);
|
||||
}
|
||||
|
||||
@ -115,7 +119,8 @@ gnc_hbci_register_menu_maketrans_cb (GtkWidget * widget,
|
||||
ledger = gnc_RegWindow_ledger (regData);
|
||||
g_assert (ledger);
|
||||
account = gnc_ledger_display_leader (ledger);
|
||||
g_assert (account);
|
||||
if (!account)
|
||||
return;
|
||||
|
||||
gnc_hbci_maketrans (gnc_RegWindow_window (regData), account);
|
||||
}
|
||||
|
180
src/import-export/hbci/gnc-hbci-getbalance.c
Normal file
180
src/import-export/hbci/gnc-hbci-getbalance.c
Normal file
@ -0,0 +1,180 @@
|
||||
/********************************************************************\
|
||||
* gnc-hbci-getbalance.c -- hbci getbalance functions *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* 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 *
|
||||
\********************************************************************/
|
||||
|
||||
#include "gnc-hbci-getbalance.h"
|
||||
|
||||
#include <openhbci/api.h>
|
||||
#include <openhbci/outboxaccjobs.h>
|
||||
|
||||
#include "gnc-ui.h"
|
||||
#include "gnc-numeric.h"
|
||||
#include "date.h"
|
||||
#include "RecnWindow.h"
|
||||
|
||||
#include "hbci-interaction.h"
|
||||
#include "gnc-hbci-utils.h"
|
||||
#include "dialog-hbcitrans.h"
|
||||
|
||||
void
|
||||
gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc)
|
||||
{
|
||||
HBCI_API *api = NULL;
|
||||
const HBCI_Account *h_acc = NULL;
|
||||
GNCInteractor *interactor = NULL;
|
||||
const HBCI_Customer *customer = NULL;
|
||||
|
||||
g_assert(parent);
|
||||
if (gnc_acc == NULL)
|
||||
return;
|
||||
|
||||
api = gnc_hbci_api_new_currentbook (parent, &interactor);
|
||||
g_assert (interactor);
|
||||
if (api == NULL) {
|
||||
printf("gnc_hbci_getbalance: Couldn't get HBCI API.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
h_acc = gnc_hbci_get_hbci_acc (api, gnc_acc);
|
||||
if (h_acc == NULL) {
|
||||
printf("gnc_hbci_getbalance: No HBCI account found.\n");
|
||||
return;
|
||||
}
|
||||
/* printf("gnc_hbci_getbalance: HBCI account no. %s found.\n",
|
||||
HBCI_Account_accountId (h_acc)); */
|
||||
|
||||
{
|
||||
/* Get one customer. */
|
||||
const list_HBCI_Customer *custlist;
|
||||
list_HBCI_Customer_iter *iter;
|
||||
|
||||
custlist = HBCI_Account_authorizedCustomers (h_acc);
|
||||
g_assert (custlist);
|
||||
switch (list_HBCI_Customer_size (custlist)) {
|
||||
case 0:
|
||||
printf("gnc_hbci_getbalance: No HBCI customer found.\n");
|
||||
return;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
gnc_warning_dialog_parented(gnc_ui_get_toplevel (),
|
||||
"Sorry, Choosing one out of several HBCI Customers not yet implemented.");
|
||||
return;
|
||||
}
|
||||
iter = list_HBCI_Customer_begin (custlist);
|
||||
customer = list_HBCI_Customer_iter_get (iter);
|
||||
list_HBCI_Customer_iter_delete (iter);
|
||||
}
|
||||
g_assert (customer);
|
||||
/* printf("gnc_hbci_getbalance: Customer id %s found.\n",
|
||||
HBCI_Customer_custId ((HBCI_Customer *)customer)); */
|
||||
|
||||
{
|
||||
/* Execute a GetBalance job. */
|
||||
HBCI_OutboxJobGetBalance *balance_job;
|
||||
HBCI_OutboxJob *job;
|
||||
HBCI_Error *err;
|
||||
|
||||
balance_job =
|
||||
HBCI_OutboxJobGetBalance_new (customer, (HBCI_Account *)h_acc);
|
||||
job = HBCI_OutboxJobGetBalance_OutboxJob (balance_job);
|
||||
g_assert (job);
|
||||
HBCI_API_addJob (api, job);
|
||||
|
||||
if (interactor)
|
||||
GNCInteractor_show (interactor);
|
||||
|
||||
HBCI_Hbci_setDebugLevel(0);
|
||||
err = HBCI_API_executeQueue (api, TRUE);
|
||||
g_assert (err);
|
||||
if (!HBCI_Error_isOk(err)) {
|
||||
char *errstr = g_strdup_printf("gnc_hbci_getbalance: Error at executeQueue: %s",
|
||||
HBCI_Error_message (err));
|
||||
printf("%s; status %d, result %d\n", errstr, HBCI_OutboxJob_status(job),
|
||||
HBCI_OutboxJob_result(job));
|
||||
HBCI_Interactor_msgStateResponse (HBCI_Hbci_interactor
|
||||
(HBCI_API_Hbci (api)), errstr);
|
||||
g_free (errstr);
|
||||
HBCI_Error_delete (err);
|
||||
gnc_hbci_debug_outboxjob (job);
|
||||
return;
|
||||
}
|
||||
/*HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE);*/
|
||||
HBCI_Error_delete (err);
|
||||
|
||||
{
|
||||
const HBCI_AccountBalance *acc_bal;
|
||||
const HBCI_Balance *bal1, *bal2;
|
||||
const HBCI_Value *val;
|
||||
time_t tt1, tt2;
|
||||
int choose1;
|
||||
Timespec ts1, ts2;
|
||||
gboolean dialogres;
|
||||
|
||||
acc_bal = HBCI_OutboxJobGetBalance_getBalance (balance_job);
|
||||
bal1 = HBCI_AccountBalance_notedBalance (acc_bal);
|
||||
bal2 = HBCI_AccountBalance_bookedBalance (acc_bal);
|
||||
|
||||
tt1 = HBCI_DateTime_to_time_t (HBCI_Balance_date (bal1),
|
||||
HBCI_Balance_time (bal1));
|
||||
tt2 = HBCI_DateTime_to_time_t (HBCI_Balance_date (bal2),
|
||||
HBCI_Balance_time (bal2));
|
||||
|
||||
val = HBCI_Balance_value (bal1);
|
||||
printf("Noted balance: %s for account no. %s at date %s",
|
||||
HBCI_Value_toReadableString (val), // this ought to be free'd
|
||||
HBCI_Account_accountId (h_acc),
|
||||
ctime(&tt1));
|
||||
|
||||
val = HBCI_Balance_value (bal2);
|
||||
printf("Booked balance: %s for account no. %s at date %s",
|
||||
HBCI_Value_toReadableString (val),
|
||||
HBCI_Account_accountId (h_acc),
|
||||
ctime(&tt2));
|
||||
|
||||
timespecFromTime_t (&ts1, tt1);
|
||||
timespecFromTime_t (&ts2, tt2);
|
||||
|
||||
choose1 = (timespec_cmp (&ts1, &ts2) == 1);
|
||||
|
||||
val = HBCI_Balance_value (choose1 ? bal1 : bal2);
|
||||
|
||||
dialogres = gnc_verify_dialog_parented
|
||||
(parent,
|
||||
TRUE,
|
||||
"Result of HBCI job: \nAccount %s balance is %g\nReconcile account now?",
|
||||
(choose1 ? "noted" : "booked"),
|
||||
HBCI_Value_getValue (val));
|
||||
|
||||
if (dialogres)
|
||||
recnWindowWithBalance (parent,
|
||||
gnc_acc,
|
||||
double_to_gnc_numeric
|
||||
(HBCI_Value_getValue (val),
|
||||
xaccAccountGetCommoditySCU(gnc_acc),
|
||||
GNC_RND_ROUND),
|
||||
(choose1 ? tt1 : tt2));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
src/import-export/hbci/gnc-hbci-getbalance.h
Normal file
34
src/import-export/hbci/gnc-hbci-getbalance.h
Normal file
@ -0,0 +1,34 @@
|
||||
/********************************************************************\
|
||||
* gnc-hbci-getbalance.h -- hbci getbalance function *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* 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 *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef GNC_HBCI_GETBALANCE_H
|
||||
#define GNC_HBCI_GETBALANCE_H
|
||||
|
||||
#include <gnome.h>
|
||||
#include "Account.h"
|
||||
|
||||
void
|
||||
gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc);
|
||||
|
||||
|
||||
|
||||
#endif /* GNC_HBCI_GETBALANCE_H */
|
249
src/import-export/hbci/gnc-hbci-gettrans.c
Normal file
249
src/import-export/hbci/gnc-hbci-gettrans.c
Normal file
@ -0,0 +1,249 @@
|
||||
/********************************************************************\
|
||||
* gnc-hbci-gettrans.c -- hbci get transactions functions *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* 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 *
|
||||
\********************************************************************/
|
||||
|
||||
#include "gnc-hbci-gettrans.h"
|
||||
|
||||
#include <openhbci/api.h>
|
||||
#include <openhbci/outboxaccjobs.h>
|
||||
|
||||
#include "gnc-ui.h"
|
||||
#include "gnc-numeric.h"
|
||||
#include "date.h"
|
||||
#include "Transaction.h"
|
||||
#include "gnc-generic-import.h"
|
||||
|
||||
#include "hbci-interaction.h"
|
||||
#include "gnc-hbci-utils.h"
|
||||
#include "dialog-hbcitrans.h"
|
||||
|
||||
|
||||
static void *trans_list_cb (const HBCI_Transaction *trans, void *user_data);
|
||||
struct trans_list_data
|
||||
{
|
||||
Account *gnc_acc;
|
||||
};
|
||||
|
||||
void
|
||||
gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc)
|
||||
{
|
||||
HBCI_API *api = NULL;
|
||||
const HBCI_Account *h_acc = NULL;
|
||||
GNCInteractor *interactor = NULL;
|
||||
const HBCI_Customer *customer = NULL;
|
||||
|
||||
g_assert(parent);
|
||||
g_assert(gnc_acc);
|
||||
|
||||
api = gnc_hbci_api_new_currentbook (parent, &interactor);
|
||||
g_assert (interactor);
|
||||
if (api == NULL) {
|
||||
printf("gnc_hbci_gettrans: Couldn't get HBCI API.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
h_acc = gnc_hbci_get_hbci_acc (api, gnc_acc);
|
||||
if (h_acc == NULL) {
|
||||
printf("gnc_hbci_gettrans: No HBCI account found.\n");
|
||||
return;
|
||||
}
|
||||
/* printf("gnc_hbci_gettrans: HBCI account no. %s found.\n",
|
||||
HBCI_Account_accountId (h_acc)); */
|
||||
|
||||
{
|
||||
/* Get one customer. */
|
||||
const list_HBCI_Customer *custlist;
|
||||
list_HBCI_Customer_iter *iter;
|
||||
|
||||
custlist = HBCI_Account_authorizedCustomers (h_acc);
|
||||
g_assert (custlist);
|
||||
switch (list_HBCI_Customer_size (custlist)) {
|
||||
case 0:
|
||||
printf("gnc_hbci_gettrans: No HBCI customer found.\n");
|
||||
return;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
gnc_warning_dialog_parented(gnc_ui_get_toplevel (),
|
||||
"Sorry, Choosing one out of several HBCI Customers not yet implemented.");
|
||||
return;
|
||||
}
|
||||
iter = list_HBCI_Customer_begin (custlist);
|
||||
customer = list_HBCI_Customer_iter_get (iter);
|
||||
list_HBCI_Customer_iter_delete (iter);
|
||||
}
|
||||
g_assert (customer);
|
||||
/* printf("gnc_hbci_gettrans: Customer id %s found.\n",
|
||||
HBCI_Customer_custId ((HBCI_Customer *)customer)); */
|
||||
|
||||
{
|
||||
/* Execute a GetTransactions job. */
|
||||
HBCI_OutboxJobGetTransactions *trans_job;
|
||||
HBCI_OutboxJob *job;
|
||||
HBCI_Error *err;
|
||||
HBCI_Date *blank_date = HBCI_Date_new_blank();
|
||||
|
||||
trans_job =
|
||||
HBCI_OutboxJobGetTransactions_new (customer,
|
||||
(HBCI_Account *)h_acc,
|
||||
blank_date,
|
||||
blank_date);
|
||||
job = HBCI_OutboxJobGetTransactions_OutboxJob (trans_job);
|
||||
g_assert (job);
|
||||
HBCI_API_addJob (api, job);
|
||||
|
||||
if (interactor)
|
||||
GNCInteractor_show (interactor);
|
||||
|
||||
HBCI_Hbci_setDebugLevel(0);
|
||||
err = HBCI_API_executeQueue (api, TRUE);
|
||||
g_assert (err);
|
||||
if (!HBCI_Error_isOk(err)) {
|
||||
char *errstr = g_strdup_printf("gnc_hbci_gettrans: Error at executeQueue: %s",
|
||||
HBCI_Error_message (err));
|
||||
printf("%s; status %d, result %d\n", errstr, HBCI_OutboxJob_status(job),
|
||||
HBCI_OutboxJob_result(job));
|
||||
HBCI_Interactor_msgStateResponse (HBCI_Hbci_interactor
|
||||
(HBCI_API_Hbci (api)), errstr);
|
||||
g_free (errstr);
|
||||
HBCI_Error_delete (err);
|
||||
gnc_hbci_debug_outboxjob (job);
|
||||
return;
|
||||
}
|
||||
/*HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE);*/
|
||||
HBCI_Error_delete (err);
|
||||
HBCI_Date_delete (blank_date);
|
||||
|
||||
{
|
||||
const list_HBCI_Transaction *trans_list;
|
||||
struct trans_list_data data;
|
||||
|
||||
data.gnc_acc = gnc_acc;
|
||||
|
||||
trans_list = HBCI_OutboxJobGetTransactions_transactions (trans_job);
|
||||
list_HBCI_Transaction_foreach (trans_list, trans_list_cb, &data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* list_HBCI_Transaction_foreach callback */
|
||||
static void *trans_list_cb (const HBCI_Transaction *h_trans,
|
||||
void *user_data)
|
||||
{
|
||||
time_t current_time, tt1, tt2;
|
||||
/*struct tm tm1, tm2;*/
|
||||
Account *gnc_acc;
|
||||
GNCBook *book;
|
||||
Transaction *gnc_trans;
|
||||
Split *split;
|
||||
struct trans_list_data *data = user_data;
|
||||
g_assert(data);
|
||||
g_assert(h_trans);
|
||||
|
||||
gnc_acc = data->gnc_acc;
|
||||
g_assert(gnc_acc);
|
||||
|
||||
book = xaccAccountGetBook(gnc_acc);
|
||||
gnc_trans = xaccMallocTransaction(book);
|
||||
xaccTransBeginEdit(gnc_trans);
|
||||
|
||||
/*if(data.fi_id_valid==true){
|
||||
gnc_import_set_trans_online_id(gnc_trans, data.fi_id);
|
||||
}*/
|
||||
|
||||
tt1 = HBCI_Date_to_time_t (HBCI_Transaction_date(h_trans));
|
||||
tt2 = HBCI_Date_to_time_t (HBCI_Transaction_valutaDate(h_trans));
|
||||
printf("Date? %s ValutaDate? %s", ctime(&tt1), ctime(&tt2));
|
||||
/*tm1 = HBCI_Date_to_tm (HBCI_Transaction_date(h_trans));
|
||||
tm2 = HBCI_Date_to_tm (HBCI_Transaction_valutaDate(h_trans));
|
||||
printf("Date asc %s ValutaDate asc %s", asctime(&tm1), asctime(&tm2));*/
|
||||
|
||||
|
||||
/* Date / Time */
|
||||
xaccTransSetDateSecs
|
||||
(gnc_trans, HBCI_Date_to_time_t (HBCI_Transaction_valutaDate (h_trans)));
|
||||
|
||||
current_time = time(NULL);
|
||||
xaccTransSetDateEnteredSecs(gnc_trans, mktime(localtime(¤t_time)));
|
||||
|
||||
{
|
||||
/* Number. We use the "customer reference", if there is one. */
|
||||
const char *custref = HBCI_Transaction_customerReference (h_trans);
|
||||
if (custref && (strlen (custref) > 0) &&
|
||||
(g_strncasecmp (custref, "NONREF", 6) != 0))
|
||||
xaccTransSetNum (gnc_trans, custref);
|
||||
}
|
||||
|
||||
{
|
||||
/* Description */
|
||||
char *descr = list_string_concat (HBCI_Transaction_description (h_trans));
|
||||
xaccTransSetDescription (gnc_trans, descr);
|
||||
free (descr);
|
||||
}
|
||||
|
||||
/* Notes. TransactionText contains strings like "STANDING ORDER",
|
||||
"UEBERWEISUNGSGUTSCHRIFT", etc. */
|
||||
xaccTransSetNotes (gnc_trans, HBCI_Transaction_transactionText (h_trans));
|
||||
|
||||
/* Currency; we take simply the default currency of the gnucash account */
|
||||
xaccTransSetCurrency(gnc_trans, xaccAccountGetCommodity(gnc_acc));
|
||||
|
||||
/* Add one split */
|
||||
split=xaccMallocSplit(book);
|
||||
xaccTransAppendSplit(gnc_trans, split);
|
||||
xaccAccountInsertSplit(gnc_acc, split);
|
||||
|
||||
{
|
||||
/* Amount into the split */
|
||||
gnc_numeric gnc_amount = double_to_gnc_numeric
|
||||
(HBCI_Value_getValue (HBCI_Transaction_value (h_trans)),
|
||||
xaccAccountGetCommoditySCU(gnc_acc),
|
||||
GNC_RND_ROUND);
|
||||
xaccSplitSetBaseValue(split, gnc_amount, xaccAccountGetCommodity(gnc_acc));
|
||||
}
|
||||
|
||||
{
|
||||
/* Memo in the split. We write the recipient (i.e. "other party") in
|
||||
here since the other party might be another gnucash account, and
|
||||
in that account split's memo the respective "this party" will be
|
||||
noted. */
|
||||
char *othername =
|
||||
list_string_concat_delim (HBCI_Transaction_otherName (h_trans), ", ");
|
||||
char *memo =
|
||||
g_strdup_printf ("HBCI Transaction to: %s, Account %s, Bank %s",
|
||||
othername,
|
||||
HBCI_Transaction_otherAccountId (h_trans),
|
||||
HBCI_Transaction_otherBankCode (h_trans));
|
||||
xaccSplitSetMemo(split, memo);
|
||||
free (othername);
|
||||
g_free (memo);
|
||||
}
|
||||
|
||||
/* Instead of xaccTransCommitEdit(gnc_trans) */
|
||||
gnc_import_add_trans(gnc_trans);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
32
src/import-export/hbci/gnc-hbci-gettrans.h
Normal file
32
src/import-export/hbci/gnc-hbci-gettrans.h
Normal file
@ -0,0 +1,32 @@
|
||||
/********************************************************************\
|
||||
* gnc-hbci-gettrans.h -- hbci get transactions function *
|
||||
* Copyright (C) 2002 Christian Stimming *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* 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 *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef GNC_HBCI_GETTRANS_H
|
||||
#define GNC_HBCI_GETTRANS_H
|
||||
|
||||
#include <gnome.h>
|
||||
#include "Account.h"
|
||||
|
||||
void
|
||||
gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc);
|
||||
|
||||
#endif /* GNC_HBCI_GETTRANS_H */
|
@ -340,9 +340,9 @@ gnc_hbci_new_pmonitor(GNCInteractor *data)
|
||||
GtkWidget *dialog;
|
||||
GladeXML *xml;
|
||||
|
||||
xml = gnc_glade_xml_new ("hbci.glade", "HBCI_connection_window");
|
||||
xml = gnc_glade_xml_new ("hbci.glade", "HBCI_connection_dialog");
|
||||
|
||||
g_assert (dialog = glade_xml_get_widget (xml, "HBCI_connection_window"));
|
||||
g_assert (dialog = glade_xml_get_widget (xml, "HBCI_connection_dialog"));
|
||||
data->dialog = dialog;
|
||||
g_assert (data->job_entry = glade_xml_get_widget (xml, "job_entry"));
|
||||
g_assert (data->action_entry = glade_xml_get_widget (xml, "action_entry"));
|
||||
@ -358,8 +358,10 @@ gnc_hbci_new_pmonitor(GNCInteractor *data)
|
||||
gtk_signal_connect (GTK_OBJECT (data->close_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (on_button_clicked), data);
|
||||
|
||||
//if (data->parent)
|
||||
if (data->parent)
|
||||
gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (data->parent));
|
||||
//gtk_widget_set_parent (GTK_WIDGET (dialog), data->parent);
|
||||
|
||||
gtk_widget_hide_all (dialog);
|
||||
|
||||
pmon = HBCI_ProgressMonitorCB_new(&destr,
|
||||
|
Loading…
Reference in New Issue
Block a user