Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d860b41d

Von Moritz Bunkus vor etwa 10 Jahren hinzugefügt

  • ID d860b41d55abbf46fa8b94ec445aca3a2bb4e0d6
  • Vorgänger eecee9b5
  • Nachfolger 8f9f5434

Pflichtenhefte vordef Textblöcke: Verwaltung Flags »benutzbar für…«

Unterschiede anzeigen:

SL/Controller/RequirementSpecPredefinedText.pm
4 4

  
5 5
use parent qw(SL::Controller::Base);
6 6

  
7
use List::MoreUtils qw(none);
8

  
7 9
use SL::DB::RequirementSpecPredefinedText;
8 10
use SL::Helper::Flash;
9 11
use SL::Locale::String;
......
32 34
sub action_new {
33 35
  my ($self) = @_;
34 36

  
35
  $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new;
37
  $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new(useable_for_text_blocks => 1);
36 38
  $self->render('requirement_spec_predefined_text/form', title => t8('Create a new predefined text'));
37 39
}
38 40

  
......
95 97
  my $params = delete($::form->{requirement_spec_predefined_text}) || { };
96 98
  my $title  = $is_new ? t8('Create a new predefined text') : t8('Edit predefined text');
97 99

  
100
  # Force presence of booleans for the useable_* flags.
101
  my @useable_flags = qw(text_blocks sections);
102
  $params->{"useable_for_${_}"} = !!$params->{"useable_for_${_}"} for @useable_flags;
103

  
104
  # Force usage for text blocks if none of the check boxes are marked.
105
  $params->{useable_for_text_blocks} = 1 if none { $params->{"useable_for_${_}"} } @useable_flags;
106

  
98 107
  $self->{requirement_spec_predefined_text}->assign_attributes(%{ $params });
99 108

  
100 109
  my @errors = $self->{requirement_spec_predefined_text}->validate;
SL/DB/MetaSetup/RequirementSpecPredefinedText.pm
9 9
__PACKAGE__->meta->table('requirement_spec_predefined_texts');
10 10

  
11 11
__PACKAGE__->meta->columns(
12
  description => { type => 'text', not_null => 1 },
13
  id          => { type => 'serial', not_null => 1 },
14
  itime       => { type => 'timestamp', default => 'now()' },
15
  mtime       => { type => 'timestamp' },
16
  position    => { type => 'integer', not_null => 1 },
17
  text        => { type => 'text', not_null => 1 },
18
  title       => { type => 'text', not_null => 1 },
12
  description             => { type => 'text', not_null => 1 },
13
  id                      => { type => 'serial', not_null => 1 },
14
  itime                   => { type => 'timestamp', default => 'now()' },
15
  mtime                   => { type => 'timestamp' },
16
  position                => { type => 'integer', not_null => 1 },
17
  text                    => { type => 'text', not_null => 1 },
18
  title                   => { type => 'text', not_null => 1 },
19
  useable_for_sections    => { type => 'boolean', default => 'false', not_null => 1 },
20
  useable_for_text_blocks => { type => 'boolean', default => 'false', not_null => 1 },
19 21
);
20 22

  
21 23
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
locale/de/all
2338 2338
  'Test database connectivity'  => 'Datenbankverbindung testen',
2339 2339
  'Text block actions'          => 'Textblockaktionen',
2340 2340
  'Text block picture actions'  => 'Aktionen für Textblockbilder',
2341
  'Text blocks'                 => 'Textblöcke',
2341 2342
  'Text blocks back'            => 'Textblöcke hinten',
2342 2343
  'Text blocks front'           => 'Textblöcke vorne',
2343 2344
  'Text field'                  => 'Textfeld',
......
2783 2784
  'Use WebDAV Repository'       => 'WebDAV-Ablage verwenden',
2784 2785
  'Use existing templates'      => 'Vorhandene Druckvorlagen verwenden',
2785 2786
  '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',
2787
  'Useable for…'                => 'Benutzbar für…',
2786 2788
  'User'                        => 'Benutzer',
2787 2789
  'User Config'                 => 'Einstellungen',
2788 2790
  'User Groups'                 => 'Gruppen',
sql/Pg-upgrade2/requirement_spec_predefined_texts_for_sections.sql
1
-- @tag: requirement_spec_predefined_texts_for_sections
2
-- @description: Verwendung von vordefinierten Pflichtenhefttextblöcken bei Abschnitten
3
-- @depends: requirement_specs
4
ALTER TABLE requirement_spec_predefined_texts ADD COLUMN useable_for_text_blocks BOOLEAN;
5
ALTER TABLE requirement_spec_predefined_texts ADD COLUMN useable_for_sections    BOOLEAN;
6

  
7
UPDATE requirement_spec_predefined_texts
8
SET useable_for_text_blocks = TRUE, useable_for_sections = FALSE;
9

  
10
ALTER TABLE requirement_spec_predefined_texts ALTER COLUMN useable_for_text_blocks SET DEFAULT FALSE;
11
ALTER TABLE requirement_spec_predefined_texts ALTER COLUMN useable_for_sections    SET DEFAULT FALSE;
12

  
13
ALTER TABLE requirement_spec_predefined_texts ALTER COLUMN useable_for_text_blocks SET NOT NULL;
14
ALTER TABLE requirement_spec_predefined_texts ALTER COLUMN useable_for_sections    SET NOT NULL;
templates/webpages/requirement_spec_predefined_text/form.html
20 20
    <td>[% LxERP.t8("Content") %]</td>
21 21
    <td>[% 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') %]</td>
22 22
   </tr>
23

  
24
   <tr>
25
    <td>[% LxERP.t8("Useable for…") %]</sup></td>
26
    <td>
27
     [% 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) %]
28
     [% 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) %]
29
    </td>
30
   </tr>
23 31
  </table>
24 32

  
25 33
  <p>
templates/webpages/requirement_spec_predefined_text/list.html
13 13
  [%- ELSE %]
14 14
   <table id="requirement_spec_predefined_text_list">
15 15
    <thead>
16
    <tr class="listheading">
17
     <th colspan="4"></th>
18
     <th colspan="2" align="center">[% LxERP.t8("Useable for…") %]</th>
19
    </tr>
16 20
    <tr class="listheading">
17 21
     <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
18 22
     <th>[% LxERP.t8("Description") %]</th>
19 23
     <th>[% LxERP.t8("Title") %]</th>
20 24
     <th>[% LxERP.t8("Content") %]</th>
25
     <th>[% LxERP.t8("Text blocks") %]</th>
26
     <th>[% LxERP.t8("Sections") %]</th>
21 27
    </tr>
22 28
    </thead>
23 29

  
......
33 39

  
34 40
     <td>[% HTML.escape(requirement_spec_predefined_text.title) %]</td>
35 41
     <td>[% HTML.escape(L.truncate(requirement_spec_predefined_text.text_as_stripped_html)) %]</td>
42
     <td align="right">[% IF requirement_spec_predefined_text.useable_for_text_blocks %][% LxERP.t8("Yes") %][% ELSE %][% LxERP.t8("No") %][% END %]</td>
43
     <td align="right">[% IF requirement_spec_predefined_text.useable_for_sections %][% LxERP.t8("Yes") %][% ELSE %][% LxERP.t8("No") %][% END %]</td>
36 44
    </tr>
37 45
    [%- END %]
38 46
    </tbody>

Auch abrufbar als: Unified diff