Remove ktoblzcheck dependency.

Remove old (non-SEPA) online transaction code, because now in 2019
the banks will only offer SEPA transactions and no others. This
in turn means we don't need the old ktoblzcheck checking functions
at all, hence I remove this dependency completely.
This commit is contained in:
Christian Stimming 2019-02-13 11:26:39 +01:00
parent 140eb0b110
commit dac94ce038
9 changed files with 18 additions and 231 deletions

View File

@ -360,10 +360,6 @@ if (WITH_AQBANKING)
gnc_pkg_check_modules (GWENHYWFAR REQUIRED gwenhywfar)
gnc_pkg_check_modules (AQBANKING REQUIRED aqbanking)
if(WITH_GNUCASH)
gnc_pkg_check_modules (KTOBLZCHECK ktoblzcheck)
if(KTOBLZCHECK_FOUND)
set(HAVE_KTOBLZCHECK_H 1)
endif(KTOBLZCHECK_FOUND)
gnc_pkg_check_modules (GWEN_GTK3 gwengui-gtk3)
if(GWEN_GTK3_FOUND AND GWEN_GTK3_VERSION VERSION_GREATER "4.20.0")
set(HAVE_GWEN_GTK3 1 CACHE BOOL "True if gwen-gtk3.pc exists")

View File

@ -147,9 +147,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
/* Define to 1 if you have the <ktoblzcheck.h> header file. */
#cmakedefine HAVE_KTOBLZCHECK_H 1
/* Define if you have <langinfo.h> and nl_langinfo(D_FMT). */
#cmakedefine HAVE_LANGINFO_D_FMT 1

View File

