Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1600ef67

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

  • ID 1600ef672b02029ef3bb2ab940c0954820ef47b3
  • Vorgänger 5a469687
  • Nachfolger 03f5aaa3

Projekte: Templates und get_linked_records etwas entzerrt

Unterschiede anzeigen:

SL/Controller/Project.pm
71 71
sub action_edit {
72 72
  my ($self) = @_;
73 73

  
74
  $self->linked_records([
75
    map  { @{ $_ } }
76
    grep { $_      } (
77
      SL::DB::Manager::Order->          get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer', 'vendor' ], sort_by => 'transdate ASC'),
78
      SL::DB::Manager::DeliveryOrder->  get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer', 'vendor' ], sort_by => 'transdate ASC'),
79
      SL::DB::Manager::Invoice->        get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer'           ], sort_by => 'transdate ASC'),
80
      SL::DB::Manager::PurchaseInvoice->get_all(where => [ globalproject_id => $self->project->id ], with_objects => [             'vendor' ], sort_by => 'transdate ASC'),
81
    )]);
82

  
74
  $self->get_linked_records;
83 75
  $self->display_form(title    => $::locale->text('Edit project #1', $self->project->projectnumber),
84 76
                      callback => $::form->{callback} || $self->url_for(action => 'edit', id => $self->project->id));
85 77
}
......
176 168
  $self->project(SL::DB::Project->new(id => $::form->{id})->load);
