Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d98b10d9

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID d98b10d9bf580996729826c720e986ac9d57bf53
  • Vorgänger 5dc93413
  • Nachfolger 5a0288d0

SimpleSystemSetting: Umstellung von »Pflichtenhefte« → »Pflichtenhefttypen«

Unterschiede anzeigen:

SL/Controller/RequirementSpecType.pm
1
package SL::Controller::RequirementSpecType;
2

  
3
use strict;
4

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

  
7
use SL::DB::RequirementSpecType;
8
use SL::Helper::Flash;
9
use SL::Locale::String;
10

  
11
use Rose::Object::MakeMethods::Generic
12
(
13
 scalar => [ qw(requirement_spec_type) ],
14
);
15

  
16
__PACKAGE__->run_before('check_auth');
17
__PACKAGE__->run_before('load_requirement_spec_type', only => [ qw(edit update destroy) ]);
18

  
19
#
20
# actions
21
#
22

  
23
sub action_list {
24
  my ($self) = @_;
25

  
26
  $self->render('requirement_spec_type/list',
27
                title                  => t8('Requirement Spec Types'),
28
                REQUIREMENT_SPEC_TYPES => SL::DB::Manager::RequirementSpecType->get_all_sorted);
29
}
30

  
31
sub action_new {
32
  my ($self) = @_;
33

  
34
  $self->{requirement_spec_type} = SL::DB::RequirementSpecType->new(template_file_name => 'requirement_spec');
35
  $self->render('requirement_spec_type/form', title => t8('Create a new requirement spec type'));
36
}
37

  
38
sub action_edit {
39
  my ($self) = @_;
40
  $self->render('requirement_spec_type/form', title => t8('Edit requirement spec type'));
41
}
42

  
43
sub action_create {
44
  my ($self) = @_;
45

  
46
  $self->{requirement_spec_type} = SL::DB::RequirementSpecType->new;
47
  $self->create_or_update;
48
}
49

  
50
sub action_update {
51
  my ($self) = @_;
52
  $self->create_or_update;
53
}
54

  
55
sub action_destroy {
56
  my ($self) = @_;
57

  
58
  if (eval { $self->{requirement_spec_type}->delete; 1; }) {
59
    flash_later('info',  t8('The requirement spec type has been deleted.'));
60
  } else {
61
    flash_later('error', t8('The requirement spec type is in use and cannot be deleted.'));
62
  }
63

  
64
  $self->redirect_to(action => 'list');
65
}
66

  
67
sub action_reorder {
68
  my ($self) = @_;
69

  
70
  SL::DB::RequirementSpecType->reorder_list(@{ $::form->{requirement_spec_type_id} || [] });
71

  
72
  $self->render(\'', { type => 'json' });
73
}
74

  
75
#
76
# filters
77
#
78

  
79
sub check_auth {
80
  $::auth->assert('config');
81
}
82

  
83
#
84
# helpers
85
#
86

  
87
sub create_or_update {
88
  my $self   = shift;
89
  my $is_new = !$self->{requirement_spec_type}->id;
90
  my $params = delete($::form->{requirement_spec_type}) || { };
91
  my $title  = $is_new ? t8('Create a new requirement spec type') : t8('Edit requirement spec type');
92

  
93
  $self->{requirement_spec_type}->assign_attributes(%{ $params });
94

  
95
  my @errors = $self->{requirement_spec_type}->validate;
96

  
97
  if (@errors) {
98
    flash('error', @errors);
99
    $self->render('requirement_spec_type/form', title => $title);
100
    return;
101
  }
102

  
103
  $self->{requirement_spec_type}->save;
104

  
105
  flash_later('info', $is_new ? t8('The requirement spec type has been created.') : t8('The requirement spec type has been saved.'));
106
  $self->redirect_to(action => 'list');
107
}
108

  
109
sub load_requirement_spec_type {
110
  my ($self) = @_;
111
  $self->{requirement_spec_type} = SL::DB::RequirementSpecType->new(id => $::form->{id})->load;
112
}
113

  
114
1;
SL/Controller/SimpleSystemSetting.pm
158 158
    ],
159 159
  },
160 160

  
161
  requirement_spec_type => {
162
    # Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_type_form")
163
    class  => 'RequirementSpecType',
164
    titles => {
165
      list => t8('Requirement Spec Types'),
166
      add  => t8('Add requirement spec type'),
167
      edit => t8('Edit requirement spec type'),
168
    },
169
    list_attributes => [
170
      { method => 'description',                  title => t8('Description') },
171
      { method => 'section_number_format',        title => t8('Section number format') },
172
      { method => 'function_block_number_format', title => t8('Function block number format') },
173
    ],
174
  },
