itime => { type => 'timestamp', default => 'now()' },
mtime => { type => 'timestamp' },
active => { type => 'boolean', default => 'true' },
+ customer_id => { type => 'integer' },
+ type => { type => 'text' },
+ valid => { type => 'boolean', default => 'true' },
],
primary_key_columns => [ 'id' ],
unique_key => [ 'projectnumber' ],
allow_inline_column_values => 1,
+
+ foreign_keys => [
+ customer => {
+ class => 'SL::DB::Customer',
+ key_columns => { customer_id => 'id' },
+ },
+ ],
);
1;
push @filters, 'NOT COALESCE(p.active, FALSE)';
}
+ if ($params{valid} eq "valid") {
+ push @filters, 'p.valid';
+
+ } elsif ($params{valid} eq "invalid") {
+ push @filters, 'NOT COALESCE(p.valid, FALSE)';
+ }
+
+ if ($params{customer}) {
+ push @filters, 'c.name ILIKE ?';
+ push @values, '%' . $params{customer} . '%';
+ }
+
+ if ($params{type}) {
+ push @filters, 'p.type ILIKE ?';
+ push @values, '%' . $params{type} . '%';
+ }
+
my ($cvar_where, @cvar_values) = CVar->build_filter_query('module' => 'Projects',
'trans_id_field' => 'p.id',
'filter' => $form);
my $sortorder = $params{sort} ? $params{sort} : "projectnumber";
$sortorder =~ s/[^a-z_]//g;
- my $query = qq|SELECT p.id, p.projectnumber, p.description, p.active
+ my $query = qq|SELECT p.id, p.projectnumber, p.description, p.active, p.valid, p.type,
+ c.name AS customer
FROM project p
+ LEFT JOIN customer c ON (p.customer_id = c.id)
$where
ORDER BY $sortorder|;
$params{active} = 1;
}
- my $query = qq|UPDATE project SET projectnumber = ?, description = ?, active = ?
- WHERE id = ?|;
+ my $query = <<SQL;
+ UPDATE project
+ SET projectnumber = ?, description = ?, active = ?, customer_id = ?, type = ?, valid = ?
+ WHERE id = ?
+SQL
- @values = ($params{projectnumber}, $params{description}, $params{active} ? 't' : 'f', conv_i($params{id}));
+ @values = ($params{projectnumber}, $params{description}, $params{active} ? 't' : 'f', conv_i($params{customer_id}), $params{type}, $params{valid} ? 't' : 'f', conv_i($params{id}));
do_query($form, $dbh, $query, @values);
CVar->save_custom_variables('dbh' => $dbh,
}
1;
-
my $report = SL::ReportGenerator->new(\%myconfig, $form);
- my @columns = qw(projectnumber description active);
+ my @columns = qw(projectnumber description customer type active valid);
my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs };
my @searchable_custom_variables = grep { $_->{searchable} } @{ $cvar_configs };
my %column_defs = (
'projectnumber' => { 'text' => $locale->text('Number'), },
'description' => { 'text' => $locale->text('Description'), },
+ 'customer' => { 'text' => $locale->text('Customer'), },
+ 'type' => { 'text' => $locale->text('Type'), },
'active' => { 'text' => $locale->text('Active'), 'visible' => 'both' eq $filter->{active}, },
+ 'valid' => { 'text' => $locale->text('Valid'), 'visible' => 'both' eq $filter->{active}, },
%column_defs_cvars,
);
- foreach (qw(projectnumber description)) {
+ foreach (qw(projectnumber description customer type)) {
$column_defs{$_}->{link} = $href . "&sort=$_";
$column_defs{$_}->{visible} = 1;
}
push @options, $locale->text('All') if ($filter->{all});
push @options, $locale->text('Orphaned') if ($filter->{orphaned});
push @options, $locale->text('Project Number') . " : $filter->{projectnumber}" if ($filter->{projectnumber});
- push @options, $locale->text('Description') . " : $filter->{description}" if ($filter->{description});
+ push @options, $locale->text('Description') . " : $filter->{description}" if ($filter->{description});
+ push @options, $locale->text('Customer') . " : $filter->{customer}" if ($filter->{customer});
+ push @options, $locale->text('Type') . " : $filter->{type}" if ($filter->{type});
push @options, $locale->text('Active') if ($filter->{active} eq 'active');
push @options, $locale->text('Inactive') if ($filter->{active} eq 'inactive');
push @options, $locale->text('Orphaned') if ($filter->{status} eq 'orphaned');
foreach my $project (@{ $form->{project_list} }) {
$project->{active} = $project->{active} ? $locale->text('Yes') : $locale->text('No');
+ $project->{valid} = $project->{valid} ? $locale->text('Yes') : $locale->text('No');
my $row = { map { $_ => { 'data' => $project->{$_} } } keys %{ $project } };
$form->{title} = $form->{project}->{id} ? $locale->text("Edit Project") : $locale->text("Add Project");
+ $form->{ALL_CUSTOMERS} = SL::DB::Manager::Customer->get_all_sorted(where => [ or => [ obsolete => 0, obsolete => undef, id => $form->{project}->{customer_id} ]]);
$form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'Projects', 'trans_id' => $form->{project}->{id});
# $main::lxdebug->dump(0, "cv", $form->{CUSTOM_VARIABLES});
CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}) if (scalar @{ $form->{CUSTOM_VARIABLES} });
'Client Configuration saved!' => 'Mandantenkonfiguration gespeichert!',
'Close' => 'Übernehmen',
'Close Books up to' => 'Die Bücher abschließen bis zum',
- 'Close Dialog' => 'Schließen',
'Close Flash' => 'Schließen',
'Close SEPA exports' => 'SEPA-Export abschließen',
'Close Window' => 'Fenster Schließen',
'Introduction of Buchungsgruppen' => 'Einführung von Buchungsgruppen',
'Introduction of units' => 'Einführung von Einheiten',
'Inv. Duedate' => 'Rg. Fälligkeit',
- 'Invalid' => 'Ungültig',
+ 'Invalid' => 'Ungültig',
'Invalid follow-up ID.' => 'Ungültige Wiedervorlage-ID.',
'Invalid quantity.' => 'Die Mengenangabe ist ungültig.',
'Invdate' => 'Rechnungsdatum',
'Please select the source bank account for the transfers:' => 'Bitte wählen Sie das Bankkonto als Quelle für die Überweisungen aus:',
'Please seletct the dataset you want to delete:' => 'Bitte wählen Sie die zu löschende Datenbank aus:',
'Please specify a description for the warehouse designated for these goods.' => 'Bitte geben Sie den Namen des Ziellagers für die übernommenen Daten ein.',
- 'Please wait...' => 'Bitte warten...',
'Plural' => 'Plural',
'Port' => 'Port',
'Portrait' => 'Hochformat',
'Username' => 'Benutzername',
'Users in this group' => 'BenutzerInnen in dieser Gruppe',
'Ust-IDNr' => 'USt-IdNr.',
+ 'Valid' => 'Gültig',
'Valid from' => 'Gültig ab',
'Valid until' => 'gültig bis',
'Value' => 'Wert',
'list_of_payments' => 'zahlungsausgaenge',
'list_of_receipts' => 'zahlungseingaenge',
'list_of_transactions' => 'buchungsliste',
- 'loading' => 'wird geladen',
'logout' => 'abmelden',
'male' => 'männlich',
'mark as paid' => 'als bezahlt markieren',
--- /dev/null
+-- @tag: project_customer_type_valid
+-- @description: Projekt: Spalten "Kunde", "Typ", "Gültig"
+-- @depends: release_3_0_0
+-- @charset: utf-8
+ALTER TABLE project ADD COLUMN customer_id INTEGER;
+ALTER TABLE project ADD COLUMN type TEXT;
+ALTER TABLE project ADD COLUMN valid BOOLEAN;
+ALTER TABLE project ALTER COLUMN valid SET DEFAULT TRUE;
+
+ALTER TABLE project ADD FOREIGN KEY (customer_id) REFERENCES customer (id);
+
+UPDATE project SET valid = TRUE;
<table>
<tr>
<th align="right">[% 'Number' | $T8 %]</th>
- <td><input name="project.projectnumber" size="20" value="[% HTML.escape(project.projectnumber) %]"></td>
+ <td><input name="project.projectnumber" size="60" value="[% HTML.escape(project.projectnumber) %]"></td>
</tr>
<tr>
</td>
</tr>
+ <tr>
+ <th align="right">[% 'Type' | $T8 %]</th>
+ <td>[% L.input_tag('project.type', project.type, size=60) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Customer' | $T8 %]</th>
+ <td>[% L.select_tag('project.customer_id', ALL_CUSTOMERS, default=project.customer_id, title_key='name', style='width: 300px') %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Valid' | $T8 %]</th>
+ <td>[% L.select_tag('project.valid', [ [ 1, LxERP.t8('Valid') ], [ 0, LxERP.t8('Invalid') ] ], default=project.valid, style='width: 300px') %]</td>
+ </tr>
+
[%- IF project.id %]
<tr>
- <th align="right"> </th>
- <td>
- <input type="radio" name="project.active" id="active_1" value="1"[% IF project.active %] checked[% END %]><label for="active_1">[% 'Active' | $T8 %]</label>
- <input type="radio" name="project.active" id="active_0" value="0"[% IF !project.active %] checked[% END %]><label for="active_0">[% 'Inactive' | $T8 %]</label>
- </td>
+ <th align="right">[% 'Active' | $T8 %]</th>
+ <td>[% L.select_tag('project.active', [ [ 1, LxERP.t8('Active') ], [ 0, LxERP.t8('Inactive') ] ], default=project.valid, style='width: 300px') %]</td>
</tr>
[%- END %]
</table>
<td><input name="filter.description" size="60"></td>
</tr>
+ <tr>
+ <th align="right">[% 'Customer' | $T8 %]</th>
+ <td><input name="filter.customer" size="60"></td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Type' | $T8 %]</th>
+ <td><input name="filter.type" size="60"></td>
+ </tr>
+
[% CUSTOM_VARIABLES_FILTER_CODE %]
<tr>
</td>
</tr>
+ <tr>
+ <td>
+ <input type="radio" name="filter.valid" id="valid_valid" value="valid" checked>
+ <label for="valid_valid">[% 'Valid' | $T8 %]</label>
+ </td>
+ <td>
+ <input type="radio" name="filter.valid" id="valid_invalid" value="invalid">
+ <label for="valid_invalid">[% 'Invalid' | $T8 %]</label>
+ </td>
+ <td>
+ <input type="radio" name="filter.valid" id="valid_both" value="both">
+ <label for="valid_both">[% 'Both' | $T8 %]</label>
+ </td>
+ </tr>
+
<tr>
<td>
<input type="radio" name="filter.status" id="status_all" value="all" checked>
<input class="submit" type="submit" name="action" value="[% 'Continue' | $T8 %]">
</p>
</form>
-