177 169
}
178 170

  
171
sub get_linked_records {
172
  my ($self) = @_;
173

  
174
  $self->linked_records([
175
    map  { @{ $_ } }
176
    grep { $_      } (
177
      SL::DB::Manager::Order->          get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer', 'vendor' ], sort_by => 'transdate ASC'),
178
      SL::DB::Manager::DeliveryOrder->  get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer', 'vendor' ], sort_by => 'transdate ASC'),
179
      SL::DB::Manager::Invoice->        get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer'           ], sort_by => 'transdate ASC'),
180
      SL::DB::Manager::PurchaseInvoice->get_all(where => [ globalproject_id => $self->project->id ], with_objects => [             'vendor' ], sort_by => 'transdate ASC'),
181
    )]);
182
}
183

  
179 184
sub setup_db_args_from_filter {
180 185
  my ($self) = @_;
181 186

  
templates/webpages/project/_basic_data.html
1
[%- USE T8 %]
2
[%- USE L %]
3
[%- USE P %]
4
[%- USE HTML %]
5
[%- USE LxERP %]
6
<table>
7
 <tr>
8
  <th align="right">[% 'Number' | $T8 %]</th>
9
  <td>[% L.input_tag("project.projectnumber", SELF.project.projectnumber, size=60, class="initial_focus") %]</td>
10
 </tr>
11

  
12
 <tr>
13
  <th align="right">[% 'Description' | $T8 %]</th>
14
  <td>
15
   [%- SET rows = LxERP.numtextrows(SELF.project.description, 60) %]
16
   [%- IF rows > 1 %]
17
    [%- L.textarea_tag("project.description", SELF.project.description, rows=row, size=60, style="width: 100%", wrap="soft") %]
18
   [%- ELSE %]
19
    [%- L.input_tag("project.description", SELF.project.description, size=60) %]
20
   [%- END %]
21
  </td>
22
 </tr>
23

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

  
29
 <tr>
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>
32
 </tr>
33

  
34
 <tr>
35
  <th align="right">[% 'Valid' | $T8 %]</th>
36
  <td>[% L.select_tag('project.valid', [ [ 1, LxERP.t8('Valid') ], [ 0, LxERP.t8('Invalid') ] ], default=SELF.project.valid, style='width: 300px') %]</td>
37
 </tr>
38

  
39
 [%- IF SELF.project.id %]
40
 <tr>
41
  <th align="right">[% 'Active' | $T8 %]</th>
42
  <td>[% L.select_tag('project.active', [ [ 1, LxERP.t8('Active') ], [ 0, LxERP.t8('Inactive') ] ], default=SELF.project.active, style='width: 300px') %]</td>
43
 </tr>
44
 [%- END %]
45
</table>
templates/webpages/project/_cvars.html
1
[%- USE HTML  %]
2
<table>
3
[%- FOREACH var = CUSTOM_VARIABLES %]
4
<tr>
5
 <td align="right" valign="top">[% HTML.escape(var.description) %]</td>
6
 <td valign="top">[% var.HTML_CODE %]</td>
7
</tr>
8
[%- END %]
9
</table>
templates/webpages/project/_linked_records.html
1
[%- USE P %]
2
 [% P.grouped_record_list(records) %]
templates/webpages/project/form.html
1 1
[%- USE T8 %]
2
[%- USE L %][%- USE P %]
3
[%- USE HTML %][%- USE LxERP %]
4

  
2
[%- USE L %]
3
[%- USE P %]
4
[%- USE HTML %]
5
[%- USE LxERP %]
5 6
<h1>[% title %]</h1>
6 7

  
7 8
[%- INCLUDE 'common/flash.html' %]
......
22 23
   </ul>
23 24

  
24 25
   <div id="basic_data">
25

  
26
    <table>
27
     <tr>
28
      <th align="right">[% 'Number' | $T8 %]</th>
29
      <td>[% L.input_tag("project.projectnumber", SELF.project.projectnumber, size=60, class='initial_focus') %]</td>
30
     </tr>
31

  
32
     <tr>
33
      <th align="right">[% 'Description' | $T8 %]</th>
34
      <td>
35
       [%- SET rows = LxERP.numtextrows(SELF.project.description, 60) %]
36
       [%- IF rows > 1 %]
37
        [%- L.textarea_tag("project.description", SELF.project.description, rows=row, size=60, style="width: 100%", wrap="soft") %]
38
       [%- ELSE %]
39
        [%- L.input_tag("project.description", SELF.project.description, size=60) %]
40
       [%- END %]
41
      </td>
42
     </tr>
43

  
44
     <tr>
45
      <th align="right">[% 'Project Type' | $T8 %]</th>
46
      <td>[% L.select_tag('project.project_type_id', ALL_PROJECT_TYPES, default=SELF.project.project_type_id, title_key='description', style='width: 300px') %]</td>
47
     </tr>
48

  
49
     <tr>
50
      <th align="right">[% 'Customer' | $T8 %]</th>
51
      <td>[% L.select_tag('project.customer_id', ALL_CUSTOMERS, default=SELF.project.customer_id, title_key='name', with_empty=1, style='width: 300px') %]</td>
52
     </tr>
53

  
54
     <tr>
55
      <th align="right">[% 'Valid' | $T8 %]</th>
56
      <td>[% L.select_tag('project.valid', [ [ 1, LxERP.t8('Valid') ], [ 0, LxERP.t8('Invalid') ] ], default=SELF.project.valid, style='width: 300px') %]</td>
57
     </tr>
58

  
59
     [%- IF SELF.project.id %]
60
     <tr>
61
      <th align="right">[% 'Active' | $T8 %]</th>
62
      <td>[% L.select_tag('project.active', [ [ 1, LxERP.t8('Active') ], [ 0, LxERP.t8('Inactive') ] ], default=SELF.project.active, style='width: 300px') %]</td>
63
     </tr>
64
     [%- END %]
65
    </table>
26
   [%- PROCESS 'project/_basic_data.html' %]
66 27
   </div>
67 28

  
68 29
   [%- IF CUSTOM_VARIABLES.size %]
69 30
   <div id="custom_variables">
70

  
71
    <p>
72
     <table>
73
      [%- FOREACH var = CUSTOM_VARIABLES %]
74
      <tr>
75
       <td align="right" valign="top">[% HTML.escape(var.description) %]</td>
76
       <td valign="top">[% var.HTML_CODE %]</td>
77
      </tr>
78
      [%- END %]
79
     </table>
80
    </p>
31
   [%- PROCESS 'project/_cvars.html' %]
81 32
   </div>
82 33
   [%- END %]
83 34

  
84 35
   [%- IF SELF.project.id %]
85 36
   <div id="linked_records">
86
    [% P.grouped_record_list(SELF.linked_records) %]
37
   [%- PROCESS 'project/_linked_records.html' records=SELF.linked_records %]
87 38
   </div>
88 39
   [%- END %]
89 40

  

Auch abrufbar als: Unified diff