Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5e55cce6

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 5e55cce6abaf16fb9425bcdc5a669eaaddca3319
  • Vorgänger 79dc6c16
  • Nachfolger 5dc93413

SimpleSystemSetting: Umstellung von »Projekttypen« und »Projekstatus«

Unterschiede anzeigen:

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

  
3
use strict;
4

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

  
7
use SL::DB::ProjectStatus;
8
use SL::Helper::Flash;
9

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

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

  
18
#
19
# actions
20
#
21

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

  
25
  $self->render('project_status/list',
26
                title          => $::locale->text('Project Status'),
27
                PROJECT_STATUS => SL::DB::Manager::ProjectStatus->get_all_sorted);
28
}
29

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

  
33
  $self->{project_status} = SL::DB::ProjectStatus->new;
34
  $self->render('project_status/form', title => $::locale->text('Create a new project status'));
35
}
36

  
37
sub action_edit {
38
  my ($self) = @_;
39
  $self->render('project_status/form', title => $::locale->text('Edit project status'));
40
}
41

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

  
45
  $self->{project_status} = SL::DB::ProjectStatus->new;
46
  $self->create_or_update;
47
}
48

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

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

  
57
  if (eval { $self->{project_status}->delete; 1; }) {
58
    flash_later('info',  $::locale->text('The project status has been deleted.'));
59
  } else {
60
    flash_later('error', $::locale->text('The project status is in use and cannot be deleted.'));
61
  }
62

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

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

  
69
  SL::DB::ProjectStatus->reorder_list(@{ $::form->{project_status_id} || [] });
70

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

  
74
#
75
# filters
76
#
77

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

  
82
#
83
# helpers
84
#
85

  
86
sub create_or_update {
87
  my $self   = shift;
88
  my $is_new = !$self->{project_status}->id;
89
  my $params = delete($::form->{project_status}) || { };
90

  
91
  $self->{project_status}->assign_attributes(%{ $params });
92

  
93
  my @errors = $self->{project_status}->validate;
94

  
95
  if (@errors) {
96
    flash('error', @errors);
97
    $self->render('project_status/form', title => $is_new ? $::locale->text('Create a new project status') : $::locale->text('Edit project status'));
98
    return;
99
  }
100

  
101
  $self->{project_status}->save;
102

  
103
  flash_later('info', $is_new ? $::locale->text('The project status has been created.') : $::locale->text('The project status has been saved.'));
104
  $self->redirect_to(action => 'list');
105
}
106

  
107
sub load_project_status {
108
  my ($self) = @_;
109
  $self->{project_status} = SL::DB::ProjectStatus->new(id => $::form->{id})->load;
110
}
111

  
112
1;
SL/Controller/ProjectType.pm
1
package SL::Controller::ProjectType;
2

  
3
use strict;
4

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

  
7
use SL::DB::ProjectType;
8
use SL::Helper::Flash;
9

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

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

  
18
#
19
# actions
20
#
21

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

  
25
  $self->render('project_type/list',
26
                title         => $::locale->text('Project Types'),
27
                PROJECT_TYPES => SL::DB::Manager::ProjectType->get_all_sorted);
28
}
29

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

  
33
  $self->{project_type} = SL::DB::ProjectType->new;
34
  $self->render('project_type/form', title => $::locale->text('Create a new project type'));
35
}
36

  
37
sub action_edit {
38
  my ($self) = @_;
39
  $self->render('project_type/form', title => $::locale->text('Edit project type'));
40
}
41

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

  
45
  $self->{project_type} = SL::DB::ProjectType->new;
46
  $self->create_or_update;
47
}
48

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

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

  
57
  if (eval { $self->{project_type}->delete; 1; }) {
58
    flash_later('info',  $::locale->text('The project type has been deleted.'));
59
  } else {
60
    flash_later('error', $::locale->text('The project type is in use and cannot be deleted.'));
61
  }
62

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

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

  
69
  SL::DB::ProjectType->reorder_list(@{ $::form->{project_type_id} || [] });
70

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

  
74
#
75
# filters
76
#
77

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

  
82
#
83
# helpers
84
#
85

  
86
sub create_or_update {
87
  my $self   = shift;
88
  my $is_new = !$self->{project_type}->id;
89
  my $params = delete($::form->{project_type}) || { };
90

  
91
  $self->{project_type}->assign_attributes(%{ $params });
92

  
93
  my @errors = $self->{project_type}->validate;
94

  
95
  if (@errors) {
96
    flash('error', @errors);
97
    $self->render('project_type/form', title => $is_new ? $::locale->text('Create a new project type') : $::locale->text('Edit project type'));
98
    return;
99
  }
100

  
101
  $self->{project_type}->save;
102

  
103
  flash_later('info', $is_new ? $::locale->text('The project type has been created.') : $::locale->text('The project type has been saved.'));
104
  $self->redirect_to(action => 'list');
105
}
106

  
107
sub load_project_type {
108
  my ($self) = @_;
109
  $self->{project_type} = SL::DB::ProjectType->new(id => $::form->{id})->load;
110
}
111

  
112
1;
SL/Controller/SimpleSystemSetting.pm
122 122
      { method => 'obsolete',   title => t8('Obsolete'), formatter => sub { $_[0]->obsolete ? t8('yes') : t8('no') } },
