From 6bf8b2c4e5cc63efda8b90774888a0c49e250c9a Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 1 Feb 2013 15:08:38 +0100 Subject: [PATCH] Verwaltung von Pflichtenheftabnahmestatus --- .../RequirementSpecAcceptanceStatus.pm | 116 ++++++++++++++++++ locale/de/all | 8 ++ menus/erp.ini | 4 +- .../form.html | 29 +++++ .../list.html | 45 +++++++ 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 SL/Controller/RequirementSpecAcceptanceStatus.pm create mode 100755 templates/webpages/requirement_spec_acceptance_status/form.html create mode 100644 templates/webpages/requirement_spec_acceptance_status/list.html diff --git a/SL/Controller/RequirementSpecAcceptanceStatus.pm b/SL/Controller/RequirementSpecAcceptanceStatus.pm new file mode 100644 index 000000000..98b857308 --- /dev/null +++ b/SL/Controller/RequirementSpecAcceptanceStatus.pm @@ -0,0 +1,116 @@ +package SL::Controller::RequirementSpecAcceptanceStatus; + +use strict; + +use parent qw(SL::Controller::Base); + +use SL::DB::RequirementSpecAcceptanceStatus; +use SL::DB::Language; +use SL::Helper::Flash; +use SL::Locale::String; + +use Rose::Object::MakeMethods::Generic +( + scalar => [ qw(requirement_spec_acceptance_status valid_names) ], +); + +__PACKAGE__->run_before('check_auth'); +__PACKAGE__->run_before('load_requirement_spec_acceptance_status', only => [ qw(edit update destroy) ]); +__PACKAGE__->run_before(sub { $_[0]->valid_names(\@SL::DB::RequirementSpecAcceptanceStatus::valid_names) }); + +# +# actions +# + +sub action_list { + my ($self) = @_; + + $self->render('requirement_spec_acceptance_status/list', + title => t8('Acceptance Statuses'), + REQUIREMENT_SPEC_ACCEPTANCE_STATUSES => SL::DB::Manager::RequirementSpecAcceptanceStatus->get_all_sorted); +} + +sub action_new { + my ($self) = @_; + + $self->{requirement_spec_acceptance_status} = SL::DB::RequirementSpecAcceptanceStatus->new; + $self->render('requirement_spec_acceptance_status/form', title => t8('Create a new acceptance status')); +} + +sub action_edit { + my ($self) = @_; + $self->render('requirement_spec_acceptance_status/form', title => t8('Edit acceptance status')); +} + +sub action_create { + my ($self) = @_; + + $self->{requirement_spec_acceptance_status} = SL::DB::RequirementSpecAcceptanceStatus->new; + $self->create_or_update; +} + +sub action_update { + my ($self) = @_; + $self->create_or_update; +} + +sub action_destroy { + my ($self) = @_; + + if (eval { $self->{requirement_spec_acceptance_status}->delete; 1; }) { + flash_later('info', t8('The acceptance status has been deleted.')); + } else { + flash_later('error', t8('The acceptance status is in use and cannot be deleted.')); + } + + $self->redirect_to(action => 'list'); +} + +sub action_reorder { + my ($self) = @_; + + SL::DB::RequirementSpecAcceptanceStatus->reorder_list(@{ $::form->{requirement_spec_acceptance_status_id} || [] }); + + $self->render(\'', { status => 'json' }); +} + +# +# filters +# + +sub check_auth { + $::auth->assert('config'); +} + +# +# helpers +# + +sub create_or_update { + my $self = shift; + my $is_new = !$self->{requirement_spec_acceptance_status}->id; + my $params = delete($::form->{requirement_spec_acceptance_status}) || { }; + my $title = $is_new ? t8('Create a new acceptance status') : t8('Edit acceptance status'); + + $self->{requirement_spec_acceptance_status}->assign_attributes(%{ $params }); + + my @errors = $self->{requirement_spec_acceptance_status}->validate; + + if (@errors) { + flash('error', @errors); + $self->render('requirement_spec_acceptance_status/form', title => $title); + return; + } + + $self->{requirement_spec_acceptance_status}->save; + + flash_later('info', $is_new ? t8('The acceptance status has been created.') : t8('The acceptance status has been saved.')); + $self->redirect_to(action => 'list'); +} + +sub load_requirement_spec_acceptance_status { + my ($self) = @_; + $self->{requirement_spec_acceptance_status} = SL::DB::RequirementSpecAcceptanceStatus->new(id => $::form->{id})->load; +} + +1; diff --git a/locale/de/all b/locale/de/all index 390fd797d..c58c01238 100755 --- a/locale/de/all +++ b/locale/de/all @@ -73,6 +73,7 @@ $self->{texts} = { 'Abteilung' => 'Abteilung', 'Access rights' => 'Zugriffsrechte', 'Access to clients' => 'Zugriff auf Mandanten', + 'Acceptance Statuses' => 'Abnahmestatus', 'Acceptance Types' => 'Abnahmetypen', 'Account' => 'Konto', 'Account Category A' => 'Aktiva/Mittelverwendung', @@ -517,6 +518,7 @@ $self->{texts} = { 'Create Chart of Accounts' => 'Zu verwendender Kontenplan', 'Create Dataset' => 'Neue Datenbank anlegen', 'Create Date' => 'Erstelldatum', + 'Create a new acceptance status' => 'Einen neuen Abnahmestatus anlegen', 'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen', 'Create a new business' => 'Einen neuen Kunden-/Lieferantentyp erfassen', 'Create a new client' => 'Einen neuen Mandanten anlegen', @@ -853,6 +855,7 @@ $self->{texts} = { 'Edit Vendor' => 'Lieferant editieren', 'Edit Vendor Invoice' => 'Einkaufsrechnung bearbeiten', 'Edit Warehouse' => 'Lager bearbeiten', + 'Edit acceptance status' => 'Abnahmestatus bearbeiten', 'Edit background job' => 'Hintergrund-Job bearbeiten', 'Edit bank account' => 'Bankkonto bearbeiten', 'Edit business' => 'Kunden-/Lieferantentyp bearbeiten', @@ -1397,6 +1400,7 @@ $self->{texts} = { 'No Company Name given' => 'Kein Firmenname hinterlegt!', 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden', 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden', + 'No acceptance statuses has been created yet.' => 'Es wurde noch kein Abnahmestatus angelegt.', 'No action defined.' => 'Keine Aktion definiert.', 'No background job has been created yet.' => 'Es wurden noch keine Hintergrund-Jobs angelegt.', 'No bank information has been entered in this customer\'s master data entry. You cannot create bank collections unless you enter bank information.' => 'Für diesen Kunden wurden in seinen Stammdaten keine Kontodaten hinterlegt. Solange dies nicht geschehen ist, können Sie keine Überweisungen für den Lieferanten anlegen.', @@ -2125,6 +2129,10 @@ $self->{texts} = { '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.', 'The WebDAV feature has been used.' => 'Das WebDAV-Feature wurde benutzt.', + 'The acceptance status has been created.' => 'Der Abnahmestatus wurde angelegt.', + 'The acceptance status has been deleted.' => 'Der Abnahmestatus wurde gelöscht.', + 'The acceptance status has been saved.' => 'Der Abnahmestatus wurde gespeichert.', + '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 3804 already exists, the update will be skipped.' => 'Das Konto 3804 existiert schon, das Update wird übersprungen.', diff --git a/menus/erp.ini b/menus/erp.ini index b1530070f..a51b056c1 100644 --- a/menus/erp.ini +++ b/menus/erp.ini @@ -611,9 +611,9 @@ action=RequirementSpecComplexity/list module=controller.pl action=RequirementSpecRisk/list -[System--Requirement specs--Acceptance Types] +[System--Requirement specs--Acceptance Statuses] module=controller.pl -action=RequirementSpecAcceptanceType/list +action=RequirementSpecAcceptanceStatus/list [System--Languages and translations] module=menu.pl diff --git a/templates/webpages/requirement_spec_acceptance_status/form.html b/templates/webpages/requirement_spec_acceptance_status/form.html new file mode 100755 index 000000000..7b0a3cafb --- /dev/null +++ b/templates/webpages/requirement_spec_acceptance_status/form.html @@ -0,0 +1,29 @@ +[% USE HTML %][% USE L %][% USE LxERP %] + +
+
[% FORM.title %]
+ +[%- INCLUDE 'common/flash.html' %] + + + + + + + + + + + +
[% LxERP.t8('Name') %][% L.select_tag("requirement_spec_acceptance_status.name", SELF.valid_names, default = SELF.requirement_spec_acceptance_status.name) %]
[% LxERP.t8('Description') %][% L.input_tag("requirement_spec_acceptance_status.description", SELF.requirement_spec_acceptance_status.description) %]
+ +