175

  
161 176
);
162 177

  
163 178
my @default_list_attributes = (
locale/de/all
215 215
  'Add pricegroup'              => 'Preisgruppe hinzufügen',
216 216
  'Add project status'          => 'Projektstatus hinzufügen',
217 217
  'Add project type'            => 'Projekttypen hinzufügen',
218
  'Add requirement spec type'   => 'Pflichtenhefttypen hinzufügen',
218 219
  'Add section'                 => 'Abschnitt hinzufügen',
219 220
  'Add sub function block'      => 'Unterfunktionsblock hinzufügen',
220 221
  'Add taxzone'                 => 'Steuerzone hinzufügen',
......
677 678
  'Create a new requirement spec' => 'Ein neues Pflichtenheft anlegen',
678 679
  'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen',
679 680
  'Create a new requirement spec template' => 'Eine neue Pflichtenheftvorlage erfassen',
680
  'Create a new requirement spec type' => 'Einen neuen Pflichtenhefttypen anlegen',
681 681
  'Create a new risk level'     => 'Einen neuen Risikograd anlegen',
682 682
  'Create a new sales price rule' => 'Neue Verkaufspreisregel anlegen',
683 683
  'Create a new user'           => 'Einen neuen Benutzer anlegen',
......
1887 1887
  'No report with id #1'        => 'Es gibt keinen Report mit der Id #1',
1888 1888
  'No requirement spec statuses has been created yet.' => 'Es wurden noch keine Pflichtenheftstatus angelegt.',
1889 1889
  'No requirement spec templates have been created yet.' => 'Es wurden noch keine Pflichtenheftvorlagen angelegt.',
1890
  'No requirement spec type has been created yet.' => 'Es wurden noch keine Pflichtenhefttypen angelegt.',
1891 1890
  'No results.'                 => 'Keine Artikel',
1892 1891
  'No revert available.'        => 'Dieser Vorgang kann nicht rückgängig gemacht werden, ggf. falsch erstellte Buchungen müssen einzeln manuell korrigiert werden.',
1893 1892
  'No risks level has been created yet.' => 'Es wurden noch keine Risikograde angelegt.',
......
3094 3093
  'The requirement spec status has been saved.' => 'Der Pflichtenheftstatus wurde gespeichert.',
3095 3094
  'The requirement spec status is in use and cannot be deleted.' => 'Der Pflichtenheftstatus wird verwendet und kann nicht gelöscht werden.',
3096 3095
  'The requirement spec template has been saved.' => 'Die Pflichtenheftvorlage wurde gespeichert.',
3097
  'The requirement spec type has been created.' => 'Der Pflichtenhefttyp wurde angelegt.',
3098
  'The requirement spec type has been deleted.' => 'Der Pflichtenhefttyp wurde gelöscht.',
3099
  'The requirement spec type has been saved.' => 'Der Pflichtenhefttyp wurde gespeichert.',
3100
  'The requirement spec type is in use and cannot be deleted.' => 'Der Pflichtenhefttyp wird verwendet und kann nicht gelöscht werden.',
3101 3096
  'The risk level has been created.' => 'Der Risikograd wurde angelegt.',
3102 3097
  'The risk level has been deleted.' => 'Der Risikograd wurde gelöscht.',
3103 3098
  'The risk level has been saved.' => 'Der Risikograd wurde gespeichert.',
menus/user/00-erp.yaml
1147 1147
  name: Requirement Spec Types
1148 1148
  order: 200
1149 1149
  params:
1150
    action: RequirementSpecType/list
1150
    action: SimpleSystemSetting/list
1151
    type: requirement_spec_type
1151 1152
- parent: system_requirement_specs
1152 1153
  id: system_requirement_specs_requirement_spec_statuses
1153 1154
  name: Requirement Spec Statuses
templates/webpages/requirement_spec_type/form.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2
<h1>[% FORM.title %]</h1>
3

  
4
 <form method="post" action="controller.pl">
5

  
6
[%- INCLUDE 'common/flash.html' %]
7

  
8
  <table>
9
   <tr>
10
    <td>[% LxERP.t8('Description') %]</td>
11
    <td>[% L.input_tag("requirement_spec_type.description", SELF.requirement_spec_type.description) %]</td>
12
   </tr>
13

  
14
   <tr>
15
    <td>[% LxERP.t8('Print template base file name') %]<sup>(1)</sup></td>
16
    <td>[% L.input_tag("requirement_spec_type.template_file_name", SELF.requirement_spec_type.template_file_name) %]</td>
17
   </tr>
18

  
19
   <tr>
20
    <td>[% LxERP.t8('Section number format') %]<sup>(2)</sup></td>
21
    <td>[% L.input_tag("requirement_spec_type.section_number_format", SELF.requirement_spec_type.section_number_format, size="15") %]</td>
22
   </tr>
23

  
24
   <tr>
25
    <td>[% LxERP.t8('Function block number format') %]<sup>(2)</sup></td>
26
    <td>[% L.input_tag("requirement_spec_type.function_block_number_format", SELF.requirement_spec_type.function_block_number_format, size="15") %]</td>
27
   </tr>
28
  </table>
29

  
30
  <p>
31
   [% L.hidden_tag("id", SELF.requirement_spec_type.id) %]
32
   [% L.hidden_tag("action", "RequirementSpecType/dispatch") %]
33
   [% L.submit_tag("action_" _ (SELF.requirement_spec_type.id ? "update" : "create"), LxERP.t8('Save')) %]
34
   [%- IF SELF.requirement_spec_type.id %]
35
    [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %]
36
   [%- END %]
37
   <a href="[% SELF.url_for(action => 'list') %]">[%- LxERP.t8('Abort') %]</a>
38
  </p>
39

  
40
  <p>
41
   <sup>(1)</sup>: [% LxERP.t8("The base file name without a path or an extension to be used for printing for this type of requirement spec.") %]
42
   <br>
43
   <sup>(2)</sup>: [% LxERP.t8('The numbering will start at 1 with each requirement spec.') %]
44
  </p>
45
 </form>
templates/webpages/requirement_spec_type/list.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2
<h1>[% FORM.title %]</h1>
3

  
4
[%- INCLUDE 'common/flash.html' %]
5

  
6
 <form method="post" action="controller.pl">
7
  [% IF !REQUIREMENT_SPEC_TYPES.size %]
8
   <p>
9
    [%- LxERP.t8('No requirement spec type has been created yet.') %]
10
   </p>
11

  
12
  [%- ELSE %]
13
   <table id="requirement_spec_type_list">
14
    <thead>
15
    <tr class="listheading">
16
     <th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
17
     <th>[%- LxERP.t8('Description') %]</th>
18
     <th>[%- LxERP.t8('Section number format') %]</th>
19
     <th>[%- LxERP.t8('Function block number format') %]</th>
20
    </tr>
21
    </thead>
22

  
23
    <tbody>
24
    [%- FOREACH requirement_spec_type = REQUIREMENT_SPEC_TYPES %]
25
    <tr class="listrow[% loop.count % 2 %]" id="requirement_spec_type_id_[% requirement_spec_type.id %]">
26
     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
27
     <td>
28
      <a href="[% SELF.url_for(action => 'edit', id => requirement_spec_type.id) %]">
29
       [%- HTML.escape(requirement_spec_type.description) %]
30
      </a>
31
     </td>
32

  
33
     <td>[% HTML.escape(requirement_spec_type.section_number_format) %]</td>
34
     <td>[% HTML.escape(requirement_spec_type.function_block_number_format) %]</td>
35
    </tr>
36
    [%- END %]
37
    </tbody>
38
   </table>
39
  [%- END %]
40

  
41
  <p>
42
   <a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8('Create a new requirement spec type') %]</a>
