mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
More work on openhbci2 support.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9810 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
bbe599b144
commit
480c61d88a
@ -172,6 +172,9 @@ reset_initial_info (HBCIInitialInfo *info)
|
||||
if (info->gnc_hash != NULL)
|
||||
g_hash_table_destroy (info->gnc_hash);
|
||||
info->gnc_hash = NULL;
|
||||
|
||||
list_HBCI_Account_delete(info->hbci_accountlist);
|
||||
info->hbci_accountlist = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -613,21 +616,30 @@ on_finish (GnomeDruidPage *gnomedruidpage,
|
||||
|
||||
|
||||
if (info->configfile) {
|
||||
printf("on_finish: Got configfile %s, but the book has %s.\n", info->configfile, gnc_hbci_get_book_configfile (gnc_get_current_book ()));
|
||||
if (!gnc_hbci_get_book_configfile (gnc_get_current_book ()) ||
|
||||
(strcmp(info->configfile,
|
||||
gnc_hbci_get_book_configfile (gnc_get_current_book ())) != 0))
|
||||
gnc_hbci_get_book_configfile (gnc_get_current_book ())) != 0)) {
|
||||
/* Name of configfile has changed */
|
||||
gnc_hbci_set_book_configfile (gnc_get_current_book (), info->configfile);
|
||||
if (strcmp(info->configfile,
|
||||
gnc_hbci_get_book_configfile (gnc_get_current_book ())) != 0)
|
||||
printf("on_finish: OOOPS: I just setted the book_configfile to %s, but the book now still has %s.\n", info->configfile, gnc_hbci_get_book_configfile (gnc_get_current_book ()));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
HBCI_Error *err;
|
||||
printf("on_finish: trying to save openhbci data to file %s.\n", info->configfile);
|
||||
|
||||
err = gnc_hbci_api_save (info->api);
|
||||
if (err != NULL) {
|
||||
if (!HBCI_Error_isOk (err))
|
||||
printf("on_finish: Error at saving OpenHBCI data: %s.\n",
|
||||
HBCI_Error_message (err));
|
||||
HBCI_Error_delete (err);
|
||||
delete_initial_druid(info);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1056,7 +1068,7 @@ on_accountinfo_next (GnomeDruidPage *gnomedruidpage,
|
||||
{
|
||||
HBCIInitialInfo *info = user_data;
|
||||
g_assert(info);
|
||||
|
||||
|
||||
/* of course we need to know for which customer we do this */
|
||||
if (info->newcustomer == NULL)
|
||||
info->newcustomer = choose_customer (info);
|
||||
@ -1065,39 +1077,47 @@ on_accountinfo_next (GnomeDruidPage *gnomedruidpage,
|
||||
return FALSE;
|
||||
|
||||
{
|
||||
/* Execute a Synchronize job, then a GetAccounts job. */
|
||||
HBCI_OutboxJob *job;
|
||||
|
||||
/* Execute a Synchronize job, then a GetAccounts job. */
|
||||
/*job = HBCI_OutboxJob_new("JobSync",
|
||||
(HBCI_Customer *)info->newcustomer, "");
|
||||
HBCI_Outbox_addJob (info->outbox, job);*/
|
||||
|
||||
job = HBCI_OutboxJob_new("JobSync",
|
||||
(HBCI_Customer *)info->newcustomer, "");
|
||||
HBCI_Outbox_addJob (info->outbox, job);
|
||||
|
||||
/* Execute Outbox. */
|
||||
if (!gnc_hbci_api_execute (info->window, info->api, info->outbox,
|
||||
job, info->interactor)) {
|
||||
/* HBCI_API_executeOutbox failed. */
|
||||
/*return FALSE;*/
|
||||
/* -- it seems to be no problem if this fails ?! */
|
||||
}
|
||||
|
||||
/*if (!gnc_hbci_api_execute (info->window, info->api, info->outbox,
|
||||
job, info->interactor)) {*/
|
||||
/* HBCI_API_executeOutbox failed. */
|
||||
/*return FALSE;*/
|
||||
/* -- it seems to be no problem if this fails ?! */
|
||||
/*}*/
|
||||
|
||||
/* Now the GetAccounts job. */
|
||||
job = HBCI_OutboxJob_new("JobGetAccounts",
|
||||
(HBCI_Customer *)info->newcustomer, "");
|
||||
HBCI_Outbox_addJob (info->outbox, job);
|
||||
|
||||
/*{
|
||||
{
|
||||
HBCI_Job *jjob = HBCI_OutboxJob_Job(job);
|
||||
HBCI_Job_setIntProperty("open/ident/country", bank.ref().country());
|
||||
HBCI_Job_setProperty("open/ident/bankcode", bank.ref().bankCode());
|
||||
HBCI_Job_setProperty("open/ident/customerid", c.ref().custId());
|
||||
HBCI_Job_setIntProperty("open/prepare/updversion",0);
|
||||
}*/
|
||||
HBCI_Job_setIntProperty
|
||||
(jjob, "open/ident/country",
|
||||
HBCI_Bank_country(HBCI_User_bank
|
||||
(HBCI_Customer_user(info->newcustomer))));
|
||||
HBCI_Job_setProperty
|
||||
(jjob, "open/ident/bankcode",
|
||||
HBCI_Bank_bankCode(HBCI_User_bank
|
||||
(HBCI_Customer_user(info->newcustomer))));
|
||||
HBCI_Job_setProperty
|
||||
(jjob, "open/ident/customerid", HBCI_Customer_custId(info->newcustomer));
|
||||
HBCI_Job_setIntProperty(jjob, "open/prepare/updversion",0);
|
||||
}
|
||||
|
||||
|
||||
/* Execute Outbox. */
|
||||
if (!gnc_hbci_api_execute (info->window, info->api, info->outbox,
|
||||
job, info->interactor)) {
|
||||
/* HBCI_API_executeOutbox failed. */
|
||||
printf("on_accountinfo_next: oops, executeOutbox failed.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -278,9 +278,13 @@ gnc_processOutboxResponse(HBCI_API *api, HBCI_Outbox *outbox,
|
||||
/*g_assert(accountlist);*/
|
||||
|
||||
response = HBCI_Outbox_response(outbox);
|
||||
|
||||
/*printf("gnc_processOutboxResponse: Complete response:\n");
|
||||
GWEN_DB_Dump(response, stdout, 1);*/
|
||||
|
||||
n=GWEN_DB_GetFirstGroup(response);
|
||||
while (n){
|
||||
if (strcasecmp(GWEN_DB_GroupName(n), "accountdata")==0) {
|
||||
if (strcasecmp(GWEN_DB_GroupName(n), "AccountData")==0) {
|
||||
/* found account data, create account */
|
||||
const char *accountId;
|
||||
const char *accountSubId;
|
||||
@ -298,7 +302,7 @@ gnc_processOutboxResponse(HBCI_API *api, HBCI_Outbox *outbox,
|
||||
accountId=GWEN_DB_GetCharValue(n, "accountid", 0, "");
|
||||
accountSubId=GWEN_DB_GetCharValue(n, "accountsubid", 0, "");
|
||||
if (strlen(bankCode)==0 || strlen(accountId)==0 || strlen(custid)==0) {
|
||||
fprintf(stderr, "gnc_processOutboxResponse: AccountData without bank code/account id/customer id");
|
||||
printf("gnc_processOutboxResponse: AccountData without bank code/account id/customer id\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -345,7 +349,7 @@ gnc_processOutboxResponse(HBCI_API *api, HBCI_Outbox *outbox,
|
||||
const char *p;
|
||||
|
||||
/* Update account information */
|
||||
printf("Account %d/%s/%s already exists, updating",
|
||||
printf("Account %d/%s/%s already exists, updating.\n",
|
||||
country, bankCode, accountId);
|
||||
|
||||
p=GWEN_DB_GetCharValue(n, "name", 0, 0);
|
||||
@ -368,7 +372,7 @@ gnc_processOutboxResponse(HBCI_API *api, HBCI_Outbox *outbox,
|
||||
/* Add it to our internal list. */
|
||||
accountlist = g_list_append(accountlist, acc);
|
||||
|
||||
printf("Added account %d/%s/%s",
|
||||
printf("Added account %d/%s/%s\n",
|
||||
country, bankCode, accountId);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ void *list_HBCI_Account_foreach(GList *h_list,
|
||||
g_assert(func_cb);
|
||||
void *res = NULL;
|
||||
|
||||
if (h_list == NULL) return NULL;
|
||||
if (!h_list) return NULL;
|
||||
|
||||
iter = h_list;
|
||||
if (iter->data)
|
||||
@ -91,7 +91,7 @@ void *list_HBCI_Account_foreach(GList *h_list,
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
for (iter = h_list->next; iter != h_list; iter = iter->next)
|
||||
for (iter = h_list; iter; iter = iter->next)
|
||||
{
|
||||
if (iter->data)
|
||||
func_cb(iter->data, user_data);
|
||||
@ -112,7 +112,7 @@ static void* del_func(gnc_HBCI_Account *acc, void *user_data)
|
||||
void list_HBCI_Account_delete(GList *list_HBCI_Account)
|
||||
{
|
||||
list_HBCI_Account_foreach(list_HBCI_Account, del_func, NULL);
|
||||
g_free (list_HBCI_Account);
|
||||
g_list_free (list_HBCI_Account);
|
||||
}
|
||||
|
||||
|
||||
|
@ -211,7 +211,7 @@ HBCI_Error * gnc_hbci_api_save (const HBCI_API *api)
|
||||
if ((file == NULL) || (strlen (file) == 0))
|
||||
return HBCI_Error_new ("gnc_hbci_api_save", ERROR_LEVEL_NORMAL, 0,
|
||||
ERROR_ADVISE_ABORT,
|
||||
"No filename for config file.", "");
|
||||
"No filename for config file in gnc_book.", "");
|
||||
|
||||
return HBCI_API_saveEnvironment (api, file);
|
||||
}
|
||||
|
@ -632,10 +632,10 @@ static void closeConnection(TransportType t, void *user_data)
|
||||
if (debug_pmonitor)
|
||||
printf("actFinished-cb: current_job %d, jobs %d, current_act %d, actions %d.\n",
|
||||
data->current_job, data->jobs, data->current_act, data->actions);
|
||||
if (data->current_act > data->actions) {
|
||||
/*if (data->current_act > data->actions) {
|
||||
printf("actFinished-cb: oops, current_act==%d is > than actions==%d.\n",
|
||||
data->current_act, data->actions);
|
||||
}
|
||||
data->current_act, data->actions);
|
||||
}*/
|
||||
|
||||
GNCInteractor_setFinished (data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user