@ -59,7 +59,7 @@ if(WITH_AQBANKING)
gncmod-register-gnome gncmod-ledger-core gncmod-engine gwengui-gtk3
${AQB_EXPORT_SYMBOLS} ${AQBANKING_LDFLAGS}
${GWENHYWFAR_LDFLAGS}
${GNOME_LDFLAGS} ${KTOBLZCHECK_LDFLAGS} ${AQB_LIBSTDCXX})
${GNOME_LDFLAGS} ${AQB_LIBSTDCXX})
target_compile_definitions(gncmod-aqbanking PRIVATE -DG_LOG_DOMAIN=\"gnc.import.aqbanking\")
target_compile_options(gncmod-aqbanking PRIVATE -Wno-deprecated-declarations)
@ -67,8 +67,7 @@ if(WITH_AQBANKING)
target_include_directories(gncmod-aqbanking PRIVATE
${CMAKE_SOURCE_DIR}/borrowed/gwengui-gtk3
${AQBANKING_INCLUDE_DIRS}
${GWENHYWFAR_INCLUDE_DIRS}
${KTOBLZCHECK_INCLUDE_DIRS})
${GWENHYWFAR_INCLUDE_DIRS})
if (APPLE)
set_target_properties (gncmod-aqbanking PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")

View File

@ -32,9 +32,6 @@
#include <config.h>
#include <glib/gi18n.h>
#if HAVE_KTOBLZCHECK_H
# include <ktoblzcheck.h>
#endif
#include <aqbanking/jobsingletransfer.h>
#include <aqbanking/jobsingledebitnote.h>
#include <aqbanking/jobinternaltransfer.h>
@ -72,11 +69,10 @@ static AB_TRANSACTION *gnc_ab_trans_dialog_fill_values(GncABTransDialog *td);
static AB_JOB *gnc_ab_trans_dialog_get_available_empty_job(AB_ACCOUNT *ab_acc,
GncABTransType trans_type);
static void gnc_ab_trans_dialog_check_ktoblzcheck(const GncABTransDialog *td,
static void gnc_ab_trans_dialog_check_iban(const GncABTransDialog *td,
const AB_TRANSACTION *trans);
/* Callbacks - connected with GtkBuilder */
G_MODULE_EXPORT void gnc_ab_trans_dialog_bankcode_changed_cb(GtkEditable *editable, gpointer user_data);
G_MODULE_EXPORT void gnc_ab_trans_dialog_add_templ_cb(GtkButton *button, gpointer user_data);
G_MODULE_EXPORT void gnc_ab_trans_dialog_moveup_templ_cb(GtkButton *button, gpointer user_data);
G_MODULE_EXPORT void gnc_ab_trans_dialog_movedown_templ_cb(GtkButton *button, gpointer user_data);
@ -151,11 +147,6 @@ struct _GncABTransDialog
/* The gnucash transaction that got created here */
Transaction *gnc_trans;
#if HAVE_KTOBLZCHECK_H
/* object for Account number checking */
AccountNumberCheck *blzcheck;
#endif
};
gboolean gnc_ab_trans_isSEPA(GncABTransType t)
@ -298,10 +289,6 @@ gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
td->ab_acc = ab_acc;
td->trans_type = trans_type;
#if HAVE_KTOBLZCHECK_H
td->blzcheck = AccountNumberCheck_new();
#endif
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-ab.glade", "aqbanking_transaction_dialog");
td->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "aqbanking_transaction_dialog"));
@ -381,22 +368,7 @@ gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
break;
case SINGLE_DEBITNOTE:
gtk_label_set_text(GTK_LABEL (heading_label),
_("Enter an Online Direct Debit Note"));
gtk_label_set_text(GTK_LABEL(recp_name_heading),
_("Debited Account Owner"));
gtk_label_set_text(GTK_LABEL(recp_account_heading),
_("Debited Account Number"));
gtk_label_set_text(GTK_LABEL(recp_bankcode_heading),
_("Debited Account Bank Code"));
gtk_label_set_text(GTK_LABEL(orig_name_heading),
_("Credited Account Owner"));
gtk_label_set_text(GTK_LABEL(orig_account_heading),
_("Credited Account Number"));
gtk_label_set_text(GTK_LABEL(orig_bankcode_heading),
_("Credited Account Bank Code"));
/* this case is no longer in use; don't introduce extra strings */
break;
case SEPA_DEBITNOTE:
@ -487,11 +459,12 @@ gnc_ab_trans_dialog_entry_set (GtkWidget* entry,
}
static void
gnc_ab_trans_dialog_check_ktoblzcheck(const GncABTransDialog *td,
const AB_TRANSACTION *trans)
gnc_ab_trans_dialog_check_iban(const GncABTransDialog *td,
const AB_TRANSACTION *trans)
{
if (gnc_ab_trans_isSEPA(td->trans_type))
{
/* Verify the correct IBAN bank code */
int rv = AB_Banking_CheckIban(AB_Transaction_GetRemoteIban(trans));
if (rv != 0) {
gchar *message = g_strdup_printf(_("The internal check of the destination IBAN '%s' "
@ -511,65 +484,9 @@ gnc_ab_trans_dialog_check_ktoblzcheck(const GncABTransDialog *td,
}
else
{
#ifndef HAVE_KTOBLZCHECK_H
return;
#else
gint blzresult;
const char *blztext;
gchar* message;
ENTER(" ");
if (gnc_ab_trans_isSEPA(td->trans_type))
{
// FIXME: libktoblzcheck also has <iban.h>, maybe add this here?
LEAVE("No ktoblzcheck implemented for IBAN");
/* this case is no longer in use */
return;
}
blzresult = AccountNumberCheck_check(
td->blzcheck,
AB_Transaction_GetRemoteBankCode(trans),
AB_Transaction_GetRemoteAccountNumber(trans));
switch (blzresult)
{
case 2:
message = g_strdup_printf(_("The internal check of the destination account number '%s' "
"at the specified bank with bank code '%s' failed. This means "
"the account number might contain an error."),
AB_Transaction_GetRemoteAccountNumber(trans),
AB_Transaction_GetRemoteBankCode(trans));
gnc_ab_trans_dialog_entry_set (td->recp_bankcode_entry, message,
"dialog-warning");
gnc_ab_trans_dialog_entry_set (td->recp_account_entry, message,
"dialog-warning");
blztext = "Kontonummer wahrscheinlich falsch";
break;
case 0:
blztext = "Kontonummer ok";
break;
case 3:
blztext = "bank unbekannt";
break;
case 1:
default:
blztext = "unbekannt aus unbekanntem grund";
break;
}
if (blzresult != 2)
{
gnc_ab_trans_dialog_entry_set (td->recp_bankcode_entry, "",
NULL);
gnc_ab_trans_dialog_entry_set (td->recp_account_entry, "",
NULL);
}
LEAVE("KtoBlzCheck said check is %d = %s",
blzresult, blztext ? blztext : "(none)");
#endif
}
}
static void
@ -667,7 +584,7 @@ gnc_ab_trans_dialog_verify_values(GncABTransDialog *td)
}
/* Check if account details are correct - gives warning only */
if (values_ok)
gnc_ab_trans_dialog_check_ktoblzcheck(td, td->ab_trans);
gnc_ab_trans_dialog_check_iban(td, td->ab_trans);
/* Check transaction value */
if (AB_Value_GetValueAsDouble(AB_Transaction_GetValue(td->ab_trans))
@ -834,9 +751,6 @@ gnc_ab_trans_dialog_free(GncABTransDialog *td)
gnc_ab_trans_dialog_clear_templ_helper, NULL);
g_object_unref(td->template_list_store);
}
#if HAVE_KTOBLZCHECK_H
AccountNumberCheck_delete(td->blzcheck);
#endif
g_free(td);
}
@ -903,15 +817,15 @@ gnc_ab_trans_dialog_get_available_empty_job(AB_ACCOUNT *ab_acc, GncABTransType t
case SINGLE_INTERNAL_TRANSFER:
job = AB_JobInternalTransfer_new(ab_acc);
break;
case SEPA_TRANSFER:
job = AB_JobSepaTransfer_new(ab_acc);
case SINGLE_TRANSFER:
job = AB_JobSingleTransfer_new(ab_acc);
break;
case SEPA_DEBITNOTE:
job = AB_JobSepaDebitNote_new(ab_acc);
break;
case SINGLE_TRANSFER:
case SEPA_TRANSFER:
default:
job = AB_JobSingleTransfer_new(ab_acc);
job = AB_JobSepaTransfer_new(ab_acc);
break;
};
@ -1024,65 +938,6 @@ gnc_ab_trans_dialog_templ_list_row_activated_cb(GtkTreeView *view,
LEAVE(" ");
}
void
gnc_ab_trans_dialog_bankcode_changed_cb(GtkEditable *editable, gpointer user_data)
{
#if HAVE_KTOBLZCHECK_H
GncABTransDialog *td = user_data;
const AccountNumberCheck_Record *record;
const gchar *input = gtk_entry_get_text(GTK_ENTRY(td->recp_bankcode_entry));
g_return_if_fail(td);
// FIXME: If this is a SEPA transaction, totally different verification
// rules apply anyway. There are some initial verification functions in
// <ktoblzcheck/iban.h>, but those need to be implemented here as well.
if (gnc_ab_trans_isSEPA(td->trans_type))
return;
ENTER("td=%p, input=%s", td, input);
record = AccountNumberCheck_findBank(td->blzcheck, input);
if (record)
{
const char *bankname = AccountNumberCheck_Record_bankName(record);
GError *error = NULL;
const char *ktoblzcheck_encoding =
#ifdef KTOBLZCHECK_VERSION_MAJOR
/* This version number macro has been added in ktoblzcheck-1.10, but
* this function exists already since ktoblzcheck-1.7, so we're on
* the safe side. */
AccountNumberCheck_stringEncoding()
#else
/* Every ktoblzcheck release before 1.10 is guaranteed to return
* strings only in ISO-8859-15. */
"ISO-8859-15"
#endif
;
gchar *utf8_bankname = g_convert(bankname, strlen(bankname), "UTF-8",
ktoblzcheck_encoding, NULL, NULL,
&error);
if (error)
{
g_critical("Error converting bankname \"%s\" to UTF-8", bankname);
g_error_free (error);
/* Conversion was erroneous, so don't use the string */
utf8_bankname = g_strdup(_("(unknown)"));
}
gtk_label_set_text(GTK_LABEL(td->recp_bankname_label),
*utf8_bankname ? utf8_bankname : _("(unknown)"));
DEBUG("Found: %s", utf8_bankname);
g_free(utf8_bankname);
}
else
{
gtk_label_set_text(GTK_LABEL(td->recp_bankname_label), _("(unknown)"));
}
gnc_ab_trans_dialog_verify_values(td);
LEAVE(" ");
#endif
}
struct _FindTemplData
{

View File

@ -50,8 +50,8 @@ typedef struct _GncABTransDialog GncABTransDialog;
typedef enum _GncABTransType GncABTransType;
enum _GncABTransType
{
SINGLE_TRANSFER = 0,
SINGLE_DEBITNOTE,
SINGLE_TRANSFER = 0, /* obsolete old non-SEPA transfer; no longer in use */
SINGLE_DEBITNOTE, /* obsolete old non-SEPA debit note; no longer in use */
SINGLE_INTERNAL_TRANSFER
, SEPA_TRANSFER
, SEPA_DEBITNOTE

View File

@ -974,7 +974,6 @@
<property name="invisible_char_set">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<signal name="changed" handler="gnc_ab_trans_dialog_bankcode_changed_cb" swapped="no"/>
<signal name="insert-text" handler="gnc_ab_trans_dialog_bicentry_filter_cb" swapped="no"/>
</object>
<packing>

View File

@ -695,15 +695,14 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data)
case AB_Transaction_TypeDebitNote:
trans_type = SINGLE_DEBITNOTE;
break;
case AB_Transaction_TypeEuTransfer:
trans_type = SEPA_TRANSFER;
break;
case AB_Transaction_TypeTransaction:
/* trans_type = SINGLE_INTERNAL_TRANSFER;
* break; */
case AB_Transaction_TypeTransfer:
case AB_Transaction_TypeEuTransfer:
default:
trans_type = SINGLE_TRANSFER;
trans_type = SEPA_TRANSFER;
break;
} /* switch */
job = gnc_ab_get_trans_job(data->ab_acc, ab_trans, trans_type);

View File

@ -20,10 +20,8 @@
<menuitem name="ABGetBalance" action="ABGetBalanceAction"/>
<menuitem name="ABGetTrans" action="ABGetTransAction"/>
<separator name="OnlineActionsSep1"/>
<!--menuitem name="ABIssueTrans" action="ABIssueTransAction"/-- the non-SEPA version is no longer in use -->
<menuitem name="ABIssueSepaTrans" action="ABIssueSepaTransAction"/>
<menuitem name="ABIssueIntTrans" action="ABIssueIntTransAction"/>
<!--menuitem name="ABIssueDirectDebit" action="ABIssueDirectDebitAction"/-- the non-SEPA version is no longer in use -->
<!--menuitem name="ABIssueSepaDirectDebit" action="ABIssueSepaDirectDebitAction"/-->
<separator name="OnlineActionsSep2"/>
<menuitem name="ABViewLogwindow" action="ABViewLogwindowAction"/>

View File

@ -71,10 +71,8 @@ static Account *main_window_to_account(GncMainWindow *window);
static void gnc_plugin_ab_cmd_setup(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_get_balance(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_get_transactions(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_issue_transaction(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_issue_sepatransaction(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_issue_inttransaction(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_issue_direct_debit(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_issue_sepa_direct_debit(GtkAction *action, GncMainWindowActionData *data);
static void gnc_plugin_ab_cmd_view_logwindow(GtkToggleAction *action, GncMainWindow *window);
static void gnc_plugin_ab_cmd_mt940_import(GtkAction *action, GncMainWindowActionData *data);
@ -109,11 +107,6 @@ static GtkActionEntry gnc_plugin_actions [] =
N_("Get the transactions online through Online Banking"),
G_CALLBACK(gnc_plugin_ab_cmd_get_transactions)
},
{
"ABIssueTransAction", NULL, N_("_Issue Transaction..."), NULL,
N_("Issue a new transaction online through Online Banking"),
G_CALLBACK(gnc_plugin_ab_cmd_issue_transaction)
},
{
"ABIssueSepaTransAction", NULL,
/* Translators: https://en.wikipedia.org/wiki/Single_Euro_Payments_Area */
@ -126,11 +119,6 @@ static GtkActionEntry gnc_plugin_actions [] =
N_("Issue a new bank-internal transaction online through Online Banking"),
G_CALLBACK(gnc_plugin_ab_cmd_issue_inttransaction)
},
{
"ABIssueDirectDebitAction", NULL, N_("_Direct Debit..."), NULL,
N_("Issue a new direct debit note online through Online Banking"),
G_CALLBACK(gnc_plugin_ab_cmd_issue_direct_debit)
},
{
"ABIssueSepaDirectDebitAction", NULL, N_("_Issue SEPA Direct Debit..."), NULL,
N_("Issue a new international European (SEPA) direct debit note online through Online Banking"),
@ -190,10 +178,8 @@ static const gchar *need_account_actions[] =
{
"ABGetBalanceAction",
"ABGetTransAction",
"ABIssueTransAction",
"ABIssueSepaTransAction",
"ABIssueIntTransAction",
"ABIssueDirectDebitAction",
"ABIssueSepaDirectDebitAction",
NULL
};
@ -542,27 +528,6 @@ gnc_plugin_ab_cmd_get_transactions(GtkAction *action,
LEAVE(" ");
}
static void
gnc_plugin_ab_cmd_issue_transaction(GtkAction *action,
GncMainWindowActionData *data)
{
Account *account;
ENTER("action %p, main window data %p", action, data);
account = main_window_to_account(data->window);
if (account == NULL)
{
g_message("No AqBanking account selected");
LEAVE("no account");
return;
}
gnc_main_window = data->window;
gnc_ab_maketrans(GTK_WIDGET(data->window), account, SINGLE_TRANSFER);
LEAVE(" ");
}
static void
gnc_plugin_ab_cmd_issue_sepatransaction(GtkAction *action,
GncMainWindowActionData *data)
@ -606,27 +571,6 @@ gnc_plugin_ab_cmd_issue_inttransaction(GtkAction *action,
LEAVE(" ");
}
static void
gnc_plugin_ab_cmd_issue_direct_debit(GtkAction *action,
GncMainWindowActionData *data)
{
Account *account;
ENTER("action %p, main window data %p", action, data);
account = main_window_to_account(data->window);
if (account == NULL)
{
g_message("No AqBanking account selected");
LEAVE("no account");
return;
}
gnc_main_window = data->window;
gnc_ab_maketrans(GTK_WIDGET(data->window), account, SINGLE_DEBITNOTE);
LEAVE(" ");
}
static void
gnc_plugin_ab_cmd_issue_sepa_direct_debit(GtkAction *action,
GncMainWindowActionData *data)