Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6761a7c1

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 6761a7c1fdf3074ac5a16dccf04d40dbc64f6b5f
  • Vorgänger 5a0288d0
  • Nachfolger 459574b9

SimpleSystemSetting: Umstellung von »Pflichtenhefte« → »Abnahmestatus«

Unterschiede anzeigen:

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

  
3
use strict;
4

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

  
7
use SL::DB::RequirementSpecAcceptanceStatus;
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_acceptance_status valid_names) ],
15
);
16

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

  
21
#
22
# actions
23
#
24

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

  
28
  $self->render('requirement_spec_acceptance_status/list',
29
                title                                => t8('Acceptance Statuses'),
30
                REQUIREMENT_SPEC_ACCEPTANCE_STATUSES => SL::DB::Manager::RequirementSpecAcceptanceStatus->get_all_sorted);
31
}
32

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

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

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

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

  
48
  $self->{requirement_spec_acceptance_status} = SL::DB::RequirementSpecAcceptanceStatus->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_acceptance_status}->delete; 1; }) {
61
    flash_later('info',  t8('The acceptance status has been deleted.'));
62
  } else {
63
    flash_later('error', t8('The acceptance 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::RequirementSpecAcceptanceStatus->reorder_list(@{ $::form->{requirement_spec_acceptance_status_id} || [] });
73

  
74
  $self->render(\'', { type => 'json' });
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_acceptance_status}->id;
92
  my $params = delete($::form->{requirement_spec_acceptance_status}) || { };
93
  my $title  = $is_new ? t8('Create a new acceptance status') : t8('Edit acceptance status');
94

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

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

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

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

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

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

  
116
1;
SL/Controller/SimpleSystemSetting.pm
141 141
    },
142 142
  },
143 143

  
144
  requirement_spec_acceptance_status => {
145
    # Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_acceptance_status_form")
146
    class  => 'RequirementSpecAcceptanceStatus',
147
    titles => {
148
      list => t8('Acceptance Statuses'),
149
      add  => t8('Add acceptance status'),
150
      edit => t8('Edit acceptance status'),
151
    },
152
    list_attributes => [
153
      { method => 'name',        title => t8('Name') },
154
      { method => 'description', title => t8('Description') },
155
    ],
156
  },
