GnuCash c935c2f+
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
AqBanking

Files

file  assistant-ab-initial.h
 AqBanking setup functionality.
 
file  dialog-ab-select-imexporter.h
 Dialog to select AQBanking importer/exporter and format profile.
 
file  dialog-ab-trans.h
 Dialog for AqBanking transaction data.
 
file  gnc-ab-getbalance.h
 AqBanking getbalance functions.
 
file  gnc-ab-kvp.h
 AqBanking KVP handling.
 
file  gnc-ab-transfer.h
 Dialog for AqBanking transaction data.
 
file  gnc-ab-utils.h
 AqBanking utility functions.
 
file  gnc-flicker-gui.h
 GUI callbacks for Flicker and ChipTAN(optisch)
 
file  gnc-gwen-gui.h
 GUI callbacks for AqBanking.
 
file  gnc-plugin-aqbanking.h
 Plugin registration of the AqBanking module.
 

Data Structures

struct  AB_Node_Pair
 
struct  GncFlickerGui
 

Macros

#define GNC_RESPONSE_NOW   GTK_RESPONSE_YES
 
#define GNC_RESPONSE_LATER   GTK_RESPONSE_NO
 
#define AQBANKING_VERSION_INT   (10000 * AQBANKING_VERSION_MAJOR + 100 * AQBANKING_VERSION_MINOR + AQBANKING_VERSION_PATCHLEVEL)
 A define that combines the aqbanking version number into one single integer number.
 
#define GWENHYWFAR_VERSION_INT   (10000 * GWENHYWFAR_VERSION_MAJOR + 100 * GWENHYWFAR_VERSION_MINOR + GWENHYWFAR_VERSION_PATCHLEVEL)
 A define that combines the gwenhywfar version number into one single integer number.
 
#define GNC_AB_ACCOUNT_SPEC   AB_ACCOUNT_SPEC
 
#define GNC_AB_ACCOUNT_SPEC_LIST   AB_ACCOUNT_SPEC_LIST
 
#define GNC_AB_JOB   AB_TRANSACTION
 
#define GNC_AB_JOB_LIST2   AB_TRANSACTION_LIST2
 
#define GNC_AB_JOB_LIST2_ITERATOR   AB_TRANSACTION_LIST2_ITERATOR
 
#define GNC_AB_JOB_STATUS   AB_TRANSACTION_STATUS
 
#define GNC_GWEN_DATE   GWEN_DATE
 
#define GNC_PREFS_GROUP_AQBANKING   "dialogs.import.hbci"
 
#define GNC_PREF_FORMAT_SWIFT940   "format-swift-mt940"
 
#define GNC_PREF_FORMAT_SWIFT942   "format-swift-mt942"
 
#define GNC_PREF_FORMAT_DTAUS   "format-dtaus"
 
#define GNC_PREF_IMPORT_NOTED_TXNS   "import-noted-transactions"
 
#define GNC_PREF_USE_TRANSACTION_TXT   "use-ns-transaction-text"
 
#define GNC_PREF_VERBOSE_DEBUG   "verbose-debug"
 
#define AWAIT_BALANCES   1 << 1
 
#define FOUND_BALANCES   1 << 2
 
#define IGNORE_BALANCES   1 << 3
 
#define AWAIT_TRANSACTIONS   1 << 4
 
#define FOUND_TRANSACTIONS   1 << 5
 
#define IGNORE_TRANSACTIONS   1 << 6
 
#define GNC_TYPE_PLUGIN_AQBANKING   (gnc_plugin_aqbanking_get_type())
 
#define GNC_PLUGIN_AQBANKING_NAME   "gnc-plugin-aqbanking"
 

Typedefs

typedef struct _GncABSelectImExDlg GncABSelectImExDlg
 
typedef enum _GncABTransType GncABTransType
 
typedef typedefG_BEGIN_DECLS struct _GncGWENGui GncGWENGui
 

Enumerations

enum  _GncABTransType {
  SINGLE_TRANSFER = 0 , SINGLE_DEBITNOTE , SINGLE_INTERNAL_TRANSFER , SEPA_TRANSFER ,
  SEPA_DEBITNOTE
}
 

Functions

GncABTransTempl * gnc_ab_trans_templ_new (void)
 Create a template with unset contents.
 
GncABTransTempl * gnc_ab_trans_templ_new_full (const gchar *name, const gchar *recp_name, const gchar *recp_account, const gchar *recp_bankcode, gnc_numeric amount, const gchar *purpose, const gchar *purpose_cont)
 Create a template with given contents.
 
GList * gnc_ab_trans_templ_list_new_from_book (QofBook *b)
 Obtain the list of QofTemplates saved in a Book.
 
void gnc_ab_set_book_template_list (QofBook *b, GList *template_list)
 Set the GList of kvp_frames of template transactions in the Book b to template_list.
 
void gnc_ab_trans_templ_free (GncABTransTempl *t)
 Free the memory used by a template.
 
void gnc_ab_trans_templ_list_free (GList *l)
 Free the memory used by a list of templates, including the list itself.
 
const gchar * gnc_ab_trans_templ_get_name (const GncABTransTempl *t)
 
const gchar * gnc_ab_trans_templ_get_recp_name (const GncABTransTempl *t)
 
const gchar * gnc_ab_trans_templ_get_recp_account (const GncABTransTempl *t)
 
const gchar * gnc_ab_trans_templ_get_recp_bankcode (const GncABTransTempl *t)
 
gnc_numeric gnc_ab_trans_templ_get_amount (const GncABTransTempl *t)
 
const gchar * gnc_ab_trans_templ_get_purpose (const GncABTransTempl *t)
 
const gchar * gnc_ab_trans_templ_get_purpose_cont (const GncABTransTempl *t)
 
void gnc_ab_trans_templ_set_name (GncABTransTempl *t, const gchar *name)
 Set the name of a template.
 
void gnc_ab_trans_templ_set_recp_name (GncABTransTempl *t, const gchar *recp_name)
 Replace the Account Number of the recipient stored in a template.
 
void gnc_ab_trans_templ_set_recp_account (GncABTransTempl *t, const gchar *recp_account)
 Replace the Account Number of the recipient stored in a template.
 
void gnc_ab_trans_templ_set_recp_bankcode (GncABTransTempl *t, const gchar *recp_bankcode)
 Replace the Bank Code of the recipient stored in a template.
 
void gnc_ab_trans_templ_set_amount (GncABTransTempl *t, gnc_numeric amount)
 Replace the amount stored in a template.
 
void gnc_ab_trans_templ_set_purpose (GncABTransTempl *t, const gchar *purpose)
 Replace the first purpose line stored in a template.
 
void gnc_ab_trans_templ_set_purpose_cont (GncABTransTempl *t, const gchar *purpose_cont)
 Replace the second purpose line stored in a template.
 
G_BEGIN_DECLS void gnc_ab_initial_assistant (void)
 Create and show an assistant for the aqbanking setup.
 
G_BEGIN_DECLS gboolean gnc_ab_enter_daterange (GtkWidget *parent, const char *heading, time64 *from_date, gboolean *last_retv_date, gboolean *first_possible_date, time64 *to_date, gboolean *to_now)
 Show a dialog to pick a time frame using a sensible set of default options.
 
G_BEGIN_DECLS GncABSelectImExDlg * gnc_ab_select_imex_dlg_new (GtkWidget *parent, AB_BANKING *abi)
 Create an AQBanking importer/exporter selection dialog.
 
void gnc_ab_select_imex_dlg_destroy (GncABSelectImExDlg *imexd)
 Destroy an AQBanking importer/exporter selection dialog.
 
int gnc_ab_select_imex_dlg_run (GncABSelectImExDlg *imexd)
 Run an AQBanking importer/exporter selection dialog.
 
char * gnc_ab_select_imex_dlg_get_imexporter_name (GncABSelectImExDlg *imexd)
 Get the selected importer/exporter name.
 
void gnc_ab_select_imex_dlg_set_imexporter_name (GncABSelectImExDlg *imexd, const char *name)
 Get the selected importer/exporter name.
 
char * gnc_ab_select_imex_dlg_get_profile_name (GncABSelectImExDlg *imexd)
 Get the selected file format profile name.
 
void gnc_ab_select_imex_dlg_set_profile_name (GncABSelectImExDlg *imexd, const char *name)
 Get the selected file format profile name.
 
gboolean gnc_ab_trans_isSEPA (GncABTransType t)
 Returns true if the given GncABTransType is an European (SEPA) transaction (transfer or debit note), otherwise false.
 
GncABTransDialog * gnc_ab_trans_dialog_new (GtkWidget *parent, GNC_AB_ACCOUNT_SPEC *ab_acc, gint commodity_scu, GncABTransType trans_type, GList *templates)
 Create a new AqBanking transfer dialog.
 
gint gnc_ab_trans_dialog_run_until_ok (GncABTransDialog *td)
 Run the Aqbanking transfer dialog until correct values where entered or the user cancelled the dialog.
 
void gnc_ab_trans_dialog_free (GncABTransDialog *td)
 Free a Aqbanking transfer dialog.
 
GtkWidget * gnc_ab_trans_dialog_get_parent (const GncABTransDialog *td)
 Retrieve the widget used as parent.
 
const AB_TRANSACTION * gnc_ab_trans_dialog_get_ab_trans (const GncABTransDialog *td)
 Receive the Aqbanking Transaction filled by the dialog.
 
GNC_AB_JOB * gnc_ab_trans_dialog_get_job (const GncABTransDialog *td)
 Receive the Aqbanking job filled by the dialog.
 
GNC_AB_JOB * gnc_ab_get_trans_job (GNC_AB_ACCOUNT_SPEC *ab_acc, const AB_TRANSACTION *ab_trans, GncABTransType trans_type)
 Return the AqBanking job associated with the transaction.
 
G_BEGIN_DECLS void gnc_ab_getbalance (GtkWidget *parent, Account *gnc_acc)
 Execute a GetBalance job, show the resulting balance and offer to reconcile the GnuCash account.
 
G_BEGIN_DECLS void gnc_ab_gettrans (GtkWidget *parent, Account *gnc_acc)
 Execute a GetTransactions job.
 
G_BEGIN_DECLS void gnc_ab_maketrans (GtkWidget *parent, Account *gnc_acc, GncABTransType trans_type)
 Create SEPA transfers.
 
void gnc_GWEN_Init (void)
 Initialize the gwenhywfar library by calling GWEN_Init() and setting up gwenhywfar logging.
 
void gnc_GWEN_Fini (void)
 Finalize the gwenhywfar library.
 
AB_BANKING * gnc_AB_BANKING_new (void)
 If there is a cached AB_BANKING object, return it initialized.
 
void gnc_AB_BANKING_delete (AB_BANKING *api)
 Delete the AB_BANKING api.
 
gint gnc_AB_BANKING_fini (AB_BANKING *api)
 Finish the AB_BANKING api.
 
GNC_AB_ACCOUNT_SPEC * gnc_ab_get_ab_account (const AB_BANKING *api, Account *gnc_acc)
 Get the corresponding AqBanking account to the GnuCash account gnc_acc.
 
gchar * gnc_AB_VALUE_to_readable_string (const AB_VALUE *value)
 Print the value of value with two decimal places and value's currency appended, or 0.0 otherwise.
 
gchar * gnc_AB_JOB_to_readable_string (const GNC_AB_JOB *job)
 Return the job as string.
 
gchar * gnc_AB_JOB_ID_to_string (gulong job_id)
 Return the job_id as string.
 
gchar * gnc_ab_get_remote_name (const AB_TRANSACTION *ab_trans)
 Retrieve the merged "remote name" fields from a transaction.
 
gchar * gnc_ab_get_purpose (const AB_TRANSACTION *ab_trans, gboolean is_ofx)
 Retrieve the merged purpose fields from a transaction.
 
gchar * gnc_ab_description_to_gnc (const AB_TRANSACTION *ab_trans, gboolean is_ofx)
 Create the appropriate description field for a GnuCash Transaction by the information given in the AB_TRANSACTION ab_trans.
 
gchar * gnc_ab_memo_to_gnc (const AB_TRANSACTION *ab_trans)
 Create the appropriate memo field for a GnuCash Split by the information given in the AB_TRANSACTION ab_trans.
 
Transaction * gnc_ab_trans_to_gnc (const AB_TRANSACTION *ab_trans, Account *gnc_acc)
 Create an unbalanced and dirty GnuCash transaction with a split to gnc_acc from the information available in the AqBanking transaction ab_trans.
 
GncABImExContextImport * gnc_ab_import_context (AB_IMEXPORTER_CONTEXT *context, guint awaiting, gboolean execute_txns, AB_BANKING *api, GtkWidget *parent)
 Import balances and transactions found in a AB_IMEXPORTER_CONTEXT into GnuCash.
 
guint gnc_ab_ieci_get_found (GncABImExContextImport *ieci)
 Extract awaiting from data.
 
GNC_AB_JOB_LIST2 * gnc_ab_ieci_get_job_list (GncABImExContextImport *ieci)
 Extract the job list from data.
 
gboolean gnc_ab_ieci_run_matcher (GncABImExContextImport *ieci)
 Run the generic transaction matcher dialog.
 
GWEN_DB_NODE * gnc_ab_get_permanent_certs (void)
 get the GWEN_DB_NODE from AqBanking configuration files
 
gchar * gnc_ab_create_online_id (const gchar *bankcode, const gchar *accountnumber)
 Creates an online ID from bank code and account number.
 
GList * gnc_ab_imexporter_list (AB_BANKING *abi)
 Retrieve the available AQBanking importers.
 
GList * gnc_ab_imexporter_profile_list (AB_BANKING *abi, const char *importer_name)
 Retrieve the available format templates for an AQBanking importer.
 
G_BEGIN_DECLS void gnc_file_aqbanking_import_dialog (GtkWindow *parent)
 Import files via AQBanking's Import Dialog.
 
void ini_flicker_gui (const char *pChallenge, GncFlickerGui *gui)
 Initialize the dialog and drawing area.
 
void gnc_GWEN_Gui_log_init (void)
 Hook our logging into the gwenhywfar logging framework by creating a minimalistic GWEN_GUI with only a callback for Gwen_Gui_LogHook().
 
GncGWENGui * gnc_GWEN_Gui_get (GtkWidget *parent)
 When called for the first time, create a unique GncGWENGui object featuring a GWEN_GUI with all necessary callbacks, which can serve as a user interface for AqBanking jobs.
 
void gnc_GWEN_Gui_release (GncGWENGui *gui)
 Currently a no-op.
 
void gnc_GWEN_Gui_shutdown (void)
 Free all memory related to both the full-blown and minimalistic GUI objects.
 
void gnc_GWEN_Gui_set_close_flag (gboolean close_when_finished)
 Set "Close when finished" flag.
 
gboolean gnc_GWEN_Gui_get_close_flag (void)
 Get "Close when finished" flag.
 
gboolean gnc_GWEN_Gui_show_dialog (void)
 Unhides Online Banking Connection Window (Make log visible)
 
void gnc_GWEN_Gui_hide_dialog (void)
 Hides Online Banking Connection Window (Close log window)
 
GncPlugin * gnc_plugin_aqbanking_new (void)
 
void gnc_plugin_aqbanking_create_plugin (void)
 Create a new GncPluginAqBanking object and register it.
 
void gnc_plugin_aqbanking_set_logwindow_visible (gboolean logwindow_visible)
 Set MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW.
 

Variables

GtkWidget * GncFlickerGui::dialog
 
GtkWidget * GncFlickerGui::input_entry
 
GtkWidget * GncFlickerGui::flicker_challenge
 
GtkWidget * GncFlickerGui::flicker_marker
 
GtkWidget * GncFlickerGui::flicker_hbox
 
GtkAdjustment * GncFlickerGui::adj_barwidth
 
GtkAdjustment * GncFlickerGui::adj_delay
 
GtkSpinButton * GncFlickerGui::spin_barwidth
 
GtkSpinButton * GncFlickerGui::spin_delay
 

Account

const gchar * gnc_ab_get_account_accountid (const Account *a)
 Return accountid string in the Account a.
 
void gnc_ab_set_account_accountid (Account *a, const gchar *id)
 Set the accountid string in the Account a to id.
 
const gchar * gnc_ab_get_account_bankcode (const Account *a)
 Return the bankcode string in the Account a.
 
void gnc_ab_set_account_bankcode (Account *a, const gchar *code)
 Set the bankcode string in the Account a to code.
 
guint32 gnc_ab_get_account_uid (const Account *a)
 Return the unique id for the AB_BANKING account in the Account a.
 
void gnc_ab_set_account_uid (Account *a, guint32 uid)
 Set the unique id for the AB_BANKING account in the Account a to uid.
 
time64 gnc_ab_get_account_trans_retrieval (const Account *a)
 Return the time of last online transaction retrieval for Account a.
 
void gnc_ab_set_account_trans_retrieval (Account *a, time64 time)
 Set the time of last online transaction retrieval for Account a.
 

Detailed Description

Macro Definition Documentation

◆ AQBANKING_VERSION_INT

#define AQBANKING_VERSION_INT   (10000 * AQBANKING_VERSION_MAJOR + 100 * AQBANKING_VERSION_MINOR + AQBANKING_VERSION_PATCHLEVEL)

A define that combines the aqbanking version number into one single integer number.

Assumption: Both MINOR and PATCHLEVEL numbers are in the interval [0..99].

Definition at line 48 of file gnc-ab-utils.h.

◆ AWAIT_BALANCES

#define AWAIT_BALANCES   1 << 1

