From 857242398f40610d90f52b83b2d4ac5e1d764b9f Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 27 Jun 2013 12:00:13 +0200 Subject: [PATCH] =?utf8?q?Datenbank=20l=C3=B6schen:=20auch=20benutzte=20au?= =?utf8?q?sw=C3=A4hlbar,=20dann=20aber=20mit=20Sonderwarnung?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixt #2312. --- SL/Controller/Admin.pm | 4 +-- SL/User.pm | 21 --------------- js/locale/de.js | 4 ++- locale/de/all | 1 + templates/webpages/admin/delete_dataset.html | 27 +++++++++++++++++--- 5 files changed, 29 insertions(+), 28 deletions(-) diff --git a/SL/Controller/Admin.pm b/SL/Controller/Admin.pm index bb7a3b539..fe7dac531 100644 --- a/SL/Controller/Admin.pm +++ b/SL/Controller/Admin.pm @@ -20,7 +20,7 @@ use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(client user group printer db_cfg is_locked all_dateformats all_numberformats all_countrycodes all_stylesheets all_menustyles all_clients all_groups all_users all_rights all_printers - all_dbsources all_unused_dbsources all_accounting_methods all_inventory_systems all_profit_determinations all_charts) ], + all_dbsources all_used_dbsources all_accounting_methods all_inventory_systems all_profit_determinations all_charts) ], ); __PACKAGE__->run_before(\&setup_layout); @@ -462,7 +462,7 @@ sub init_all_dateformats { [ qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd) ] sub init_all_numberformats { [ '1,000.00', '1000.00', '1.000,00', '1000,00' ] } sub init_all_stylesheets { [ qw(lx-office-erp.css Mobile.css kivitendo.css) ] } sub init_all_dbsources { [ sort User->dbsources($::form) ] } -sub init_all_unused_dbsources { [ sort User->dbsources_unused($::form) ] } +sub init_all_used_dbsources { { map { (join(':', $_->dbhost || 'localhost', $_->dbport || 5432, $_->dbname) => $_->name) } @{ $_[0]->all_clients } } } sub init_all_accounting_methods { [ { id => 'accrual', name => t8('Accrual accounting') }, { id => 'cash', name => t8('Cash accounting') } ] } sub init_all_inventory_systems { [ { id => 'perpetual', name => t8('Perpetual inventory') }, { id => 'periodic', name => t8('Periodic inventory') } ] } sub init_all_profit_determinations { [ { id => 'balance', name => t8('Balancing') }, { id => 'income', name => t8('Cash basis accounting') } ] } diff --git a/SL/User.pm b/SL/User.pm index 1e23602f4..3e9d0ace0 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -298,27 +298,6 @@ sub dbdelete { $main::lxdebug->leave_sub(); } -sub dbsources_unused { - $main::lxdebug->enter_sub(); - - my ($self, $form) = @_; - - my %dbexcl = map { $_->dbname => 1 } - grep { ($_->dbhost eq $form->{dbhost}) && ($_->dbport eq $form->{dbport}) } - @{ SL::DB::Manager::AuthClient->get_all }; - - $form->{only_acc_db} = 1; - - $dbexcl{$form->{dbdefault}} = 1; - $dbexcl{$main::auth->{DB_config}->{db}} = 1; - - my @dbunused = grep { !$dbexcl{$_} } dbsources("", $form); - - $main::lxdebug->leave_sub(); - - return @dbunused; -} - sub calc_version { $main::lxdebug->enter_sub(2); diff --git a/js/locale/de.js b/js/locale/de.js index c452769e2..0d45d3094 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -1,6 +1,8 @@ namespace("kivi").setupLocale({ +"Are you sure?":"Sind Sie sicher?", "The description is missing.":"Die Beschreibung fehlt.", "The name is missing.":"Der Name fehlt.", "The name must only consist of letters, numbers and underscores and start with a letter.":"Der Name darf nur aus Buchstaben (keine Umlaute), Ziffern und Unterstrichen bestehen und muss mit einem Buchstaben beginnen.", -"The option field is empty.":"Das Optionsfeld ist leer." +"The option field is empty.":"Das Optionsfeld 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?" }); diff --git a/locale/de/all b/locale/de/all index 6771137dd..9fd78e1b5 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2093,6 +2093,7 @@ $self->{texts} = { 'The selected bank account does not exist anymore.' => 'Das ausgewählte Bankkonto existiert nicht mehr.', 'The selected bin does not exist.' => 'Der ausgewählte Lagerplatz existiert nicht.', 'The selected currency' => 'Die ausgewählte Währung', + '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?', 'The selected exports have been closed.' => 'Die ausgewählten Exporte wurden abgeschlossen.', 'The selected warehouse does not exist.' => 'Das ausgewählte Lager existiert nicht.', 'The selected warehouse is empty, or no stocked items where found that match the filter settings.' => 'Das ausgewählte Lager ist leer, oder in ihm wurden keine zu den Sucheinstellungen passenden eingelagerten Artikel gefunden.', diff --git a/templates/webpages/admin/delete_dataset.html b/templates/webpages/admin/delete_dataset.html index e27657e6c..e3b61151c 100644 --- a/templates/webpages/admin/delete_dataset.html +++ b/templates/webpages/admin/delete_dataset.html @@ -1,4 +1,4 @@ -[%- USE HTML %][%- USE LxERP -%][%- USE L -%] +[%- USE HTML %][%- USE LxERP -%][%- USE L -%][%- USE JavaScript -%] [% INCLUDE 'common/flash.html' %] @@ -11,12 +11,12 @@ [% LxERP.t8('If you want to delete such a dataset you have to edit the client(s) that are using the dataset in question and have them use another dataset.') %]

-[% IF SELF.all_unused_dbsources.size %] +[% IF SELF.all_dbsources.size %]

[% LxERP.t8('Please select the dataset you want to delete:') %] - [% L.select_tag('db', SELF.all_unused_dbsources, class="initial_focus") %] + [% L.select_tag('db', SELF.all_dbsources, class="initial_focus") %]

[% L.hidden_tag("dbhost", FORM.dbhost) %] @@ -27,9 +27,28 @@ [% L.hidden_tag("action", "Admin/do_delete_dataset") %]
- [% L.submit_tag('dummy', LxERP.t8('Delete Dataset'), confirm=LxERP.t8('Are you sure?')) %] + [% L.submit_tag('dummy', LxERP.t8('Delete Dataset'), id='submit') %]
+ + [% END %] -- 2.20.1