Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2bd51903

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 2bd51903b8c0ed8114ba05e481573b9440918210
  • Vorgänger 21f24006
  • Nachfolger c45b8d02

Verwaltung von Pflichtenheftrisikograden

Unterschiede anzeigen:

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

  
3
use strict;
4

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

  
7
use SL::DB::RequirementSpecRisk;
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_risk) ],
15
);
16

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

  
20
#
21
# actions
22
#
23

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

  
27
  $self->render('requirement_spec_risk/list',
28
                title                  => t8('Risk levels'),
29
                REQUIREMENT_SPEC_RISKS => SL::DB::Manager::RequirementSpecRisk->get_all_sorted);
30
}
31

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

  
35
  $self->{requirement_spec_risk} = SL::DB::RequirementSpecRisk->new;
36
  $self->render('requirement_spec_risk/form', title => t8('Create a new risk level'));
37
}
38

  
39
sub action_edit {
40
  my ($self) = @_;
41
  $self->render('requirement_spec_risk/form', title => t8('Edit risk level'));
42
}
43

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

  
47
  $self->{requirement_spec_risk} = SL::DB::RequirementSpecRisk->new;
48
  $self->create_or_update;
49
}
50

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

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

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

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

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

  
71
  SL::DB::RequirementSpecRisk->reorder_list(@{ $::form->{requirement_spec_risk_id} || [] });
72

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

  
76
#
77
# filters
78
#
79

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

  
84
#
85
# helpers
86
#
87

  
88
sub create_or_update {
89
  my $self   = shift;
90
  my $is_new = !$self->{requirement_spec_risk}->id;
91
  my $params = delete($::form->{requirement_spec_risk}) || { };
92
  my $title  = $is_new ? t8('Create a new risk level') : t8('Edit risk level');
93

  
94
  $self->{requirement_spec_risk}->assign_attributes(%{ $params });
95

  
96
  my @errors = $self->{requirement_spec_risk}->validate;
97

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

  
104
  $self->{requirement_spec_risk}->save;
105

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

  
110
sub load_requirement_spec_risk {
111
  my ($self) = @_;
112
  $self->{requirement_spec_risk} = SL::DB::RequirementSpecRisk->new(id => $::form->{id})->load;
113
}
114

  
115
1;
SL/DB/RequirementSpecRisk.pm
11 11
  my ($self) = @_;
12 12

  
13 13
  my @errors;
14
  push @errors, t8('The description is missing.') if !$self->description;
14
  push @errors, t8('The description is missing.')    if !$self->description;
15
  push @errors, t8('The description is not unique.') if  $self->get_first_conflicting('description');
15 16

  
16 17
  return @errors;
17 18
}
locale/de/all
531 531
  'Create a new project type'   => 'Einen neuen Projekttypen anlegen',
532 532
  'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen',
533 533
  'Create a new requirement spec type' => 'Einen neuen Pflichtenhefttypen anlegen',
534
  'Create a new risk level'     => 'Einen neuen Risikograd anlegen',
534 535
  'Create a new user'           => 'Einen neuen Benutzer anlegen',
535 536
  'Create a new user group'     => 'Eine neue Benutzergruppe erfassen',
536 537
  'Create and edit RFQs'        => 'Lieferantenanfragen erfassen und bearbeiten',
......
870 871
  'Edit project type'           => 'Projekttypen bearbeiten',
871 872
  'Edit requirement spec status' => 'Pflichtenheftstatus bearbeiten',
872 873
  'Edit requirement spec type'  => 'Pflichtenhefttypen bearbeiten',
874
  'Edit risk level'             => 'Risikograd bearbeiten',
873 875
  'Edit templates'              => 'Vorlagen bearbeiten',
874 876
  'Edit the Delivery Order'     => 'Lieferschein bearbeiten',
875 877
  'Edit the configuration for periodic invoices' => 'Konfiguration für wiederkehrende Rechnungen bearbeiten',
......
1423 1425
  'No report with id #1'        => 'Es gibt keinen Report mit der Id #1',
1424 1426
  'No requirement spec statuses has been created yet.' => 'Es wurden noch keine Pflichtenheftstatus angelegt.',
1425 1427
  'No requirement spec type has been created yet.' => 'Es wurden noch keine Pflichtenhefttypen angelegt.',
1428
  'No risks level has been created yet.' => 'Es wurden noch keine Risikograde angelegt.',
1426 1429
  'No shipto selected to delete' => 'Keine Lieferadresse zum Löschen ausgewählt',