Definition at line 79 of file gnc-ab-utils.h.

◆ AWAIT_TRANSACTIONS

#define AWAIT_TRANSACTIONS   1 << 4

Definition at line 82 of file gnc-ab-utils.h.

◆ FOUND_BALANCES

#define FOUND_BALANCES   1 << 2

Definition at line 80 of file gnc-ab-utils.h.

◆ FOUND_TRANSACTIONS

#define FOUND_TRANSACTIONS   1 << 5

Definition at line 83 of file gnc-ab-utils.h.

◆ GNC_AB_ACCOUNT_SPEC

#define GNC_AB_ACCOUNT_SPEC   AB_ACCOUNT_SPEC

Definition at line 55 of file gnc-ab-utils.h.

◆ GNC_AB_ACCOUNT_SPEC_LIST

#define GNC_AB_ACCOUNT_SPEC_LIST   AB_ACCOUNT_SPEC_LIST

Definition at line 56 of file gnc-ab-utils.h.

◆ GNC_AB_JOB

#define GNC_AB_JOB   AB_TRANSACTION

Definition at line 57 of file gnc-ab-utils.h.

◆ GNC_AB_JOB_LIST2

#define GNC_AB_JOB_LIST2   AB_TRANSACTION_LIST2

Definition at line 58 of file gnc-ab-utils.h.

◆ GNC_AB_JOB_LIST2_ITERATOR

#define GNC_AB_JOB_LIST2_ITERATOR   AB_TRANSACTION_LIST2_ITERATOR

Definition at line 59 of file gnc-ab-utils.h.

◆ GNC_AB_JOB_STATUS

#define GNC_AB_JOB_STATUS   AB_TRANSACTION_STATUS

Definition at line 60 of file gnc-ab-utils.h.

◆ GNC_GWEN_DATE

#define GNC_GWEN_DATE   GWEN_DATE

Definition at line 61 of file gnc-ab-utils.h.

◆ GNC_PLUGIN_AQBANKING_NAME

#define GNC_PLUGIN_AQBANKING_NAME   "gnc-plugin-aqbanking"

Definition at line 46 of file gnc-plugin-aqbanking.h.

◆ GNC_PREF_FORMAT_DTAUS

#define GNC_PREF_FORMAT_DTAUS   "format-dtaus"

Definition at line 66 of file gnc-ab-utils.h.

◆ GNC_PREF_FORMAT_SWIFT940

#define GNC_PREF_FORMAT_SWIFT940   "format-swift-mt940"

Definition at line 64 of file gnc-ab-utils.h.

◆ GNC_PREF_FORMAT_SWIFT942

#define GNC_PREF_FORMAT_SWIFT942   "format-swift-mt942"

Definition at line 65 of file gnc-ab-utils.h.

◆ GNC_PREF_IMPORT_NOTED_TXNS

#define GNC_PREF_IMPORT_NOTED_TXNS   "import-noted-transactions"

Definition at line 67 of file gnc-ab-utils.h.

◆ GNC_PREF_USE_TRANSACTION_TXT

#define GNC_PREF_USE_TRANSACTION_TXT   "use-ns-transaction-text"

Definition at line 68 of file gnc-ab-utils.h.

◆ GNC_PREF_VERBOSE_DEBUG

#define GNC_PREF_VERBOSE_DEBUG   "verbose-debug"

Definition at line 69 of file gnc-ab-utils.h.

◆ GNC_PREFS_GROUP_AQBANKING

#define GNC_PREFS_GROUP_AQBANKING   "dialogs.import.hbci"

Definition at line 63 of file gnc-ab-utils.h.

◆ GNC_RESPONSE_LATER

#define GNC_RESPONSE_LATER   GTK_RESPONSE_NO

Definition at line 47 of file dialog-ab-trans.h.

◆ GNC_RESPONSE_NOW

#define GNC_RESPONSE_NOW   GTK_RESPONSE_YES

Definition at line 46 of file dialog-ab-trans.h.

◆ GNC_TYPE_PLUGIN_AQBANKING

#define GNC_TYPE_PLUGIN_AQBANKING   (gnc_plugin_aqbanking_get_type())

Definition at line 43 of file gnc-plugin-aqbanking.h.

◆ GWENHYWFAR_VERSION_INT

#define GWENHYWFAR_VERSION_INT   (10000 * GWENHYWFAR_VERSION_MAJOR + 100 * GWENHYWFAR_VERSION_MINOR + GWENHYWFAR_VERSION_PATCHLEVEL)

A define that combines the gwenhywfar version number into one single integer number.

Assumption: Both MINOR and PATCHLEVEL numbers are in the interval [0..99].

Definition at line 53 of file gnc-ab-utils.h.

◆ IGNORE_BALANCES

#define IGNORE_BALANCES   1 << 3

Definition at line 81 of file gnc-ab-utils.h.

◆ IGNORE_TRANSACTIONS

#define IGNORE_TRANSACTIONS   1 << 6

Definition at line 84 of file gnc-ab-utils.h.

Typedef Documentation

◆ GncABSelectImExDlg

typedef struct _GncABSelectImExDlg GncABSelectImExDlg

Definition at line 39 of file dialog-ab-select-imexporter.h.

◆ GncABTransType

typedef enum _GncABTransType GncABTransType

Definition at line 51 of file dialog-ab-trans.h.

◆ GncGWENGui

typedef typedefG_BEGIN_DECLS struct _GncGWENGui GncGWENGui

Definition at line 40 of file gnc-gwen-gui.h.

Enumeration Type Documentation

◆ _GncABTransType

enum _GncABTransType

Definition at line 52 of file dialog-ab-trans.h.

53{
54 SINGLE_TRANSFER = 0, /* obsolete old non-SEPA transfer; no longer in use */
55 SINGLE_DEBITNOTE, /* obsolete old non-SEPA debit note; no longer in use */
56 SINGLE_INTERNAL_TRANSFER
57 , SEPA_TRANSFER
58 , SEPA_DEBITNOTE
59#if (AQBANKING_VERSION_INT >= 60400)
60 , SEPA_INTERNAL_TRANSFER
61#endif
62};

Function Documentation

◆ gnc_AB_BANKING_delete()

void gnc_AB_BANKING_delete ( AB_BANKING *  api)

Delete the AB_BANKING api.

If this is also the one that was cached by gnc_AB_BANKING_new(), then all references are deleted, too.

Parameters
apiAB_BANKING or NULL for the cached AB_BANKING object

Definition at line 206 of file gnc-ab-utils.c.

207{
208 if (!api)
209 api = gnc_AB_BANKING;
210
211 if (api)
212 {
213 if (api == gnc_AB_BANKING)
214 {
215 gnc_AB_BANKING = NULL;
217 }
218
219 AB_Banking_free (api);
220 }
221}
gint gnc_AB_BANKING_fini(AB_BANKING *api)
Finish the AB_BANKING api.

◆ gnc_AB_BANKING_fini()

gint gnc_AB_BANKING_fini ( AB_BANKING *  api)

Finish the AB_BANKING api.

If this is also the one that was cached by gnc_AB_BANKING_new(), then finish only if the decremented reference count reaches zero. After this call, you may only call gnc_AB_BANKING_new() to get the api again in a properly initialized state.

Parameters
apiAB_BANKING object
Returns
Zero on success

Definition at line 225 of file gnc-ab-utils.c.

226{
227 if (api == gnc_AB_BANKING)
228 {
229 if (--gnc_AB_BANKING_refcount == 0)
230 {
231 if (gnc_gwengui_extended_by_ABBanking)
232 AB_Gui_Unextend (gnc_gwengui_extended_by_ABBanking);
233 gnc_gwengui_extended_by_ABBanking = NULL;
234 return AB_Banking_Fini (api);
235 }
236 }
237 else
238 {
239 if (gnc_gwengui_extended_by_ABBanking)
240 AB_Gui_Unextend (gnc_gwengui_extended_by_ABBanking);
241 gnc_gwengui_extended_by_ABBanking = NULL;
242 return AB_Banking_Fini (api);
243 }
244 return 0;
245}

◆ gnc_AB_BANKING_new()

AB_BANKING * gnc_AB_BANKING_new ( void  )

If there is a cached AB_BANKING object, return it initialized.

Otherwise, create a new AB_BANKING, let it load its environment from its default configuration and cache it.

Returns
The AB_BANKING object

Definition at line 162 of file gnc-ab-utils.c.

163{
164 AB_BANKING *api;
165
166 if (gnc_AB_BANKING)
167 {
168 /* API cached. */
169 api = gnc_AB_BANKING;
170
171 /* Init the API again. */
172 if (gnc_AB_BANKING_refcount == 0)
173 g_return_val_if_fail (AB_Banking_Init (api) == 0, NULL);
174
175 }
176 else
177 {
178 api = AB_Banking_new (PROJECT_NAME, NULL, 0);
179 g_return_val_if_fail (api, NULL);
180
181 /* These two values must be set because newest bank regulation requires
182 the bank servers to require it. The string itself results from our
183 registration with the German bank association at
184 https://www.hbci-zka.de/register/prod_register.htm (where the
185 registration was requested and is managed by cstim). The function call was
186 introduced in aqbanking-5.99.25 and aqbanking-5.7.9. */
187 AB_Banking_RuntimeConfig_SetCharValue (api, "fintsRegistrationKey", "412748A1836CDD07181CE1910");
188 AB_Banking_RuntimeConfig_SetCharValue (api, "fintsApplicationVersionString", PROJECT_VERSION);
189
190 /* Init the API */
191 g_return_val_if_fail (AB_Banking_Init (api) == 0, NULL);
192 gnc_gwengui_extended_by_ABBanking = GWEN_Gui_GetGui ();
193 AB_Gui_Extend (gnc_gwengui_extended_by_ABBanking, api);
194
195 /* Cache it */
196 gnc_AB_BANKING = api;
197 gnc_AB_BANKING_refcount = 0;
198 }
199
200 gnc_AB_BANKING_refcount++;
201
202 return api;
203}

◆ gnc_ab_create_online_id()

gchar * gnc_ab_create_online_id ( const gchar *  bankcode,
const gchar *  accountnumber 
)

Creates an online ID from bank code and account number.

The returned string must be g_free'd by the caller.

Parameters
bankcodeBank code
accountnumberAccount number
Returns
an online ID

Definition at line 294 of file gnc-ab-utils.c.

295{
296 gchar *online_id;
297
298 /* The accountnumber may have leading zeros, depending on where them
299 * accountnumber is came from, e.g. the accountnumber of accountinfo
300 * has no leading zeros while the (local)accountnumber of a transaction
301 * has leading zeros.
302 * So remove all leading '0', to get a consistent online_id.
303 */
304 while (accountnumber && *accountnumber == '0')
305 accountnumber++;
306
307 online_id = g_strconcat (bankcode ? bankcode : "",
308 accountnumber ? accountnumber : "",
309 (gchar*)NULL);
310
311 return online_id;
312}

◆ gnc_ab_description_to_gnc()

gchar * gnc_ab_description_to_gnc ( const AB_TRANSACTION *  ab_trans,
gboolean  is_ofx 
)

Create the appropriate description field for a GnuCash Transaction by the information given in the AB_TRANSACTION ab_trans.

The returned string must be g_free'd by the caller.

Parameters
ab_transAqBanking transaction
Returns
A newly allocated string, may be ""

Definition at line 424 of file gnc-ab-utils.c.

425{
426 GList *acc = NULL;
427 gchar *retval;
428
429 acc = g_list_prepend (acc, gnc_ab_get_remote_name (ab_trans));
430 acc = g_list_prepend (acc, gnc_ab_get_purpose (ab_trans, is_ofx));
431 acc = g_list_prepend (acc, ab_ultimate_creditor_debtor_to_gnc (ab_trans, is_ofx));
432 retval = gnc_g_list_stringjoin_nodups (acc, "; ");
433
434 g_list_free_full (acc, g_free);
435 return retval ? retval : g_strdup (_("Unspecified"));
436}
gchar * gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans, gboolean is_ofx)
Retrieve the merged purpose fields from a transaction.
gchar * gnc_ab_get_remote_name(const AB_TRANSACTION *ab_trans)
Retrieve the merged "remote name" fields from a transaction.
gchar * gnc_g_list_stringjoin_nodups(GList *list_of_strings, const gchar *sep)
Like stringjoin but ensures that the string to be added isn't already part of the return string.

◆ gnc_ab_enter_daterange()

G_BEGIN_DECLS gboolean gnc_ab_enter_daterange ( GtkWidget *  parent,
const char *  heading,
time64 from_date,
gboolean *  last_retv_date,
gboolean *  first_possible_date,
time64 to_date,
gboolean *  to_now 
)

Show a dialog to pick a time frame using a sensible set of default options.

Parameters
parentWidget to use as parent, may be NULL
headingDescriptive text showed at the top, may be NULL
from_dateLocation to read from the initial and write to the final value of the from date entry
last_retv_dateLocation to read from whether the caller knows the last retrieval date and write to whether the corresponding button has been chosen
first_possible_dateLocation to write to whether the earliest possible date button has been chosen
to_dateLocation to read from the initial and write to the final value of the to date entry
to_nowLocation to write to whether the to now button has been chosen

Definition at line 52 of file dialog-ab-daterange.c.

59{
60 GtkBuilder *builder;
61 GtkWidget *dialog;
62 GtkWidget *heading_label;
63 GtkWidget *first_button;
64 GtkWidget *last_retrieval_button;
65 GtkWidget *now_button;
66 DaterangeInfo info;
67 gint result;
68
69 ENTER("");
70
71 builder = gtk_builder_new();
72 gnc_builder_add_from_file (builder, "dialog-ab.glade", "aqbanking_date_range_dialog");
73
74 dialog = GTK_WIDGET(gtk_builder_get_object (builder, "aqbanking_date_range_dialog"));
75
76 /* Connect the signals */
77 gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, &info );
78
79 if (parent)
80 gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent));
81
82 heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "date_heading_label"));
83 first_button = GTK_WIDGET(gtk_builder_get_object (builder, "first_button"));
84 last_retrieval_button = GTK_WIDGET(gtk_builder_get_object (builder, "last_retrieval_button"));
85 info.enter_from_button = GTK_WIDGET(gtk_builder_get_object (builder, "enter_from_button"));
86 now_button = GTK_WIDGET(gtk_builder_get_object (builder, "now_button"));
87 info.enter_to_button = GTK_WIDGET(gtk_builder_get_object (builder, "enter_to_button"));
88
89 info.from_dateedit = gnc_date_edit_new (*from_date, FALSE, FALSE);
90 gtk_container_add(GTK_CONTAINER(gtk_builder_get_object (builder, "enter_from_box")),
91 info.from_dateedit);
92 gtk_widget_show(info.from_dateedit);
93
94 info.to_dateedit = gnc_date_edit_new (*to_date, FALSE, FALSE);
95 gtk_container_add(GTK_CONTAINER(gtk_builder_get_object (builder, "enter_to_box")),
96 info.to_dateedit);
97 gtk_widget_show(info.to_dateedit);
98
99 if (*last_retv_date)
100 {
101 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(last_retrieval_button),
102 TRUE);
103 }
104 else
105 {
106 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(first_button), TRUE);
107 gtk_widget_set_sensitive(last_retrieval_button, FALSE);
108 }
109
110 gtk_widget_set_sensitive(info.from_dateedit, FALSE);
111 gtk_widget_set_sensitive(info.to_dateedit, FALSE);
112
113 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
114
115 if (heading)
116 gtk_label_set_text(GTK_LABEL(heading_label), heading);
117
118 gtk_widget_show(dialog);
119
120 result = gtk_dialog_run(GTK_DIALOG(dialog));
121 gtk_widget_hide(dialog);
122
123 if (result == GTK_RESPONSE_OK)
124 {
125 *from_date = gnc_date_edit_get_date(GNC_DATE_EDIT(info.from_dateedit));
126 *last_retv_date = gtk_toggle_button_get_active(
127 GTK_TOGGLE_BUTTON(last_retrieval_button));
128 *first_possible_date = gtk_toggle_button_get_active(
129 GTK_TOGGLE_BUTTON(first_button));
130 *to_date = gnc_date_edit_get_date (GNC_DATE_EDIT(info.to_dateedit));
131 *to_now = gtk_toggle_button_get_active(
132 GTK_TOGGLE_BUTTON(now_button));
133 }
134
135 g_object_unref(G_OBJECT(builder));
136
137 gtk_widget_destroy(dialog);
138
139 LEAVE("");
140 return result == GTK_RESPONSE_OK;
141}
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition qoflog.h:282
#define ENTER(format, args...)
Print a function entry debugging message.
Definition qoflog.h:272

◆ gnc_ab_get_ab_account()

GNC_AB_ACCOUNT_SPEC * gnc_ab_get_ab_account ( const AB_BANKING *  api,
Account gnc_acc 
)

Get the corresponding AqBanking account to the GnuCash account gnc_acc.

Of course this only works after the GnuCash account has been set up for AqBanking use, i.e. the account's hbci data have been set up and populated.

Parameters
apiThe AB_BANKING to get the GNC_AB_ACCOUNT_SPEC from
gnc_accThe GnuCash account to query for GNC_AB_ACCOUNT_SPEC reference data
Returns
The GNC_AB_ACCOUNT_SPEC found or NULL otherwise

Definition at line 248 of file gnc-ab-utils.c.

