From: Moritz Bunkus Date: Wed, 1 Feb 2017 13:53:28 +0000 (+0100) Subject: SimpleSystemSetting: Umstellung von »Abteilungen« X-Git-Tag: release-3.5.4~1557 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9380035c08379c1ad6d07e9d51e24c16cbea84f2;p=kivitendo-erp.git SimpleSystemSetting: Umstellung von »Abteilungen« --- diff --git a/SL/Controller/Department.pm b/SL/Controller/Department.pm deleted file mode 100644 index 03d3fb676..000000000 --- a/SL/Controller/Department.pm +++ /dev/null @@ -1,102 +0,0 @@ -package SL::Controller::Department; - -use strict; - -use parent qw(SL::Controller::Base); - -use SL::DB::Department; -use SL::Helper::Flash; - -use Rose::Object::MakeMethods::Generic -( - scalar => [ qw(department) ], -); - -__PACKAGE__->run_before('check_auth'); -__PACKAGE__->run_before('load_department', only => [ qw(edit update destroy) ]); - -# -# actions -# - -sub action_list { - my ($self) = @_; - - $self->render('department/list', - title => $::locale->text('Departments'), - DEPARTMENTS => SL::DB::Manager::Department->get_all_sorted); -} - -sub action_new { - my ($self) = @_; - - $self->render('department/form', title => $::locale->text('Create a new department')); -} - -sub action_edit { - my ($self) = @_; - $self->render('department/form', title => $::locale->text('Edit department')); -} - -sub action_create { - my ($self) = @_; - - $self->{department} = SL::DB::Department->new; - $self->create_or_update; -} - -sub action_update { - my ($self) = @_; - $self->create_or_update; -} - -sub action_destroy { - my ($self) = @_; - - if (eval { $self->{department}->delete; 1; }) { - flash_later('info', $::locale->text('The department has been deleted.')); - } else { - flash_later('error', $::locale->text('The department is in use and cannot be deleted.')); - } - - $self->redirect_to(action => 'list'); -} - -# -# filters -# - -sub check_auth { - $::auth->assert('config'); -} - -# -# helpers -# - -sub create_or_update { - my $self = shift; - my $is_new = !$self->{department}->id; - my $params = delete($::form->{department}) || { }; - - $self->{department}->assign_attributes(%{ $params }); - - my @errors = $self->{department}->validate; - - if (@errors) { - flash('error', @errors); - $self->render('department/form', title => $is_new ? $::locale->text('Create a new department') : $::locale->text('Edit department')); - return; - } - $self->{department}->save; - - flash_later('info', $is_new ? $::locale->text('The department has been created.') : $::locale->text('The department has been saved.')); - $self->redirect_to(action => 'list'); -} - -sub load_department { - my ($self) = @_; - $self->{department} = SL::DB::Department->new(id => $::form->{id})->load; -} - -1; diff --git a/SL/Controller/SimpleSystemSetting.pm b/SL/Controller/SimpleSystemSetting.pm index 0c78f1109..979de3269 100644 --- a/SL/Controller/SimpleSystemSetting.pm +++ b/SL/Controller/SimpleSystemSetting.pm @@ -40,6 +40,15 @@ my %supported_types = ( ], }, + department => { + class => 'Department', + titles => { + list => t8('Departments'), + add => t8('Add department'), + edit => t8('Edit department'), + }, + }, + part_classification => { # Make locales.pl happy: $self->render("simple_system_setting/_part_classification_form") class => 'PartClassification', diff --git a/locale/de/all b/locale/de/all old mode 100644 new mode 100755 index 4164e7c9a..c1ef427bb --- a/locale/de/all +++ b/locale/de/all @@ -191,6 +191,7 @@ $self->{texts} = { 'Add bank account' => 'Bankkonto erfassen', 'Add booking group' => 'Buchungsgruppe erfassen', 'Add custom variable' => 'Benutzerdefinierte Variable erfassen', + 'Add department' => 'Abteilung hinzufügen', 'Add empty line (csv_import)' => 'Leere Zeile einfügen', 'Add function block' => 'Funktionsblock hinzufügen', 'Add headers from last uploaded file (csv_import)' => 'Spalten aus der hochgeladenen Datei einfügen', @@ -292,7 +293,6 @@ $self->{texts} = { 'Are you sure you want to delete this background job?' => 'Sind Sie sicher, dass Sie diesen Hintergrund-Job löschen möchten?', 'Are you sure you want to delete this business?' => 'Sind Sie sicher, dass Sie diesen Kunden-/Lieferantentyp löschen wollen?', 'Are you sure you want to delete this delivery term?' => 'Wollen Sie diese Lieferbedingungen wirklich löschen?', - 'Are you sure you want to delete this department?' => 'Sind Sie sicher, dass Sie diese Abteilung löschen wollen?', 'Are you sure you want to delete this letter?' => 'Sind Sie sicher, dass Sie diesen Brief löschen wollen?', 'Are you sure you want to delete this payment term?' => 'Wollen Sie diese Zahlungsbedingungen wirklich löschen?', 'Are you sure you want to remove the marked entries from the queue?' => 'Sind Sie sicher, dass die markierten Einträge von der Warteschlange gelöscht werden sollen?', @@ -665,7 +665,6 @@ $self->{texts} = { 'Create a new client' => 'Einen neuen Mandanten anlegen', 'Create a new complexity' => 'Einen Komplexitätsgrad anlegen', 'Create a new delivery term' => 'Neue Lieferbedingungen anlegen', - 'Create a new department' => 'Eine neue Abteilung erfassen', 'Create a new group' => 'Neue Benutzergruppe erfassen', 'Create a new payment term' => 'Neue Zahlungsbedingungen anlegen', 'Create a new predefined text' => 'Einen neuen vordefinierten Textblock anlegen', @@ -713,7 +712,6 @@ $self->{texts} = { 'Create new business' => 'Kunden-/Lieferantentyp erfassen', 'Create new client #1' => 'Neuen Mandanten #1 anlegen', 'Create new delivery term' => 'Neue Lieferbedingungen anlegen', - 'Create new department' => 'Neue Abteilung erfassen', 'Create new payment term' => 'Neue Zahlungsbedingung anlegen', 'Create new project type' => 'Neuen Projekttypen anlegen', 'Create new quotation or order' => 'Neues Angebot oder neuen Auftrag anlegen', @@ -1865,7 +1863,6 @@ $self->{texts} = { 'No delievery orders selected, please set one checkbox!' => 'Kein Lieferschein selektiert, bitte eine Box anklicken!', 'No delivery orders have been selected.' => 'Es wurden keine Lieferscheine ausgewählt.', 'No delivery term has been created yet.' => 'Es wurden noch keine Lieferbedingungen angelegt', - 'No department has been created yet.' => 'Es wurde noch keine Abteilung erfasst.', 'No document' => 'Kein Datei mitschicken (ggf. Anhänge)', 'No draft was found.' => 'Kein Entwurf gefunden.', 'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgewählt.', @@ -2976,10 +2973,6 @@ $self->{texts} = { 'The delivery term has been deleted.' => 'Die Lieferbedingungen wurden gelöscht.', 'The delivery term has been saved.' => 'Die Lieferbedingungen wurden gespeichert.', 'The delivery term is in use and cannot be deleted.' => 'Die Lieferbedingungen werden bereits verwendet und können nicht gelöscht werden.', - 'The department has been created.' => 'Die Abteilung wurde angelegt.', - 'The department has been deleted.' => 'Die Abteilung wurde gelöscht.', - 'The department has been saved.' => 'Die Abteilung wurde gespeichert.', - 'The department is in use and cannot be deleted.' => 'Die Abteilung wird benutzt und kann nicht gelöscht werden.', 'The description is missing.' => 'Die Beschreibung fehlt.', 'The description is not unique.' => 'Die Beschreibung ist nicht eindeutig.', 'The description is shown on the form. Chose something short and descriptive.' => 'Die Beschreibung wird in der jeweiligen Maske angezeigt. Sie sollte kurz und prägnant sein.', diff --git a/menus/user/00-erp.yaml b/menus/user/00-erp.yaml index 14b885433..7a37abe03 100644 --- a/menus/user/00-erp.yaml +++ b/menus/user/00-erp.yaml @@ -1108,7 +1108,8 @@ name: Departments order: 1300 params: - action: Department/list + action: SimpleSystemSetting/list + type: department - parent: system id: system_types_of_business name: Types of Business diff --git a/templates/webpages/department/form.html b/templates/webpages/department/form.html deleted file mode 100644 index 894e259b3..000000000 --- a/templates/webpages/department/form.html +++ /dev/null @@ -1,25 +0,0 @@ -[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %] -[% SET is_used = SELF.department.is_used %] -