1427 1430
  'No summary account'          => 'Kein Sammelkonto',
1428 1431
  'No transaction selected!'    => 'Keine Transaktion ausgewählt',
......
1808 1811
  'Revenues EU without UStId'   => 'Erlöse EU o. UStId',
1809 1812
  'Review of Aging list'        => 'Altersstrukturliste',
1810 1813
  'Right'                       => 'Rechts',
1814
  'Risk levels'                 => 'Risikograde',
1811 1815
  'Risks'                       => 'Risikograde',
1812 1816
  'Row'                         => 'Zeile',
1813 1817
  'Row #1: amount has to be different from zero.' => 'Zeile #1: Der Wert darf nicht 0 sein.',
......
2283 2287
  'The requirement spec type has been deleted.' => 'Der Pflichtenhefttyp wurde gelöscht.',
2284 2288
  'The requirement spec type has been saved.' => 'Der Pflichtenhefttyp wurde gespeichert.',
2285 2289
  'The requirement spec type is in use and cannot be deleted.' => 'Der Pflichtenhefttyp wird verwendet und kann nicht gelöscht werden.',
2290
  'The risk level has been created.' => 'Der Risikograd wurde angelegt.',
2291
  'The risk level has been deleted.' => 'Der Risikograd wurde gelöscht.',
2292
  'The risk level has been saved.' => 'Der Risikograd wurde gespeichert.',
2293
  'The risk level is in use and cannot be deleted.' => 'Der Risikograd wird verwendet und kann nicht gelöscht werden.',
2286 2294
  'The second reason is that kivitendo allowed the user to enter the tax amount manually regardless of the taxkey used.' => 'Der zweite Grund war, dass kivitendo zuließ, dass die Benutzer beliebige, von den tatsächlichen Steuerschlüsseln unabhängige Steuerbeträge eintrugen.',
2287 2295
  'The second way is to use Perl\'s CPAN module and let it download and install the module for you.' => 'Die zweite Variante besteht darin, Perls CPAN-Modul zu benutzen und es das Modul für Sie installieren zu lassen.',
2288 2296
  'The selected bank account does not exist anymore.' => 'Das ausgewählte Bankkonto existiert nicht mehr.',
templates/webpages/requirement_spec_risk/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("Description") %]</td>
11
    <td>[% L.input_tag("requirement_spec_risk.description", SELF.requirement_spec_risk.description) %]</td>
12
   </tr>
13
  </table>
14

  
15
  <p>
16
   [% L.hidden_tag("id", SELF.requirement_spec_risk.id) %]
17
   [% L.hidden_tag("action", "RequirementSpecRisk/dispatch") %]
18
   [% L.submit_tag("action_" _ (SELF.requirement_spec_risk.id ? "update" : "create"), LxERP.t8('Save')) %]
19
   [%- IF SELF.requirement_spec_risk.id %]
20
    [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %]
21
   [%- END %]
22
   <a href="[% SELF.url_for(action => 'list') %]">[%- LxERP.t8('Abort') %]</a>
23
  </p>
24
 </form>
templates/webpages/requirement_spec_risk/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_RISKS.size %]
9
   <p>
10
    [%- LxERP.t8("No risks level has been created yet.") %]
11
   </p>
12

  
13
  [%- ELSE %]
14
   <table id="requirement_spec_risk_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("Description") %]</th>
19
    </tr>
20
    </thead>
21

  
22
    <tbody>
23
    [%- FOREACH requirement_spec_risk = REQUIREMENT_SPEC_RISKS %]
24
    <tr class="listrow[% loop.count % 2 %]" id="requirement_spec_risk_id_[% requirement_spec_risk.id %]">
25
     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8("reorder item") %]"></td>
26
     <td>
27
      <a href="[% SELF.url_for(action => "edit", id => requirement_spec_risk.id) %]">
28
       [%- HTML.escape(requirement_spec_risk.description) %]
29
      </a>
30
     </td>
31
    </tr>
32
    [%- END %]
33
    </tbody>
34
   </table>
35
  [%- END %]
36

  
37
  <p>
38
   <a href="[% SELF.url_for(action => "new") %]">[%- LxERP.t8("Create a new risk level") %]</a>
39
  </p>
40
 </form>
41

  
42
 [% L.sortable_element("#requirement_spec_risk_list tbody", url => "controller.pl?action=RequirementSpecRisk/reorder", with => "requirement_spec_risk_id") %]

Auch abrufbar als: Unified diff