157

  
144 158
  requirement_spec_predefined_text => {
145 159
    # Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_predefined_text_form")
146 160
    class  => 'RequirementSpecPredefinedText',
......
338 352
# type-specific helper functions
339 353
#
340 354

  
355
sub setup_requirement_spec_acceptance_status {
356
  my ($self) = @_;
357

  
358
  no warnings 'once';
359
  $self->{valid_names} = \@SL::DB::RequirementSpecAcceptanceStatus::valid_names;
360
}
361

  
341 362
sub setup_requirement_spec_status {
342 363
  my ($self) = @_;
343 364

  
locale/de/all
187 187
  'Add Vendor'                  => 'Lieferant erfassen',
188 188
  'Add Vendor Invoice'          => 'Einkaufsrechnung erfassen',
189 189
  'Add Warehouse'               => 'Lager erfassen',
190
  'Add acceptance status'       => 'Abnahmestatus hinzufügen',
190 191
  'Add and edit units'          => 'Einheiten erfassen und bearbeiten',
191 192
  'Add bank account'            => 'Bankkonto erfassen',
192 193
  'Add booking group'           => 'Buchungsgruppe erfassen',
......
664 665
  'Create Date'                 => 'Erstelldatum',
665 666
  'Create HTML'                 => 'HTML erzeugen',
666 667
  'Create PDF'                  => 'PDF erzeugen',
667
  'Create a new acceptance status' => 'Einen neuen Abnahmestatus anlegen',
668 668
  'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen',
669 669
  'Create a new client'         => 'Einen neuen Mandanten anlegen',
670 670
  'Create a new complexity'     => 'Einen Komplexitätsgrad anlegen',
......
1841 1841
  'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
1842 1842
  'No Journal'                  => 'Kein Journal',
1843 1843
  'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
1844
  'No acceptance statuses has been created yet.' => 'Es wurde noch kein Abnahmestatus angelegt.',
1845 1844
  'No action defined.'          => 'Keine Aktion definiert.',
1846 1845
  'No articles have been added yet.' => 'Es wurden noch keine Artikel hinzugefügt.',
1847 1846
  'No background job has been created yet.' => 'Es wurden noch keine Hintergrund-Jobs angelegt.',
......
2878 2877
  'The SEPA strings have been saved.' => 'Die bei SEPA-Überweisungen verwendeten Begriffe wurden gespeichert.',
2879 2878
  'The WebDAV feature has been used.' => 'Das WebDAV-Feature wurde benutzt.',
2880 2879
  'The abbreviation is missing.' => 'Abkürzung fehlt',
2881
  'The acceptance status has been created.' => 'Der Abnahmestatus wurde angelegt.',
2882
  'The acceptance status has been deleted.' => 'Der Abnahmestatus wurde gelöscht.',
2883
  'The acceptance status has been saved.' => 'Der Abnahmestatus wurde gespeichert.',
2884
  'The acceptance status is in use and cannot be deleted.' => 'Der Abnahmestatus wird verwendet und kann nicht gelöscht werden.',
2885 2880
  'The access rights a user has within a client instance is still governed by his group membership.' => 'Welche Zugriffsrechte ein Benutzer innerhalb eines Mandanten hat, wird weiterhin über Gruppenmitgliedschaften geregelt.',
2886 2881
  'The access rights have been saved.' => 'Die Zugriffsrechte wurden gespeichert.',
2887 2882
  'The account #1 is already being used by bank account #2.' => 'Das Konto #1 wird schon von Bankkonto #2 benutzt.',
menus/user/00-erp.yaml
1173 1173
  name: Acceptance Statuses
1174 1174
  order: 600
1175 1175
  params:
1176
    action: RequirementSpecAcceptanceStatus/list
1176
    action: SimpleSystemSetting/list
1177
    type: requirement_spec_acceptance_status
1177 1178
- parent: system
1178 1179
  id: system_languages_and_translations
1179 1180
  name: Languages and translations
templates/webpages/requirement_spec_acceptance_status/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('Name') %]</td>
11
    <td>[% L.select_tag("requirement_spec_acceptance_status.name",  SELF.valid_names, default = SELF.requirement_spec_acceptance_status.name) %]</td>
12
   </tr>
13

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

  
20
  <p>
21
   [% L.hidden_tag("id", SELF.requirement_spec_acceptance_status.id) %]
22
   [% L.hidden_tag("action", "RequirementSpecAcceptanceStatus/dispatch") %]
23
   [% L.submit_tag("action_" _ (SELF.requirement_spec_acceptance_status.id ? "update" : "create"), LxERP.t8('Save')) %]
24
   [%- IF SELF.requirement_spec_acceptance_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_acceptance_status/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_ACCEPTANCE_STATUSES.size %]
8
   <p>
9
    [%- LxERP.t8('No acceptance statuses has been created yet.') %]
10
   </p>
11

  
12
  [%- ELSE %]
13
   <table id="requirement_spec_acceptance_status_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('Name') %]</th>
18
     <th>[%- LxERP.t8('Description') %]</th>
19
    </tr>
20
    </thead>
21

  
22
    <tbody>
23
    [%- FOREACH requirement_spec_acceptance_status = REQUIREMENT_SPEC_ACCEPTANCE_STATUSES %]
24
    <tr class="listrow[% loop.count % 2 %]" id="requirement_spec_acceptance_status_id_[% requirement_spec_acceptance_status.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_acceptance_status.id) %]">
28
       [%- HTML.escape(requirement_spec_acceptance_status.name) %]
29
      </a>
30
     </td>
31

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

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

  
44
 [% L.sortable_element('#requirement_spec_acceptance_status_list tbody', url => 'controller.pl?action=RequirementSpecAcceptanceStatus/reorder', with => 'requirement_spec_acceptance_status_id') %]
templates/webpages/simple_system_setting/_requirement_spec_acceptance_status_form.html
1
[%- USE LxERP -%][%- USE L -%]
2
[% SET style="width: 250px" %]
3
<table>
4
 <tr>
5
  <td>[% LxERP.t8("Name") %]</td>
6
  <td>[% L.select_tag("object.name",  SELF.valid_names, default=SELF.object.name, style=style) %]</td>
7
 </tr>
8

  
9
 <tr>
10
  <td>[% LxERP.t8("Description") %]</td>
11
  <td>[% L.input_tag("object.description", SELF.object.description, style=style, "data-validate"="required", "data-title"=LxERP.t8("Description")) %]</td>
12
 </tr>
13
</table>

Auch abrufbar als: Unified diff