[Gnucash-changes] More HBCI/aqbanking work.
Christian Stimming
cstim at cvs.gnucash.org
Wed Sep 8 16:50:37 EDT 2004
Log Message:
-----------
More HBCI/aqbanking work.
Modified Files:
--------------
gnucash/src/import-export/hbci:
druid-hbci-utils.c
gnc-hbci-kvp.c
gnc-hbci-kvp.h
gnc-hbci-utils.c
Revision Data
-------------
Index: druid-hbci-utils.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/druid-hbci-utils.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -Lsrc/import-export/hbci/druid-hbci-utils.c -Lsrc/import-export/hbci/druid-hbci-utils.c -u -r1.15 -r1.16
--- src/import-export/hbci/druid-hbci-utils.c
+++ src/import-export/hbci/druid-hbci-utils.c
@@ -63,12 +63,30 @@
AB_Account_GetUniqueId(hbci_acc))
gnc_hbci_set_account_uid
(gnc_acc, AB_Account_GetUniqueId(hbci_acc));
+
+ if (AB_Account_GetAccountNumber(hbci_acc) &&
+ ((gnc_hbci_get_account_accountid(gnc_acc) == NULL) ||
+ (strcmp(gnc_hbci_get_account_accountid(gnc_acc),
+ AB_Account_GetAccountNumber(hbci_acc)) != 0)))
+ gnc_hbci_set_account_accountid
+ (gnc_acc, AB_Account_GetAccountNumber(hbci_acc));
+
+ if (AB_Account_GetBankCode(hbci_acc) &&
+ ((gnc_hbci_get_account_bankcode(gnc_acc) == NULL) ||
+ (strcmp(gnc_hbci_get_account_bankcode(gnc_acc),
+ AB_Account_GetBankCode(hbci_acc)) != 0)))
+ gnc_hbci_set_account_bankcode
+ (gnc_acc, AB_Account_GetBankCode(hbci_acc));
}
static gpointer accounts_clear_kvp (Account *gnc_acc, gpointer user_data)
{
if (gnc_hbci_get_account_uid(gnc_acc))
gnc_hbci_set_account_uid (gnc_acc, 0);
+ if (gnc_hbci_get_account_accountid(gnc_acc))
+ gnc_hbci_set_account_accountid (gnc_acc, "");
+ if (gnc_hbci_get_account_bankcode(gnc_acc))
+ gnc_hbci_set_account_bankcode (gnc_acc, "");
return NULL;
}
Index: gnc-hbci-utils.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-utils.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -Lsrc/import-export/hbci/gnc-hbci-utils.c -Lsrc/import-export/hbci/gnc-hbci-utils.c -u -r1.41 -r1.42
--- src/import-export/hbci/gnc-hbci-utils.c
+++ src/import-export/hbci/gnc-hbci-utils.c
@@ -179,15 +179,28 @@
{
int account_uid = 0;
AB_ACCOUNT *hbci_acc = NULL;
+ const char *bankcode = NULL, *accountid = NULL;
+ bankcode = gnc_hbci_get_account_bankcode (gnc_acc);
+ accountid = gnc_hbci_get_account_accountid (gnc_acc);
account_uid = gnc_hbci_get_account_uid (gnc_acc);
if (account_uid > 0) {
/*printf("gnc_hbci_get_hbci_acc: gnc_acc %s has blz %s and ccode %d\n",
xaccAccountGetName (gnc_acc), bankcode, countrycode);*/
hbci_acc = AB_Banking_GetAccount(api, account_uid);
+
+ if (!hbci_acc && bankcode && (strlen(bankcode)>0) &&
+ accountid && (strlen(accountid) > 0)) {
+ printf("gnc_hbci_get_hbci_acc: No AB_ACCOUNT found for UID %d, trying bank code\n", account_uid);
+ hbci_acc = AB_Banking_GetAccountByCodeAndNumber(api, bankcode, accountid);
+ }
/*printf("gnc_hbci_get_hbci_acc: return HBCI_Account %p\n", hbci_acc);*/
return hbci_acc;
+ } else if (bankcode && (strlen(bankcode)>0) && accountid && (strlen(accountid) > 0)) {
+ hbci_acc = AB_Banking_GetAccountByCodeAndNumber(api, bankcode, accountid);
+ return hbci_acc;
}
+
return NULL;
}
Index: gnc-hbci-kvp.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-kvp.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lsrc/import-export/hbci/gnc-hbci-kvp.c -Lsrc/import-export/hbci/gnc-hbci-kvp.c -u -r1.10 -r1.11
--- src/import-export/hbci/gnc-hbci-kvp.c
+++ src/import-export/hbci/gnc-hbci-kvp.c
@@ -32,7 +32,6 @@
#define HBCI_ACCOUNTS "hbci-accounts"
/* Account */
-#if 0
char *gnc_hbci_get_account_accountid (Account *a)
{
kvp_frame *frame = gnc_hbci_get_account_kvp (a);
@@ -75,7 +74,6 @@
kvp_frame_set_slot_nc (frame, HBCI_COUNTRY_CODE, value);
xaccAccountCommitEdit (a);
}
-#endif
gint gnc_hbci_get_account_uid (Account *a)
{
kvp_frame *frame = gnc_hbci_get_account_kvp (a);
Index: gnc-hbci-kvp.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-kvp.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lsrc/import-export/hbci/gnc-hbci-kvp.h -Lsrc/import-export/hbci/gnc-hbci-kvp.h -u -r1.9 -r1.10
--- src/import-export/hbci/gnc-hbci-kvp.h
+++ src/import-export/hbci/gnc-hbci-kvp.h
@@ -30,29 +30,27 @@
/* Account */
-#if 0
-/** DEPRECATED. Returns a non-copied pointer to the accountid string in the
+/** Returns a non-copied pointer to the accountid string in the
* Account a. The char* is still owned by the kvp_frame, so don't free
* it until you want to delete the whole kvp_frame. */
char *gnc_hbci_get_account_accountid (Account *a);
-/** DEPRECATED. Set the accountid string in the Account a. A copy of the string
+/** Set the accountid string in the Account a. A copy of the string
* will be stored. The Account will be marked as "dirty". */
void gnc_hbci_set_account_accountid (Account *a, const char *id);
-/** DEPRECATED. Returns a non-copied pointer to the bankcode string in the
+/** Returns a non-copied pointer to the bankcode string in the
* Account a. The char* is still owned by the kvp_frame, so don't free
* it until you want to delete the whole kvp_frame. */
char *gnc_hbci_get_account_bankcode (Account *a);
-/** DEPRECATED. Set the bankcode string in the Account a. A copy of the string
+/** Set the bankcode string in the Account a. A copy of the string
* will be stored. The Account will be marked as "dirty". */
void gnc_hbci_set_account_bankcode (Account *a, const char *code);
-/** DEPRECATED. Returns the countrycode integer value from the Account a. */
+/** Returns the countrycode integer value from the Account a. */
gint gnc_hbci_get_account_countrycode (Account *a);
-/** DEPRECATED. Set the countrycode integer value in the Account a. The Account
+/** Set the countrycode integer value in the Account a. The Account
* will be marked as "dirty". */
void gnc_hbci_set_account_countrycode (Account *a, gint code);
-#endif
/** Returns the unique id for the AB_BANKING account in the Account
* a. */
More information about the gnucash-changes
mailing list