81 GncABTransType trans_type)
84 GNC_AB_ACCOUNT_SPEC *ab_acc;
85 GList *templates = NULL;
86 GncABTransDialog *td = NULL;
87 gboolean successful = FALSE;
88 gboolean aborted = FALSE;
90 g_return_if_fail(parent && gnc_acc);
96 g_warning(
"gnc_ab_maketrans: Couldn't get AqBanking API");
103 g_warning(
"gnc_ab_gettrans: No AqBanking account found");
104 gnc_error_dialog (GTK_WINDOW (parent), _(
"No valid online banking account assigned."));
108#if (AQBANKING_VERSION_INT >= 60400)
109 if (trans_type == SEPA_INTERNAL_TRANSFER)
112 templates = gnc_ab_trans_templ_list_new_from_ref_accounts (ab_acc);
113 if (templates == NULL)
115 g_warning (
"gnc_ab_gettrans: No reference accounts found");
116 gnc_error_dialog (GTK_WINDOW (parent), _(
"No reference accounts found."));
125 gnc_account_get_book(gnc_acc));
131 trans_type, templates);
137 GncGWENGui *gui = NULL;
139 const AB_TRANSACTION *ab_trans;
140 GNC_AB_JOB *job = NULL;
141 GNC_AB_JOB_LIST2 *job_list = NULL;
142 XferDialog *xfer_dialog = NULL;
146 Transaction *gnc_trans = NULL;
147 AB_IMEXPORTER_CONTEXT *context = NULL;
148 GNC_AB_JOB_STATUS job_status;
149 GncABImExContextImport *ieci = NULL;
155#if (AQBANKING_VERSION_INT >= 60400)
157 templates = gnc_ab_trans_dialog_get_templ(td, &changed);
158 if (trans_type != SEPA_INTERNAL_TRANSFER && changed)
161 save_templates(parent, gnc_acc, templates,
162 (result == GNC_RESPONSE_NOW));
164 g_list_free(templates);
168 if (result != GNC_RESPONSE_NOW && result != GNC_RESPONSE_LATER)
177 if (!job || AB_AccountSpec_GetTransactionLimitsForCommand(ab_acc, AB_Transaction_GetCommand(job))==NULL)
179 if (!gnc_verify_dialog (
180 GTK_WINDOW (parent), FALSE,
"%s",
181 _(
"The backend found an error during the preparation "
182 "of the job. It is not possible to execute this job.\n"
184 "Most probable the bank does not support your chosen "
185 "job or your Online Banking account does not have the permission "
186 "to execute this job. More error messages might be "
187 "visible on your console log.\n"
189 "Do you want to enter the job again?")))
193 job_list = AB_Transaction_List2_new();
194 AB_Transaction_List2_PushBack(job_list, job);
200 case SINGLE_DEBITNOTE:
201 gnc_xfer_dialog_set_title(
202 xfer_dialog, _(
"Online Banking Direct Debit Note"));
203 gnc_xfer_dialog_lock_to_account_tree(xfer_dialog);
205 case SINGLE_INTERNAL_TRANSFER:
206 gnc_xfer_dialog_set_title(
207 xfer_dialog, _(
"Online Banking Bank-Internal Transfer"));
208 gnc_xfer_dialog_lock_from_account_tree(xfer_dialog);
211 gnc_xfer_dialog_set_title(
212 xfer_dialog, _(
"Online Banking European (SEPA) Transfer"));
213 gnc_xfer_dialog_lock_from_account_tree(xfer_dialog);
215#if (AQBANKING_VERSION_INT >= 60400)
216 case SEPA_INTERNAL_TRANSFER:
217 gnc_xfer_dialog_set_title (
218 xfer_dialog, _(
"Online Banking European (SEPA) Internal Transfer"));
219 gnc_xfer_dialog_lock_from_account_tree (xfer_dialog);
223 gnc_xfer_dialog_set_title(
224 xfer_dialog, _(
"Online Banking European (SEPA) Debit Note"));
225 gnc_xfer_dialog_lock_to_account_tree(xfer_dialog);
227 case SINGLE_TRANSFER:
229 gnc_xfer_dialog_set_title(
230 xfer_dialog, _(
"Online Banking Transaction"));
231 gnc_xfer_dialog_lock_from_account_tree(xfer_dialog);
233 gnc_xfer_dialog_set_to_show_button_active(xfer_dialog, TRUE);
236 AB_Value_GetValueAsDouble(AB_Transaction_GetValue(ab_trans)),
239 gnc_xfer_dialog_set_amount(xfer_dialog, amount);
240 gnc_xfer_dialog_set_amount_sensitive(xfer_dialog, FALSE);
241 gnc_xfer_dialog_set_date_sensitive(xfer_dialog, FALSE);
245 gnc_xfer_dialog_set_description(xfer_dialog, description);
249 gnc_xfer_dialog_set_memo(xfer_dialog, memo);
252 gnc_xfer_dialog_set_txn_cb(xfer_dialog, txn_created_cb, &gnc_trans);
255 successful = gnc_xfer_dialog_run_until_done(xfer_dialog);
258 if (!successful || !gnc_trans)
264 if (result == GNC_RESPONSE_NOW)
267 context = AB_ImExporterContext_new();
272 g_warning(
"gnc_ab_maketrans: Couldn't initialize Gwenhywfar GUI");
278 AB_Banking_SendCommands(api, job_list, context);
284 job_status = AB_Transaction_GetStatus(job);
285 if (job_status != AB_Transaction_StatusAccepted
286 && job_status != AB_Transaction_StatusPending)
289 if (!gnc_verify_dialog (
290 GTK_WINDOW (parent), FALSE,
"%s",
291 _(
"An error occurred while executing the job. Please check "
292 "the log window for the exact error message.\n"
294 "Do you want to enter the job again?")))
314 if (gnc_trans && !successful)
324 AB_ImExporterContext_free(context);
327 AB_Transaction_List2_free(job_list);
332 AB_Transaction_free(job);
342 while (!successful && !aborted);