43
  </p>
44
 </form>
45

  
46
 [% L.sortable_element('#requirement_spec_type_list tbody', url => 'controller.pl?action=RequirementSpecType/reorder', with => 'requirement_spec_type_id') %]
templates/webpages/simple_system_setting/_requirement_spec_type_form.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2
<table>
3
 <tr>
4
  <th align="right">[% LxERP.t8("Description") %]</th>
5
  <td>[% L.input_tag("object.description", SELF.object.description, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]</td>
6
 </tr>
7

  
8
 <tr>
9
  <th align="right">[% LxERP.t8("Print template base file name") %]<sup>(1)</sup></th>
10
  <td>[% L.input_tag("object.template_file_name", SELF.object.template_file_name, "data-validate"="required", "data-title"=LxERP.t8("Print template base file name")) %]</td>
11
 </tr>
12

  
13
 <tr>
14
  <th align="right">[% LxERP.t8("Section number format") %]<sup>(2)</sup></th>
15
  <td>[% L.input_tag("object.section_number_format", SELF.object.section_number_format, size="15", "data-validate"="required", "data-title"=LxERP.t8("Section number format")) %]</td>
16
 </tr>
17

  
18
 <tr>
19
  <th align="right">[% LxERP.t8("Function block number format") %]<sup>(2)</sup></th>
20
  <td>[% L.input_tag("object.function_block_number_format", SELF.object.function_block_number_format, size="15", "data-validate"="required", "data-title"=LxERP.t8("Function block number format")) %]</td>
21
 </tr>
22
</table>
23

  
24
<p>
25
 <sup>(1)</sup>: [% LxERP.t8("The base file name without a path or an extension to be used for printing for this type of requirement spec.") %]
26
 <br>
27
 <sup>(2)</sup>: [% LxERP.t8("The numbering will start at 1 with each requirement spec.") %]
28
</p>

Auch abrufbar als: Unified diff