+ [% L.hidden_tag("id", SELF.requirement_spec_acceptance_status.id) %] + [% L.hidden_tag("action", "RequirementSpecAcceptanceStatus/dispatch") %] + [% L.submit_tag("action_" _ (SELF.requirement_spec_acceptance_status.id ? "update" : "create"), LxERP.t8('Save')) %] + [%- IF SELF.requirement_spec_acceptance_status.id %] + [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %] + [%- END %] + [%- LxERP.t8('Abort') %] +

+
diff --git a/templates/webpages/requirement_spec_acceptance_status/list.html b/templates/webpages/requirement_spec_acceptance_status/list.html new file mode 100644 index 000000000..75fcf53b2 --- /dev/null +++ b/templates/webpages/requirement_spec_acceptance_status/list.html @@ -0,0 +1,45 @@ +[% USE HTML %][% USE L %][% USE LxERP %] + +
[% FORM.title %]
+ +[%- INCLUDE 'common/flash.html' %] + +
+ [% IF !REQUIREMENT_SPEC_ACCEPTANCE_STATUSES.size %] +

+ [%- LxERP.t8('No acceptance statuses has been created yet.') %] +

+ + [%- ELSE %] + + + + + + + + + + + [%- FOREACH requirement_spec_acceptance_status = REQUIREMENT_SPEC_ACCEPTANCE_STATUSES %] + + + + + + + [%- END %] + +
[ LxERP.t8('reorder item') %][%- LxERP.t8('Name') %][%- LxERP.t8('Description') %]
[ LxERP.t8('reorder item') %] + + [%- HTML.escape(requirement_spec_acceptance_status.name) %] + + [%- HTML.escape(requirement_spec_acceptance_status.description) %]
+ [%- END %] + +

+ [%- LxERP.t8('Create a new acceptance status') %] +

+
+ + [% L.sortable_element('#requirement_spec_acceptance_status_list tbody', url => 'controller.pl?action=RequirementSpecAcceptanceStatus/reorder', with => 'requirement_spec_acceptance_status_id') %] -- 2.20.1