[% FORM.title %]

- -
- -[%- INCLUDE 'common/flash.html' %] - - - - - - -
[%- 'Description' | $T8 %][% L.input_tag("department.description", SELF.department.description) %]
- -

- [% L.hidden_tag("id", SELF.department.id) %] - [% L.hidden_tag("action", "Department/dispatch") %] - [% L.submit_tag("action_" _ (SELF.department.id ? "update" : "create"), LxERP.t8('Save')) %] - [%- IF SELF.department.id && !is_used %] - [% L.submit_tag("action_destroy", LxERP.t8("Delete"), "confirm", LxERP.t8("Are you sure you want to delete this department?")) %] - [%- END %] - [%- 'Abort' | $T8 %] -

-
diff --git a/templates/webpages/department/list.html b/templates/webpages/department/list.html deleted file mode 100644 index b932b52c4..000000000 --- a/templates/webpages/department/list.html +++ /dev/null @@ -1,39 +0,0 @@ -[% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %] -

[% FORM.title %]

- -[%- INCLUDE 'common/flash.html' %] - -
- [% IF !DEPARTMENTS.size %] -

- [%- 'No department has been created yet.' | $T8 %] -

- - [%- ELSE %] - - - - - - - - - [%- FOREACH department = DEPARTMENTS %] - - - - [%- END %] - -
[%- 'Description' | $T8 %]
- - [%- HTML.escape(department.description) %] - -
- [%- END %] - -
- -

- [%- 'Create new department' | $T8 %] -

-