123 123
    ],
124 124
  },
125

  
126
  project_status => {
127
    class  => 'ProjectStatus',
128
    titles => {
129
      list => t8('Project statuses'),
130
      add  => t8('Add project status'),
131
      edit => t8('Edit project status'),
132
    },
133
  },
134

  
135
  project_type => {
136
    class  => 'ProjectType',
137
    titles => {
138
      list => t8('Project types'),
139
      add  => t8('Add project type'),
140
      edit => t8('Edit project type'),
141
    },
142
  },
143

  
125 144
);
126 145

  
127 146
my @default_list_attributes = (
locale/de/all
212 212
  'Add picture'                 => 'Bild hinzufügen',
213 213
  'Add picture to text block'   => 'Bild dem Textblock hinzufügen',
214 214
  'Add pricegroup'              => 'Preisgruppe hinzufügen',
215
  'Add project status'          => 'Projektstatus hinzufügen',
216
  'Add project type'            => 'Projekttypen hinzufügen',
215 217
  'Add section'                 => 'Abschnitt hinzufügen',
216 218
  'Add sub function block'      => 'Unterfunktionsblock hinzufügen',
217 219
  'Add taxzone'                 => 'Steuerzone hinzufügen',
......
671 673
  'Create a new printer'        => 'Einen neuen Drucker anlegen',
672 674
  'Create a new project'        => 'Neues Projekt anlegen',
673 675
  'Create a new project and link to it.' => 'Neues Projekt anlegen und damit verknüpfen.',
674
  'Create a new project status' => 'Einen neuen Projektstatus anlegen',
675
  'Create a new project type'   => 'Einen neuen Projekttypen anlegen',
676 676
  'Create a new purchase price rule' => 'Neue Einkaufspreisregel anlegen',
677 677
  'Create a new requirement spec' => 'Ein neues Pflichtenheft anlegen',
678 678
  'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen',
......
711 711
  'Create new client #1'        => 'Neuen Mandanten #1 anlegen',
712 712
  'Create new delivery term'    => 'Neue Lieferbedingungen anlegen',
713 713
  'Create new payment term'     => 'Neue Zahlungsbedingung anlegen',
714
  'Create new project type'     => 'Neuen Projekttypen anlegen',
715 714
  'Create new quotation or order' => 'Neues Angebot oder neuen Auftrag anlegen',
716 715
  'Create new quotation/order'  => 'Neues Angebot/neuen Auftrag anlegen',
717 716
  'Create new qutoation/order'  => 'Neues Angebot/neuen Auftrag anlegen',
......
1885 1884
  'No print templates have been created for this client yet. Please do so in the client configuration.' => 'Für diesen Mandanten wurden noch keine Druckvorlagen angelegt. Bitte holen Sie dies in der Mandantenkonfiguration nach.',
1886 1885
  'No printers have been created yet.' => 'Es wurden noch keine Drucker angelegt.',
1887 1886
  'No problems were recognized.' => 'Es wurden keine Probleme gefunden.',
1888
  'No project status has been created yet.' => 'Es wurde noch kein Projektstatus angelegt.',
1889
  'No project type has been created yet.' => 'Es wurden noch keine Projekttypen angelegt.',
1890 1887
  'No quotations or orders have been created yet.' => 'Es wurden noch keine Angebote oder Aufträge angelegt.',
1891 1888
  'No report with id #1'        => 'Es gibt keinen Report mit der Id #1',
1892 1889
  'No requirement spec statuses has been created yet.' => 'Es wurden noch keine Pflichtenheftstatus angelegt.',
......
2263 2260
  'Project Type'                => 'Projekttyp',
2264 2261
  'Project Types'               => 'Projekttypen',
2265 2262
  'Project link actions'        => 'Projektverknüpfungs-Aktionen',
2263
  'Project statuses'            => 'Projektstatus',
2266 2264
  'Project type'                => 'Projekttyp',
2265
  'Project types'               => 'Projekttypen',
2267 2266
  'Projects'                    => 'Projekte',
2268 2267
  'Projecttransactions'         => 'Projektbuchungen',
2269 2268
  'Proposal'                    => 'Vorschlag',
......
3085 3084
  'The project link has been updated.' => 'Die Projektverknüpfung wurde aktualisiert.',
3086 3085
  'The project number is already in use.' => 'Die Projektnummer wird bereits verwendet.',
3087 3086
  'The project number is missing.' => 'Die Projektnummer fehlt.',
3088
  'The project status has been created.' => 'Der Projektstatus wurde angelegt.',
3089
  'The project status has been deleted.' => 'Der Projektstatus wurde gelöscht.',
3090
  'The project status has been saved.' => 'Der Projektstatus wurde gespeichert.',
3091
  'The project status is in use and cannot be deleted.' => 'Der Projektstatus wird verwendet und kann nicht gelöscht werden.',
3092
  'The project type has been created.' => 'Der Projekttyp wurde angelegt.',
3093
  'The project type has been deleted.' => 'Der Projekttyp wurde gelöscht.',
3094
  'The project type has been saved.' => 'Der Projekttyp wurde gespeichert.',
3095
  'The project type is in use and cannot be deleted.' => 'Der Projekttyp wird verwendet und kann nicht gelöscht werden.',
3096 3087
  'The receivables chart isn\'t a valid chart.' => 'Das Forderungskonto ist kein gültiges Konto',
3097 3088
  'The recipient, subject or body is missing.' => 'Der Empfäger, der Betreff oder der Text ist leer.',
3098 3089
  'The record template \'#1\' has been loaded.' => 'Die Belegvorlage »#1« wurde geladen.',
menus/user/00-erp.yaml
1122 1122
  name: Project Types
1123 1123
  order: 1600
1124 1124
  params:
1125
    action: ProjectType/list
1125
    action: SimpleSystemSetting/list
1126
    type: project_type
1126 1127
- parent: system
1127 1128
  id: system_project_status
1128 1129
  name: Project Status
1129 1130
  order: 1700
1130 1131
  params:
1131
    action: ProjectStatus/list
1132
    action: SimpleSystemSetting/list
1133
    type: project_status
1132 1134
- parent: system
1133 1135
  id: system_requirement_specs
1134 1136
  name: Requirement specs
templates/webpages/project_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.input_tag("project_status.name" SELF.project_status.name) %]</td>
12
   </tr>
