Ejemplo n.º 1
0
void AB_ImExporterAccountInfo_FillFromAccount(AB_IMEXPORTER_ACCOUNTINFO *iea,
					      const AB_ACCOUNT *a) {
  const char *s;
  AB_ACCOUNT_TYPE at;

  assert(iea);
  assert(a);

  s=AB_Account_GetBankCode(a);
  AB_ImExporterAccountInfo_SetBankCode(iea, s);

  s=AB_Account_GetBankName(a);
  AB_ImExporterAccountInfo_SetBankName(iea, s);

  s=AB_Account_GetAccountNumber(a);
  AB_ImExporterAccountInfo_SetAccountNumber(iea, s);

  s=AB_Account_GetAccountName(a);
  AB_ImExporterAccountInfo_SetAccountName(iea, s);

  s=AB_Account_GetIBAN(a);
  AB_ImExporterAccountInfo_SetIban(iea, s);

  s=AB_Account_GetBIC(a);
  AB_ImExporterAccountInfo_SetBic(iea, s);

  s=AB_Account_GetCurrency(a);
  AB_ImExporterAccountInfo_SetCurrency(iea, s);

  s=AB_Account_GetOwnerName(a);
  AB_ImExporterAccountInfo_SetOwner(iea, s);

  at=AB_Account_GetAccountType(a);
  AB_ImExporterAccountInfo_SetType(iea, at);
}
Ejemplo n.º 2
0
int AB_Provider_AccountToAccountSpec(AB_PROVIDER *pro, const AB_ACCOUNT *acc, AB_ACCOUNT_SPEC *as, int doLock)
{
  int rv;

  assert(acc);
  assert(as);

  AB_AccountSpec_SetType(as, AB_Account_GetAccountType(acc));
  AB_AccountSpec_SetUniqueId(as, AB_Account_GetUniqueId(acc));
  AB_AccountSpec_SetBackendName(as, AB_Account_GetBackendName(acc));
  AB_AccountSpec_SetOwnerName(as, AB_Account_GetOwnerName(acc));
  AB_AccountSpec_SetAccountName(as, AB_Account_GetAccountName(acc));
  AB_AccountSpec_SetCurrency(as, AB_Account_GetCurrency(acc));
  AB_AccountSpec_SetIban(as, AB_Account_GetIban(acc));
  AB_AccountSpec_SetBic(as, AB_Account_GetBic(acc));

  AB_AccountSpec_SetCountry(as, AB_Account_GetCountry(acc));
  AB_AccountSpec_SetBankCode(as, AB_Account_GetBankCode(acc));
  AB_AccountSpec_SetAccountNumber(as, AB_Account_GetAccountNumber(acc));
  AB_AccountSpec_SetSubAccountNumber(as, AB_Account_GetSubAccountId(acc));

  rv=AB_Provider_UpdateAccountSpec(pro, as, doLock);
  if (rv<0 && rv!=GWEN_ERROR_NOT_IMPLEMENTED) {
    DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv);
    return rv;
  }

  return 0;
}
Ejemplo n.º 3
0
static void createAccountListBoxString(const AB_ACCOUNT *a, GWEN_BUFFER *tbuf)
{
  const char *s;
  char numbuf[32];
  uint32_t uid;

  /* column 1 */
  uid=AB_Account_GetUniqueId(a);
  snprintf(numbuf, sizeof(numbuf)-1, "%06d", uid);
  numbuf[sizeof(numbuf)-1]=0;
  GWEN_Buffer_AppendString(tbuf, numbuf);
  GWEN_Buffer_AppendString(tbuf, "\t");

  /* column 2 */
  s=AB_Account_GetBankCode(a);
  if (s && *s)
    GWEN_Buffer_AppendString(tbuf, s);
  GWEN_Buffer_AppendString(tbuf, "\t");

  /* column 3 */
  s=AB_Account_GetBankName(a);
  if (s && *s)
    GWEN_Buffer_AppendString(tbuf, s);
  GWEN_Buffer_AppendString(tbuf, "\t");

  /* column 4 */
  s=AB_Account_GetAccountNumber(a);
  if (s && *s)
    GWEN_Buffer_AppendString(tbuf, s);
  GWEN_Buffer_AppendString(tbuf, "\t");

  /* column 5 */
  s=AB_Account_GetAccountName(a);
  if (s && *s)
    GWEN_Buffer_AppendString(tbuf, s);
  GWEN_Buffer_AppendString(tbuf, "\t");

  /* column 6 */
  s=AB_Account_GetOwnerName(a);
  if (s && *s)
    GWEN_Buffer_AppendString(tbuf, s);
  GWEN_Buffer_AppendString(tbuf, "\t");

  /* column 7 */
  s=AB_Account_GetBackendName(a);
  if (s && *s)
    GWEN_Buffer_AppendString(tbuf, s);
}
Ejemplo n.º 4
0
void KBAccountListViewItem::_populate()
{
  QString tmp;
  int i;

  assert(_account);

  i = 0;

  // unique id
  setText(i++, QString::number(AB_Account_GetUniqueId(_account)));

  // bank code
  setText(i++, QString::fromUtf8(AB_Account_GetBankCode(_account)));

  // bank name
  tmp = AB_Account_GetBankName(_account);
  if (tmp.isEmpty())
    tmp = i18nc("replacement for institution or account w/o name", "(unnamed)");
  setText(i++, tmp);

  // account id
  setText(i++, QString::fromUtf8(AB_Account_GetAccountNumber(_account)));

  // account name
  tmp = QString::fromUtf8(AB_Account_GetAccountName(_account));
  if (tmp.isEmpty())
    tmp = i18nc("replacement for institution or account w/o name", "(unnamed)");
  setText(i++, tmp);

  tmp = QString::fromUtf8(AB_Account_GetOwnerName(_account));
  if (tmp.isEmpty())
    tmp = "";
  setText(i++, tmp);

  tmp = QString::fromUtf8(AB_Provider_GetName(AB_Account_GetProvider(_account)));
  if (tmp.isEmpty())
    tmp = i18nc("replacement for institution or account w/o name", "(unnamed)");
  setText(i++, tmp);
}
Ejemplo n.º 5
0
GncABTransDialog *
gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc,
                        gint commodity_scu, GncABTransType trans_type,
                        GList *templates)
{
    GncABTransDialog *td;
    GtkBuilder  *builder;
    const gchar *ab_ownername;
    const gchar *ab_accountnumber;
    const gchar *ab_bankname;
    const gchar *ab_bankcode;
    GtkWidget *heading_label;
    GtkWidget *recp_name_heading;
    GtkWidget *recp_account_heading;
    GtkWidget *recp_bankcode_heading;
    GtkWidget *amount_hbox;
    GtkWidget *orig_name_heading;
    GtkWidget *orig_name_label;
    GtkWidget *orig_account_heading;
    GtkWidget *orig_account_label;
    GtkWidget *orig_bankname_heading;
    GtkWidget *orig_bankname_label;
    GtkWidget *orig_bankcode_heading;
    GtkWidget *orig_bankcode_label;
    GtkCellRenderer *renderer;
    GtkTreeViewColumn *column;

    g_return_val_if_fail(ab_acc, NULL);

    ab_ownername = AB_Account_GetOwnerName(ab_acc);
    if (!ab_ownername)
        ab_ownername = "";
    ab_accountnumber = AB_Account_GetAccountNumber(ab_acc);
    ab_bankcode = AB_Account_GetBankCode(ab_acc);
    ab_bankname = AB_Account_GetBankName(ab_acc);
    if (!ab_bankname || !*ab_bankname)
        ab_bankname = _("(unknown)");

    td = g_new0(GncABTransDialog, 1);
    td->parent = parent;
    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", "Transaction Dialog");
    td->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Transaction Dialog"));

    if (parent)
        gtk_window_set_transient_for(GTK_WINDOW(td->dialog), GTK_WINDOW(parent));

    /* Extract widgets */
    heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label"));
    recp_name_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_name_heading"));
    td->recp_name_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_name_entry"));
    recp_account_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_account_heading"));
    td->recp_account_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_account_entry"));
    recp_bankcode_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankcode_heading"));
    td->recp_bankcode_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankcode_entry"));
    td->recp_bankname_label = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankname_label"));
    amount_hbox = GTK_WIDGET(gtk_builder_get_object (builder, "amount_hbox"));
    td->purpose_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_entry"));
    td->purpose_cont_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont_entry"));
    td->purpose_cont2_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont2_entry"));
    td->purpose_cont3_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont3_entry"));
    orig_name_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_name_heading"));
    orig_name_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_name_label"));
    orig_account_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_account_heading"));
    orig_account_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_account_label"));
    orig_bankname_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankname_heading"));
    orig_bankname_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankname_label"));
    orig_bankcode_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankcode_heading"));
    orig_bankcode_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankcode_label"));
    td->template_gtktreeview =
        GTK_TREE_VIEW(gtk_builder_get_object (builder, "template_list"));

    /* Amount edit */
    td->amount_edit = gnc_amount_edit_new();
    gtk_box_pack_start_defaults(GTK_BOX(amount_hbox), td->amount_edit);
    gnc_amount_edit_set_evaluate_on_enter(GNC_AMOUNT_EDIT(td->amount_edit),
                                          TRUE);
    gnc_amount_edit_set_fraction(GNC_AMOUNT_EDIT(td->amount_edit),
                                 commodity_scu);

    /* Check for what kind of transaction this should be, and change the
     * labels accordingly */
    switch (trans_type)
    {
    case SINGLE_TRANSFER:
    case SINGLE_INTERNAL_TRANSFER:
        /* all labels are already set */
        break;
    case SINGLE_DEBITNOTE:
        gtk_label_set_text(GTK_LABEL (heading_label),
                           /* Translators: Strings from this file are
                             * needed only in countries that have one of
                             * aqbanking's Online Banking techniques
                             * available. This is 'OFX DirectConnect'
                             * (U.S. and others), 'HBCI' (in Germany),
                             * or 'YellowNet' (Switzerland). If none of
                             * these techniques are available in your
                             * country, you may safely ignore strings
                             * from the import-export/hbci
                             * subdirectory. */
                           _("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"));
        break;

    default:
        g_critical("gnc_ab_trans_dialog_new: Oops, unknown GncABTransType %d",
                   trans_type);
    break;
    }

    gtk_label_set_text(GTK_LABEL(orig_name_label), ab_ownername);
    gtk_label_set_text(GTK_LABEL(orig_account_label), ab_accountnumber);
    gtk_label_set_text(GTK_LABEL(orig_bankname_label), ab_bankname);
    gtk_label_set_text (GTK_LABEL (orig_bankcode_label), ab_bankcode);

    /* Fill list for choosing a transaction template */
    td->template_list_store = gtk_list_store_new(TEMPLATE_NUM_COLUMNS,
                              G_TYPE_STRING, G_TYPE_POINTER);
    g_list_foreach(templates, fill_templ_helper, td->template_list_store);
    gtk_tree_view_set_model(td->template_gtktreeview,
                            GTK_TREE_MODEL(td->template_list_store));
    td->templ_changed = FALSE;
    /* Keep a reference to the store */

    /* Show this list */
    renderer = gtk_cell_renderer_text_new();
    column = gtk_tree_view_column_new_with_attributes(
                 "Template Name", renderer, "text", TEMPLATE_NAME, NULL);
    gtk_tree_view_append_column(td->template_gtktreeview, column);

    /* Connect the Signals */
    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, td);

    g_object_unref(G_OBJECT(builder));

    return td;
}