Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6d75a1bc

Von Moritz Bunkus vor fast 11 Jahren hinzugefügt

  • ID 6d75a1bc95b6b7ea7c5a348fffc37a2b7fea35fd
  • Vorgänger 4fa00e30
  • Nachfolger 14b824ae

Verwaltung von Pflichtenheftstatus

Unterschiede anzeigen:

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

  
3
use strict;
4

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

  
7
use SL::DB::RequirementSpecStatus;
8
use SL::DB::Language;
9
use SL::Helper::Flash;
10
use SL::Locale::String;
11

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

  
17
__PACKAGE__->run_before('check_auth');
18
__PACKAGE__->run_before('load_requirement_spec_status', only => [ qw(edit update destroy) ]);
19
__PACKAGE__->run_before(sub { $_[0]->valid_names(\@SL::DB::RequirementSpecStatus::valid_names) });
20

  
21
#
22
# actions
23
#
24

  
25
sub action_list {
26
  my ($self) = @_;
27

  
28
  $self->render('requirement_spec_status/list',
29
                title                     => t8('Requirement Spec Statuses'),
30
                REQUIREMENT_SPEC_STATUSES => SL::DB::Manager::RequirementSpecStatus->get_all_sorted);
31
}
32

  
33
sub action_new {
34
  my ($self) = @_;
35

  
36
  $self->{requirement_spec_status} = SL::DB::RequirementSpecStatus->new;
37
  $self->render('requirement_spec_status/form', title => t8('Create a new requirement spec status'));
38
}
39

  
40
sub action_edit {
41
  my ($self) = @_;
42
  $self->render('requirement_spec_status/form', title => t8('Edit requirement spec status'));
43
}
44

  
45
sub action_create {
46
  my ($self) = @_;
47

  
48
  $self->{requirement_spec_status} = SL::DB::RequirementSpecStatus->new;
49
  $self->create_or_update;
50
}
51

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

  
57
sub action_destroy {
58
  my ($self) = @_;
59

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

  
66
  $self->redirect_to(action => 'list');
67
}
68

  
69
sub action_reorder {
70
  my ($self) = @_;
71

  
72
  SL::DB::RequirementSpecStatus->reorder_list(@{ $::form->{requirement_spec_status_id} || [] });
73

  
74
  $self->render('1;', { type => 'js', inline => 1 });
75
}
76

  
77
#
78
# filters
79
#
80

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

  
85
#
86
# helpers
87
#
88

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

  
95
  $self->{requirement_spec_status}->assign_attributes(%{ $params });
96

  
97
  my @errors = $self->{requirement_spec_status}->validate;
98

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

  
105
  $self->{requirement_spec_status}->save;
106

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

  
111
sub load_requirement_spec_status {
112
  my ($self) = @_;
113
  $self->{requirement_spec_status} = SL::DB::RequirementSpecStatus->new(id => $::form->{id})->load;
114
}
115

  
116
1;
SL/DB/RequirementSpecAcceptanceStatus.pm
2 2

  
3 3
use strict;
4 4

  
5
use List::MoreUtils qw(none);
6

  
5 7
use SL::DB::MetaSetup::RequirementSpecAcceptanceStatus;
6 8
use SL::DB::Manager::RequirementSpecAcceptanceStatus;
7 9
use SL::DB::Helper::ActsAsList;
8 10
use SL::Locale::String;
9 11

  
12
our @valid_names = qw(accepted accepted_with_defects accepted_with_defects_to_be_fixed not_accepted);
13

  
10 14
sub validate {
11 15
  my ($self) = @_;
12 16

  
13 17
  my @errors;
14
  push @errors, t8('The description is missing.') if !$self->description;
18
  push @errors, t8('The name is missing.')                     if !$self->name;
19
  push @errors, t8('The name and description are not unique.') if  $self->get_first_conflicting('name', 'description');
20
  push @errors, t8('The name is invalid.')                     if  none { $_ eq $self->name } @valid_names;
21
  push @errors, t8('The description is missing.')              if !$self->description;
15 22

  
16 23
  return @errors;
17 24
}
SL/DB/RequirementSpecStatus.pm
2 2

  
3 3
use strict;
4 4

  
5
use List::MoreUtils qw(none);
6

  
5 7
use SL::DB::MetaSetup::RequirementSpecStatus;
6 8
use SL::DB::Manager::RequirementSpecStatus;
7 9
use SL::DB::Helper::ActsAsList;
8 10
use SL::Locale::String;
9 11

  
12
our @valid_names = qw(planning running done);
13

  
10 14
sub validate {
11 15
  my ($self) = @_;
12 16

  
13 17
  my @errors;
14 18

  
15
  push @errors, t8('The name is missing.')        if !$self->name;
16
  push @errors, t8('The description is missing.') if !$self->description;
19
  push @errors, t8('The name is missing.')                     if !$self->name;
20
  push @errors, t8('The name and description are not unique.') if  $self->get_first_conflicting('name', 'description');
21
  push @errors, t8('The name is invalid.')                     if  none { $_ eq $self->name } @valid_names;
22
  push @errors, t8('The description is missing.')              if !$self->description;
17 23

  
18 24
  return @errors;
19 25
}
locale/de/all
526 526
  'Create a new printer'        => 'Einen neuen Drucker anlegen',
527 527
  'Create a new project'        => 'Neues Projekt anlegen',
528 528
  'Create a new project type'   => 'Einen neuen Projekttypen anlegen',
529
  'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen',
529 530
  'Create a new requirement spec type' => 'Einen neuen Pflichtenhefttypen anlegen',
530 531
  'Create a new user'           => 'Einen neuen Benutzer anlegen',
531 532
  'Create a new user group'     => 'Eine neue Benutzergruppe erfassen',