249{
250 GNC_AB_ACCOUNT_SPEC *ab_account = NULL;
251 const gchar *bankcode = NULL;
252 const gchar *accountid = NULL;
253 guint32 account_uid = 0;
254
255 bankcode = gnc_ab_get_account_bankcode (gnc_acc);
256 accountid = gnc_ab_get_account_accountid (gnc_acc);
257 account_uid = gnc_ab_get_account_uid (gnc_acc);
258
259 if (account_uid > 0)
260 {
261 gint rv;
262
263 rv = AB_Banking_GetAccountSpecByUniqueId (api, account_uid, &ab_account);
264
265 if ( (rv<0 || !ab_account) && bankcode && *bankcode &&
266 accountid && *accountid)
267 {
268/* Finding the account by code and number is suspended in AQBANKING 6 pending
269 * implementation of a replacement for AB_Banking_GetAccountByCodeAndNumber.
270 */
271 PINFO("gnc_ab_get_ab_account: No AB_ACCOUNT found for UID %d, "
272 "trying bank code\n", account_uid);
273 return NULL;
274 }
275 return ab_account;
276 }
277
278 return NULL;
279}
const gchar * gnc_ab_get_account_bankcode(const Account *a)
Return the bankcode string in the Account a.
Definition gnc-ab-kvp.c:59
const gchar * gnc_ab_get_account_accountid(const Account *a)
Return accountid string in the Account a.
Definition gnc-ab-kvp.c:39
guint32 gnc_ab_get_account_uid(const Account *a)
Return the unique id for the AB_BANKING account in the Account a.
Definition gnc-ab-kvp.c:79
#define PINFO(format, args...)
Print an informational note.
Definition qoflog.h:256

◆ gnc_ab_get_account_accountid()

const gchar * gnc_ab_get_account_accountid ( const Account a)

Return accountid string in the Account a.

Parameters
aAccount
Returns
Account ID

Definition at line 39 of file gnc-ab-kvp.c.

40{
41 gchar *id = NULL;
42 qof_instance_get (QOF_INSTANCE (a),
43 "ab-account-id", &id,
44 NULL);
45 return id;
46}
void qof_instance_get(const QofInstance *inst, const gchar *first_prop,...)
Wrapper for g_object_get.

◆ gnc_ab_get_account_bankcode()

const gchar * gnc_ab_get_account_bankcode ( const Account a)

Return the bankcode string in the Account a.

Parameters
aAccount
Returns
Bank code

Definition at line 59 of file gnc-ab-kvp.c.

60{
61 gchar *code = NULL;
62 qof_instance_get (QOF_INSTANCE (a),
63 "ab-bank-code", &code,
64 NULL);
65 return code;
66}

◆ gnc_ab_get_account_trans_retrieval()

time64 gnc_ab_get_account_trans_retrieval ( const Account a)

Return the time of last online transaction retrieval for Account a.

Parameters
aAccount
Returns
Retrieval time

Definition at line 99 of file gnc-ab-kvp.c.

100{
101 Time64 *t = NULL;
102 qof_instance_get (QOF_INSTANCE (a),
103 "ab-trans-retrieval", &t,
104 NULL);
105 return t ? t->t : 0;
106}

◆ gnc_ab_get_account_uid()

guint32 gnc_ab_get_account_uid ( const Account a)

Return the unique id for the AB_BANKING account in the Account a.

Parameters
aAccount
Returns
Unique ID

Definition at line 79 of file gnc-ab-kvp.c.

80{
81 guint64 uid = 0LL;
82 qof_instance_get (QOF_INSTANCE (a),
83 "ab-account-uid", &uid,
84 NULL);
85 return (guint32)uid;
86}

◆ gnc_ab_get_permanent_certs()

GWEN_DB_NODE * gnc_ab_get_permanent_certs ( void  )

get the GWEN_DB_NODE from AqBanking configuration files

Returns
a GWEN_DB containing all permanently accepted SSL certificates (hashed).

Definition at line 1198 of file gnc-ab-utils.c.

1199{
1200 int rv;
1201 GWEN_DB_NODE *perm_certs = NULL;
1202 AB_BANKING *banking = gnc_AB_BANKING_new ();
1203
1204 g_return_val_if_fail (banking, NULL);
1205 rv = AB_Banking_LoadSharedConfig (banking, "certs", &perm_certs);
1206 gnc_AB_BANKING_fini (banking);
1207 g_return_val_if_fail (rv >= 0, NULL);
1208 return perm_certs;
1209}
AB_BANKING * gnc_AB_BANKING_new(void)
If there is a cached AB_BANKING object, return it initialized.

◆ gnc_ab_get_purpose()

gchar * gnc_ab_get_purpose ( const AB_TRANSACTION *  ab_trans,
gboolean  is_ofx 
)

Retrieve the merged purpose fields from a transaction.

The returned string must be g_free'd by the caller. If there was no purpose, an empty (but allocated) string is returned.

Parameters
ab_transAqBanking transaction
Returns
A newly allocated string, may be ""

Definition at line 369 of file gnc-ab-utils.c.

370{
371 GWEN_STRINGLIST *ab_purpose;
372 const char *ab_transactionText = NULL;
373 gchar *gnc_description = NULL;
374
375 g_return_val_if_fail (ab_trans, g_strdup (""));
376
377 if (!is_ofx && gnc_prefs_get_bool (GNC_PREFS_GROUP_AQBANKING, GNC_PREF_USE_TRANSACTION_TXT))
378 {
379 /* According to AqBanking, some of the non-swift lines have a special
380 * meaning. Some banks place valuable text into the transaction text,
381 * hence we put this text in front of the purpose. */
382 ab_transactionText = AB_Transaction_GetTransactionText (ab_trans);
383 if (ab_transactionText && *ab_transactionText)
384 gnc_description = g_utf8_normalize (ab_transactionText, -1, G_NORMALIZE_NFC);
385 }
386
387 ab_purpose = AB_Transaction_GetPurposeAsStringList (ab_trans);
388 if (ab_purpose)
389 GWEN_StringList_ForEach (ab_purpose, join_ab_strings_cb,
390 &gnc_description);
391
392 GWEN_StringList_free (ab_purpose);
393
394 return gnc_description;
395}
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.

◆ gnc_ab_get_remote_name()

gchar * gnc_ab_get_remote_name ( const AB_TRANSACTION *  ab_trans)

Retrieve the merged "remote name" fields from a transaction.

The returned string must be g_free'd by the caller. If there was no "remote name" field, NULL (!) is returned.

Parameters
ab_transAqBanking transaction
Returns
A newly allocated string or NULL otherwise

Definition at line 349 of file gnc-ab-utils.c.

350{
351 const char* ab_remote_name;
352 gchar *gnc_other_name = NULL;
353
354 g_return_val_if_fail (ab_trans, NULL);
355
356 ab_remote_name = AB_Transaction_GetRemoteName (ab_trans);
357 if (ab_remote_name)
358 gnc_other_name = g_strdup(ab_remote_name);
359 if (!gnc_other_name || !*gnc_other_name)
360 {
361 g_free (gnc_other_name);
362 gnc_other_name = NULL;
363 }
364
365 return gnc_other_name;
366}

◆ gnc_ab_get_trans_job()

GNC_AB_JOB * gnc_ab_get_trans_job ( GNC_AB_ACCOUNT_SPEC *  ab_acc,
const AB_TRANSACTION *  ab_trans,
GncABTransType  trans_type 
)

Return the AqBanking job associated with the transaction.

Parameters
tdTransaction dialog
Returns
An AQBanking job

Definition at line 866 of file dialog-ab-trans.c.

869{
870 GNC_AB_JOB *job;
871
872 g_return_val_if_fail(ab_acc && ab_trans, NULL);
873
874 job = gnc_ab_trans_dialog_get_available_empty_job(ab_acc, trans_type);
875 if (job)
876 {
877 AB_TRANSACTION *new_job;
878
879 /* merge transactions */
880 new_job=AB_Transaction_dup(ab_trans);
881 AB_Transaction_SetCommand(new_job, AB_Transaction_GetCommand(job));
882 AB_Transaction_SetUniqueAccountId(new_job,
883 AB_Transaction_GetUniqueAccountId(job));
884
885 AB_Transaction_free(job);
886 return new_job;
887 }
888 return NULL;
889
890}

◆ gnc_ab_getbalance()

G_BEGIN_DECLS void gnc_ab_getbalance ( GtkWidget *  parent,
Account gnc_acc 
)

Execute a GetBalance job, show the resulting balance and offer to reconcile the GnuCash account.

Parameters
parentWidget to use as parent, may be NULL
gnc_accGnuCash account to fetch balance for

Definition at line 47 of file gnc-ab-getbalance.c.

48{
49 AB_BANKING *api;
50 GNC_AB_ACCOUNT_SPEC *ab_acc;
51 GNC_AB_JOB *job = NULL;
52 GNC_AB_JOB_LIST2 *job_list = NULL;
53 GncGWENGui *gui = NULL;
54 AB_IMEXPORTER_CONTEXT *context = NULL;
55 GncABImExContextImport *ieci = NULL;
56 GNC_AB_JOB_STATUS job_status;
57
58 g_return_if_fail(parent && gnc_acc);
59
60 /* Get the API */
61 api = gnc_AB_BANKING_new();
62 if (!api)
63 {
64 g_warning("gnc_ab_gettrans: Couldn't get AqBanking API");
65 return;
66 }
67
68 /* Get the AqBanking Account */
69 ab_acc = gnc_ab_get_ab_account(api, gnc_acc);
70 if (!ab_acc)
71 {
72 g_warning("gnc_ab_getbalance: No AqBanking account found");
73 gnc_error_dialog (GTK_WINDOW (parent), _("No valid online banking account assigned."));
74 goto cleanup;
75 }
76
77 /* Get a GetBalance job and enqueue it */
78 if (!AB_AccountSpec_GetTransactionLimitsForCommand(ab_acc, AB_Transaction_CommandGetBalance))
79 {
80 g_warning("gnc_ab_getbalance: JobGetBalance not available for this "
81 "account");
82 gnc_error_dialog (GTK_WINDOW (parent), _("Online action \"Get Balance\" not available for this account."));
83 goto cleanup;
84 }
85 job = AB_Transaction_new();
86 AB_Transaction_SetCommand(job, AB_Transaction_CommandGetBalance);
87 AB_Transaction_SetUniqueAccountId(job, AB_AccountSpec_GetUniqueId(ab_acc));
88
89 job_list = AB_Transaction_List2_new();
90 AB_Transaction_List2_PushBack(job_list, job);
91 /* Get a GUI object */
92 gui = gnc_GWEN_Gui_get(parent);
93 if (!gui)
94 {
95 g_warning("gnc_ab_getbalance: Couldn't initialize Gwenhywfar GUI");
96 goto cleanup;
97 }
98
99 /* Create a context to store the results */
100 context = AB_ImExporterContext_new();
101
102 /* Execute the job */
103 AB_Banking_SendCommands(api, job_list, context);
104 /* Ignore the return value of AB_Banking_ExecuteJobs(), as the job's
105 * status always describes better whether the job was actually
106 * transferred to and accepted by the bank. See also
107 * https://lists.gnucash.org/pipermail/gnucash-de/2008-September/006389.html
108 */
109 job_status = AB_Transaction_GetStatus(job);
110 if (job_status != AB_Transaction_StatusEnqueued
111 && job_status != AB_Transaction_StatusPending
112 && job_status != AB_Transaction_StatusAccepted)
113 {
114 g_warning("gnc_ab_getbalance: Error on executing job: %d", job_status);
115 gnc_error_dialog (GTK_WINDOW (parent),
116 _("Error on executing job.\n\nStatus: %s"),
117 AB_Transaction_Status_toString(job_status));
118 goto cleanup;
119 }
120
121 /* Import the results */
122 ieci = gnc_ab_import_context(context, AWAIT_BALANCES, FALSE, NULL, parent);
123
124cleanup:
125 if (ieci)
126 g_free(ieci);
127 if (context)
128 AB_ImExporterContext_free(context);
129 if (gui)
131 if (job_list)
132 AB_Transaction_List2_free(job_list);
133 if (job)
134 AB_Transaction_free(job);
136}
GNC_AB_ACCOUNT_SPEC * gnc_ab_get_ab_account(const AB_BANKING *api, Account *gnc_acc)
Get the corresponding AqBanking account to the GnuCash account gnc_acc.
GncGWENGui * gnc_GWEN_Gui_get(GtkWidget *parent)
When called for the first time, create a unique GncGWENGui object featuring a GWEN_GUI with all neces...
GncABImExContextImport * gnc_ab_import_context(AB_IMEXPORTER_CONTEXT *context, guint awaiting, gboolean execute_txns, AB_BANKING *api, GtkWidget *parent)
Import balances and transactions found in a AB_IMEXPORTER_CONTEXT into GnuCash.
void gnc_GWEN_Gui_release(GncGWENGui *gui)
Currently a no-op.

◆ gnc_ab_gettrans()

G_BEGIN_DECLS void gnc_ab_gettrans ( GtkWidget *  parent,
Account gnc_acc 
)

Execute a GetTransactions job.

Parameters
parentWidget to use as parent, may be NULL
gnc_accGnuCash account to fetch transactions for

Definition at line 97 of file gnc-ab-gettrans.c.

98{
99 AB_BANKING *api;
100 GNC_AB_ACCOUNT_SPEC *ab_acc;
101 GWEN_TIME *from_date = NULL, *to_date = NULL;
102 time64 until;
103 GNC_AB_JOB *job = NULL;
104 GNC_AB_JOB_LIST2 *job_list = NULL;
105 GncGWENGui *gui = NULL;
106 AB_IMEXPORTER_CONTEXT *context = NULL;
107 GncABImExContextImport *ieci = NULL;
108 GNC_AB_JOB_STATUS job_status;
109
110 g_return_if_fail(parent && gnc_acc);
111
112 /* Get the API */
113 api = gnc_AB_BANKING_new();
114 if (!api)
115 {
116 g_warning("gnc_ab_gettrans: Couldn't get AqBanking API");
117 return;
118 }
119 /* Get the AqBanking Account */
120 ab_acc = gnc_ab_get_ab_account(api, gnc_acc);
121 if (!ab_acc)
122 {
123 g_warning("gnc_ab_gettrans: No AqBanking account found");
124 gnc_error_dialog (GTK_WINDOW (parent), _("No valid online banking account assigned."));
125 goto cleanup;
126 }
127
128 /* Get the start and end dates for the GetTransactions job. */
129 if (!gettrans_dates(parent, gnc_acc, &from_date, &to_date))
130 {
131 DEBUG("gnc_ab_gettrans: gettrans_dates aborted");
132 goto cleanup;
133 }
134 /* Use this as a local storage for the until_time below. */
135 until = GWEN_Time_toTime_t(to_date);
136
137 /* Get a GetTransactions job and enqueue it */
138 if (!AB_AccountSpec_GetTransactionLimitsForCommand(ab_acc, AB_Transaction_CommandGetTransactions))
139 {
140 g_warning("gnc_ab_gettrans: JobGetTransactions not available for this "
141 "account");
142 gnc_error_dialog (GTK_WINDOW (parent), _("Online action \"Get Transactions\" not available for this account."));
143 goto cleanup;
144 }
145 job = AB_Transaction_new();
146 AB_Transaction_SetCommand(job, AB_Transaction_CommandGetTransactions);
147 AB_Transaction_SetUniqueAccountId(job, AB_AccountSpec_GetUniqueId(ab_acc));
148
149 if (from_date) /* TODO: this should be simplified */
150 {
151 GWEN_DATE *dt;
152
153 dt=GWEN_Date_fromLocalTime(GWEN_Time_toTime_t(from_date));
154 AB_Transaction_SetFirstDate(job, dt);
155 GWEN_Date_free(dt);
156 }
157
158 if (to_date)
159 {
160 GWEN_DATE *dt;
161
162 dt=GWEN_Date_fromLocalTime(GWEN_Time_toTime_t(to_date));
163 AB_Transaction_SetLastDate(job, dt);
164 GWEN_Date_free(dt);
165 }
166
167 job_list = AB_Transaction_List2_new();
168 AB_Transaction_List2_PushBack(job_list, job);
169 /* Get a GUI object */
170 gui = gnc_GWEN_Gui_get(parent);
171 if (!gui)
172 {
173 g_warning("gnc_ab_gettrans: Couldn't initialize Gwenhywfar GUI");
174 goto cleanup;
175 }
176
177 /* Create a context to store the results */
178 context = AB_ImExporterContext_new();
179
180 /* Execute the job */
181 AB_Banking_SendCommands(api, job_list, context);
182
183 /* Ignore the return value of AB_Banking_ExecuteJobs(), as the job's
184 * status always describes better whether the job was actually
185 * transferred to and accepted by the bank. See also
186 * https://lists.gnucash.org/pipermail/gnucash-de/2008-September/006389.html
187 */
188 job_status = AB_Transaction_GetStatus(job);
189 if (job_status != AB_Transaction_StatusAccepted
190 && job_status != AB_Transaction_StatusPending)
191 {
192 g_warning("gnc_ab_gettrans: Error on executing job");
193 gnc_error_dialog (GTK_WINDOW (parent),
194 _("Error on executing job.\n\nStatus: %s (%d)"),
195 AB_Transaction_Status_toString(job_status),
196 job_status);
197 goto cleanup;
198 }
199
200 /* Import the results */
201 ieci = gnc_ab_import_context(context, AWAIT_TRANSACTIONS, FALSE, NULL,
202 parent);
203 if (!(gnc_ab_ieci_get_found(ieci) & FOUND_TRANSACTIONS))
204 {
205 /* No transaction found */
206 GtkWidget *dialog = gtk_message_dialog_new(
207 GTK_WINDOW(parent),
208 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
209 GTK_MESSAGE_INFO,
210 GTK_BUTTONS_OK,
211 "%s",
212 _("The Online Banking import returned no transactions "
213 "for the selected time period."));
214 gtk_dialog_run(GTK_DIALOG(dialog));
215 gtk_widget_destroy(dialog);
216 }
217
218 /* Store the date of this retrieval */
220
221cleanup:
222 if (ieci)
223 g_free(ieci);
224 if (context)
225 AB_ImExporterContext_free(context);
226 if (gui)
228 if (job_list)
229 AB_Transaction_List2_free(job_list);
230 if (job)
231 AB_Transaction_free(job);
232 if (to_date)
233 GWEN_Time_free(to_date);
234 if (from_date)
235 GWEN_Time_free(from_date);
237}
void gnc_ab_set_account_trans_retrieval(Account *a, time64 time)
Set the time of last online transaction retrieval for Account a.
Definition gnc-ab-kvp.c:109
guint gnc_ab_ieci_get_found(GncABImExContextImport *ieci)
Extract awaiting from data.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition gnc-date.h:87
#define DEBUG(format, args...)
Print a debugging message.
Definition qoflog.h:264

