Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5c5c1eef

Von Moritz Bunkus vor fast 12 Jahren hinzugefügt

  • ID 5c5c1eef2ef26aa166f612d0718770488809b74b
  • Vorgänger ee04154a
  • Nachfolger 7f8599c0

Projekt: neue Spalten (Kunde, Typ, gültig)

Unterschiede anzeigen:

SL/DB/MetaSetup/Project.pm
16 16
    itime         => { type => 'timestamp', default => 'now()' },
17 17
    mtime         => { type => 'timestamp' },
18 18
    active        => { type => 'boolean', default => 'true' },
19
    customer_id   => { type => 'integer' },
20
    type          => { type => 'text' },
21
    valid         => { type => 'boolean', default => 'true' },
19 22
  ],
20 23

  
21 24
  primary_key_columns => [ 'id' ],
......
23 26
  unique_key => [ 'projectnumber' ],
24 27

  
25 28
  allow_inline_column_values => 1,
29

  
30
  foreign_keys => [
31
    customer => {
32
      class       => 'SL::DB::Customer',
33
      key_columns => { customer_id => 'id' },
34
    },
35
  ],
26 36
);
27 37

  
28 38
1;
SL/Projects.pm
94 94
    push @filters, 'NOT COALESCE(p.active, FALSE)';
95 95
  }
96 96

  
97
  if ($params{valid} eq "valid") {
98
    push @filters, 'p.valid';
99

  
100
  } elsif ($params{valid} eq "invalid") {
101
    push @filters, 'NOT COALESCE(p.valid, FALSE)';
102
  }
103

  
104
  if ($params{customer}) {
105
    push @filters, 'c.name ILIKE ?';
106
    push @values,  '%' . $params{customer} . '%';
107
  }
108

  
109
  if ($params{type}) {
110
    push @filters, 'p.type ILIKE ?';
111
    push @values,  '%' . $params{type} . '%';
112
  }
113

  
97 114
  my ($cvar_where, @cvar_values) = CVar->build_filter_query('module'         => 'Projects',
98 115
                                                            'trans_id_field' => 'p.id',
99 116
                                                            'filter'         => $form);
......
108 125

  
109 126
  my $sortorder =  $params{sort} ? $params{sort} : "projectnumber";
110 127
  $sortorder    =~ s/[^a-z_]//g;
111
  my $query     = qq|SELECT p.id, p.projectnumber, p.description, p.active
128
  my $query     = qq|SELECT p.id, p.projectnumber, p.description, p.active, p.valid, p.type,
129
                       c.name AS customer
112 130
                     FROM project p
131
                     LEFT JOIN customer c ON (p.customer_id = c.id)
113 132
                     $where
114 133
                     ORDER BY $sortorder|;
115 134

  
......
180 199
    $params{active} = 1;
181 200
  }
182 201

  
183
  my $query  = qq|UPDATE project SET projectnumber = ?, description = ?, active = ?
184
               WHERE id = ?|;
202
  my $query  = <<SQL;
203
    UPDATE project
204
    SET projectnumber = ?, description = ?, active = ?, customer_id = ?, type = ?, valid = ?
205
    WHERE id = ?
206
SQL
185 207

  
186
  @values = ($params{projectnumber}, $params{description}, $params{active} ? 't' : 'f', conv_i($params{id}));
208
  @values = ($params{projectnumber}, $params{description}, $params{active} ? 't' : 'f', conv_i($params{customer_id}), $params{type}, $params{valid} ? 't' : 'f', conv_i($params{id}));
187 209
  do_query($form, $dbh, $query, @values);
188 210

  
189 211
  CVar->save_custom_variables('dbh'       => $dbh,
......
220 242
}
221 243

  
222 244
1;
223

  
bin/mozilla/projects.pl
118 118

  
119 119
  my $report       = SL::ReportGenerator->new(\%myconfig, $form);
120 120

  
121
  my @columns      = qw(projectnumber description active);
121
  my @columns      = qw(projectnumber description customer type active valid);
122 122

  
123 123
  my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs };
124 124
  my @searchable_custom_variables  = grep { $_->{searchable} }  @{ $cvar_configs };
......
144 144
  my %column_defs  = (
145 145
    'projectnumber'            => { 'text' => $locale->text('Number'), },
146 146
    'description'              => { 'text' => $locale->text('Description'), },
147
    'customer'                 => { 'text' => $locale->text('Customer'), },
148
    'type'                     => { 'text' => $locale->text('Type'), },
147 149
    'active'                   => { 'text' => $locale->text('Active'), 'visible' => 'both' eq $filter->{active}, },
150
    'valid'                    => { 'text' => $locale->text('Valid'),  'visible' => 'both' eq $filter->{active}, },
148 151
    %column_defs_cvars,
149 152
    );
