Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision aaa2cd92

Von Sven Schöling vor mehr als 10 Jahren hinzugefügt

  • ID aaa2cd9291719d6a8f327606fc5aeeeb172b7ecb
  • Vorgänger b8a90763
  • Nachfolger 6b87fc69

Projektstatus Controller

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;
locale/de/all
562 562
  'Create a new predefined text' => 'Einen neuen vordefinierten Textblock anlegen',
563 563
  'Create a new printer'        => 'Einen neuen Drucker anlegen',
564 564
  'Create a new project'        => 'Neues Projekt anlegen',
565
  'Create a new project status' => 'Einen neuen Projektstatus anlegen',
565 566
  'Create a new project type'   => 'Einen neuen Projekttypen anlegen',
566 567
  'Create a new requirement spec' => 'Ein neues Pflichtenheft anlegen',
567 568
  'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen',
......
933 934
  'Edit prices and discount (if not used, textfield is ONLY set readonly)' => 'Preise und Rabatt in Formularen frei anpassen (falls deaktiviert, wird allerdings NUR das textfield auf READONLY gesetzt / kann je nach Browserversion und technischen Fähigkeiten des Anwenders noch umgangen werden)',
934 935
  'Edit project'                => 'Projekt bearbeiten',
935 936
  'Edit project #1'             => 'Projekt #1 bearbeiten',
937
  'Edit project status'         => 'Projektstatus bearbeiten',
936 938
  'Edit project type'           => 'Projekttypen bearbeiten',
937 939
  'Edit requirement spec'       => 'Pflichtenheft bearbeiten',
938 940
  'Edit requirement spec status' => 'Pflichtenheftstatus bearbeiten',
......
1510 1512
  '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.',
1511 1513
  'No printers have been created yet.' => 'Es wurden noch keine Drucker angelegt.',
1512 1514
  'No problems were recognized.' => 'Es wurden keine Probleme gefunden.',
1515
  'No project status has been created yet.' => 'Es wurde noch kein Projektstatus angelegt.',
1513 1516
  'No project type has been created yet.' => 'Es wurden noch keine Projekttypen angelegt.',
1514 1517
  'No quotations or orders have been created yet.' => 'Es wurden noch keine Angebote oder Aufträge angelegt.',
1515 1518
  'No report with id #1'        => 'Es gibt keinen Report mit der Id #1',
......
2427 2430
  'The project is in use and cannot be deleted.' => 'Das Projekt ist in Verwendung und kann nicht gelöscht werden.',
2428 2431
  'The project number is already in use.' => 'Die Projektnummer wird bereits verwendet.',
2429 2432
  'The project number is missing.' => 'Die Projektnummer fehlt.',
2433
  'The project status has been created.' => 'Der Projektstatus wurde angelegt.',
2434
  'The project status has been deleted.' => 'Der Projektstatus wurde gelöscht.',
2435
  'The project status has been saved.' => 'Der Projektstatus wurde gespeichert.',
2436
  'The project status is in use and cannot be deleted.' => 'Der Projektstatus wird verwendet und kann nicht gelöscht werden.',
2430 2437
  'The project type has been created.' => 'Der Projekttyp wurde angelegt.',
2431 2438
  'The project type has been deleted.' => 'Der Projekttyp wurde gelöscht.',
2432 2439
  'The project type has been saved.' => 'Der Projekttyp wurde gespeichert.',
menus/erp.ini
606 606
module=controller.pl
607 607
action=ProjectType/list
608 608

  
609
[System--Project Status]
610
module=controller.pl
611
action=ProjectStatus/list
612

  
609 613
[System--Requirement specs]
610 614
module=menu.pl
611 615
action=acc_menu
templates/webpages/project_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') %]</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

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

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

  
7
 <form method="post" action="controller.pl">
8
  [% IF !PROJECT_STATUS.size %]
9
   <p>
10
    [%- 'No project status has been created yet.' | $T8 %]
11
   </p>
12

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

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

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

  
40
 [% L.sortable_element('#project_status_list tbody', url => 'controller.pl?action=ProjectStatus/reorder', with => 'project_status_id') %]

Auch abrufbar als: Unified diff