From: G. Richardson
Date: Sun, 12 Apr 2015 19:55:45 +0000 (+0200)
Subject: Bankkonten auf Controller umgestellt
X-Git-Tag: release-3.3.0beta~100^2~10
X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=28fee2e2ebc6746bcfeb47c0318e79789ba1c850;p=kivitendo-erp.git
Bankkonten auf Controller umgestellt
Außerdem wurde neue Datenbankspalten eingeführt: obsolete, sortkey
In Vorbereitung auf den Kontenabgleich wurden zwei neue Spalten
eingeführt:
reconciliation_starting_balance
reconciliation_starting_date
Damit kann man einstellen, ab welchem Datum der Kontenabgleich für das
jeweilige Konto beginnen soll, und, für den Abgleich des Gesamtsaldos,
welchen Saldo das Konto zu dem Zeitpunkt hatte. Dies ist nützlich, wenn
man mit dem Kontenabgleich im laufenden Betrieb anfangen möchte, aber
nicht alle Buchungen der Vergangenheit nachträglich abgleichen möchte.
---
diff --git a/SL/BankAccount.pm b/SL/BankAccount.pm
deleted file mode 100644
index 3178b2a31..000000000
--- a/SL/BankAccount.pm
+++ /dev/null
@@ -1,121 +0,0 @@
-package SL::BankAccount;
-
-use strict;
-
-use SL::DBUtils;
-
-sub save {
- $main::lxdebug->enter_sub();
-
- my $self = shift;
- my %params = @_;
-
- my $myconfig = \%main::myconfig;
- my $form = $main::form;
-
- my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
-
- if (!$params{id}) {
- ($params{id}) = selectfirst_array_query($form, $dbh, qq|SELECT nextval('id')|);
- do_query($form, $dbh, qq|INSERT INTO bank_accounts (id, chart_id)
- VALUES (?, (SELECT id FROM chart LIMIT 1))|, conv_i($params{id}));
- }
-
- my $query =
- qq|UPDATE bank_accounts
- SET name= ?, account_number = ?, bank_code = ?, bank = ?, iban = ?, bic = ?, chart_id = ?
- WHERE id = ?|;
- my @values = (@params{qw(name account_number bank_code bank iban bic)}, conv_i($params{chart_id}), conv_i($params{id}));
-
- do_query($form, $dbh, $query, @values);
-
- $dbh->commit() unless ($params{dbh});
-
- $main::lxdebug->leave_sub();
-
- return $params{id};
-}
-
-sub retrieve {
- $main::lxdebug->enter_sub();
-
- my $self = shift;
- my %params = @_;
-
- Common::check_params(\%params, qw(id));
-
- my $myconfig = \%main::myconfig;
- my $form = $main::form;
-
- my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
-
- my $query = qq|SELECT * FROM bank_accounts WHERE id = ?|;
- my $account = selectfirst_hashref_query($form, $dbh, $query, conv_i($params{id}));
-
- $main::lxdebug->leave_sub();
-
- return $account;
-}
-
-sub delete {
- $::lxdebug->enter_sub();
-
- my $self = shift;
- my %params = @_;
-
- Common::check_params(\%params, qw(id));
-
- my $dbh = $params{dbh} || $::form->get_standard_dbh(%::myconfig);
-
- my $query = '
- DELETE
- FROM bank_accounts
- WHERE id = ?';
-
- do_query($::form, $dbh, $query, conv_i($params{id}));
-
- $dbh->commit();
-
- $::lxdebug->leave_sub();
-}
-
-sub list {
- $main::lxdebug->enter_sub();
-
- my $self = shift;
- my %params = @_;
-
- my $myconfig = \%main::myconfig;
- my $form = $main::form;
-
- my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
-
- my %sort_columns = (
- 'name' => [ 'ba.name', ],
- 'account_number' => [ 'ba.account_number', ],
- 'bank_code' => [ 'ba.bank_code', 'ba.account_number', ],
- 'bank' => [ 'ba.bank', 'ba.account_number', ],
- 'iban' => [ 'ba.iban', 'ba.account_number', ],
- 'bic' => [ 'ba.bic', 'ba.account_number', ],
- 'chart_accno' => [ 'c.accno', ],
- 'chart_description' => [ 'c.description', ],
- );
-
- my %sort_spec = create_sort_spec('defs' => \%sort_columns, 'default' => 'bank', 'column' => $params{sortorder}, 'dir' => $params{sortdir});
-
- my $query =
- qq|SELECT ba.id, ba.name, ba.account_number, ba.bank_code, ba.bank, ba.iban, ba.bic, ba.chart_id,
- c.accno AS chart_accno, c.description AS chart_description
- FROM bank_accounts ba
- LEFT JOIN chart c ON (ba.chart_id = c.id)
- ORDER BY $sort_spec{sql}|;
-
- my $results = selectall_hashref_query($form, $dbh, $query);
-
- $main::lxdebug->leave_sub();
-
- return $results;
-}
-
-
-1;
diff --git a/SL/Controller/BankAccount.pm b/SL/Controller/BankAccount.pm
new file mode 100644
index 000000000..15d5db308
--- /dev/null
+++ b/SL/Controller/BankAccount.pm
@@ -0,0 +1,122 @@
+ SL::Controller::BankAccount;
+
+use strict;
+
+use parent qw(SL::Controller::Base);
+
+use SL::Helper::Flash;
+use SL::Locale::String;
+use SL::DB::Default;
+use SL::DB::Manager::BankAccount;
+use SL::DB::Manager::BankTransaction;
+
+use Rose::Object::MakeMethods::Generic (
+ scalar => [ qw(bank_account) ],
+);
+
+__PACKAGE__->run_before('check_auth');
+__PACKAGE__->run_before('load_bank_account', only => [ qw(edit update delete) ]);
+
+#
+# actions
+#
+
+sub action_list {
+ my ($self) = @_;
+
+ $self->render('bankaccounts/list',
+ title => t8('Bank accounts'),
+ BANKACCOUNTS => SL::DB::Manager::BankAccount->get_all_sorted,
+ );
+}
+
+sub action_new {
+ my ($self) = @_;
+
+ $self->{bank_account} = SL::DB::BankAccount->new;
+ $self->render('bankaccounts/form',
+ title => t8('Add bank account'));
+}
+
+sub action_edit {
+ my ($self) = @_;
+
+ $self->render('bankaccounts/form', title => t8('Edit bank account'));
+}
+
+sub action_create {
+ my ($self) = @_;
+
+ $self->{bank_account} = SL::DB::BankAccount->new;
+ $self->create_or_update;
+}
+
+sub action_update {
+ my ($self) = @_;
+ $self->create_or_update;
+}
+
+sub action_delete {
+ my ($self) = @_;
+
+ if ( $self->{bank_account}->{number_of_bank_transactions} > 0 ) {
+ flash_later('error', $::locale->text('The bank account has been used and cannot be deleted.'));
+ } elsif ( eval { $self->{bank_account}->delete; 1; } ) {
+ flash_later('info', $::locale->text('The bank account has been deleted.'));
+ } else {
+ flash_later('error', $::locale->text('The bank account has been used and cannot be deleted.'));
+ };
+ $self->redirect_to(action => 'list');
+
+}
+
+sub action_reorder {
+ my ($self) = @_;
+
+ SL::DB::BankAccount->reorder_list(@{ $::form->{account_id} || [] });
+ $self->render(\'', { type => 'json' });
+}
+
+#
+# filters
+#
+
+sub check_auth {
+ $::auth->assert('config');
+}
+
+sub load_bank_account {
+ my ($self) = @_;
+
+ $self->{bank_account} = SL::DB::BankAccount->new(id => $::form->{id})->load;
+ $self->{bank_account}->{number_of_bank_transactions} = SL::DB::Manager::BankTransaction->get_all_count( query => [ local_bank_account_id => $self->{bank_account}->{id} ] );
+}
+
+#
+# helpers
+#
+
+sub create_or_update {
+ my ($self) = @_;
+ my $is_new = !$self->{bank_account}->id;
+
+ my $params = delete($::form->{bank_account}) || { };
+
+ $self->{bank_account}->assign_attributes(%{ $params });
+
+ my @errors = $self->{bank_account}->validate;
+
+ if (@errors) {
+ flash('error', @errors);
+ $self->render('bankaccounts/form',
+ title => $is_new ? t8('Add bank account') : t8('Edit bank account'));
+ return;
+ }
+
+ $self->{bank_account}->save;
+
+ flash_later('info', $is_new ? t8('The bank account has been created.') : t8('The bank account has been saved.'));
+ $self->redirect_to(action => 'list');
+}
+
+1;
diff --git a/SL/DB/BankAccount.pm b/SL/DB/BankAccount.pm
index 4ef201b99..9ac755beb 100644
--- a/SL/DB/BankAccount.pm
+++ b/SL/DB/BankAccount.pm
@@ -6,9 +6,40 @@ package SL::DB::BankAccount;
use strict;
use SL::DB::MetaSetup::BankAccount;
+use SL::DB::Manager::BankAccount;
+use SL::DB::Helper::ActsAsList;
__PACKAGE__->meta->initialize;
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
-__PACKAGE__->meta->make_manager_class;
+
+sub validate {
+ my ($self) = @_;
+
+ my @errors;
+
+ if ( not $self->{chart_id} ) {
+ push @errors, $::locale->text('There is no connected chart.');
+ } else {
+ # check whether the assigned chart is valid or is already being used by
+ # another bank account (there is also a UNIQUE database constraint on
+ # chart_id)
+
+ my $chart_id = $self->chart_id;
+ my $chart = SL::DB::Chart->new( id => $chart_id );
+ if ( $chart->load(speculative => 1) ) {
+ my $linked_bank = SL::DB::Manager::BankAccount->find_by( chart_id => $chart_id );
+ if ( $linked_bank ) {
+ if ( not $self->{id} or ( $self->{id} && $linked_bank->id != $self->{id} )) {
+ push @errors, $::locale->text('The account #1 is already being used by bank account #2.', $chart->displayable_name, $linked_bank->{name});
+ };
+ };
+ } else {
+ push @errors, $::locale->text('The chart is not valid.');
+ };
+ };
+
+ push @errors, $::locale->text('The IBAN is missing.') unless $self->{iban};
+
+ return @errors;
+}
1;
diff --git a/SL/DB/MetaSetup/BankAccount.pm b/SL/DB/MetaSetup/BankAccount.pm
index 8057f44ac..d778138e9 100644
--- a/SL/DB/MetaSetup/BankAccount.pm
+++ b/SL/DB/MetaSetup/BankAccount.pm
@@ -9,22 +9,29 @@ use base qw(SL::DB::Object);
__PACKAGE__->meta->table('bank_accounts');
__PACKAGE__->meta->columns(
- account_number => { type => 'varchar', length => 100 },
- bank => { type => 'text' },
- bank_code => { type => 'varchar', length => 100 },
- bic => { type => 'varchar', length => 100 },
- chart_id => { type => 'integer', not_null => 1 },
- iban => { type => 'varchar', length => 100 },
- id => { type => 'integer', not_null => 1, sequence => 'id' },
- name => { type => 'text' },
+ account_number => { type => 'varchar', length => 100 },
+ bank => { type => 'text' },
+ bank_code => { type => 'varchar', length => 100 },
+ bic => { type => 'varchar', length => 100 },
+ chart_id => { type => 'integer', not_null => 1 },
+ iban => { type => 'varchar', length => 100 },
+ id => { type => 'integer', not_null => 1, sequence => 'id' },
+ name => { type => 'text' },
+ obsolete => { type => 'boolean' },
+ reconciliation_starting_balance => { type => 'numeric', precision => 15, scale => 5 },
+ reconciliation_starting_date => { type => 'date' },
+ sortkey => { type => 'integer', not_null => 1 },
);
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
+__PACKAGE__->meta->unique_keys([ 'chart_id' ]);
+
__PACKAGE__->meta->foreign_keys(
chart => {
class => 'SL::DB::Chart',
key_columns => { chart_id => 'id' },
+ rel_type => 'one to one',
},
);
diff --git a/bin/mozilla/bankaccounts.pl b/bin/mozilla/bankaccounts.pl
deleted file mode 100644
index 941e40768..000000000
--- a/bin/mozilla/bankaccounts.pl
+++ /dev/null
@@ -1,175 +0,0 @@
-use strict;
-
-use List::MoreUtils qw(any);
-use POSIX qw(strftime);
-
-use SL::BankAccount;
-use SL::Chart;
-use SL::Form;
-use SL::ReportGenerator;
-
-require "bin/mozilla/common.pl";
-require "bin/mozilla/reportgenerator.pl";
-
-sub bank_account_add {
- $main::lxdebug->enter_sub();
-
- bank_account_display_form('account' => {});
-
- $main::lxdebug->leave_sub();
-}
-
-sub bank_account_edit {
- $main::lxdebug->enter_sub();
-
- my %params = @_;
- my $form = $main::form;
-
- my $account = SL::BankAccount->retrieve('id' => $params{id} || $form->{id});
-
- bank_account_display_form('account' => $account);
-
- $main::lxdebug->leave_sub();
-}
-
-sub bank_account_delete {
- $::lxdebug->enter_sub();
-
- SL::BankAccount->delete(id => $::form->{account}{id});
-
- print $::form->redirect_header('bankaccounts.pl?action=bank_account_list');
-
- $::lxdebug->leave_sub();
-}
-
-sub bank_account_display_form {
- $main::lxdebug->enter_sub();
-
- my %params = @_;
- my $account = $params{account} || {};
- my $form = $main::form;
- my $locale = $main::locale;
-
- my $charts = SL::Chart->list('link' => 'AP_paid');
- my $label_sub = sub { join '--', map { $_[0]->{$_} } qw(accno description) };
-
- $form->{title} = $account->{id} ? $locale->text('Edit bank account') : $locale->text('Add bank account');
-
- $form->header();
- print $form->parse_html_template('bankaccounts/bank_account_display_form',
- { 'CHARTS' => $charts,
- 'account' => $account,
- 'chart_label' => $label_sub,
- 'params' => \%params });
-
- $main::lxdebug->leave_sub();
-}
-
-sub bank_account_save {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my $locale = $main::locale;
-
- my $account = $form->{account} && (ref $form->{account} eq 'HASH') ? $form->{account} : { };
-
- if (any { !$account->{$_} } qw(name account_number bank_code iban bic)) {
- bank_account_display_form('account' => $account,
- 'error' => $locale->text('You have to fill in at least a name, an account number, the bank code, the IBAN and the BIC.'));
-
- $main::lxdebug->leave_sub();
- return;
- }
-
- my $id = SL::BankAccount->save(%{ $account });
-
- if ($form->{callback}) {
- $form->redirect();
-
- } else {
- bank_account_edit('id' => $id);
- }
-
- $main::lxdebug->leave_sub();
-}
-
-
-sub bank_account_list {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my $locale = $main::locale;
-
- $form->{title} = $locale->text('List of bank accounts');
-
- $form->{sort} ||= 'account_number';
- $form->{sortdir} = '1' if (!defined $form->{sortdir});
-
- $form->{callback} = build_std_url('action=bank_account_list', 'sort', 'sortdir');
-
- my $accounts = SL::BankAccount->list('sortorder' => $form->{sort},
- 'sortdir' => $form->{sortdir});
-
- my $report = SL::ReportGenerator->new(\%main::myconfig, $form);
-
- my $href = build_std_url('action=bank_account_list');
-
- my %column_defs = (
- 'name' => { 'text' => $locale->text('Name'), },
- 'account_number' => { 'text' => $locale->text('Account number'), },
- 'bank_code' => { 'text' => $locale->text('Bank code'), },
- 'bank' => { 'text' => $locale->text('Bank'), },
- 'bic' => { 'text' => $locale->text('BIC'), },
- 'iban' => { 'text' => $locale->text('IBAN'), },
- );
-
- my @columns = qw(name account_number bank bank_code bic iban);
-
- foreach my $name (@columns) {
- my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
- $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir";
- }
-
- $report->set_options('raw_bottom_info_text' => $form->parse_html_template('bankaccounts/bank_account_list_bottom'),
- 'std_column_visibility' => 1,
- 'output_format' => 'HTML',
- 'title' => $form->{title},
- 'attachment_basename' => $locale->text('bankaccounts') . strftime('_%Y%m%d', localtime time),
- );
- $report->set_options_from_form();
- $locale->set_numberformat_wo_thousands_separator(\%::myconfig) if lc($report->{options}->{output_format}) eq 'csv';
-
- $report->set_columns(%column_defs);
- $report->set_column_order(@columns);
- $report->set_export_options('bank_account_list');
- $report->set_sort_indicator($form->{sort}, $form->{sortdir});
-
- my $edit_url = build_std_url('action=bank_account_edit', 'callback');
-
- foreach my $account (@{ $accounts }) {
- my $row = { map { $_ => { 'data' => $account->{$_} } } keys %{ $account } };
-
- $row->{account_number}->{link} = $edit_url . '&id=' . E($account->{id});
-
- $report->add_data($row);
- }
-
- $report->generate_with_headers();
-
- $main::lxdebug->leave_sub();
-}
-
-sub dispatcher {
- my $form = $main::form;
-
- foreach my $action (qw(bank_account_save bank_account_delete)) {
- if ($form->{"action_${action}"}) {
- call_sub($action);
- return;
- }
- }
-
- $form->error($main::locale->text('No action defined.'));
-}
-
-1;
diff --git a/js/locale/de.js b/js/locale/de.js
index 874ccc90f..95b135720 100644
--- a/js/locale/de.js
+++ b/js/locale/de.js
@@ -69,6 +69,7 @@ namespace("kivi").setupLocale({
"The recipient, subject or body is missing.":"Der Empfäger, der Betreff oder der Text ist leer.",
"The selected database is still configured for client \"#1\". If you delete the database that client will stop working until you re-configure it. Do you still want to delete the database?":"Die auswählte Datenbank ist noch für Mandant \"#1\" konfiguriert. Wenn Sie die Datenbank löschen, wird der Mandanten nicht mehr funktionieren, bis er anders konfiguriert wurde. Wollen Sie die Datenbank trotzdem löschen?",
"There are still transfers not matching the qty of the delivery order. Stock operations can not be changed later. Do you really want to proceed?":"Einige der Lagerbewegungen sind nicht vollständig und Lagerbewegungen können nachträglich nicht mehr verändert werden. Wollen Sie wirklich fortfahren?",
+"There is no connected chart.":"Es fehlt ein verknüpftes Buchungskonto.",
"There is one or more sections for which no part has been assigned yet; therefore creating the new record is not possible yet.":"Es gibt einen oder mehrere Abschnitte ohne Artikelzuweisung; daher kann der neue Beleg noch nicht erstellt werden.",
"This sales order has an active configuration for periodic invoices. If you save then all subsequently created invoices will contain those changes as well, but not those that have already been created. Do you want to continue?":"Dieser Auftrag besitzt eine aktive Konfiguration für wiederkehrende Rechnungen. Wenn Sie jetzt speichern, so werden alle zukünftig hieraus erzeugten Rechnungen die Ãnderungen enthalten, nicht aber die bereits erzeugten Rechnungen. Wollen Sie speichern?",
"Time/cost estimate actions":"Aktionen für Kosten-/Zeitabschätzung",
diff --git a/locale/de/all b/locale/de/all
index ef144cb6e..620fe6c51 100755
--- a/locale/de/all
+++ b/locale/de/all
@@ -1598,7 +1598,6 @@ $self->{texts} = {
'New Purchase Price Rule' => 'Neue Einkaufspreisregel',
'New Sales Price Rule' => 'Neue Verkaufspreisregel',
'New assembly' => 'Neues Erzeugnis',
- 'New bank account' => 'Neues Bankkonto',
'New client #1: The database configuration fields "host", "port", "name" and "user" must not be empty.' => 'Neuer Mandant #1: Die Datenbankkonfigurationsfelder "Host", "Port" und "Name" dürfen nicht leer sein.',
'New client #1: The name must be unique and not empty.' => 'Neuer Mandant #1: Der Name darf nicht leer und muss eindeutig sein.',
'New contact' => 'Neue Ansprechperson',
@@ -2369,6 +2368,8 @@ $self->{texts} = {
'Start the correction assistant' => 'Korrekturassistenten starten',
'Startdate_coa' => 'Gültig ab',
'Starting Balance' => 'Eröffnungsbilanzwerte',
+ 'Starting balance' => 'Anfangssaldo',
+ 'Starting date' => 'Anfangsdatum',
'Starting the task server failed.' => 'Das Starten des Task-Servers schlug fehl.',
'Starting with version 2.6.3 the configuration files in "config" have been consolidated.' => 'Ab Version 2.6.3 wurden die Konfiguration vereinfacht und es gibt nur noch eine Konfigurationsdatei im Verzeichnis config',
'Statement' => 'Sammelrechnung',
@@ -2488,6 +2489,7 @@ $self->{texts} = {
'The Buchungsgruppe has been created.' => 'Die Buchungsgruppe wurde erstellt.',
'The Buchungsgruppe has been saved.' => 'Die Buchungsgruppe wurde gespeichert.',
'The GL transaction #1 has been deleted.' => 'Die Dialogbuchung #1 wurde gelöscht.',
+ 'The IBAN is missing.' => 'Die IBAN fehlt.',
'The LDAP server "#1:#2" is unreachable. Please check config/kivitendo.conf.' => 'Der LDAP-Server "#1:#2" ist nicht erreichbar. Bitte überprüfen Sie die Angaben in config/kivitendo.conf.',
'The SEPA export has been created.' => 'Der SEPA-Export wurde erstellt',
'The SEPA strings have been saved.' => 'Die bei SEPA-Ãberweisungen verwendeten Begriffe wurden gespeichert.',
@@ -2498,6 +2500,7 @@ $self->{texts} = {
'The acceptance status is in use and cannot be deleted.' => 'Der Abnahmestatus wird verwendet und kann nicht gelöscht werden.',
'The access rights a user has within a client instance is still governed by his group membership.' => 'Welche Zugriffsrechte ein Benutzer innerhalb eines Mandanten hat, wird weiterhin über Gruppenmitgliedschaften geregelt.',
'The access rights have been saved.' => 'Die Zugriffsrechte wurden gespeichert.',
+ 'The account #1 is already being used by bank account #2.' => 'Das Konto #1 wird schon von Bankkonto #2 benutzt.',
'The account 3804 already exists, the update will be skipped.' => 'Das Konto 3804 existiert schon, das Update wird übersprungen.',
'The account 3804 will not be added automatically.' => 'Das Konto 3804 wird nicht automatisch hinzugefügt.',
'The action is missing or invalid.' => 'Die action fehlt, oder sie ist ungültig.',
@@ -2513,6 +2516,10 @@ $self->{texts} = {
'The background job has been deleted.' => 'Der Hintergrund-Job wurde gelöscht.',
'The background job has been saved.' => 'Der Hintergrund-Job wurde gespeichert.',
'The background job was executed successfully.' => 'Der Hintergrund-Job wurde erfolgreich ausgeführt.',
+ 'The bank account has been created.' => 'Das Bankkonto wurde erstellt.',
+ 'The bank account has been deleted.' => 'Das Bankkonto wurde gelöscht.',
+ 'The bank account has been saved.' => 'Das Bankkonto wurde gespeichert',
+ 'The bank account has been used and cannot be deleted.' => 'Das Bankkonto wurde benutzt und kann nicht gelöscht werden.',
'The bank information must not be empty.' => 'Die Bankinformationen müssen vollständig ausgefüllt werden.',
'The base file name without a path or an extension to be used for printing for this type of requirement spec.' => 'Der Basisdateiname ohne Pfadanteil oder Erweiterung, der bei Drucken dieses Pflichtenhefttyps verwendet wird.',
'The base unit does not exist or it is about to be deleted in row %d.' => 'Die Basiseinheit in Zeile %d existiert nicht oder soll gelöscht werden.',
@@ -2527,6 +2534,7 @@ $self->{texts} = {
'The business has been saved.' => 'Der Kunden-/Lieferantentyp wurde gespeichert.',
'The business is in use and cannot be deleted.' => 'Der Kunden-/Lieferantentyp wird benutzt und kann nicht gelöscht werden.',
'The changing of tax-o-matic account is NOT recommended, but if you do so please also (re)configure buchungsgruppen and reconfigure ALL charts which point to this tax-o-matic account. ' => 'Es wird nicht empfohlen Steuerkonten (Umsatzsteuer oder Vorsteuer) "umzuhängen", aber falls es gemacht wird, bitte auch entsprechend konsequent die Buchungsgruppen und die Konten die mit dieser Steuer verknüpft sind umkonfigurieren.',
+ 'The chart is not valid.' => 'Das Konto ist nicht gültig.',
'The client could not be deleted.' => 'Der Mandant konnte nicht gelöscht werden.',
'The client has been created.' => 'Der Mandant wurde angelegt.',
'The client has been deleted.' => 'Der Mandant wurde gelöscht.',
@@ -2562,7 +2570,6 @@ $self->{texts} = {
'The database user is missing.' => 'Der Datenbankbenutzer fehlt.',
'The dataset #1 has been created.' => 'Die Datenbank #1 wurde angelegt.',
'The dataset #1 has been deleted.' => 'Die Datenbank #1 wurde gelöscht.',
- 'The date is missing.' => 'Das Datum fehlt',
'The deductible amount' => 'Der abziehbare Skontobetrag',
'The default delivery plan only checks if all delivery orders have been created not if the goods are transferred. This feature will check if all the goods are transferred. Caveat: Only the state of the delivery orders are checked not partial transferred delivery orders (in technical terms: the table inventory is not checked' => 'Standardmässig wird beim Lieferplan überprüft, ob es eine vollständige Liefermenge über alle Lieferscheine gibt. Dies ist dann die Statusbedingung für geliefert oder nicht geliefert. Mit dieser Erweiterung wird geprüft ob die Lieferbelege auch wirklich ausgelagert sind oder nicht. Teilausgelagerte Lieferscheine werden allerdings nicht berücksichtigt (Technischer Hintergrund: Keine Ãberprüfung der Lagertabelle inventory).',
'The default value depends on the variable type:' => 'Die Bedeutung des Standardwertes hängt vom Variablentypen ab:',
@@ -2771,6 +2778,7 @@ $self->{texts} = {
'There is an inconsistancy in your database.' => 'In Ihrer Datenbank sind Unstimmigkeiten vorhanden.',
'There is at least one sales or purchase invoice for which kivitendo recorded an inventory transaction with taxkeys even though no tax was recorded.' => 'Es gibt mindestens eine Verkaufs- oder Einkaufsrechnung, für die kivitendo eine Warenbestandsbuchung ohne dazugehörige Steuerbuchung durchgeführt hat.',
'There is at least one transaction for which the user has chosen a logically wrong taxkey.' => 'Es gibt mindestens eine Buchung, bei der ein logisch nicht passender Steuerschlüssel ausgewählt wurde.',
+ 'There is no connected chart.' => 'Es fehlt ein verknüpftes Buchungskonto.',
'There is not enough available of \'#1\' at warehouse \'#2\', bin \'#3\', #4, #5, for the transfer of #6.' => 'Von \'#1\' ist in Lager \'#2\', Lagerplatz \'#3\', #4, #5, nicht genügend eingelagert, um insgesamt #6 auszulagern.',
'There is not enough available of \'#1\' at warehouse \'#2\', bin \'#3\', #4, for the transfer of #5.' => 'Von \'#1\' ist in Lager \'#2\', Lagerplatz \'#3\', #4 nicht genügend eingelagert, um insgesamt #5 auszulagern.',
'There is not enough left of \'#1\' in bin \'#2\' for the removal of #3.' => 'In Lagerplatz \'#2\' ist nicht genug von \'#1\' vorhanden, um #3 zu entnehmen.',
diff --git a/menus/erp.ini b/menus/erp.ini
index c96847542..e3378099a 100644
--- a/menus/erp.ini
+++ b/menus/erp.ini
@@ -619,8 +619,8 @@ module=am.pl
action=list_tax
[System--Bank accounts]
-module=bankaccounts.pl
-action=bank_account_list
+module=controller.pl
+action=BankAccount/list
[System--Groups]
module=pe.pl
diff --git a/sql/Pg-upgrade2/bank_accounts_unique_chart_constraint.sql b/sql/Pg-upgrade2/bank_accounts_unique_chart_constraint.sql
new file mode 100644
index 000000000..59e0b0a2a
--- /dev/null
+++ b/sql/Pg-upgrade2/bank_accounts_unique_chart_constraint.sql
@@ -0,0 +1,6 @@
+-- @tag: bank_accounts_unique_chart_constraint
+-- @description: Bankkonto - Constraint für eindeutiges Konto
+-- @depends: release_3_2_0
+-- @encoding: utf-8
+
+ALTER TABLE bank_accounts ADD CONSTRAINT chart_id_unique UNIQUE (chart_id);
diff --git a/sql/Pg-upgrade2/bankaccounts_reconciliation.sql b/sql/Pg-upgrade2/bankaccounts_reconciliation.sql
new file mode 100644
index 000000000..cb9e53b97
--- /dev/null
+++ b/sql/Pg-upgrade2/bankaccounts_reconciliation.sql
@@ -0,0 +1,7 @@
+-- @tag: bankaccounts_reconciliation
+-- @description: Kontenabgleichsststartdatum und -saldo
+-- @depends: release_3_2_0
+-- @encoding: utf-8
+
+ALTER TABLE bank_accounts ADD COLUMN reconciliation_starting_date DATE;
+ALTER TABLE bank_accounts ADD COLUMN reconciliation_starting_balance numeric(15,5);
diff --git a/sql/Pg-upgrade2/bankaccounts_sortkey_and_obsolete.sql b/sql/Pg-upgrade2/bankaccounts_sortkey_and_obsolete.sql
new file mode 100644
index 000000000..49baff90e
--- /dev/null
+++ b/sql/Pg-upgrade2/bankaccounts_sortkey_and_obsolete.sql
@@ -0,0 +1,12 @@
+-- @tag: bankaccounts_sortkey_and_obsolete
+-- @description: Bankkonto - Sortierreihenfolge und Ungültig
+-- @depends: release_3_2_0
+-- @encoding: utf-8
+
+ALTER TABLE bank_accounts ADD COLUMN obsolete BOOLEAN;
+
+ALTER TABLE bank_accounts ADD COLUMN sortkey INTEGER;
+CREATE SEQUENCE tmp_counter;
+UPDATE bank_accounts SET sortkey = nextval('tmp_counter');
+DROP SEQUENCE tmp_counter;
+ALTER TABLE bank_accounts ALTER COLUMN sortkey SET NOT NULL;
diff --git a/templates/webpages/bankaccounts/bank_account_display_form.html b/templates/webpages/bankaccounts/bank_account_display_form.html
deleted file mode 100644
index dbc45966f..000000000
--- a/templates/webpages/bankaccounts/bank_account_display_form.html
+++ /dev/null
@@ -1,72 +0,0 @@
-[%- USE T8 %]
-[% USE HTML %]
-[% title %]
-
-[%- IF params.error %]
- [% params.error %]
-[%- END %]
-
-
-
diff --git a/templates/webpages/bankaccounts/bank_account_list_bottom.html b/templates/webpages/bankaccounts/bank_account_list_bottom.html
deleted file mode 100644
index 202dd2d4c..000000000
--- a/templates/webpages/bankaccounts/bank_account_list_bottom.html
+++ /dev/null
@@ -1,4 +0,0 @@
-[% USE T8 %][% USE HTML %]
-
- [%- 'New bank account' | $T8 %]
-
diff --git a/templates/webpages/bankaccounts/form.html b/templates/webpages/bankaccounts/form.html
new file mode 100644
index 000000000..e1c323ca3
--- /dev/null
+++ b/templates/webpages/bankaccounts/form.html
@@ -0,0 +1,92 @@
+[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
+
+[% SET style="width: 400px" %]
+[% SET size=34 %]
+
+[% HTML.escape(title) %]
+
+
diff --git a/templates/webpages/bankaccounts/list.html b/templates/webpages/bankaccounts/list.html
new file mode 100644
index 000000000..c1a9ff022
--- /dev/null
+++ b/templates/webpages/bankaccounts/list.html
@@ -0,0 +1,43 @@
+[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%][%- INCLUDE 'common/flash.html' %]
+
+[% title %]
+
+
+
+
+
+ |
+ [% 'Name' | $T8 %] |
+ [% 'IBAN' | $T8 %] |
+ [% 'Bank' | $T8 %] |
+ [% 'Bank code' | $T8 %] |
+ [% 'BIC' | $T8 %] |
+ [% 'Date' | $T8 %] |
+ [% 'Balance' | $T8 %] |
+
+
+
+
+ [%- FOREACH account = BANKACCOUNTS %]
+
+ |
+ [% HTML.escape(account.name) %] |
+ [% HTML.escape(account.iban) %] |
+ [% HTML.escape(account.bank) %] |
+ [% HTML.escape(account.bank_code) %] |
+ [% HTML.escape(account.bic) %] |
+ [% HTML.escape(account.reconciliation_starting_date.to_kivitendo) %] |
+ [% HTML.escape(account.reconciliation_starting_balance_as_number) %] |
+
+ [%- END %]
+
+
+
+
+
+
+[% L.sortable_element('#bankaccount_list tbody', url=SELF.url_for(action='reorder'), with='account_id') %]
+
+
+ [%- 'Add' | $T8 %]
+