150 153

  
151
  foreach (qw(projectnumber description)) {
154
  foreach (qw(projectnumber description customer type)) {
152 155
    $column_defs{$_}->{link}    = $href . "&sort=$_";
153 156
    $column_defs{$_}->{visible} = 1;
154 157
  }
......
171 174
  push @options, $locale->text('All')                                            if ($filter->{all});
172 175
  push @options, $locale->text('Orphaned')                                       if ($filter->{orphaned});
173 176
  push @options, $locale->text('Project Number') . " : $filter->{projectnumber}" if ($filter->{projectnumber});
174
  push @options, $locale->text('Description') . " : $filter->{description}"      if ($filter->{description});
177
  push @options, $locale->text('Description')    . " : $filter->{description}"   if ($filter->{description});
178
  push @options, $locale->text('Customer')       . " : $filter->{customer}"      if ($filter->{customer});
179
  push @options, $locale->text('Type')           . " : $filter->{type}"          if ($filter->{type});
175 180
  push @options, $locale->text('Active')                                         if ($filter->{active} eq 'active');
176 181
  push @options, $locale->text('Inactive')                                       if ($filter->{active} eq 'inactive');
177 182
  push @options, $locale->text('Orphaned')                                       if ($filter->{status} eq 'orphaned');
......
197 202

  
198 203
  foreach my $project (@{ $form->{project_list} }) {
199 204
    $project->{active} = $project->{active} ? $locale->text('Yes')  : $locale->text('No');
205
    $project->{valid}  = $project->{valid} ? $locale->text('Yes')  : $locale->text('No');
200 206

  
201 207
    my $row = { map { $_ => { 'data' => $project->{$_} } } keys %{ $project } };
202 208

  
......
222 228

  
223 229
  $form->{title}     = $form->{project}->{id} ? $locale->text("Edit Project") : $locale->text("Add Project");
224 230

  
231
  $form->{ALL_CUSTOMERS}    = SL::DB::Manager::Customer->get_all_sorted(where => [ or => [ obsolete => 0, obsolete => undef, id => $form->{project}->{customer_id} ]]);
225 232
  $form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'Projects', 'trans_id' => $form->{project}->{id});
226 233
#  $main::lxdebug->dump(0, "cv", $form->{CUSTOM_VARIABLES});
227 234
  CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}) if (scalar @{ $form->{CUSTOM_VARIABLES} });
locale/de/all
417 417
  'Client Configuration saved!' => 'Mandantenkonfiguration gespeichert!',
418 418
  'Close'                       => 'Übernehmen',
419 419
  'Close Books up to'           => 'Die Bücher abschließen bis zum',
420
  'Close Dialog'                => 'Schließen',
421 420
  'Close Flash'                 => 'Schließen',
422 421
  'Close SEPA exports'          => 'SEPA-Export abschließen',
423 422
  'Close Window'                => 'Fenster Schlie&szlig;en',
......
1018 1017
  'Introduction of Buchungsgruppen' => 'Einf&uuml;hrung von Buchungsgruppen',
1019 1018
  'Introduction of units'       => 'Einf&uuml;hrung von Einheiten',
1020 1019
  'Inv. Duedate'                => 'Rg. Fälligkeit',
1021
  'Invalid'                     => 'Ung&uuml;ltig',
1020
  'Invalid'                     => 'Ungültig',
1022 1021
  'Invalid follow-up ID.'       => 'Ung&uuml;ltige Wiedervorlage-ID.',
1023 1022
  'Invalid quantity.'           => 'Die Mengenangabe ist ung&uuml;ltig.',
1024 1023
  'Invdate'                     => 'Rechnungsdatum',
......
1432 1431
  'Please select the source bank account for the transfers:' => 'Bitte wählen Sie das Bankkonto als Quelle für die Überweisungen aus:',
1433 1432
  'Please seletct the dataset you want to delete:' => 'Bitte w&auml;hlen Sie die zu l&ouml;schende Datenbank aus:',
1434 1433
  'Please specify a description for the warehouse designated for these goods.' => 'Bitte geben Sie den Namen des Ziellagers f&uuml;r die &uuml;bernommenen Daten ein.',
1435
  'Please wait...'              => 'Bitte warten...',
1436 1434
  'Plural'                      => 'Plural',
1437 1435
  'Port'                        => 'Port',
1438 1436
  'Portrait'                    => 'Hochformat',
......
2181 2179
  'Username'                    => 'Benutzername',
2182 2180
  'Users in this group'         => 'BenutzerInnen in dieser Gruppe',
2183 2181
  'Ust-IDNr'                    => 'USt-IdNr.',
