]> wagnertech.de Git - kivitendo-erp.git/commitdiff
SimpleSystemSetting: Umstellung von »Bankkonten«
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 1 Feb 2017 13:03:51 +0000 (14:03 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 1 Feb 2017 15:51:59 +0000 (16:51 +0100)
SL/Controller/BankAccount.pm [deleted file]
SL/Controller/SimpleSystemSetting.pm
js/locale/de.js
locale/de/all
menus/user/00-erp.yaml
templates/webpages/bankaccounts/form.html [deleted file]
templates/webpages/bankaccounts/list.html [deleted file]
templates/webpages/simple_system_setting/_bank_account_form.html [new file with mode: 0644]

diff --git a/SL/Controller/BankAccount.pm b/SL/Controller/BankAccount.pm
deleted file mode 100644 (file)
index dff4312..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-package 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;
index 0c797627ba6b2e808cb8f98ca63ccf3eeea48c94..429d2879b02a90a5f06957f87d4370d29f05d1da 100644 (file)
@@ -21,6 +21,25 @@ __PACKAGE__->run_before('setup_javascript', only => [ qw(add create edit update
 # Make locales.pl happy: $self->render("simple_system_setting/_default_form")
 
 my %supported_types = (
+  bank_account => {
+    # Make locales.pl happy: $self->render("simple_system_setting/_bank_account_form")
+    class  => 'BankAccount',
+    titles => {
+      list => t8('Bank accounts'),
+      add  => t8('Add bank account'),
+      edit => t8('Edit bank account'),
+    },
+    list_attributes => [
+      { method => 'name',                                      title => t8('Name'), },
+      { method => 'iban',                                      title => t8('IBAN'), },
+      { method => 'bank',                                      title => t8('Bank'), },
+      { method => 'bank_code',                                 title => t8('Bank code'), },
+      { method => 'bic',                                       title => t8('BIC'), },
+      { method => 'reconciliation_starting_date_as_date',      title => t8('Date'),    align => 'right' },
+      { method => 'reconciliation_starting_balance_as_number', title => t8('Balance'), align => 'right' },
+    ],
+  },
+
   pricegroup => {
     # Make locales.pl happy: $self->render("simple_system_setting/_pricegroup_form")
     class  => 'Pricegroup',
index e6c964b8923c4e91a3e967e8fa43ad976df671e4..93a3aff9b84e4e9d2137a93ec17c83009a1b9280 100644 (file)
@@ -94,7 +94,6 @@ namespace("kivi").setupLocale({
 "Subject":"Betreff",
 "Text block actions":"Textblockaktionen",
 "Text block picture actions":"Aktionen für Textblockbilder",
-"The IBAN is missing.":"Die IBAN fehlt.",
 "The description is missing.":"Die Beschreibung fehlt.",
 "The field '#{title}' must be set.":"Das Feld »#{title}« muss gesetzt sein.",
 "The name is missing.":"Der Name fehlt.",
@@ -106,7 +105,6 @@ namespace("kivi").setupLocale({
 "The uploaded filename still exists.<br>If you not modify the name this is a new version of the file":"Der Dateiname existiert bereits.<br>Wenn Sie den Namen nicht ändern gibt dies eine neue Version der Datei",
 "There are duplicate parts at positions":"Es gibt doppelte Artikel bei den Positionen",
 "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",
index 6b6d41d88822a692ce296b4a47603f3d38481a4e..55ca5986225f5c93bc4d74387a8ef64bb6d0db08 100644 (file)
@@ -2918,10 +2918,6 @@ $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&ouml;scht werden.',
index 2ca178e73ddb9a5744156f8635788c55d92f895d..5468915118c320aedd1cec6ba981289218346587 100644 (file)
   name: Bank accounts
   order: 800
   params:
-    action: BankAccount/list
+    action: SimpleSystemSetting/list
+    type: bank_account
 - parent: system
   id: system_partsgroups
   name: Partsgroups
diff --git a/templates/webpages/bankaccounts/form.html b/templates/webpages/bankaccounts/form.html
deleted file mode 100644 (file)
index e1c323c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
-
-[% SET style="width: 400px" %]
-[% SET size=34 %]
-
-<h1>[% HTML.escape(title) %]</h1>
-
-<form action="controller.pl" method="post">
-
-[%- INCLUDE 'common/flash.html' %]
-
-[%- L.hidden_tag("id", SELF.bank_account.id) %]
-
-<table>
-  <tr>
-    <th align="right">[% 'Description' | $T8 %]</th>
-    <td>[%- L.input_tag("bank_account.name", SELF.bank_account.name, size=size) %]</td>
-  </tr>
-  <tr>
-    <th align="right">[% 'IBAN' | $T8 %]</th>
-    <td>[%- L.input_tag("bank_account.iban", SELF.bank_account.iban, size=size) %]</td>
-  </tr>
-  <tr>
-    <th align="right">[% 'Bank' | $T8 %]</th>
-    <td>[%- L.input_tag("bank_account.bank", SELF.bank_account.bank, size=size) %]</td>
-  </tr>
-  <tr>
-    <th align="right">[% 'Account number' | $T8 %]</th>
-    <td>[%- L.input_tag("bank_account.account_number", SELF.bank_account.account_number, size=size) %]</td>
-  </tr>
-  <tr>
-    <th align="right">[% 'BIC' | $T8 %]</th>
-    <td>[%- L.input_tag("bank_account.bic", SELF.bank_account.bic, size=size) %]</td>
-  </tr>
-  <tr>
-    <th align="right">[% 'Bank code' | $T8 %]</th>
-    <td>[%- L.input_tag("bank_account.bank_code", SELF.bank_account.bank_code, size=size) %]</td>
-  </tr>
-  <tr>
-    <th align="right">[% 'Chart' | $T8 %]</th>
-    <td>[% L.chart_picker('bank_account.chart_id', SELF.bank_account.chart_id, type='AR_paid,AP_paid', category='A,L,Q', choose=1, style=style) %]</td>
-  </tr>
-  <tr>
-    <th align="right">[% 'Obsolete' | $T8 %]</th>
-    <td>[% L.checkbox_tag('bank_account.obsolete', checked = SELF.bank_account.obsolete, for_submit=1) %]</td>
-  </tr>
-  <tr>
-    <td align="left">[% 'Reconciliation' | $T8 %]:</td>
-    <td></td>
-  </tr>
-  <tr>
-    <th align="right">[% 'Starting date' | $T8 %]</th>
-    <td>[% L.date_tag('bank_account.reconciliation_starting_date', SELF.bank_account.reconciliation_starting_date) %]</td>
-  </tr>
-  <tr>
-    <th align="right">[% 'Starting balance' | $T8 %]</th>
-    <td>[%- L.input_tag('bank_account.reconciliation_starting_balance_as_number', SELF.bank_account.reconciliation_starting_balance_as_number) %]</td>
-  </tr>
-</table>
-
- <p>
-  [% L.hidden_tag("action", "BankAccount/dispatch") %]
-  [% L.submit_tag("action_" _  (SELF.bank_account.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %]
-  [%- IF SELF.bank_account.id AND SELF.bank_account.number_of_bank_transactions == 0 -%]
-    [% L.submit_tag("action_delete", LxERP.t8('Delete')) %]
-  [%- END %]
-  <a href="[% SELF.url_for(action='list') %]">[%- LxERP.t8("Cancel") %]</a>
- </p>
-
- <hr>
-
-<script type="text/javascript">
-<!--
-function check_prerequisites() {
-  if ($('#bank_account_name').val() === "") {
-    alert(kivi.t8('The name is missing.'));
-    return false;
-  }
-  if ($('#bank_account_iban').val() === "") {
-    alert(kivi.t8('The IBAN is missing.'));
-    return false;
-  }
-  if ($('#bank_account_chart_id').val() === "") {
-    alert(kivi.t8('There is no connected chart.'));
-    return false;
-  }
-
-  return true;
-}
--->
-</script>
-</form>
diff --git a/templates/webpages/bankaccounts/list.html b/templates/webpages/bankaccounts/list.html
deleted file mode 100644 (file)
index a4b6018..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%][%- INCLUDE 'common/flash.html' %]
-
-<h1>[% title %]</h1>
-
-<p>
- <table width="100%" id="bankaccount_list">
-  <thead>
-   <tr class="listheading">
-    <th align="center" width="1%"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
-    <th>[% 'Name' | $T8 %]</th>
-    <th>[% 'IBAN' | $T8 %]</th>
-    <th>[% 'Bank' | $T8 %]</th>
-    <th>[% 'Bank code' | $T8 %]</th>
-    <th>[% 'BIC' | $T8 %]</th>
-    <th>[% 'Date' | $T8 %]</th>
-    <th>[% 'Balance' | $T8 %]</th>
-   </tr>
-  </thead>
-
-  <tbody>
-   [%- FOREACH account = BANKACCOUNTS %]
-    <tr class="listrow" id="account_id_[% account.id %]">
-     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
-     <td><a href="[% SELF.url_for(action='edit', id=account.id) %]">[% HTML.escape(account.name) %]</a></td>
-     <td>[% HTML.escape(account.iban) %]</a></td>
-     <td>[% HTML.escape(account.bank) %]</a></td>
-     <td>[% HTML.escape(account.bank_code) %]</a></td>
-     <td>[% HTML.escape(account.bic) %]</a></td>
-     <td>[% HTML.escape(account.reconciliation_starting_date.to_kivitendo) %]</a></td>
-     <td align="right">[% HTML.escape(account.reconciliation_starting_balance_as_number) %]</a></td>
-    </tr>
-   [%- END %]
-  </tbody>
- </table>
-</p>
-
-<hr height="3">
-
-[% L.sortable_element('#bankaccount_list tbody', url=SELF.url_for(action='reorder'), with='account_id') %]
-
-<p>
- <a href="[% SELF.url_for(action='new') %]">[%- 'Add' | $T8 %]</a>
-</p>
diff --git a/templates/webpages/simple_system_setting/_bank_account_form.html b/templates/webpages/simple_system_setting/_bank_account_form.html
new file mode 100644 (file)
index 0000000..63cc87f
--- /dev/null
@@ -0,0 +1,50 @@
+[%- USE HTML -%][%- USE LxERP -%][%- USE L -%]
+
+[% SET style="width: 400px" %]
+
+<table>
+ <tr>
+  <th align="right">[% LxERP.t8('Description') %]</th>
+  <td>[%- L.input_tag("object.name", SELF.object.name, style=style, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]</td>
+ </tr>
+ <tr>
+  <th align="right">[% LxERP.t8('IBAN') %]</th>
+  <td>[%- L.input_tag("object.iban", SELF.object.iban, style=style, "data-validate"="required", "data-title"=LxERP.t8("IBAN")) %]</td>
+ </tr>
+ <tr>
+  <th align="right">[% LxERP.t8('Bank') %]</th>
+  <td>[%- L.input_tag("object.bank", SELF.object.bank, style=style) %]</td>
+ </tr>
+ <tr>
+  <th align="right">[% LxERP.t8('Account number') %]</th>
+  <td>[%- L.input_tag("object.account_number", SELF.object.account_number, style=style) %]</td>
+ </tr>
+ <tr>
+  <th align="right">[% LxERP.t8('BIC') %]</th>
+  <td>[%- L.input_tag("object.bic", SELF.object.bic, style=style) %]</td>
+ </tr>
+ <tr>
+  <th align="right">[% LxERP.t8('Bank code') %]</th>
+  <td>[%- L.input_tag("object.bank_code", SELF.object.bank_code, style=style) %]</td>
+ </tr>
+ <tr>
+  <th align="right">[% LxERP.t8('Chart') %]</th>
+  <td>[% L.chart_picker('object.chart_id', SELF.object.chart_id, type='AR_paid,AP_paid', category='A,L,Q', choose=1, style=style, "data-validate"="required", "data-title"=LxERP.t8("Chart")) %]</td>
+ </tr>
+ <tr>
+  <th align="right">[% LxERP.t8('Obsolete') %]</th>
+  <td>[% L.checkbox_tag('object.obsolete', checked = SELF.object.obsolete, for_submit=1) %]</td>
+ </tr>
+ <tr>
+  <td align="left">[% LxERP.t8('Reconciliation') %]:</td>
+  <td></td>
+ </tr>
+ <tr>
+  <th align="right">[% LxERP.t8('Starting date') %]</th>
+  <td>[% L.date_tag('object.reconciliation_starting_date', SELF.object.reconciliation_starting_date) %]</td>
+ </tr>
+ <tr>
+  <th align="right">[% LxERP.t8('Starting balance') %]</th>
+  <td>[%- L.input_tag('object.reconciliation_starting_balance_as_number', SELF.object.reconciliation_starting_balance_as_number) %]</td>
+ </tr>
+</table>