[Gnucash-changes] Back-ported HBCI fixes.
Christian Stimming
cstim at cvs.gnucash.org
Thu Sep 30 10:56:02 EDT 2004
Log Message:
-----------
Back-ported HBCI fixes.
Tags:
----
gnucash-1-8-branch
Modified Files:
--------------
gnucash/src/import-export/hbci:
gnc-hbci-getbalance.c
gnc-hbci-utils.c
hbci-interaction.c
Revision Data
-------------
Index: hbci-interaction.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/hbci-interaction.c,v
retrieving revision 1.16.2.14
retrieving revision 1.16.2.15
diff -Lsrc/import-export/hbci/hbci-interaction.c -Lsrc/import-export/hbci/hbci-interaction.c -u -r1.16.2.14 -r1.16.2.15
--- src/import-export/hbci/hbci-interaction.c
+++ src/import-export/hbci/hbci-interaction.c
@@ -359,7 +359,9 @@
else {
g_assert (maxLen > strlen(resultbuffer));
strcpy(resultbuffer, passwd);
- if (text && data->cache_pin) {
+ /* Watch out: If we only compare the user string, then don't
+ cache this if a TAN is asked for. */
+ if (text && data->cache_pin && !(strstr(text, "TAN"))) {
/*printf("Cached the PIN for user %s.\n", HBCI_User_userId (user));*/
data->cache_text= g_strdup(text);
if (data->pw)
Index: gnc-hbci-utils.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-utils.c,v
retrieving revision 1.23.2.10
retrieving revision 1.23.2.11
diff -Lsrc/import-export/hbci/gnc-hbci-utils.c -Lsrc/import-export/hbci/gnc-hbci-utils.c -u -r1.23.2.10 -r1.23.2.11
--- src/import-export/hbci/gnc-hbci-utils.c
+++ src/import-export/hbci/gnc-hbci-utils.c
@@ -819,6 +819,9 @@
char *gnc_AB_VALUE_toReadableString(const AB_VALUE *v)
{
char tmp[100];
- sprintf(tmp, "%.2f %s", AB_Value_GetValue(v), AB_Value_GetCurrency(v));
+ if (v)
+ sprintf(tmp, "%.2f %s", AB_Value_GetValue(v), AB_Value_GetCurrency(v));
+ else
+ sprintf(tmp, "%.2f", 0.0);
return g_strdup(tmp);
}
Index: gnc-hbci-getbalance.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-getbalance.c,v
retrieving revision 1.13.2.6
retrieving revision 1.13.2.7
diff -Lsrc/import-export/hbci/gnc-hbci-getbalance.c -Lsrc/import-export/hbci/gnc-hbci-getbalance.c -u -r1.13.2.6 -r1.13.2.7
--- src/import-export/hbci/gnc-hbci-getbalance.c
+++ src/import-export/hbci/gnc-hbci-getbalance.c
@@ -198,10 +198,9 @@
const AB_ACCOUNT_STATUS *response;
const AB_BALANCE *noted_grp, *booked_grp;
const AB_VALUE *booked_val, *noted_val;
-
time_t booked_tt;
-
gboolean dialogres;
+ double booked_value, noted_value;
response = AB_JobGetBalance_GetAccountStatus((AB_JOB*)job);
if (!response) {
@@ -212,18 +211,38 @@
noted_grp = AB_AccountStatus_GetNotedBalance(response);
booked_grp = AB_AccountStatus_GetBookedBalance(response);
- if (!booked_grp || !noted_grp) {
- printf("gnc_hbci_getbalance_finish: Oops, booked_grp or noted_grp == NULL.\n");
- return TRUE;
+ if (booked_grp) {
+ booked_val = AB_Balance_GetValue(booked_grp);
+ booked_tt = GWEN_Time_toTime_t (AB_Balance_GetTime(booked_grp));
+ if (booked_val)
+ booked_value = AB_Value_GetValue (booked_val);
+ else {
+ printf("gnc_hbci_getbalance_finish: Warning: booked_val == NULL. Assuming 0.\n");
+ booked_value = 0.0;
+ }
+ } else {
+ printf("gnc_hbci_getbalance_finish: Warning: booked_grp == NULL. Assuming 0.\n");
+ booked_value = 0.0;
+ booked_val = NULL;
+ booked_tt = 0;
}
- booked_val = AB_Balance_GetValue(booked_grp);
-
- noted_val = AB_Balance_GetValue(noted_grp);
-
- booked_tt = GWEN_Time_toTime_t (AB_Balance_GetTime(booked_grp));
-
- if ((AB_Value_GetValue (noted_val) == 0) &&
- (AB_Value_GetValue (booked_val) == 0))
+
+ if (noted_grp) {
+ noted_val = AB_Balance_GetValue(noted_grp);
+ /* noted_tt = GWEN_Time_toTime_t (AB_Balance_GetTime(noted_grp)); */
+ if (noted_val)
+ noted_value = AB_Value_GetValue (noted_val);
+ else {
+ printf("gnc_hbci_getbalance_finish: Warning: noted_val == NULL. Assuming 0.\n");
+ noted_value = 0.0;
+ }
+ } else {
+ printf("gnc_hbci_getbalance_finish: Warning: noted_grp == NULL. Assuming 0.\n");
+ noted_value = 0.0;
+ noted_val = NULL;
+ }
+
+ if ((noted_value == 0.0) && (booked_value == 0.0))
{
gnome_ok_dialog_parented
/* Translators: Strings from this file are really only
@@ -248,7 +267,7 @@
"Account booked balance is %s\n"),
booked_str);
char *message2 =
- ((AB_Value_GetValue (noted_val) == 0) ?
+ ((noted_value == 0.0) ?
g_strdup_printf("%s", "") :
bal_print_balance
(_("For your information: This account also \n"
@@ -271,7 +290,7 @@
if (dialogres)
{
gnc_numeric value =
- double_to_gnc_numeric (AB_Value_GetValue (booked_val),
+ double_to_gnc_numeric (booked_value,
xaccAccountGetCommoditySCU(gnc_acc),
GNC_RND_ROUND);
recnWindowWithBalance (parent,
More information about the gnucash-changes
mailing list