◆ gnc_ab_ieci_get_found()

guint gnc_ab_ieci_get_found ( GncABImExContextImport *  ieci)

Extract awaiting from data.

Parameters
ieciThe return value of gnc_ab_import_context()
Returns
The initial awaiting bitmask plus IGNORE_* for unexpected and then ignored items, and FOUND_* for non-empty items

Definition at line 1174 of file gnc-ab-utils.c.

1175{
1176 g_return_val_if_fail (ieci, 0);
1177
1178 return ieci->awaiting;
1179}

◆ gnc_ab_ieci_get_job_list()

GNC_AB_JOB_LIST2 * gnc_ab_ieci_get_job_list ( GncABImExContextImport *  ieci)

Extract the job list from data.

Parameters
ieciThe return value of gnc_ab_import_context()
Returns
The list of jobs, freeable with AB_Job_List2_FreeAll()

Definition at line 1182 of file gnc-ab-utils.c.

1183{
1184 g_return_val_if_fail (ieci, NULL);
1185
1186 return ieci->job_list;
1187}

◆ gnc_ab_ieci_run_matcher()

gboolean gnc_ab_ieci_run_matcher ( GncABImExContextImport *  ieci)

Run the generic transaction matcher dialog.

Parameters
ieciThe return value of gnc_ab_import_context()
Returns
The return value of gnc_gen_trans_list_run().

Definition at line 1190 of file gnc-ab-utils.c.

1191{
1192 g_return_val_if_fail (ieci, FALSE);
1193
1194 return gnc_gen_trans_list_run (ieci->generic_importer);
1195}
bool gnc_gen_trans_list_run(GNCImportMainMatcher *info)
Run this dialog and return only after the user pressed Ok, Cancel, or closed the window.

◆ gnc_ab_imexporter_list()

GList * gnc_ab_imexporter_list ( AB_BANKING *  abi)

Retrieve the available AQBanking importers.

Parameters
abiThe AQBanking instance.
Returns
a GList<AB_Node_Pair> containing importer names and descriptions.

Definition at line 1261 of file gnc-ab-utils.c.

1262{
1263 GList* desc_list = NULL;
1264 GWEN_PLUGIN_DESCRIPTION_LIST2 *il =
1265 AB_Banking_GetImExporterDescrs (api);
1266 GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR *ilit;
1267 g_return_val_if_fail (il, NULL);
1268 ilit = GWEN_PluginDescription_List2_First(il);
1269
1270 for (GWEN_PLUGIN_DESCRIPTION *pd =
1271 GWEN_PluginDescription_List2Iterator_Data(ilit);
1272 pd;
1273 pd = GWEN_PluginDescription_List2Iterator_Next(ilit))
1274 {
1275 AB_Node_Pair *node = NULL;
1276
1277 node = g_slice_new (AB_Node_Pair);
1278 node->name = g_strdup(GWEN_PluginDescription_GetName(pd));
1279 node->descr = g_strdup(GWEN_PluginDescription_GetShortDescr(pd));
1280 desc_list = g_list_prepend (desc_list, node);
1281 }
1282 GWEN_PluginDescription_List2_free(il);
1283 return g_list_sort (desc_list, (GCompareFunc)ab_node_pair_compare);
1284}

◆ gnc_ab_imexporter_profile_list()

GList * gnc_ab_imexporter_profile_list ( AB_BANKING *  abi,
const char *  importer_name 
)

Retrieve the available format templates for an AQBanking importer.

Parameters
apithe AQBanking instance.
importer_nameThe importer's name.
Returns
a GList<AB_Node_Pair> containing format template names and descriptions.

Definition at line 1287 of file gnc-ab-utils.c.

1288{
1289 GList* prof_list = NULL;
1290 GWEN_DB_NODE* db = AB_Banking_GetImExporterProfiles(api, importer_name);
1291 g_return_val_if_fail (db, NULL);
1292
1293 for (GWEN_DB_NODE *profile = GWEN_DB_GetFirstGroup(db); profile;
1294 profile = GWEN_DB_GetNextGroup(profile))
1295 {
1296 AB_Node_Pair *node = g_slice_new(AB_Node_Pair);
1297 if (!profile) continue;
1298 node->name = g_strdup(GWEN_DB_GetCharValue(profile, "name", 0, NULL));
1299 node->descr = g_strdup(GWEN_DB_GetCharValue(profile, "shortDescr", 0, NULL));
1300 prof_list = g_list_prepend (prof_list, node);
1301 }
1302 return g_list_sort (prof_list, (GCompareFunc)ab_node_pair_compare);
1303}

◆ gnc_ab_import_context()

GncABImExContextImport * gnc_ab_import_context ( AB_IMEXPORTER_CONTEXT *  context,
guint  awaiting,
gboolean  execute_txns,
AB_BANKING *  api,
GtkWidget *  parent 
)

Import balances and transactions found in a AB_IMEXPORTER_CONTEXT into GnuCash.

By using awaiting the caller can specify what the user will expect to receive. By using execute_txns, transactions in context can be used to generate corresponding AqBanking jobs, e.g. after a file import.

Parameters
contextAB_IMEXPORTER_CONTEXT to import
awaitingInformation the caller expects to receive or wants to ignore, bitmask of AWAIT_* or IGNORE_* values
execute_txnsIf awaiting contains AWAIT_TRANSACTIONS, whether to create an aqbanking job for each of the transactions found
apiIf execute_txns is TRUE, the AB_BANKING to get GNC_AB_ACCOUNT_SPECs from
parentWidget to set new dialogs transient for, may be NULL
Returns
A new GncABImExContextImport object which must be freed with g_free(), or NULL otherwise. If execute_txns is TRUE, additionally gnc_ab_ieci_get_job_list() must be called and the result freed with AB_Job_List2_FreeAll()

Definition at line 1103 of file gnc-ab-utils.c.

1106{
1107 GncABImExContextImport *data = g_new (GncABImExContextImport, 1);
1108 AB_IMEXPORTER_ACCOUNTINFO_LIST *ab_ail;
1109 g_return_val_if_fail (context, NULL);
1110 /* Do not await and ignore at the same time */
1111 g_return_val_if_fail (!(awaiting & AWAIT_BALANCES)
1112 || !(awaiting & IGNORE_BALANCES),
1113 NULL);
1114 g_return_val_if_fail (!(awaiting & AWAIT_TRANSACTIONS)
1115 || !(awaiting & IGNORE_TRANSACTIONS),
1116 NULL);
1117 /* execute_txns must be FALSE if txns are not awaited */
1118 g_return_val_if_fail (awaiting & AWAIT_TRANSACTIONS || !execute_txns, NULL);
1119 /* An api is needed for the jobs */
1120 g_return_val_if_fail (!execute_txns || api, NULL);
1121
1122 data->awaiting = awaiting;
1123 data->txn_found = FALSE;
1124 data->execute_txns = execute_txns;
1125 data->api = api;
1126 data->parent = parent;
1127 data->job_list = AB_Transaction_List2_new ();
1128 data->tmp_job_list = NULL;
1129 data->generic_importer = NULL;
1130
1131 g_datalist_init (&data->tmp_job_list);
1132
1133 /* Import transactions */
1134 ab_ail = AB_ImExporterContext_GetAccountInfoList (context);
1135 if (ab_ail && AB_ImExporterAccountInfo_List_GetCount (ab_ail))
1136 {
1137 if (!(awaiting & IGNORE_TRANSACTIONS))
1138 AB_ImExporterAccountInfo_List_ForEach (ab_ail,
1139 txn_accountinfo_cb,
1140 data);
1141
1142 /* populate and display the matching window */
1143 if (data->generic_importer)
1144 gnc_gen_trans_list_show_all (data->generic_importer);
1145
1146 /* Check balances */
1147 if (!(awaiting & IGNORE_BALANCES))
1148 AB_ImExporterAccountInfo_List_ForEach (ab_ail,
1149 bal_accountinfo_cb,
1150 data);
1151 }
1152
1153 /* Check bank-messages */
1154 {
1155 AB_MESSAGE * bankmsg = AB_ImExporterContext_GetFirstMessage (context);
1156 while (bankmsg)
1157 {
1158 const char* subject = AB_Message_GetSubject (bankmsg);
1159 const char* text = AB_Message_GetText (bankmsg);
1160 gnc_info_dialog (GTK_WINDOW(data->parent), "%s\n%s %s\n%s",
1161 _("The bank has sent a message in its response."),
1162 _("Subject:"),
1163 subject,
1164 text);
1165
1166 bankmsg = AB_Message_List_Next (bankmsg);
1167 }
1168 }
1169
1170 return data;
1171}
void gnc_gen_trans_list_show_all(GNCImportMainMatcher *info)
Shows widgets.

◆ gnc_ab_initial_assistant()

G_BEGIN_DECLS void gnc_ab_initial_assistant ( void  )

Create and show an assistant for the aqbanking setup.

Definition at line 809 of file assistant-ab-initial.c.

810{
811 if (!single_info)
812 single_info = gnc_ab_initial_assistant_new();
813 gtk_widget_show(single_info->window);
814}

◆ gnc_AB_JOB_ID_to_string()

gchar * gnc_AB_JOB_ID_to_string ( gulong  job_id)

Return the job_id as string.

Parameters
job_id
Returns
A newly allocated string

Definition at line 793 of file gnc-ab-utils.c.

794{
795 return g_strdup_printf ("job_%lu", job_id);
796}

◆ gnc_AB_JOB_to_readable_string()

gchar * gnc_AB_JOB_to_readable_string ( const GNC_AB_JOB *  job)

Return the job as string.

Parameters
valueGNC_AB_JOB or NULL
Returns
A newly allocated string

Definition at line 781 of file gnc-ab-utils.c.

782{
783 if (job)
784 {
785 return gnc_AB_JOB_ID_to_string (AB_Transaction_GetUniqueId (job));
786 }
787 else
788 {
789 return gnc_AB_JOB_ID_to_string (0);
790 }
791}
gchar * gnc_AB_JOB_ID_to_string(gulong job_id)
Return the job_id as string.

◆ gnc_ab_maketrans()

G_BEGIN_DECLS void gnc_ab_maketrans ( GtkWidget *  parent,
Account gnc_acc,
GncABTransType  trans_type 
)

Create SEPA transfers.

Parameters
parentWidget to use as parent, may be NULL
gnc_accGnuCash account to fetch balance for
trans_typeType of transaction

Definition at line 80 of file gnc-ab-transfer.c.

82{
83 AB_BANKING *api;
84 GNC_AB_ACCOUNT_SPEC *ab_acc;
85 GList *templates = NULL;
86 GncABTransDialog *td = NULL;
87 gboolean successful = FALSE;
88 gboolean aborted = FALSE;
89
90 g_return_if_fail(parent && gnc_acc);
91
92 /* Get the API */
93 api = gnc_AB_BANKING_new();
94 if (!api)
95 {
96 g_warning("gnc_ab_maketrans: Couldn't get AqBanking API");
97 return;
98 }
99 /* Get the AqBanking Account */
100 ab_acc = gnc_ab_get_ab_account(api, gnc_acc);
101 if (!ab_acc)
102 {
103 g_warning("gnc_ab_gettrans: No AqBanking account found");
104 gnc_error_dialog (GTK_WINDOW (parent), _("No valid online banking account assigned."));
105 goto cleanup;
106 }
107
108#if (AQBANKING_VERSION_INT >= 60400)
109 if (trans_type == SEPA_INTERNAL_TRANSFER)
110 {
111 /* Generate list of template transactions from the reference accounts*/
112 templates = gnc_ab_trans_templ_list_new_from_ref_accounts (ab_acc);
113 if (templates == NULL)
114 {
115 g_warning ("gnc_ab_gettrans: No reference accounts found");
116 gnc_error_dialog (GTK_WINDOW (parent), _("No reference accounts found."));
117 goto cleanup;
118 }
119 }
120 else
121#endif
122 {
123 /* Get list of template transactions */
125 gnc_account_get_book(gnc_acc));
126 }
127
128 /* Create new ABTransDialog */
129 td = gnc_ab_trans_dialog_new(parent, ab_acc,
131 trans_type, templates);
132 templates = NULL;
133
134 /* Repeat until AqBanking action was successful or user pressed cancel */
135 do
136 {
137 GncGWENGui *gui = NULL;
138 gint result;
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;
143 gnc_numeric amount;
144 gchar *description;
145 gchar *memo;
146 Transaction *gnc_trans = NULL;
147 AB_IMEXPORTER_CONTEXT *context = NULL;
148 GNC_AB_JOB_STATUS job_status;
149 GncABImExContextImport *ieci = NULL;
150
151
152 /* Let the user enter the values */
154
155#if (AQBANKING_VERSION_INT >= 60400)
156 gboolean changed;
157 templates = gnc_ab_trans_dialog_get_templ(td, &changed);
158 if (trans_type != SEPA_INTERNAL_TRANSFER && changed)
159 {
160 /* Save the templates */
161 save_templates(parent, gnc_acc, templates,
162 (result == GNC_RESPONSE_NOW));
163 }
164 g_list_free(templates);
165 templates = NULL;
166#endif
167
168 if (result != GNC_RESPONSE_NOW && result != GNC_RESPONSE_LATER)
169 {
170 aborted = TRUE;
171 goto repeat;
172 }
173
174 /* Get a job and enqueue it */
177 if (!job || AB_AccountSpec_GetTransactionLimitsForCommand(ab_acc, AB_Transaction_GetCommand(job))==NULL)
178 {
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"
183 "\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"
188 "\n"
189 "Do you want to enter the job again?")))
190 aborted = TRUE;
191 goto repeat;
192 }
193 job_list = AB_Transaction_List2_new();
194 AB_Transaction_List2_PushBack(job_list, job);
195 /* Setup a Transfer Dialog for the GnuCash transaction */
196 xfer_dialog = gnc_xfer_dialog(gnc_ab_trans_dialog_get_parent(td),
197 gnc_acc);
198 switch (trans_type)
199 {
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);
204 break;
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);
209 break;
210 case SEPA_TRANSFER:
211 gnc_xfer_dialog_set_title(
212 xfer_dialog, _("Online Banking European (SEPA) Transfer"));
213 gnc_xfer_dialog_lock_from_account_tree(xfer_dialog);
214 break;
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);
220 break;
221#endif
222 case SEPA_DEBITNOTE:
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);
226 break;
227 case SINGLE_TRANSFER:
228 default:
229 gnc_xfer_dialog_set_title(
230 xfer_dialog, _("Online Banking Transaction"));
231 gnc_xfer_dialog_lock_from_account_tree(xfer_dialog);
232 }
233 gnc_xfer_dialog_set_to_show_button_active(xfer_dialog, TRUE);
234
235 amount = double_to_gnc_numeric(
236 AB_Value_GetValueAsDouble(AB_Transaction_GetValue(ab_trans)),
238 GNC_HOW_RND_ROUND_HALF_UP);
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);
242
243 /* OFX doesn't do transfers. */
244 description = gnc_ab_description_to_gnc(ab_trans, FALSE);
245 gnc_xfer_dialog_set_description(xfer_dialog, description);
246 g_free(description);
247
248 memo = gnc_ab_memo_to_gnc(ab_trans);
249 gnc_xfer_dialog_set_memo(xfer_dialog, memo);
250 g_free(memo);
251
252 gnc_xfer_dialog_set_txn_cb(xfer_dialog, txn_created_cb, &gnc_trans);
253
254 /* And run it */
255 successful = gnc_xfer_dialog_run_until_done(xfer_dialog);
256
257 /* On cancel, go back to the AB transaction dialog */
258 if (!successful || !gnc_trans)
259 {
260 successful = FALSE;
261 goto repeat;
262 }
263
264 if (result == GNC_RESPONSE_NOW)
265 {
266 /* Create a context to store possible results */
267 context = AB_ImExporterContext_new();
268
269 gui = gnc_GWEN_Gui_get(parent);
270 if (!gui)
271 {
272 g_warning("gnc_ab_maketrans: Couldn't initialize Gwenhywfar GUI");
273 aborted = TRUE;
274 goto repeat;
275 }
276
277 /* Finally, execute the job */
278 AB_Banking_SendCommands(api, job_list, context);
279 /* Ignore the return value of AB_Banking_ExecuteJobs(), as the job's
280 * status always describes better whether the job was actually
281 * transferred to and accepted by the bank. See also
282 * https://lists.gnucash.org/pipermail/gnucash-de/2008-September/006389.html
283 */
284 job_status = AB_Transaction_GetStatus(job);
285 if (job_status != AB_Transaction_StatusAccepted
286 && job_status != AB_Transaction_StatusPending)
287 {
288 successful = FALSE;
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"
293 "\n"
294 "Do you want to enter the job again?")))
295 {
296 aborted = TRUE;
297 }
298 }
299 else
300 {
301 successful = TRUE;
302 }
303
304 if (successful)
305 {
306 /* Import the results, awaiting nothing */
307 ieci = gnc_ab_import_context(context, 0, FALSE, NULL, parent);
308 }
309 }
310 /* Simply ignore any other case */
311
312repeat:
313 /* Clean up */
314 if (gnc_trans && !successful)
315 {
316 xaccTransBeginEdit(gnc_trans);
317 xaccTransDestroy(gnc_trans);
318 xaccTransCommitEdit(gnc_trans);
319 gnc_trans = NULL;
320 }
321 if (ieci)
322 g_free(ieci);
323 if (context)
324 AB_ImExporterContext_free(context);
325 if (job_list)
326 {
327 AB_Transaction_List2_free(job_list);
328 job_list = NULL;
329 }
330 if (job)
331 {
332 AB_Transaction_free(job);
333 job = NULL;
334 }
335 if (gui)
336 {
338 gui = NULL;
339 }
340
341 }
342 while (!successful && !aborted);
343
344cleanup:
345 if (td)
348}
int xaccAccountGetCommoditySCU(const Account *acc)
Return the SCU for the account.
Definition Account.cpp:2745
GtkWidget * gnc_ab_trans_dialog_get_parent(const GncABTransDialog *td)
Retrieve the widget used as parent.
gchar * gnc_ab_memo_to_gnc(const AB_TRANSACTION *ab_trans)
Create the appropriate memo field for a GnuCash Split by the information given in the AB_TRANSACTION ...
GncABTransDialog * gnc_ab_trans_dialog_new(GtkWidget *parent, GNC_AB_ACCOUNT_SPEC *ab_acc, gint commodity_scu, GncABTransType trans_type, GList *templates)
Create a new AqBanking transfer dialog.
GNC_AB_JOB * gnc_ab_trans_dialog_get_job(const GncABTransDialog *td)
Receive the Aqbanking job filled by the dialog.
gchar * gnc_ab_description_to_gnc(const AB_TRANSACTION *ab_trans, gboolean is_ofx)
Create the appropriate description field for a GnuCash Transaction by the information given in the AB...
gint gnc_ab_trans_dialog_run_until_ok(GncABTransDialog *td)
Run the Aqbanking transfer dialog until correct values where entered or the user cancelled the dialog...
GList * gnc_ab_trans_templ_list_new_from_book(QofBook *b)
Obtain the list of QofTemplates saved in a Book.
const AB_TRANSACTION * gnc_ab_trans_dialog_get_ab_trans(const GncABTransDialog *td)
Receive the Aqbanking Transaction filled by the dialog.
void gnc_ab_trans_dialog_free(GncABTransDialog *td)
Free a Aqbanking transfer dialog.
void xaccTransDestroy(Transaction *trans)
Destroys a transaction.
void xaccTransCommitEdit(Transaction *trans)
The xaccTransCommitEdit() method indicates that the changes to the transaction and its splits are com...
void xaccTransBeginEdit(Transaction *trans)
The xaccTransBeginEdit() method must be called before any changes are made to a transaction or any of...
gnc_numeric double_to_gnc_numeric(double in, gint64 denom, gint how)
Convert a floating-point number to a gnc_numeric.

