Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 47dbae62

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 47dbae62a5c80fd13cb255c3c53b5895ada1b1ba
  • Vorgänger f1ed2dc0
  • Nachfolger 89b004f8

Projektverwaltung: Fixes nach Rebase; Refactoring

Unterschiede anzeigen:

SL/Controller/Project.pm
25 25
use Rose::Object::MakeMethods::Generic
26 26
(
27 27
 scalar => [ qw(project linked_records) ],
28
 'scalar --get_set_init' => [ qw(models) ],
28
 'scalar --get_set_init' => [ qw(models customers project_types project_statuses) ],
29 29
);
30 30

  
31 31
__PACKAGE__->run_before('check_auth');
32 32
__PACKAGE__->run_before('load_project',        only => [ qw(edit update destroy) ]);
33
__PACKAGE__->run_before('load_project_types',  only => [ qw(search edit new list) ]);
34
__PACKAGE__->run_before('load_project_status', only => [ qw(search edit new list) ]);
35 33

  
36 34
#
37 35
# actions
......
115 113
# helpers
116 114
#
117 115

  
116
sub init_project_statuses { SL::DB::Manager::ProjectStatus->get_all_sorted }
117
sub init_project_types    { SL::DB::Manager::ProjectType->get_all_sorted   }
118

  
119
sub init_customers {
120
  my ($self)      = @_;
121
  my @customer_id = $self->project && $self->project->customer_id ? (id => $self->project->customer_id) : ();
122

  
123
  return SL::DB::Manager::Customer->get_all_sorted(where => [ or => [ obsolete => 0, obsolete => undef, @customer_id ]]);
124
}
125

  
118 126
sub display_form {
119 127
  my ($self, %params) = @_;
120 128

  
121
  $params{ALL_CUSTOMERS}     = SL::DB::Manager::Customer->get_all_sorted(where => [ or => [ obsolete => 0, obsolete => undef, id => $self->project->customer_id ]]);
122 129
  $params{CUSTOM_VARIABLES}  = CVar->get_custom_variables(module => 'Projects', trans_id => $self->project->id);
123 130

  
124 131
  if ($params{keep_cvars}) {
......
199 206
    description   => { obj_link => sub { $self->url_for(action => 'edit', id => $_[0]->id, callback => $callback) } },
200 207
    project_type  => { sub  => sub { $_[0]->project_type->description } },
201 208
    project_status => { sub  => sub { $_[0]->project_status->description }, text => t8('Status') },
202
    customer      => { raw_data  => sub { $self->presenter->customer($_[0]->customer, display => 'table-cell', callback => $callback) } },
209
    customer      => { raw_data  => sub { $_[0]->customer_id ? $self->presenter->customer($_[0]->customer, display => 'table-cell', callback => $callback) : '' } },
203 210
    active        => { sub  => sub { $_[0]->active   ? $::locale->text('Active') : $::locale->text('Inactive') },
204 211
                       text => $::locale->text('Active') },
205 212
    valid         => { sub  => sub { $_[0]->valid    ? $::locale->text('Valid')  : $::locale->text('Invalid')  },
......
281 288

  
282 289
  $self->{filter_summary} = join ', ', @filter_strings;
283 290
}
284

  
285
sub load_project_types {
286
  $_[0]{ALL_PROJECT_TYPES} = SL::DB::Manager::ProjectType->get_all_sorted;
287
}
288

  
289
sub load_project_status {
290
  $_[0]{ALL_PROJECT_STATUS} = SL::DB::Manager::ProjectStatus->get_all_sorted;
291
}
292

  
293 291
1;
templates/webpages/project/_basic_data.html
18 18

  
19 19
 <tr>
20 20
  <th align="right">[% 'Project Type' | $T8 %]</th>
21
  <td>[% L.select_tag('project.project_type_id', SELF.ALL_PROJECT_TYPES, default=SELF.project.project_type_id, title_key='description', style='width: 300px') %]</td>
21
  <td>[% L.select_tag('project.project_type_id', SELF.project_types, default=SELF.project.project_type_id, title_key='description', style='width: 300px') %]</td>
22 22
 </tr>
23 23

  
24 24
 <tr>
25 25
  <th align="right">[% 'Project Status' | $T8 %]</th>
26
  <td>[% L.select_tag('project.project_status_id', SELF.ALL_PROJECT_STATUS, default=SELF.project.project_status_id, title_key='description', style='width: 300px') %]</td>
26
  <td>[% L.select_tag('project.project_status_id', SELF.project_statuses, default=SELF.project.project_status_id, title_key='description', style='width: 300px') %]</td>
27 27
 </tr>
28 28

  
29 29
 <tr>
30 30
  <th align="right">[% 'Customer' | $T8 %]</th>
31
  <td>[% L.select_tag('project.customer_id', ALL_CUSTOMERS, default=SELF.project.customer_id, title_key='name', with_empty=1, style='width: 300px') %]</td>
31
  <td>[% L.select_tag('project.customer_id', SELF.customers, default=SELF.project.customer_id, title_key='name', with_empty=1, style='width: 300px') %]</td>
32 32
 </tr>
33 33

  
34 34
 <tr>
templates/webpages/project/_filter.html
11 11

  
12 12
 <tr>
13 13
  <th align="right">[% 'Description' | $T8 %]</th>
14
  <td>[% L.input_tag('filter.description:substr::ilike', filter.description_substr__ilike, size=60) %]</td>
14
  <td>[% L.input_tag('filter.description:substr::ilike', filter.description_substr__ilike, size=60, class='initial_focus') %]</td>
15 15
 </tr>
16 16

  
17 17
 <tr>
......
21 21

  
22 22
 <tr>
23 23
  <th align="right">[% 'Project Type' | $T8 %]</th>
24
  <td>[% L.select_tag('filter.project_type_id', SELF.ALL_PROJECT_TYPES, default=filter.project_type_id, title_key='description', with_empty=1) %]</td>
24
  <td>[% L.select_tag('filter.project_type_id', SELF.project_types, default=filter.project_type_id, title_key='description', with_empty=1, style="width: 200px") %]</td>
25 25
 </tr>
26 26

  
27 27
 <tr>
28 28
  <th align="right">[% 'Project Status' | $T8 %]</th>
29
  <td>[% L.select_tag('filter.project_status_id', SELF.ALL_PROJECT_STATUS, default=filter.project_status_id, title_key='description', with_empty=1) %]</td>
29
  <td>[% L.select_tag('filter.project_status_id', SELF.project_statuses, default=filter.project_status_id, title_key='description', with_empty=1, style="width: 200px") %]</td>
30 30
 </tr>
31 31

  
32 32
 [% CUSTOM_VARIABLES_FILTER_CODE %]
templates/webpages/project/search.html
10 10
  <div class="listtop">[% 'Search projects' | $T8 %]</div>
11 11

  
12 12
  <p>
13
   <table>
14
    <tr>
15
     <th align="right">[% 'Number' | $T8 %]</th>
16
     <td>[% L.input_tag('filter.projectnumber:substr::ilike', filter.projectnumber_substr__ilike, size=60) %]</td>
17
    </tr>
18

  
19
    <tr>
20
     <th align="right">[% 'Description' | $T8 %]</th>
21
     <td>[% L.input_tag('filter.description:substr::ilike', filter.description_substr__ilike, size=60, class='initial_focus') %]</td>
22
    </tr>
23

  
24
    <tr>
25
     <th align="right">[% 'Customer' | $T8 %]</th>
26
     <td>[% L.input_tag('filter.customer.name:substr::ilike', filter.customer.name_substr__ilike, size=60) %]</td>
27
    </tr>
28

  
29
    <tr>
30
     <th align="right">[% 'Project Type' | $T8 %]</th>
31
     <td>[% L.select_tag('filter.project_type_id', SELF.ALL_PROJECT_TYPES, default=filter.project_type_id, title_key='description', with_empty=1) %]</td>
32
    </tr>
33

  
34
    <tr>
35
     <th align="right">[% 'Project Status' | $T8 %]</th>
36
     <td>[% L.select_tag('filter.project_status_id', SELF.ALL_PROJECT_STATUS, default=filter.project_status_id, title_key='description', with_empty=1) %]</td>
37
    </tr>
38

  
39
    [% CUSTOM_VARIABLES_FILTER_CODE %]
40

  
41
    <tr>
42
     <th>[% 'Include in Report' | $T8 %]</th>
43
     <td>
44
      <table>
45
       <tr>
46
        <td>[% L.select_tag('filter.active', [ [ 'active', LxERP.t8('Active') ], [ 'inactive', LxERP.t8('Inactive') ], [ 'both', LxERP.t8('Both') ] ], default=filter.active, style="width: 200px") %]</td>
47
       </tr>
48

  
49
       <tr>
50
        <td>[% L.select_tag('filter.valid', [ [ 'valid', LxERP.t8('Valid') ], [ 'invalid', LxERP.t8('Invalid') ], [ 'both', LxERP.t8('Both') ] ], default=filter.valid, style="width: 200px") %]</td>
51
       </tr>
52

  
53
       <tr>
54
        <td>[% L.select_tag('filter.status', [ [ 'all', LxERP.t8('All') ], [ 'orphaned', LxERP.t8('Orphaned') ] ], default=filter.status, style="width: 200px") %]</td>
55
       </tr>
56

  
57
       [% CUSTOM_VARIABLES_INCLUSION_CODE %]
58

  
59
      </table>
60
     </td>
61
    </tr>
62
   </table>
13
[%- INCLUDE 'project/_filter.html' %]
63 14
  </p>
64 15

  
65 16
  <hr size="3" noshade>

Auch abrufbar als: Unified diff