From: Moritz Bunkus Date: Tue, 4 Nov 2014 08:58:13 +0000 (+0100) Subject: Pflichtenhefte vordef Textblöcke: Verwaltung Flags »benutzbar für…« X-Git-Tag: release-3.2.0beta~270 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d860b41d55abbf46fa8b94ec445aca3a2bb4e0d6;p=kivitendo-erp.git Pflichtenhefte vordef Textblöcke: Verwaltung Flags »benutzbar für…« --- diff --git a/SL/Controller/RequirementSpecPredefinedText.pm b/SL/Controller/RequirementSpecPredefinedText.pm index 959a770f8..00c86b474 100644 --- a/SL/Controller/RequirementSpecPredefinedText.pm +++ b/SL/Controller/RequirementSpecPredefinedText.pm @@ -4,6 +4,8 @@ use strict; use parent qw(SL::Controller::Base); +use List::MoreUtils qw(none); + use SL::DB::RequirementSpecPredefinedText; use SL::Helper::Flash; use SL::Locale::String; @@ -32,7 +34,7 @@ sub action_list { sub action_new { my ($self) = @_; - $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new; + $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new(useable_for_text_blocks => 1); $self->render('requirement_spec_predefined_text/form', title => t8('Create a new predefined text')); } @@ -95,6 +97,13 @@ sub create_or_update { my $params = delete($::form->{requirement_spec_predefined_text}) || { }; my $title = $is_new ? t8('Create a new predefined text') : t8('Edit predefined text'); + # Force presence of booleans for the useable_* flags. + my @useable_flags = qw(text_blocks sections); + $params->{"useable_for_${_}"} = !!$params->{"useable_for_${_}"} for @useable_flags; + + # Force usage for text blocks if none of the check boxes are marked. + $params->{useable_for_text_blocks} = 1 if none { $params->{"useable_for_${_}"} } @useable_flags; + $self->{requirement_spec_predefined_text}->assign_attributes(%{ $params }); my @errors = $self->{requirement_spec_predefined_text}->validate; diff --git a/SL/DB/MetaSetup/RequirementSpecPredefinedText.pm b/SL/DB/MetaSetup/RequirementSpecPredefinedText.pm index 5cb179ccb..ec9847b42 100644 --- a/SL/DB/MetaSetup/RequirementSpecPredefinedText.pm +++ b/SL/DB/MetaSetup/RequirementSpecPredefinedText.pm @@ -9,13 +9,15 @@ use base qw(SL::DB::Object); __PACKAGE__->meta->table('requirement_spec_predefined_texts'); __PACKAGE__->meta->columns( - description => { type => 'text', not_null => 1 }, - id => { type => 'serial', not_null => 1 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - position => { type => 'integer', not_null => 1 }, - text => { type => 'text', not_null => 1 }, - title => { type => 'text', not_null => 1 }, + description => { type => 'text', not_null => 1 }, + id => { type => 'serial', not_null => 1 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + position => { type => 'integer', not_null => 1 }, + text => { type => 'text', not_null => 1 }, + title => { type => 'text', not_null => 1 }, + useable_for_sections => { type => 'boolean', default => 'false', not_null => 1 }, + useable_for_text_blocks => { type => 'boolean', default => 'false', not_null => 1 }, ); __PACKAGE__->meta->primary_key_columns([ 'id' ]); diff --git a/locale/de/all b/locale/de/all index 76b703b30..c09360884 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2338,6 +2338,7 @@ $self->{texts} = { 'Test database connectivity' => 'Datenbankverbindung testen', 'Text block actions' => 'Textblockaktionen', 'Text block picture actions' => 'Aktionen für Textblockbilder', + 'Text blocks' => 'Textblöcke', 'Text blocks back' => 'Textblöcke hinten', 'Text blocks front' => 'Textblöcke vorne', 'Text field' => 'Textfeld', @@ -2783,6 +2784,7 @@ $self->{texts} = { 'Use WebDAV Repository' => 'WebDAV-Ablage verwenden', 'Use existing templates' => 'Vorhandene Druckvorlagen verwenden', 'Use master default bin for Default Transfer, if no default bin for the part is configured' => 'Standardlagerplatz für Ein- / Auslagern über Standard-Lagerplatz, falls für die Ware kein expliziter Lagerplatz konfiguriert ist', + 'Useable for…' => 'Benutzbar für…', 'User' => 'Benutzer', 'User Config' => 'Einstellungen', 'User Groups' => 'Gruppen', diff --git a/sql/Pg-upgrade2/requirement_spec_predefined_texts_for_sections.sql b/sql/Pg-upgrade2/requirement_spec_predefined_texts_for_sections.sql new file mode 100644 index 000000000..14b5f1b71 --- /dev/null +++ b/sql/Pg-upgrade2/requirement_spec_predefined_texts_for_sections.sql @@ -0,0 +1,14 @@ +-- @tag: requirement_spec_predefined_texts_for_sections +-- @description: Verwendung von vordefinierten Pflichtenhefttextblöcken bei Abschnitten +-- @depends: requirement_specs +ALTER TABLE requirement_spec_predefined_texts ADD COLUMN useable_for_text_blocks BOOLEAN; +ALTER TABLE requirement_spec_predefined_texts ADD COLUMN useable_for_sections BOOLEAN; + +UPDATE requirement_spec_predefined_texts +SET useable_for_text_blocks = TRUE, useable_for_sections = FALSE; + +ALTER TABLE requirement_spec_predefined_texts ALTER COLUMN useable_for_text_blocks SET DEFAULT FALSE; +ALTER TABLE requirement_spec_predefined_texts ALTER COLUMN useable_for_sections SET DEFAULT FALSE; + +ALTER TABLE requirement_spec_predefined_texts ALTER COLUMN useable_for_text_blocks SET NOT NULL; +ALTER TABLE requirement_spec_predefined_texts ALTER COLUMN useable_for_sections SET NOT NULL; diff --git a/templates/webpages/requirement_spec_predefined_text/form.html b/templates/webpages/requirement_spec_predefined_text/form.html index 82851400a..905d3510d 100755 --- a/templates/webpages/requirement_spec_predefined_text/form.html +++ b/templates/webpages/requirement_spec_predefined_text/form.html @@ -20,6 +20,14 @@ [% LxERP.t8("Content") %] [% L.textarea_tag("requirement_spec_predefined_text.text_as_restricted_html", SELF.requirement_spec_predefined_text.text_as_restricted_html, class='texteditor', style='width: 800px; height: 300px') %] + + + [% LxERP.t8("Useable for…") %] + + [% L.checkbox_tag("requirement_spec_predefined_text.useable_for_text_blocks", label=LxERP.t8("Text blocks"), value=1, checked=SELF.requirement_spec_predefined_text.useable_for_text_blocks) %] + [% L.checkbox_tag("requirement_spec_predefined_text.useable_for_sections", label=LxERP.t8("Sections"), value=1, checked=SELF.requirement_spec_predefined_text.useable_for_sections) %] + +

diff --git a/templates/webpages/requirement_spec_predefined_text/list.html b/templates/webpages/requirement_spec_predefined_text/list.html index 358d646b5..85f9db2ef 100644 --- a/templates/webpages/requirement_spec_predefined_text/list.html +++ b/templates/webpages/requirement_spec_predefined_text/list.html @@ -13,11 +13,17 @@ [%- ELSE %] + + + + + + @@ -33,6 +39,8 @@ + + [%- END %]
[% LxERP.t8("Useable for…") %]
[ LxERP.t8('reorder item') %] [% LxERP.t8("Description") %] [% LxERP.t8("Title") %] [% LxERP.t8("Content") %][% LxERP.t8("Text blocks") %][% LxERP.t8("Sections") %]
[% HTML.escape(requirement_spec_predefined_text.title) %] [% HTML.escape(L.truncate(requirement_spec_predefined_text.text_as_stripped_html)) %][% IF requirement_spec_predefined_text.useable_for_text_blocks %][% LxERP.t8("Yes") %][% ELSE %][% LxERP.t8("No") %][% END %][% IF requirement_spec_predefined_text.useable_for_sections %][% LxERP.t8("Yes") %][% ELSE %][% LxERP.t8("No") %][% END %]