◆ gnc_ab_memo_to_gnc()

gchar * gnc_ab_memo_to_gnc ( const AB_TRANSACTION *  ab_trans)

Create the appropriate memo field for a GnuCash Split by the information given in the AB_TRANSACTION ab_trans.

The returned string must be g_free'd by the caller.

Parameters
ab_transAqBanking transaction
Returns
A newly allocated string, may be ""

Definition at line 439 of file gnc-ab-utils.c.

440{
441 const gchar *ab_remote_accountnumber =
442 AB_Transaction_GetRemoteAccountNumber (ab_trans);
443 const gchar *ab_remote_bankcode =
444 AB_Transaction_GetRemoteBankCode (ab_trans);
445
446 gchar *ab_other_accountid;
447 gchar *ab_other_bankcode;
448
449 gboolean have_accountid;
450 gboolean have_bankcode;
451
452 gchar *retval;
453
454 // For SEPA transactions, we need to ask for something different here
455 if (!ab_remote_accountnumber)
456 ab_remote_accountnumber = AB_Transaction_GetRemoteIban (ab_trans);
457 if (!ab_remote_bankcode)
458 ab_remote_bankcode = AB_Transaction_GetRemoteBic (ab_trans);
459
460 ab_other_accountid = g_strdup (ab_remote_accountnumber ? ab_remote_accountnumber : "");
461 ab_other_bankcode = g_strdup (ab_remote_bankcode ? ab_remote_bankcode : "");
462
463 /* Ensure string is in utf8 */
464 gnc_utf8_strip_invalid (ab_other_accountid);
465 gnc_utf8_strip_invalid (ab_other_bankcode);
466
467 /* and -then- trim it */
468 g_strstrip (ab_other_accountid);
469 g_strstrip (ab_other_bankcode);
470
471
472 have_accountid = ab_other_accountid && *ab_other_accountid;
473 have_bankcode = ab_other_bankcode && *ab_other_bankcode;
474
475 if ( have_accountid || have_bankcode )
476 {
477 retval = g_strdup_printf ("%s %s %s %s",
478 have_accountid ? _("Account") : "",
479 have_accountid ? ab_other_accountid : "",
480 have_bankcode ? _("Bank") : "",
481 have_bankcode ? ab_other_bankcode : ""
482 );
483 g_strstrip (retval);
484 }
485 else
486 {
487 retval = g_strdup ("");
488 }
489
490 g_free (ab_other_accountid);
491 g_free (ab_other_bankcode);
492
493 return retval;
494}
void gnc_utf8_strip_invalid(gchar *str)
Strip any non-UTF-8 characters from a string.

◆ gnc_ab_select_imex_dlg_destroy()

void gnc_ab_select_imex_dlg_destroy ( GncABSelectImExDlg *  imexd)

Destroy an AQBanking importer/exporter selection dialog.

Parameters
imexdthe dialog.

Definition at line 136 of file dialog-ab-select-imexporter.c.

137{
138
139 if (imexd->imexporter_list)
140 gtk_list_store_clear (imexd->imexporter_list);
141
142 if (imexd->profile_list)
143 gtk_list_store_clear (imexd->profile_list);
144
145 if (imexd->dialog)
146 gtk_widget_destroy (imexd->dialog);
147
148 g_free (imexd);
149}

◆ gnc_ab_select_imex_dlg_get_imexporter_name()

char * gnc_ab_select_imex_dlg_get_imexporter_name ( GncABSelectImExDlg *  imexd)

Get the selected importer/exporter name.

Parameters
imexdthe dialog with the selection
Returns
the selected importer/exporter name, free with g_free.

Definition at line 266 of file dialog-ab-select-imexporter.c.

267{
268 return tree_view_get_name (GTK_TREE_VIEW (imexd->select_imexporter));
269}

◆ gnc_ab_select_imex_dlg_get_profile_name()

char * gnc_ab_select_imex_dlg_get_profile_name ( GncABSelectImExDlg *  imexd)

Get the selected file format profile name.

Parameters
imexdthe dialog with the selection
Returns
the selected format profile name, free with g_free.

Definition at line 272 of file dialog-ab-select-imexporter.c.

273{
274 return tree_view_get_name (GTK_TREE_VIEW (imexd->select_profile));
275}

◆ gnc_ab_select_imex_dlg_new()

G_BEGIN_DECLS GncABSelectImExDlg * gnc_ab_select_imex_dlg_new ( GtkWidget *  parent,
AB_BANKING *  abi 
)

Create an AQBanking importer/exporter selection dialog.

Parameters
parentA widget to center the dialog over.
abiThe AQBanking instance to query.
Returns
a GncABSelectImExDlg.

Definition at line 80 of file dialog-ab-select-imexporter.c.

81{
82 GncABSelectImExDlg* imexd;
83 GtkBuilder* builder;
84 GList* imexporters;
85 GtkTreeSelection *imex_select = NULL, *prof_select = NULL;
86
87 g_return_val_if_fail (abi, NULL);
88 imexporters = gnc_ab_imexporter_list (abi);
89 g_return_val_if_fail (imexporters, NULL);
90 imexd = g_new0(GncABSelectImExDlg, 1);
91 imexd->parent = parent;
92 imexd->abi = abi;
93
94 g_signal_connect (parent, "destroy",
95 G_CALLBACK (gtk_widget_destroyed), &imexd->parent);
96 builder = gtk_builder_new();
97 gnc_builder_add_from_file (builder, "dialog-ab.glade", "imexporter-list");
98 gnc_builder_add_from_file (builder, "dialog-ab.glade", "profile-list");
99 gnc_builder_add_from_file (builder, "dialog-ab.glade",
100 "aqbanking-select-imexporter-dialog");
101 imexd->dialog =
102 GTK_WIDGET (gtk_builder_get_object (builder,
103 "aqbanking-select-imexporter-dialog"));
104 g_signal_connect (imexd->dialog, "destroy",
105 G_CALLBACK (gtk_widget_destroyed), &imexd->dialog);
106 imexd->imexporter_list =
107 GTK_LIST_STORE (gtk_builder_get_object (builder, "imexporter-list"));
108 imexd->profile_list =
109 GTK_LIST_STORE (gtk_builder_get_object (builder, "profile-list"));
110 imexd->select_imexporter =
111 GTK_WIDGET (gtk_builder_get_object (builder, "imexporter-sel"));
112 imexd->select_profile =
113 GTK_WIDGET (gtk_builder_get_object (builder, "profile-sel"));
114 imexd->ok_button =
115 GTK_WIDGET (gtk_builder_get_object (builder, "imex-okbutton"));
116
117 imex_select = GTK_TREE_SELECTION (gtk_builder_get_object (builder, "imex-selection"));
118 prof_select = GTK_TREE_SELECTION (gtk_builder_get_object (builder, "prof-selection"));
119 populate_list_store (imexd->imexporter_list,
120 imexporters);
121
122 g_signal_connect (imex_select, "changed", G_CALLBACK(imexporter_changed),
123 imexd);
124 g_signal_connect (prof_select, "changed", G_CALLBACK(profile_changed),
125 imexd);
126 g_list_free (imexporters);
127 g_object_unref (G_OBJECT (builder));
128
129 gtk_window_set_transient_for (GTK_WINDOW (imexd->dialog),
130 GTK_WINDOW (imexd->parent));
131
132 return imexd;
133}
GList * gnc_ab_imexporter_list(AB_BANKING *api)
Retrieve the available AQBanking importers.

◆ gnc_ab_select_imex_dlg_run()

int gnc_ab_select_imex_dlg_run ( GncABSelectImExDlg *  imexd)

Run an AQBanking importer/exporter selection dialog.

Parameters
imexdthe dialog.
Returns
A GTK_RESPONSE status.

Definition at line 214 of file dialog-ab-select-imexporter.c.

215{
216
217 int response = gtk_dialog_run (GTK_DIALOG (imexd->dialog));
218 return response == GTK_RESPONSE_OK ? TRUE : FALSE;
219}

◆ gnc_ab_select_imex_dlg_set_imexporter_name()

void gnc_ab_select_imex_dlg_set_imexporter_name ( GncABSelectImExDlg *  imexd,
const char *  name 
)

Get the selected importer/exporter name.

Parameters
imexdthe dialog with the selection @para name the importer/exporter name to select.

Definition at line 278 of file dialog-ab-select-imexporter.c.

279{
280 if (name)
281 tree_view_set_name (GTK_TREE_VIEW (imexd->select_imexporter), name);
282}

◆ gnc_ab_select_imex_dlg_set_profile_name()

void gnc_ab_select_imex_dlg_set_profile_name ( GncABSelectImExDlg *  imexd,
const char *  name 
)

Get the selected file format profile name.

Parameters
imexdthe dialog with the selection
namethe profile to select.

Definition at line 285 of file dialog-ab-select-imexporter.c.

286{
287 if (name)
288 tree_view_set_name (GTK_TREE_VIEW (imexd->select_profile), name);
289}

◆ gnc_ab_set_account_accountid()

void gnc_ab_set_account_accountid ( Account a,
const gchar *  id 
)

Set the accountid string in the Account a to id.

A copy of the string will be stored. The Account will be marked as "dirty".

Parameters
aAccount
idAccount ID

Definition at line 49 of file gnc-ab-kvp.c.

50{
52 qof_instance_set (QOF_INSTANCE (a),
53 "ab-account-id", id,
54 NULL);
56}
void xaccAccountCommitEdit(Account *acc)
ThexaccAccountCommitEdit() subroutine is the second phase of a two-phase-commit wrapper for account u...
Definition Account.cpp:1516
void xaccAccountBeginEdit(Account *acc)
The xaccAccountBeginEdit() subroutine is the first phase of a two-phase-commit wrapper for account up...
Definition Account.cpp:1475
void qof_instance_set(QofInstance *inst, const gchar *first_prop,...)
Wrapper for g_object_set Group setting multiple parameters in a single begin/commit/rollback.

◆ gnc_ab_set_account_bankcode()

void gnc_ab_set_account_bankcode ( Account a,
const gchar *  code 
)

Set the bankcode string in the Account a to code.

A copy of the string will be stored. The Account will be marked as "dirty".

Parameters
aAccount
codeBank code

Definition at line 69 of file gnc-ab-kvp.c.

70{
72 qof_instance_set (QOF_INSTANCE (a),
73 "ab-bank-code", code,
74 NULL);
76}

◆ gnc_ab_set_account_trans_retrieval()

void gnc_ab_set_account_trans_retrieval ( Account a,
time64  time 
)

Set the time of last online transaction retrieval for Account a.

The account will be marked as "dirty".

Parameters
aAccount
timeRetrieval time

Definition at line 109 of file gnc-ab-kvp.c.

110{
111 Time64 t = {time};
113 qof_instance_set (QOF_INSTANCE (a),
114 "ab-trans-retrieval", &t,
115 NULL);
117}

◆ gnc_ab_set_account_uid()

void gnc_ab_set_account_uid ( Account a,
guint32  uid 
)

Set the unique id for the AB_BANKING account in the Account a to uid.

The Account will be marked as "dirty".

Parameters
aAccount
uidUnique ID

Definition at line 89 of file gnc-ab-kvp.c.

90{
92 qof_instance_set (QOF_INSTANCE (a),
93 "ab-account-uid", (guint64)uid,
94 NULL);
96}

◆ gnc_ab_set_book_template_list()

void gnc_ab_set_book_template_list ( QofBook b,
GList *  template_list 
)

Set the GList of kvp_frames of template transactions in the Book b to template_list.

No copy of the GList will be stored, the callee becomes the owner and the caller must not free it. The book will be marked "dirty".

Parameters
bBook
template_listTemplate list

Definition at line 180 of file gnc-aqbanking-templates.cpp.

181{
182 GList *kvp_list = NULL;
183 for (auto node = template_list; node != NULL; node = g_list_next (node))
184 {
185 auto templ = static_cast<_GncABTransTempl*>(node->data);
186 auto value = new KvpValue(templ->make_kvp_frame());
187 kvp_list = g_list_prepend (kvp_list, value);
188 }
189 kvp_list = g_list_reverse (kvp_list);
190 auto value = new KvpValue(g_list_copy_deep(kvp_list, copy_list_value,
191 nullptr));
192 qof_book_begin_edit(b);
193 KvpFrame *toplevel = qof_instance_get_slots (QOF_INSTANCE (b));
194 delete toplevel->set_path({"hbci", "template-list"}, value);
195 qof_instance_set_dirty_flag (QOF_INSTANCE (b), TRUE);
196 qof_book_commit_edit(b);
197}
A template for an AqBanking transaction.

◆ gnc_ab_trans_dialog_free()

void gnc_ab_trans_dialog_free ( GncABTransDialog *  td)

Free a Aqbanking transfer dialog.

Parameters
tdTransaction dialog

Definition at line 749 of file dialog-ab-trans.c.

750{
751 if (!td) return;
752 if (td->ab_trans)
753 AB_Transaction_free(td->ab_trans);
754 if (td->dialog)
755 gtk_widget_destroy(td->dialog);
756
757#if (AQBANKING_VERSION_INT >= 60400)
758 if (td->template_list_store)
759 {
760 gtk_tree_model_foreach(GTK_TREE_MODEL(td->template_list_store),
761 gnc_ab_trans_dialog_clear_templ_helper, NULL);
762 g_object_unref(td->template_list_store);
763 }
764#endif
765 g_free(td);
766}

◆ gnc_ab_trans_dialog_get_ab_trans()

const AB_TRANSACTION * gnc_ab_trans_dialog_get_ab_trans ( const GncABTransDialog *  td)

Receive the Aqbanking Transaction filled by the dialog.

Parameters
tdTransaction dialog
Returns
An Aqbanking transaction

Definition at line 814 of file dialog-ab-trans.c.

815{
816 g_return_val_if_fail(td, NULL);
817 return td->ab_trans;
818}

◆ gnc_ab_trans_dialog_get_job()

GNC_AB_JOB * gnc_ab_trans_dialog_get_job ( const GncABTransDialog *  td)