13
   <tr>
14
    <td>[% LxERP.t8('Description') %]</td>
15
    <td>[% L.input_tag("project_status.description" SELF.project_status.description) %]</td>
16
   </tr>
17
  </table>
18

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

  
29
 </form>
templates/webpages/project_status/list.html
1
[% USE HTML %][% USE T8 %][% 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 !PROJECT_STATUS.size %]
8
   <p>
9
    [%- 'No project status has been created yet.' | $T8 %]
10
   </p>
11

  
12
  [%- ELSE %]
13
   <table id="project_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>[%- 'Name' | $T8 %]</th>
18
     <th>[%- 'Description' | $T8 %]</th>
19
    </tr>
20
    </thead>
21

  
22
    <tbody>
23
    [%- FOREACH project_status = PROJECT_STATUS %]
24
    <tr class="listrow[% loop.count % 2 %]" id="project_status_id_[% project_status.id %]">
25
     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
26
     <td><a href="[% SELF.url_for(action => 'edit', id => project_status.id) %]">[% project_status.name | html %]</a></td>
27
     <td><a href="[% SELF.url_for(action => 'edit', id => project_status.id) %]">[% project_status.description | html %]</a></td>
28
    </tr>
29
    [%- END %]
30
    </tbody>
31
   </table>
32
  [%- END %]
33

  
34
  <p>
35
   <a href="[% SELF.url_for(action => 'new') %]">[%- 'Create a new project status' | $T8 %]</a>
36
  </p>
37
 </form>
38

  
39
 [% L.sortable_element('#project_status_list tbody', url => 'controller.pl?action=ProjectStatus/reorder', with => 'project_status_id') %]
templates/webpages/project_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("project_type.description" SELF.project_type.description) %]</td>
12
   </tr>
13
  </table>
14

  
15
  <p>
16
   [% L.hidden_tag("id", SELF.project_type.id) %]
17
   [% L.hidden_tag("action", "ProjectType/dispatch") %]
18
   [% L.submit_tag("action_" _ (SELF.project_type.id ? 'update' : 'create'), LxERP.t8('Save')) %]
19
   [%- IF SELF.project_type.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

  
25
 </form>
templates/webpages/project_type/list.html
1
[% USE HTML %][% USE T8 %][% 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 !PROJECT_TYPES.size %]
8
   <p>
9
    [%- 'No project type has been created yet.' | $T8 %]
10
   </p>
11

  
12
  [%- ELSE %]
13
   <table id="project_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>[%- 'Description' | $T8 %]</th>
18
    </tr>
19
    </thead>
20

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

  
36
  <p>
37
   <a href="[% SELF.url_for(action => 'new') %]">[%- 'Create new project type' | $T8 %]</a>
38
  </p>
39
 </form>
40

  
41
 [% L.sortable_element('#project_type_list tbody', url => 'controller.pl?action=ProjectType/reorder', with => 'project_type_id') %]

Auch abrufbar als: Unified diff