......
862 863
  'Edit project'                => 'Projekt bearbeiten',
863 864
  'Edit project #1'             => 'Projekt #1 bearbeiten',
864 865
  'Edit project type'           => 'Projekttypen bearbeiten',
866
  'Edit requirement spec status' => 'Pflichtenheftstatus bearbeiten',
865 867
  'Edit requirement spec type'  => 'Pflichtenhefttypen bearbeiten',
866 868
  'Edit templates'              => 'Vorlagen bearbeiten',
867 869
  'Edit the Delivery Order'     => 'Lieferschein bearbeiten',
......
1412 1414
  'No problems were recognized.' => 'Es wurden keine Probleme gefunden.',
1413 1415
  'No project type has been created yet.' => 'Es wurden noch keine Projekttypen angelegt.',
1414 1416
  'No report with id #1'        => 'Es gibt keinen Report mit der Id #1',
1417
  'No requirement spec statuses has been created yet.' => 'Es wurden noch keine Pflichtenheftstatus angelegt.',
1415 1418
  'No requirement spec type has been created yet.' => 'Es wurden noch keine Pflichtenhefttypen angelegt.',
1416 1419
  'No shipto selected to delete' => 'Keine Lieferadresse zum Löschen ausgewählt',
1417 1420
  'No summary account'          => 'Kein Sammelkonto',
......
2214 2217
  'The login is not unique.'    => 'Der Loginname ist nicht eindeutig.',
2215 2218
  'The long description is missing.' => 'Der Langtext fehlt.',
2216 2219
  'The master templates where not found.' => 'Der Vorlagensatz wurde nicht gefunden.',
2220
  'The name and description are not unique.' => 'Name und Beschreibung sind nicht einmalig.',
2217 2221
  'The name in row %d has already been used before.' => 'Der Name in Zeile %d wurde vorher bereits benutzt.',
2222
  'The name is invalid.'        => 'Der Name ist ungültigt.',
2218 2223
  'The name is missing in row %d.' => 'Der Name fehlt in Zeile %d.',
2219 2224
  'The name is missing.'        => 'Der Name fehlt.',
2220 2225
  'The name is not unique.'     => 'Der Name ist nicht eindeutig.',
......
2254 2259
  'The project type is in use and cannot be deleted.' => 'Der Projekttyp wird verwendet und kann nicht gelöscht werden.',
2255 2260
  'The required information consists of the IBAN and the BIC.' => 'Die benötigten Informationen bestehen aus der IBAN und der BIC.',
2256 2261
  'The required information consists of the IBAN, the BIC, the mandator ID and the mandate\'s date of signature.' => 'Die benötigten Informationen bestehen aus IBAN, BIC, Mandanten-ID und dem Unterschriftsdatum des Mandates.',
2262
  'The requirement spec status has been created.' => 'Der Pflichtenheftstatus wurde angelegt.',
2263
  'The requirement spec status has been deleted.' => 'Der Pflichtenheftstatus wurde gelöscht.',
2264
  'The requirement spec status has been saved.' => 'Der Pflichtenheftstatus wurde gespeichert.',
2265
  'The requirement spec status is in use and cannot be deleted.' => 'Der Pflichtenheftstatus wird verwendet und kann nicht gelöscht werden.',
2257 2266
  'The requirement spec type has been created.' => 'Der Pflichtenhefttyp wurde angelegt.',
2258 2267
  'The requirement spec type has been deleted.' => 'Der Pflichtenhefttyp wurde gelöscht.',
2259 2268
  'The requirement spec type has been saved.' => 'Der Pflichtenhefttyp wurde gespeichert.',
templates/webpages/requirement_spec_status/form.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2

  
3
 <form method="post" action="controller.pl">
4
  <div class="listtop">[% FORM.title %]</div>
5

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

  
8
  <table>
9
   <tr>
10
    <td>[% LxERP.t8('Name') %]</sup></td>
11
    <td>[% L.select_tag("requirement_spec_status.name",  SELF.valid_names, default = SELF.requirement_spec_status.name) %]</td>
12
   </tr>
13

  
14
   <tr>
15
    <td>[% LxERP.t8('Description') %]</td>
16
    <td>[% L.input_tag("requirement_spec_status.description", SELF.requirement_spec_status.description) %]</td>
17
   </tr>
18
  </table>
19

  
20
  <p>
21
   [% L.hidden_tag("id", SELF.requirement_spec_status.id) %]
22
   [% L.hidden_tag("action", "RequirementSpecStatus/dispatch") %]
23
   [% L.submit_tag("action_" _ (SELF.requirement_spec_status.id ? "update" : "create"), LxERP.t8('Save')) %]
24
   [%- IF SELF.requirement_spec_status.id %]
25
    [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %]
26
   [%- END %]
27
   <a href="[% SELF.url_for(action => 'list') %]">[%- LxERP.t8('Abort') %]</a>
28
  </p>
29
 </form>
templates/webpages/requirement_spec_status/list.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2

  
3
 <div class="listtop">[% FORM.title %]</div>
4

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

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

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

  
23
    <tbody>
24
    [%- FOREACH requirement_spec_status = REQUIREMENT_SPEC_STATUSES %]
25
    <tr class="listrow[% loop.count % 2 %]" id="requirement_spec_status_id_[% requirement_spec_status.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_status.id) %]">
29
       [%- HTML.escape(requirement_spec_status.name) %]
30
      </a>
31
     </td>
32

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

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

  
45
 [% L.sortable_element('#requirement_spec_status_list tbody', url => 'controller.pl?action=RequirementSpecStatus/reorder', with => 'requirement_spec_status_id') %]

Auch abrufbar als: Unified diff