Receive the Aqbanking job filled by the dialog.

Parameters
tdTransaction dialog
Returns
An Aqbanking job

Definition at line 859 of file dialog-ab-trans.c.

860{
861 g_return_val_if_fail(td, NULL);
862 return gnc_ab_get_trans_job(td->ab_acc, td->ab_trans, td->trans_type);
863}
GNC_AB_JOB * gnc_ab_get_trans_job(GNC_AB_ACCOUNT_SPEC *ab_acc, const AB_TRANSACTION *ab_trans, GncABTransType trans_type)
Return the AqBanking job associated with the transaction.

◆ gnc_ab_trans_dialog_get_parent()

GtkWidget * gnc_ab_trans_dialog_get_parent ( const GncABTransDialog *  td)

Retrieve the widget used as parent.

Parameters
tdTransaction dialog
Returns
The parent

Definition at line 807 of file dialog-ab-trans.c.

808{
809 g_return_val_if_fail(td, NULL);
810 return td->parent;
811}

◆ gnc_ab_trans_dialog_new()

GncABTransDialog * gnc_ab_trans_dialog_new ( GtkWidget *  parent,
GNC_AB_ACCOUNT_SPEC *  ab_acc,
gint  commodity_scu,
GncABTransType  trans_type,
GList *  templates 
)

Create a new AqBanking transfer dialog.

Parameters
parentWidget to use as parent, may be NULL
ab_accAqbanking account
commodity_scucommodity used for the amount
trans_typeType of transaction
templatesA GList of template transactions which will become fully managed by the dialog, so do not free it and retrieve snapshots via gnc_ab_trans_dialog_get_templ()
Returns
A new GncABTransDialog, free with gnc_ab_trans_dialog_free()

Definition at line 242 of file dialog-ab-trans.c.

245{
246 GncABTransDialog *td;
247 GtkBuilder *builder;
248 const gchar *ab_ownername;
249 const gchar *ab_accountnumber;
250 const gchar *ab_bankname;
251 const gchar *ab_bankcode;
252 G_GNUC_UNUSED GtkWidget *trans_vbox;
253 GtkWidget *heading_label;
254 GtkWidget *recp_name_heading;
255 GtkWidget *recp_account_heading;
256 GtkWidget *recp_bankcode_heading;
257 GtkWidget *amount_hbox, *amount_label;
258 GtkWidget *orig_name_heading;
259 GtkWidget *orig_account_heading;
260 GtkWidget *orig_account_label;
261 G_GNUC_UNUSED GtkWidget *orig_bankname_heading;
262 GtkWidget *orig_bankname_label;
263 GtkWidget *orig_bankcode_heading;
264 GtkWidget *orig_bankcode_label;
265 GtkCellRenderer *renderer;
266 GtkTreeViewColumn *column;
267#if (AQBANKING_VERSION_INT >= 60400)
268 GtkExpander *template_expander;
269 GtkWidget *template_label;
270 GtkWidget *add_templ_button;
271 GtkWidget *del_templ_button;
272#endif
273
274 g_return_val_if_fail(ab_acc, NULL);
275
276 ab_ownername = AB_AccountSpec_GetOwnerName(ab_acc);
277 if (!ab_ownername)
278 ab_ownername = "";
279 ab_accountnumber = AB_AccountSpec_GetAccountNumber(ab_acc);
280 ab_bankcode = AB_AccountSpec_GetBankCode(ab_acc);
281 ab_bankname = _("(unknown)");
282
283 td = g_new0(GncABTransDialog, 1);
284 td->parent = parent;
285 td->ab_acc = ab_acc;
286 td->trans_type = trans_type;
287
288 builder = gtk_builder_new();
289 gnc_builder_add_from_file (builder, "dialog-ab.glade", "aqbanking_transaction_dialog");
290 td->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "aqbanking_transaction_dialog"));
291
292 if (parent)
293 gtk_window_set_transient_for(GTK_WINDOW(td->dialog), GTK_WINDOW(parent));
294
295 /* Extract widgets */
296 trans_vbox = GTK_WIDGET(gtk_builder_get_object (builder, "trans_vbox"));
297 heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
298 recp_name_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_name_heading"));
299 td->recp_name_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_name_entry"));
300 recp_account_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_account_heading"));
301 td->recp_account_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_account_entry"));
302 recp_bankcode_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankcode_heading"));
303 td->recp_bankcode_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankcode_entry"));
304 td->recp_bankname_label = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankname_label"));
305 amount_hbox = GTK_WIDGET(gtk_builder_get_object (builder, "amount_hbox"));
306 amount_label = GTK_WIDGET(gtk_builder_get_object (builder, "amount_label"));
307 td->purpose_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_entry"));
308 td->purpose_cont_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont_entry"));
309 td->purpose_cont2_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont2_entry"));
310 td->purpose_cont3_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont3_entry"));
311 td->exec_button = GTK_WIDGET(gtk_builder_get_object(builder, "exec_now_button"));
312 orig_name_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_name_heading"));
313 td->orig_name_entry = GTK_WIDGET(gtk_builder_get_object (builder, "orig_name_label"));
314 orig_account_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_account_heading"));
315 orig_account_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_account_label"));
316 orig_bankname_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankname_heading"));
317 orig_bankname_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankname_label"));
318 orig_bankcode_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankcode_heading"));
319 orig_bankcode_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankcode_label"));
320 td->template_gtktreeview =
321 GTK_TREE_VIEW(gtk_builder_get_object (builder, "template_list"));
322#if (AQBANKING_VERSION_INT >= 60400)
323 template_expander = GTK_EXPANDER(gtk_builder_get_object (builder, "expander1"));
324 template_label = GTK_WIDGET(gtk_builder_get_object (builder, "label1"));
325 add_templ_button= GTK_WIDGET(gtk_builder_get_object(builder, "add_templ_button"));
326 del_templ_button= GTK_WIDGET(gtk_builder_get_object(builder, "del_templ_button"));
327#endif
328
329 /* Amount edit */
330 td->amount_edit = gnc_amount_edit_new();
331 gtk_box_pack_start(GTK_BOX(amount_hbox), td->amount_edit, TRUE, TRUE, 0);
332 gnc_amount_edit_make_mnemonic_target(GNC_AMOUNT_EDIT(td->amount_edit), amount_label);
333 gnc_amount_edit_set_evaluate_on_enter(GNC_AMOUNT_EDIT(td->amount_edit),
334 TRUE);
335 gnc_amount_edit_set_fraction(GNC_AMOUNT_EDIT(td->amount_edit),
336 commodity_scu);
337
338 /* Use "focus-out" signal because "amount-changed" is only sent when ENTER is pressed */
339 g_signal_connect_swapped (gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(td->amount_edit)), "focus-out-event",
340 G_CALLBACK(gnc_ab_trans_dialog_verify_values), td);
341
342 /* Check for what kind of transaction this should be, and change the
343 * labels accordingly */
344 switch (trans_type)
345 {
346 case SINGLE_TRANSFER:
347 case SINGLE_INTERNAL_TRANSFER:
348 /* all labels are already set */
349 break;
350 case SEPA_TRANSFER:
351 gtk_label_set_text(GTK_LABEL (heading_label),
352 /* Translators: Strings from this file are
353 needed only in countries that have one of
354 aqbanking's Online Banking techniques
355 available. This is 'OFX DirectConnect'
356 (U.S. and others), 'HBCI' (Germany),
357 or 'YellowNet' (Switzerland). If none of
358 these techniques are available in your
359 country, you may safely ignore strings
360 from the import-export/hbci
361 subdirectory. */
362 _("Enter a SEPA Online Transfer"));
363 gtk_label_set_text(GTK_LABEL(recp_account_heading),
364 _("Recipient IBAN (International Account Number)"));
365 gtk_label_set_text(GTK_LABEL(recp_bankcode_heading),
366 _("Recipient BIC (Bank Code)"));
367
368 gtk_label_set_text(GTK_LABEL(orig_account_heading),
369 _("Originator IBAN (International Account Number)"));
370 gtk_label_set_text(GTK_LABEL(orig_bankcode_heading),
371 _("Originator BIC (Bank Code)"));
372 break;
373
374#if (AQBANKING_VERSION_INT >= 60400)
375 case SEPA_INTERNAL_TRANSFER:
376 gtk_label_set_text(GTK_LABEL (heading_label),
377 _("Enter a SEPA Internal Transfer"));
378 gtk_label_set_text(GTK_LABEL(recp_account_heading),
379 _("Recipient IBAN (International Account Number)"));
380 gtk_label_set_text(GTK_LABEL(recp_bankcode_heading),
381 _("Recipient BIC (Bank Code)"));
382
383 gtk_label_set_text(GTK_LABEL(orig_account_heading),
384 _("Originator IBAN (International Account Number)"));
385 gtk_label_set_text(GTK_LABEL(orig_bankcode_heading),
386 _("Originator BIC (Bank Code)"));
387 /* Disable target account entry for SEPA internal transfers, but only let choose from templates */
388 gtk_widget_set_sensitive(td->recp_name_entry, FALSE);
389 gtk_widget_set_sensitive(td->recp_account_entry, FALSE);
390 gtk_widget_set_sensitive(td->recp_bankcode_entry, FALSE);
391 gtk_widget_set_sensitive(add_templ_button, FALSE);
392 gtk_widget_set_visible(add_templ_button, FALSE);
393 gtk_widget_set_can_focus(add_templ_button, FALSE);
394 gtk_widget_set_sensitive(del_templ_button, FALSE);
395 gtk_widget_set_visible(del_templ_button, FALSE);
396 gtk_widget_set_can_focus(del_templ_button, FALSE);
397 gtk_label_set_text(GTK_LABEL(template_label),
398 _("Target Accounts"));
399 gtk_expander_set_expanded(template_expander, TRUE);
400 break;
401#endif
402
403 case SINGLE_DEBITNOTE:
404 /* this case is no longer in use; don't introduce extra strings */
405 break;
406
407 case SEPA_DEBITNOTE:
408 gtk_label_set_text(GTK_LABEL (heading_label),
409 _("Enter a SEPA Online Direct Debit Note"));
410
411 gtk_label_set_text(GTK_LABEL(recp_name_heading),
412 _("Debited Account Owner"));
413 gtk_label_set_text(GTK_LABEL(recp_account_heading),
414 _("Debited IBAN (International Account Number)"));
415 gtk_label_set_text(GTK_LABEL(recp_bankcode_heading),
416 _("Debited BIC (Bank Code)"));
417
418 gtk_label_set_text(GTK_LABEL(orig_name_heading),
419 _("Credited Account Owner"));
420 gtk_label_set_text(GTK_LABEL(orig_account_heading),
421 _("Credited IBAN (International Account Number)"));
422 gtk_label_set_text(GTK_LABEL(orig_bankcode_heading),
423 _("Credited BIC (Bank Code)"));
424 break;
425
426 default:
427 g_critical("gnc_ab_trans_dialog_new: Oops, unknown GncABTransType %d",
428 trans_type);
429 break;
430 }
431
432 /* Additionally change the labels for the European (SEPA) transactions */
433 if (gnc_ab_trans_isSEPA(trans_type))
434 {
435 // Also, SEPA might have much longer IBAN (up to 34 chars) and BIC (11)
436 gtk_entry_set_max_length(GTK_ENTRY(td->recp_bankcode_entry), 11);
437 gtk_entry_set_max_length(GTK_ENTRY(td->recp_account_entry), 34);
438 }
439
440 gtk_entry_set_text(GTK_ENTRY(td->orig_name_entry), ab_ownername);
441 gtk_label_set_text(GTK_LABEL(orig_bankname_label), ab_bankname);
442 if (gnc_ab_trans_isSEPA(trans_type))
443 {
444 gtk_widget_set_sensitive(GTK_WIDGET(td->orig_name_entry), TRUE);
445 ab_accountnumber = AB_AccountSpec_GetIban(ab_acc);
446 ab_bankcode = AB_AccountSpec_GetBic(ab_acc);
447 gtk_label_set_text(GTK_LABEL(orig_account_label), ab_accountnumber);
448 gtk_label_set_text (GTK_LABEL (orig_bankcode_label), ab_bankcode);
449 }
450 else
451 {
452 gtk_widget_set_sensitive(GTK_WIDGET(td->orig_name_entry), FALSE);
453 gtk_label_set_text(GTK_LABEL(orig_account_label), ab_accountnumber);
454 gtk_label_set_text (GTK_LABEL (orig_bankcode_label), ab_bankcode);
455 }
456
457#if (AQBANKING_VERSION_INT >= 60400)
458 /* Fill list for choosing a transaction template */
459 td->template_list_store = gtk_list_store_new(TEMPLATE_NUM_COLUMNS,
460 G_TYPE_STRING, G_TYPE_POINTER);
461 g_list_foreach(templates, gnc_ab_trans_dialog_fill_templ_helper, td->template_list_store);
462 gtk_tree_view_set_model(td->template_gtktreeview,
463 GTK_TREE_MODEL(td->template_list_store));
464 td->templ_changed = FALSE;
465 /* Keep a reference to the store */
466#endif
467 /* Show this list */
468 renderer = gtk_cell_renderer_text_new();
469 column = gtk_tree_view_column_new_with_attributes(
470 "Template Name", renderer, "text", TEMPLATE_NAME, NULL);
471 gtk_tree_view_append_column(td->template_gtktreeview, column);
472
473 /* Connect the Signals */
474 gtk_builder_connect_signals_full(builder, gnc_builder_connect_full_func, td);
475
476 g_object_unref(G_OBJECT(builder));
477
478 /* Disabled OK button until suitable values are filled */
479 gnc_ab_trans_dialog_verify_values(td);
480
481 return td;
482}
gboolean gnc_ab_trans_isSEPA(GncABTransType t)
Returns true if the given GncABTransType is an European (SEPA) transaction (transfer or debit note),...

◆ gnc_ab_trans_dialog_run_until_ok()

gint gnc_ab_trans_dialog_run_until_ok ( GncABTransDialog *  td)

Run the Aqbanking transfer dialog until correct values where entered or the user cancelled the dialog.

Parameters
tdTransaction dialog
ab_accAqBanking account
Returns
GTK_RESPONSE_CANCEL or GTK_RESPONSE_DESTROY_EVENT if the user cancelled the dialog and GNC_RESPONSE_NOW otherwise.

Definition at line 662 of file dialog-ab-trans.c.

663{
664 gint result;
665 GNC_AB_JOB *job;
666 const AB_TRANSACTION_LIMITS *joblimits;
667 guint8 max_purpose_lines;
668
669 /* Check whether the account supports this job */
670 job = gnc_ab_trans_dialog_get_available_empty_job(td->ab_acc, td->trans_type);
671 if (!job)
672 {
673 g_warning("gnc_ab_trans_dialog_run_until_ok: Oops, job not available");
674 return GTK_RESPONSE_CANCEL;
675 }
676
677 /* Activate as many purpose entries as available for the job */
678 joblimits = AB_AccountSpec_GetTransactionLimitsForCommand(td->ab_acc, AB_Transaction_GetCommand(job));
679 max_purpose_lines = joblimits ?
680 AB_TransactionLimits_GetMaxLinesPurpose(joblimits) : 2;
681 gtk_widget_set_sensitive(td->purpose_cont_entry, max_purpose_lines > 1);
682 gtk_widget_set_sensitive(td->purpose_cont2_entry, max_purpose_lines > 2);
683 gtk_widget_set_sensitive(td->purpose_cont3_entry, max_purpose_lines > 3);
684 if (joblimits)
685 {
686 gtk_entry_set_max_length(GTK_ENTRY(td->purpose_entry),
687 AB_TransactionLimits_GetMaxLenPurpose(joblimits));
688 gtk_entry_set_max_length(GTK_ENTRY(td->purpose_cont_entry),
689 AB_TransactionLimits_GetMaxLenPurpose(joblimits));
690 gtk_entry_set_max_length(GTK_ENTRY(td->purpose_cont2_entry),
691 AB_TransactionLimits_GetMaxLenPurpose(joblimits));
692 gtk_entry_set_max_length(GTK_ENTRY(td->purpose_cont3_entry),
693 AB_TransactionLimits_GetMaxLenPurpose(joblimits));
694 gtk_entry_set_max_length(GTK_ENTRY(td->recp_name_entry),
695 AB_TransactionLimits_GetMaxLenRemoteName(joblimits));
696 }
697
698 /* Show the dialog */
699 gtk_widget_show(td->dialog);
700
701 /* Now run the dialog until it gets closed by a button press */
702 result = gtk_dialog_run (GTK_DIALOG (td->dialog));
703
704 /* Was cancel pressed or dialog closed?
705 * GNC_RESPONSE_NOW == execute now
706 * GNC_RESPONSE_LATER == scheduled for later execution (unimplemented)
707 * GTK_RESPONSE_CANCEL == cancel
708 * GTK_RESPONSE_DELETE_EVENT == window destroyed */
709 if (result != GNC_RESPONSE_NOW && result != GNC_RESPONSE_LATER)
710 {
711 gtk_widget_destroy(td->dialog);
712 td->dialog = NULL;
713 return result;
714 }
715
716 /* Get the transaction details - have been checked beforehand */
717 td->ab_trans = gnc_ab_trans_dialog_fill_values(td);
718
719 /* FIXME: If this is a direct debit, set the textkey/ "Textschluessel"/
720 * transactionCode according to some GUI selection here!! */
721 /*if (td->trans_type == SINGLE_DEBITNOTE)
722 AB_TRANSACTION_setTextKey (td->hbci_trans, 05); */
723
724
725 /* Hide the dialog */
726 if (td->dialog)
727 gtk_widget_hide(td->dialog);
728
729 return result;
730}