2182
  'Valid'                       => 'Gültig',
2184 2183
  'Valid from'                  => 'Gültig ab',
2185 2184
  'Valid until'                 => 'gültig bis',
2186 2185
  'Value'                       => 'Wert',
......
2391 2390
  'list_of_payments'            => 'zahlungsausgaenge',
2392 2391
  'list_of_receipts'            => 'zahlungseingaenge',
2393 2392
  'list_of_transactions'        => 'buchungsliste',
2394
  'loading'                     => 'wird geladen',
2395 2393
  'logout'                      => 'abmelden',
2396 2394
  'male'                        => 'männlich',
2397 2395
  'mark as paid'                => 'als bezahlt markieren',
sql/Pg-upgrade2/project_customer_type_valid.sql
1
-- @tag: project_customer_type_valid
2
-- @description: Projekt: Spalten "Kunde", "Typ", "Gültig"
3
-- @depends: release_3_0_0
4
-- @charset: utf-8
5
ALTER TABLE project ADD COLUMN customer_id INTEGER;
6
ALTER TABLE project ADD COLUMN type TEXT;
7
ALTER TABLE project ADD COLUMN valid BOOLEAN;
8
ALTER TABLE project ALTER COLUMN valid SET DEFAULT TRUE;
9

  
10
ALTER TABLE project ADD FOREIGN KEY (customer_id) REFERENCES customer (id);
11

  
12
UPDATE project SET valid = TRUE;
templates/webpages/projects/project_form.html
29 29
    <table>
30 30
     <tr>
31 31
      <th align="right">[% 'Number' | $T8 %]</th>
32
      <td><input name="project.projectnumber" size="20" value="[% HTML.escape(project.projectnumber) %]"></td>
32
      <td><input name="project.projectnumber" size="60" value="[% HTML.escape(project.projectnumber) %]"></td>
33 33
     </tr>
34 34

  
35 35
     <tr>
......
44 44
      </td>
45 45
     </tr>
46 46

  
47
     <tr>
48
      <th align="right">[% 'Type' | $T8 %]</th>
49
      <td>[% L.input_tag('project.type', project.type, size=60) %]</td>
50
     </tr>
51

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

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

  
47 62
     [%- IF project.id %]
48 63
     <tr>
49
      <th align="right">&nbsp;</th>
50
      <td>
51
       <input type="radio" name="project.active" id="active_1" value="1"[% IF project.active %] checked[% END %]><label for="active_1">[% 'Active' | $T8 %]</label>
52
       <input type="radio" name="project.active" id="active_0" value="0"[% IF !project.active %] checked[% END %]><label for="active_0">[% 'Inactive' | $T8 %]</label>
53
      </td>
64
      <th align="right">[% 'Active' | $T8 %]</th>
65
      <td>[% L.select_tag('project.active', [ [ 1, LxERP.t8('Active') ], [ 0, LxERP.t8('Inactive') ] ], default=project.valid, style='width: 300px') %]</td>
54 66
     </tr>
55 67
     [%- END %]
56 68
    </table>
templates/webpages/projects/search.html
16 16
     <td><input name="filter.description" size="60"></td>
17 17
    </tr>
18 18

  
19
    <tr>
20
     <th align="right">[% 'Customer' | $T8 %]</th>
21
     <td><input name="filter.customer" size="60"></td>
22
    </tr>
23

  
24
    <tr>
25
     <th align="right">[% 'Type' | $T8 %]</th>
26
     <td><input name="filter.type" size="60"></td>
27
    </tr>
28

  
19 29
    [% CUSTOM_VARIABLES_FILTER_CODE %]
20 30

  
21 31
    <tr>
......
37 47
        </td>
38 48
       </tr>
39 49

  
50
       <tr>
51
        <td>
52
         <input type="radio" name="filter.valid" id="valid_valid" value="valid" checked>
53
         <label for="valid_valid">[% 'Valid' | $T8 %]</label>
54
        </td>
55
        <td>
56
         <input type="radio" name="filter.valid" id="valid_invalid" value="invalid">
57
         <label for="valid_invalid">[% 'Invalid' | $T8 %]</label>
58
        </td>
59
        <td>
60
         <input type="radio" name="filter.valid" id="valid_both" value="both">
61
         <label for="valid_both">[% 'Both' | $T8 %]</label>
62
        </td>
63
       </tr>
64

  
40 65
       <tr>
41 66
        <td>
42 67
         <input type="radio" name="filter.status" id="status_all" value="all" checked>
......
64 89
   <input class="submit" type="submit" name="action" value="[% 'Continue' | $T8 %]">
65 90
  </p>
66 91
 </form>
67

  

Auch abrufbar als: Unified diff