◆ gnc_ab_trans_isSEPA()

gboolean gnc_ab_trans_isSEPA ( GncABTransType  t)

Returns true if the given GncABTransType is an European (SEPA) transaction (transfer or debit note), otherwise false.

Definition at line 147 of file dialog-ab-trans.c.

148{
149 switch (t)
150 {
151 case SEPA_TRANSFER:
152#if (AQBANKING_VERSION_INT >= 60400)
153 case SEPA_INTERNAL_TRANSFER:
154#endif
155 case SEPA_DEBITNOTE:
156 return TRUE;
157 default:
158 return FALSE;
159 }
160}

◆ gnc_ab_trans_templ_free()

void gnc_ab_trans_templ_free ( GncABTransTempl *  t)

Free the memory used by a template.

Parameters
tGncABTransTempl to be freed

Definition at line 161 of file gnc-aqbanking-templates.cpp.

162{
163 delete t;
164}

◆ gnc_ab_trans_templ_get_amount()

gnc_numeric gnc_ab_trans_templ_get_amount ( const GncABTransTempl *  t)
Parameters
tTemplate
Returns
Amount

Definition at line 228 of file gnc-aqbanking-templates.cpp.

229{
230 g_return_val_if_fail(t, gnc_numeric_zero());
231 return t->amount();
232}

◆ gnc_ab_trans_templ_get_name()

const gchar * gnc_ab_trans_templ_get_name ( const GncABTransTempl *  t)
Parameters
tTemplate
Returns
Name of the template, an internal string

Definition at line 200 of file gnc-aqbanking-templates.cpp.

201{
202 g_return_val_if_fail(t, NULL);
203 return t->name();
204}

◆ gnc_ab_trans_templ_get_purpose()

const gchar * gnc_ab_trans_templ_get_purpose ( const GncABTransTempl *  t)
Parameters
tTemplate
Returns
First purpose line, an internal string

Definition at line 235 of file gnc-aqbanking-templates.cpp.

236{
237 g_return_val_if_fail(t, NULL);
238 return t->purpose();
239}

◆ gnc_ab_trans_templ_get_purpose_cont()

const gchar * gnc_ab_trans_templ_get_purpose_cont ( const GncABTransTempl *  t)
Parameters
tTemplate
Returns
Second purpose line, an internal string

Definition at line 242 of file gnc-aqbanking-templates.cpp.

243{
244 g_return_val_if_fail(t, NULL);
245 return t->purpose_continuation();
246}

◆ gnc_ab_trans_templ_get_recp_account()

const gchar * gnc_ab_trans_templ_get_recp_account ( const GncABTransTempl *  t)
Parameters
tTemplate
Returns
Account Number of the recipient, an internal string

Definition at line 214 of file gnc-aqbanking-templates.cpp.

215{
216 g_return_val_if_fail(t, NULL);
217 return t->recipient_account();
218}

◆ gnc_ab_trans_templ_get_recp_bankcode()

const gchar * gnc_ab_trans_templ_get_recp_bankcode ( const GncABTransTempl *  t)
Parameters
tTemplate
Returns
Bank Code of the recipient, an internal string

Definition at line 221 of file gnc-aqbanking-templates.cpp.

222{
223 g_return_val_if_fail(t, NULL);
224 return t->recipient_bankcode();
225}

◆ gnc_ab_trans_templ_get_recp_name()

const gchar * gnc_ab_trans_templ_get_recp_name ( const GncABTransTempl *  t)
Parameters
tTemplate
Returns
Name of the recipient, an internal string

Definition at line 207 of file gnc-aqbanking-templates.cpp.

208{
209 g_return_val_if_fail(t, NULL);
210 return t->recipient_name();
211}

◆ gnc_ab_trans_templ_list_free()

void gnc_ab_trans_templ_list_free ( GList *  l)

Free the memory used by a list of templates, including the list itself.

Parameters
lGList of GncABTransTempl

Definition at line 167 of file gnc-aqbanking-templates.cpp.

168{
169 g_list_free_full (l, (GDestroyNotify)gnc_ab_trans_templ_free);
170}
void gnc_ab_trans_templ_free(GncABTransTempl *t)
Free the memory used by a template.

◆ gnc_ab_trans_templ_list_new_from_book()

GList * gnc_ab_trans_templ_list_new_from_book ( QofBook b)

Obtain the list of QofTemplates saved in a Book.

Parameters
bQofBook containing the templates.
Returns
A GList of newly allocated GncABTransTempls

Definition at line 133 of file gnc-aqbanking-templates.cpp.

134{
135 GList *retval = NULL;
136 auto toplevel = qof_instance_get_slots (QOF_INSTANCE (b));
137 auto slot = toplevel->get_slot({"hbci", "template-list"});
138 if (slot == nullptr)
139 return retval;
140 auto list = slot->get<GList*>();
141 for (auto node = list; node != NULL; node = g_list_next (node))
142 {
143 KvpFrame *frame = static_cast<KvpValue*>(node->data)->get<KvpFrame*>();
144 auto c_func = [frame](const char* key)
145 { auto slot = frame->get_slot({key});
146 return slot == nullptr ? std::string("") : std::string(slot->get<const char*>());};
147 auto n_func = [frame](const char* key)
148 { auto slot = frame->get_slot({key});
149 return slot == nullptr ? gnc_numeric_zero() : slot->get<gnc_numeric>();};
150 auto templ = new _GncABTransTempl (c_func(TT_NAME), c_func(TT_RNAME),
151 c_func(TT_RACC), c_func(TT_RBCODE),
152 n_func(TT_AMOUNT), c_func(TT_PURPOS),
153 c_func(TT_PURPOSCT));
154 retval = g_list_prepend (retval, templ);
155 }
156 retval = g_list_reverse (retval);
157 return retval;
158}

◆ gnc_ab_trans_templ_new()

GncABTransTempl * gnc_ab_trans_templ_new ( void  )

Create a template with unset contents.

Returns
A newly allocated GncABTransTempl

Definition at line 117 of file gnc-aqbanking-templates.cpp.

118{
119 return new _GncABTransTempl;
120}

◆ gnc_ab_trans_templ_new_full()

GncABTransTempl * gnc_ab_trans_templ_new_full ( const gchar *  name,
const gchar *  recp_name,
const gchar *  recp_account,
const gchar *  recp_bankcode,
gnc_numeric  amount,
const gchar *  purpose,
const gchar *  purpose_cont 
)

Create a template with given contents.

Parameters
nameName of the template
recp_nameName of the recipient
recp_accountAccount Number of the recipient
recp_bankcodeBank Code of the recipient
amountAmount
purposeFirst purpose line
purpose_contSecond purpose line
Returns
A newly allocated GncABTransTempl

Definition at line 123 of file gnc-aqbanking-templates.cpp.

127{
128 return new _GncABTransTempl(name, recp_name, recp_account, recp_bankcode,
129 amount, purpose, purpose_cont);
130}

◆ gnc_ab_trans_templ_set_amount()

void gnc_ab_trans_templ_set_amount ( GncABTransTempl *  t,
gnc_numeric  amount 
)

Replace the amount stored in a template.

Parameters
tTemplate
amountAmount

Definition at line 279 of file gnc-aqbanking-templates.cpp.

280{
281 g_return_if_fail(t);
282 t->set_amount(amount);
283}

◆ gnc_ab_trans_templ_set_name()

void gnc_ab_trans_templ_set_name ( GncABTransTempl *  t,
const gchar *  name 
)

Set the name of a template.

Parameters
tTemplate
nameName

Definition at line 249 of file gnc-aqbanking-templates.cpp.

250{
251 g_return_if_fail(t);
252 t->set_name(name);
253}

◆ gnc_ab_trans_templ_set_purpose()

void gnc_ab_trans_templ_set_purpose ( GncABTransTempl *  t,
const gchar *  purpose 
)

Replace the first purpose line stored in a template.

Parameters
tTemplate
purposeFirst purpose line

Definition at line 286 of file gnc-aqbanking-templates.cpp.

287{
288 g_return_if_fail(t);
289 t->set_purpose(purpose);
290}

◆ gnc_ab_trans_templ_set_purpose_cont()

void gnc_ab_trans_templ_set_purpose_cont ( GncABTransTempl *  t,
const gchar *  purpose_cont 
)

Replace the second purpose line stored in a template.

Parameters
tTemplate
purpose_contSecond purpose line

Definition at line 293 of file gnc-aqbanking-templates.cpp.

295{
296 g_return_if_fail(t);
297 t->set_purpose_continuation (purpose_cont);
298}

◆ gnc_ab_trans_templ_set_recp_account()

void gnc_ab_trans_templ_set_recp_account ( GncABTransTempl *  t,
const gchar *  recp_account 
)

Replace the Account Number of the recipient stored in a template.

Parameters
tTemplate
recp_accountAccount Number of the recipient

Definition at line 263 of file gnc-aqbanking-templates.cpp.

265{
266 g_return_if_fail(t);
267 t->set_recipient_account(recp_account);
268}

◆ gnc_ab_trans_templ_set_recp_bankcode()

void gnc_ab_trans_templ_set_recp_bankcode ( GncABTransTempl *  t,
const gchar *  recp_bankcode 
)

Replace the Bank Code of the recipient stored in a template.

Parameters
tTemplate
recp_bankcodeBank Code of the recipient

Definition at line 271 of file gnc-aqbanking-templates.cpp.

273{
274 g_return_if_fail(t);
275 t->set_recipient_bankcode(recp_bankcode);
276}

◆ gnc_ab_trans_templ_set_recp_name()

void gnc_ab_trans_templ_set_recp_name ( GncABTransTempl *  t,
const gchar *  recp_name 
)

Replace the Account Number of the recipient stored in a template.

Parameters
tTemplate
recp_nameAccount Number of the recipient

Definition at line 256 of file gnc-aqbanking-templates.cpp.

257{
258 g_return_if_fail(t);
259 t->set_recipient_name(recp_name);
260}

◆ gnc_ab_trans_to_gnc()

Transaction * gnc_ab_trans_to_gnc ( const AB_TRANSACTION *  ab_trans,
Account gnc_acc 
)

Create an unbalanced and dirty GnuCash transaction with a split to gnc_acc from the information available in the AqBanking transaction ab_trans.

Parameters
ab_transAqBanking transaction
gnc_accAccount of to use for the split
Returns
A dirty GnuCash transaction or NULL otherwise

Definition at line 497 of file gnc-ab-utils.c.

498{
499 QofBook *book;
500 Transaction *gnc_trans;
501 const gchar *fitid;
502 const GNC_GWEN_DATE *value_date, *post_date;
503 time64 post_time;
504 const char *custref;
505 gchar *description;
506 Split *split;
507 gchar *memo;
508
509 g_return_val_if_fail (ab_trans && gnc_acc, NULL);
510
511 /* Create new GnuCash transaction for the given AqBanking one */
512 book = gnc_account_get_book (gnc_acc);
513 gnc_trans = xaccMallocTransaction (book);
514 xaccTransBeginEdit (gnc_trans);
515
516 /* Date / Time */
517 /* SWIFT import formats (in particular MT940) provide for two
518 * dates, the entry date and the value date (valuta is value in
519 * German). The value date is the effective date for financial
520 * calculation purposes and is mandatory, the entry date is the
521 * date that the financial institution posted the
522 * transaction. Unfortunately if the transaction field doesn't
523 * provide an entry date AQBanking substitutes the date from the
524 * last balance instead of using the value date or NULL, making
525 * the field unreliable.
526 */
527 value_date = AB_Transaction_GetValutaDate (ab_trans);
528 if (value_date)
529 post_time = gnc_gwen_date_to_time64 (value_date);
530 else if ((post_date = AB_Transaction_GetDate (ab_trans))) // always true
531 post_time = gnc_gwen_date_to_time64 (post_date);
532 else
533 {
534 g_warning ("transaction_cb: Import had no transaction date");
535 post_time = gnc_time (NULL);
536 }
537 xaccTransSetDatePostedSecsNormalized (gnc_trans, post_time);
538
539 xaccTransSetDateEnteredSecs (gnc_trans, gnc_time (NULL));
540
541 /* Currency. We take simply the default currency of the gnucash account */
542 xaccTransSetCurrency (gnc_trans, xaccAccountGetCommodity (gnc_acc));
543
544 /* Trans-Num or Split-Action set with gnc_set_num_action below per book
545 * option */
546
547 fitid = AB_Transaction_GetFiId (ab_trans);
548
549 /* Description */
550 description = gnc_ab_description_to_gnc (ab_trans, (fitid && *fitid));
551 xaccTransSetDescription (gnc_trans, description);
552 g_free (description);
553
554 /* Notes. */
555 /* xaccTransSetNotes(gnc_trans, g_notes); */
556 /* But Nobody ever uses the Notes field? */
557
558 /* Add one split */
559 split = xaccMallocSplit (book);
560 xaccSplitSetParent (split, gnc_trans);
561 xaccSplitSetAccount (split, gnc_acc);
562
563 /* Set the transaction number or split action field based on book option.
564 * We use the "customer reference", if there is one. */
565 custref = AB_Transaction_GetCustomerReference (ab_trans);
566 if (custref && *custref && g_ascii_strncasecmp (custref, "NONREF", 6) != 0)
567 gnc_set_num_action (gnc_trans, split, custref, NULL);
568
569 /* Set OFX unique transaction ID */
570 if (fitid && *fitid)
571 xaccSplitSetOnlineID (split, fitid);
572
573 /* FIXME: Extract function */
574 {
575 /* Amount into the split */
576 const AB_VALUE *ab_value = AB_Transaction_GetValue (ab_trans);
577 double d_value = ab_value ? AB_Value_GetValueAsDouble (ab_value) : 0.0;
578 AB_TRANSACTION_TYPE ab_type = AB_Transaction_GetType (ab_trans);
579 gnc_numeric gnc_amount;
580
581 /*printf("Transaction with value %f has type %d\n", d_value, ab_type);*/
582 /* If the value is positive, but the transaction type says the
583 money is transferred away from our account (Transfer instead of
584 DebitNote), we switch the value to negative. */
585 if (d_value > 0.0 && ab_type == AB_Transaction_TypeTransfer)
586 d_value = -d_value;
587
588 gnc_amount = double_to_gnc_numeric (
589 d_value,
591 GNC_HOW_RND_ROUND_HALF_UP);
592 if (!ab_value)
593 g_warning ("transaction_cb: Oops, value was NULL. Using 0");
594 xaccSplitSetBaseValue (split, gnc_amount, xaccAccountGetCommodity (gnc_acc));
595 }
596
597 /* Memo in the Split. */
598 memo = gnc_ab_memo_to_gnc (ab_trans);
599 xaccSplitSetMemo (split, memo);
600 g_free (memo);
601
602 return gnc_trans;
603}
gnc_commodity * xaccAccountGetCommodity(const Account *acc)
Get the account's commodity
Definition Account.cpp:3408
time64 gnc_time(time64 *tbuf)
get the current time
Definition gnc-date.cpp:262
void xaccTransSetDescription(Transaction *trans, const char *desc)
Sets the transaction Description.
void xaccTransSetDateEnteredSecs(Transaction *trans, time64 secs)
Modify the date of when the transaction was entered.
Transaction * xaccMallocTransaction(QofBook *book)
The xaccMallocTransaction() will malloc memory and initialize it.
void xaccTransSetDatePostedSecsNormalized(Transaction *trans, time64 time)
This function sets the posted date of the transaction, specified by a time64 (see ctime(3)).
void xaccTransSetCurrency(Transaction *trans, gnc_commodity *curr)
Set a new currency on a transaction.
void xaccSplitSetMemo(Split *split, const char *memo)
The memo is an arbitrary string associated with a split.
Split * xaccMallocSplit(QofBook *book)
Constructor.
void xaccSplitSetOnlineID(Split *split, const char *id)
The online_id is the OFX/HBCI "FITID" recorded on a split when it is imported.
void xaccSplitSetBaseValue(Split *s, gnc_numeric value, const gnc_commodity *base_currency)
Depending on the base_currency, set either the value or the amount of this split or both: If the base...
Definition Split.cpp:1355
QofBook reference.
Definition qofbook-p.hpp:47

◆ gnc_AB_VALUE_to_readable_string()

gchar * gnc_AB_VALUE_to_readable_string ( const AB_VALUE *  value)

Print the value of value with two decimal places and value's currency appended, or 0.0 otherwise.

Parameters
valueAB_VALUE or NULL
Returns
A newly allocated string

Definition at line 282 of file gnc-ab-utils.c.

283{
284 if (value)
285 return g_strdup_printf ("%.2f %s",
286 AB_Value_GetValueAsDouble (value),
287 AB_Value_GetCurrency (value));
288 else
289 return g_strdup_printf ("%.2f", 0.0);
290}

◆ gnc_file_aqbanking_import_dialog()

G_BEGIN_DECLS void gnc_file_aqbanking_import_dialog ( GtkWindow *  parent)

Import files via AQBanking's Import Dialog.

This permits importing any file format that Aqbanking supports.

Parameters
parentA GtkWindow for setting the import dialog transient for.

Definition at line 133 of file gnc-file-aqb-import.c.

134{
135 AB_BANKING* api = gnc_AB_BANKING_new ();
136 GncABSelectImExDlg* imexd =
137 gnc_ab_select_imex_dlg_new (GTK_WIDGET (parent), api);
138 char *imexporter = NULL, *profile = NULL;
139 AB_IMEXPORTER_CONTEXT* ctx = NULL;
140
141 if (!imexd)
142 {
143
144 PERR ("Failed to create select imex dialog.");
146 return;
147 }
148 load_imexporter_and_profile(&imexporter, &profile);
151
152 if (!gnc_ab_select_imex_dlg_run (imexd))
153 {
155 return;
156 }
157
160
161 if (imexporter && profile)
162 {
163 ctx = named_import_get_context (parent, api, imexporter, profile);
165
166 if (ctx)
167 {
168 GncABImExContextImport* ieci = NULL;
169 ieci = gnc_ab_import_context (ctx, AWAIT_TRANSACTIONS, FALSE, api, GTK_WIDGET(parent));
170 g_free(ieci);
171 AB_ImExporterContext_free(ctx);
172 }
173
174 save_imexporter_and_profile(imexporter, profile);
175 g_free (imexporter);
176 g_free (profile);
177 }
178
180}
void gnc_ab_select_imex_dlg_destroy(GncABSelectImExDlg *imexd)
Destroy an AQBanking importer/exporter selection dialog.
char * gnc_ab_select_imex_dlg_get_imexporter_name(GncABSelectImExDlg *imexd)
Get the selected importer/exporter name.
void gnc_ab_select_imex_dlg_set_profile_name(GncABSelectImExDlg *imexd, const char *name)
Get the selected file format profile name.
char * gnc_ab_select_imex_dlg_get_profile_name(GncABSelectImExDlg *imexd)
Get the selected file format profile name.
GncABSelectImExDlg * gnc_ab_select_imex_dlg_new(GtkWidget *parent, AB_BANKING *abi)
Create an AQBanking importer/exporter selection dialog.
gboolean gnc_ab_select_imex_dlg_run(GncABSelectImExDlg *imexd)
Run an AQBanking importer/exporter selection dialog.
void gnc_ab_select_imex_dlg_set_imexporter_name(GncABSelectImExDlg *imexd, const char *name)
Get the selected importer/exporter name.
#define PERR(format, args...)
Log a serious error.
Definition qoflog.h:244

◆ gnc_GWEN_Fini()

void gnc_GWEN_Fini ( void  )

Finalize the gwenhywfar library.

Definition at line 147 of file gnc-ab-utils.c.

148{
149 /* Shutdown the GWEN_GUIs */
151 GWEN_Logger_SetLevel (NULL, GWEN_LoggerLevel_Error);
152 GWEN_Logger_SetLevel (GWEN_LOGDOMAIN, GWEN_LoggerLevel_Warning);
153 GWEN_Logger_SetLevel (AQBANKING_LOGDOMAIN, GWEN_LoggerLevel_Warning);
154
155 /* Finalize gwen library */
156 GWEN_Fini();
157}
void gnc_GWEN_Gui_shutdown(void)
Free all memory related to both the full-blown and minimalistic GUI objects.

◆ gnc_GWEN_Gui_get()

GncGWENGui * gnc_GWEN_Gui_get ( GtkWidget *  parent)

When called for the first time, create a unique GncGWENGui object featuring a GWEN_GUI with all necessary callbacks, which can serve as a user interface for AqBanking jobs.

On later calls, return the object only when it is not active and save to use. Typically, you only need to call gnc_GWEN_Gui_release() once your job has finished.

Parameters
parentWidget to set new dialogs transient for, may be NULL
Returns
The unique GncGWENGui object or NULL otherwise

Definition at line 245 of file gnc-gwen-gui.c.

246{
247 GncGWENGui *gui;
248
249 ENTER("parent=%p", parent);
250
251 if (full_gui)
252 {
253 if (full_gui->state == INIT || full_gui->state == RUNNING)
254 {
255 LEAVE("full_gui in use, state=%d", full_gui->state);
256 return NULL;
257 }
258
259 gui = full_gui;
260 gui->parent = parent;
261 reset_dialog(gui);
262 register_callbacks(gui);
263
264 LEAVE("gui=%p", gui);
265 return gui;
266 }
267
268 gui = g_new0(GncGWENGui, 1);
269 gui->parent = parent;
270 setup_dialog(gui);
271 register_callbacks(gui);
272
273 full_gui = gui;
274
275 LEAVE("new gui=%p", gui);
276 return gui;
277}

◆ gnc_GWEN_Gui_get_close_flag()

gboolean gnc_GWEN_Gui_get_close_flag ( void  )

Get "Close when finished" flag.

Returns
gboolean close_when_finished

Definition at line 344 of file gnc-gwen-gui.c.

345{
346 return gnc_prefs_get_bool (GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH);
347}

◆ gnc_GWEN_Gui_hide_dialog()

void gnc_GWEN_Gui_hide_dialog ( void  )

Hides Online Banking Connection Window (Close log window)

Definition at line 381 of file gnc-gwen-gui.c.

382{
383 GncGWENGui *gui = full_gui;
384
385 if (gui)
386 {
387 hide_dialog(gui);
388 }
389}

◆ gnc_GWEN_Gui_log_init()

void gnc_GWEN_Gui_log_init ( void  )

Hook our logging into the gwenhywfar logging framework by creating a minimalistic GWEN_GUI with only a callback for Gwen_Gui_LogHook().

This function can be called more than once, it will unref and replace the currently set GWEN_GUI though.

Definition at line 229 of file gnc-gwen-gui.c.

230{
231 if (!log_gwen_gui)
232 {
233 log_gwen_gui = Gtk3_Gui_new();
234
235 /* Always use our own logging */
236 GWEN_Gui_SetLogHookFn(log_gwen_gui, loghook_cb);
237
238 /* Keep a reference so that the GWEN_GUI survives a GUI switch */
239 GWEN_Gui_Attach(log_gwen_gui);
240 }
241 GWEN_Gui_SetGui(log_gwen_gui);
242}

◆ gnc_GWEN_Gui_release()

void gnc_GWEN_Gui_release ( GncGWENGui *  gui)

Currently a no-op.

The GncGWENGui will not be freed and it is considered finished once the first tracked progress has ended.

Parameters
guiThe GncGwenGUI returned by gnc_GWEN_Gui_get()

Definition at line 280 of file gnc-gwen-gui.c.

281{
282 g_return_if_fail(gui && gui == full_gui);
283
284 /* Currently a no-op */
285 ENTER("gui=%p", gui);
286 LEAVE(" ");
287}

◆ gnc_GWEN_Gui_set_close_flag()

void gnc_GWEN_Gui_set_close_flag ( gboolean  close_when_finished)

Set "Close when finished" flag.

Parameters
gbooleanclose_when_finished

Definition at line 325 of file gnc-gwen-gui.c.

326{
328 GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH,
329 close_when_finished);
330
331 if (full_gui)
332 {
333 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(full_gui->close_checkbutton))
334 != close_when_finished)
335 {
336 gtk_toggle_button_set_active(
337 GTK_TOGGLE_BUTTON(full_gui->close_checkbutton),
338 close_when_finished);
339 }
340 }
341}
gboolean gnc_prefs_set_bool(const gchar *group, const gchar *pref_name, gboolean value)
Store a boolean value into the preferences backend.

◆ gnc_GWEN_Gui_show_dialog()

gboolean gnc_GWEN_Gui_show_dialog ( void  )

Unhides Online Banking Connection Window (Make log visible)

Returns
gboolean window is visible

Definition at line 350 of file gnc-gwen-gui.c.

351{
352 GncGWENGui *gui = full_gui;
353
354 if (!gui)
355 {
356 gnc_GWEN_Gui_get(NULL);
357 gui = full_gui;
358 }
359
360 if (gui)
361 {
362 if (gui->state == HIDDEN)
363 {
364 gui->state = FINISHED;
365 }
366 gtk_toggle_button_set_active(
367 GTK_TOGGLE_BUTTON(gui->close_checkbutton),
368 gnc_prefs_get_bool (GNC_PREFS_GROUP_AQBANKING, GNC_PREF_CLOSE_ON_FINISH));
369
370 gtk_widget_set_sensitive(gui->close_button, TRUE);
371
372 show_dialog(gui, FALSE);
373
374 return TRUE;
375 }
376
377 return FALSE;
378}

◆ gnc_GWEN_Gui_shutdown()

void gnc_GWEN_Gui_shutdown ( void  )

Free all memory related to both the full-blown and minimalistic GUI objects.

Definition at line 290 of file gnc-gwen-gui.c.

291{
292 GncGWENGui *gui = full_gui;
293
294 ENTER(" ");
295
296 if (log_gwen_gui)
297 {
298 GWEN_Gui_free(log_gwen_gui);
299 log_gwen_gui = NULL;
300 }
301 GWEN_Gui_SetGui(NULL);
302
303 if (!gui)
304 return;
305
306 gui->parent = NULL;
307 reset_dialog(gui);
308 if (gui->passwords)
309 g_hash_table_destroy(gui->passwords);
310 if (gui->showbox_hash)
311 g_hash_table_destroy(gui->showbox_hash);
312 if (gui->permanently_accepted_certs)
313 GWEN_DB_Group_free(gui->permanently_accepted_certs);
314 if (gui->accepted_certs)
315 g_hash_table_destroy(gui->accepted_certs);
316 gtk_widget_destroy(gui->dialog);
317 g_free(gui);
318
319 full_gui = NULL;
320
321 LEAVE(" ");
322}

◆ gnc_GWEN_Init()

void gnc_GWEN_Init ( void  )

Initialize the gwenhywfar library by calling GWEN_Init() and setting up gwenhywfar logging.

Definition at line 112 of file gnc-ab-utils.c.

113{
114 gchar* gwen_logging = g_strdup (g_getenv ("GWEN_LOGLEVEL"));
115 gchar* aqb_logging = g_strdup (g_getenv ("AQBANKING_LOGLEVEL"));
116
117 /* Initialize gwen library */
118 GWEN_Init();
119
120 /* Initialize gwen logging */
121 if (gnc_prefs_get_bool (GNC_PREFS_GROUP_AQBANKING, GNC_PREF_VERBOSE_DEBUG))
122 {
123 if (!gwen_logging)
124 {
125 GWEN_Logger_SetLevel (NULL, GWEN_LoggerLevel_Info);
126 GWEN_Logger_SetLevel (GWEN_LOGDOMAIN, GWEN_LoggerLevel_Info);
127 }
128 if (!aqb_logging)
129 GWEN_Logger_SetLevel (AQBANKING_LOGDOMAIN, GWEN_LoggerLevel_Debug);
130 }
131 else
132 {
133 if (!gwen_logging)
134 {
135 GWEN_Logger_SetLevel (NULL, GWEN_LoggerLevel_Error);
136 GWEN_Logger_SetLevel (GWEN_LOGDOMAIN, GWEN_LoggerLevel_Error);
137 }
138 if (!aqb_logging)
139 GWEN_Logger_SetLevel (AQBANKING_LOGDOMAIN, GWEN_LoggerLevel_Warning);
140 }
141 g_free (gwen_logging);
142 g_free (aqb_logging);
144}
void gnc_GWEN_Gui_log_init(void)
Hook our logging into the gwenhywfar logging framework by creating a minimalistic GWEN_GUI with only ...

◆ gnc_plugin_aqbanking_create_plugin()

void gnc_plugin_aqbanking_create_plugin ( void  )

Create a new GncPluginAqBanking object and register it.

Definition at line 639 of file gnc-plugin-aqbanking.c.

640{
641 GncPlugin *plugin = gnc_plugin_aqbanking_new();
642
644}
GncPlugin * gnc_plugin_aqbanking_new(void)
void gnc_plugin_manager_add_plugin(GncPluginManager *manager, GncPlugin *plugin)
Add a plugin to the list maintained by the plugin manager.
GncPluginManager * gnc_plugin_manager_get(void)
Retrieve a pointer to the plugin manager.

◆ gnc_plugin_aqbanking_new()

GncPlugin * gnc_plugin_aqbanking_new ( void  )
Returns
A new GncPluginAqBanking object

Definition at line 150 of file gnc-plugin-aqbanking.c.

151{
152 return GNC_PLUGIN(g_object_new(GNC_TYPE_PLUGIN_AQBANKING, (gchar*) NULL));
153}

◆ gnc_plugin_aqbanking_set_logwindow_visible()

void gnc_plugin_aqbanking_set_logwindow_visible ( gboolean  logwindow_visible)

Set MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW.

Definition at line 416 of file gnc-plugin-aqbanking.c.

417{
418 GAction *action = gnc_main_window_find_action_in_group (gnc_main_window, PLUGIN_ACTIONS_NAME,
419 MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW);
420
421 if (action)
422 {
423 GVariant *state = g_action_get_state (G_ACTION(action));
424 g_action_change_state (G_ACTION(action), g_variant_new_boolean (logwindow_visible));
425 g_variant_unref (state);
426 }
427}
GAction * gnc_main_window_find_action_in_group(GncMainWindow *window, const gchar *group_name, const gchar *action_name)
Find the GAction in a specific action group for window.

◆ ini_flicker_gui()

void ini_flicker_gui ( const char *  pChallenge,
GncFlickerGui gui 
)

Initialize the dialog and drawing area.

Parameters
pChallengeThe answer from the bank which is shown as a flickering picture
guiThe structure of the Dialog-Widgets

Definition at line 391 of file gnc-flicker-gui.c.

392{
393 /* Establish reference to the dialog widgets created in gnc_gwen_gui */
394 flickergui = gui;
395
396 /* Load window size and initial setting values */
397 do_flicker_load_state (GTK_WIDGET (flickergui->dialog));
398
399 /* Initialize application */
400 flickerdraw.barheight = BAR_HEIGHT;
401 flickerdraw.margin = MARGIN;
402 flickerdraw.y_barpos = 20; /* First painting position */
403 flickerdraw.halfbyteid = 0;
404 flickerdraw.clock = 1;
405
406 flickerdraw.challenge = pChallenge;
407
408 g_signal_connect (GTK_WINDOW (flickergui->dialog), "destroy",
409 G_CALLBACK (on_dialog_destroy), NULL);
410
411 g_signal_connect (GTK_WIDGET (flickergui->flicker_challenge), "map",
412 G_CALLBACK (on_flicker_challenge_map), NULL);
413 g_signal_connect (GTK_WIDGET (flickergui->flicker_challenge), "draw",
414 G_CALLBACK (on_flicker_challenge_draw), NULL);
415 g_signal_connect (GTK_WIDGET (flickergui->flicker_challenge), "destroy",
416 G_CALLBACK (on_flicker_challenge_destroy), NULL);
417
418 g_signal_connect (GTK_WIDGET (flickergui->flicker_marker), "map",
419 G_CALLBACK (on_flicker_marker_map), NULL);
420 g_signal_connect (GTK_WIDGET (flickergui->flicker_marker), "draw",
421 G_CALLBACK (on_flicker_marker_draw), NULL);
422
423 flickergui->adj_barwidth = gtk_adjustment_new (0.0, 10.0, 80.0, 1.0, 10.0, 0.0);
424 gtk_spin_button_set_adjustment (flickergui->spin_barwidth, flickergui->adj_barwidth);
425 gtk_spin_button_set_value (GTK_SPIN_BUTTON (flickergui->spin_barwidth),
426 flickerdraw.barwidth);
427 g_signal_connect (GTK_WIDGET (flickergui->spin_barwidth), "value-changed",
428 G_CALLBACK (on_spin_barwidth_value_changed),
429 flickergui->flicker_marker);
430 gtk_widget_set_focus_on_click (GTK_WIDGET (flickergui->spin_barwidth), FALSE);
431
432 flickergui->adj_delay = gtk_adjustment_new (0.0, 10.0, 100.0, 10.0, 10.0, 0.0);
433 gtk_spin_button_set_adjustment (flickergui->spin_delay, flickergui->adj_delay);
434 gtk_spin_button_set_value (GTK_SPIN_BUTTON (flickergui->spin_delay),
435 flickerdraw.delay);
436 g_signal_connect (GTK_WIDGET (flickergui->spin_delay), "value-changed",
437 G_CALLBACK (on_spin_delay_value_changed),
438 flickergui->flicker_challenge);
439 gtk_widget_set_focus_on_click (GTK_WIDGET (flickergui->spin_delay), FALSE);
440
441 gtk_widget_grab_focus (GTK_WIDGET (flickergui->input_entry));
442}

Variable Documentation

◆ adj_barwidth

GtkAdjustment* GncFlickerGui::adj_barwidth

Definition at line 47 of file gnc-flicker-gui.h.

◆ adj_delay

GtkAdjustment* GncFlickerGui::adj_delay

Definition at line 48 of file gnc-flicker-gui.h.

◆ dialog

GtkWidget* GncFlickerGui::dialog

Definition at line 42 of file gnc-flicker-gui.h.

◆ flicker_challenge

GtkWidget* GncFlickerGui::flicker_challenge

Definition at line 44 of file gnc-flicker-gui.h.

◆ flicker_hbox

GtkWidget* GncFlickerGui::flicker_hbox

Definition at line 46 of file gnc-flicker-gui.h.

◆ flicker_marker

GtkWidget* GncFlickerGui::flicker_marker

Definition at line 45 of file gnc-flicker-gui.h.

◆ input_entry

GtkWidget* GncFlickerGui::input_entry

Definition at line 43 of file gnc-flicker-gui.h.

◆ spin_barwidth

GtkSpinButton* GncFlickerGui::spin_barwidth

Definition at line 49 of file gnc-flicker-gui.h.

◆ spin_delay

GtkSpinButton* GncFlickerGui::spin_delay

Definition at line 50 of file gnc-flicker-gui.h.