From: Moritz Bunkus Date: Fri, 25 Jul 2008 08:51:05 +0000 (+0000) Subject: Benutzerdefinierte Variablen für Projekte implementiert. X-Git-Tag: release-2.6.0beta1~38 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=cd92cf1c19785cdcd5812735185676c9ad982175;p=kivitendo-erp.git Benutzerdefinierte Variablen für Projekte implementiert. --- diff --git a/SL/Projects.pm b/SL/Projects.pm index 5327e91ad..afbc5a3d7 100644 --- a/SL/Projects.pm +++ b/SL/Projects.pm @@ -37,6 +37,7 @@ package Projects; use Data::Dumper; use SL::DBUtils; +use SL::CVar; my %project_id_column_prefixes = ("ar" => "global", "ap" => "global", @@ -68,7 +69,7 @@ sub search_projects { foreach my $column (qw(projectnumber description)) { if ($params{$column}) { - push @filters, "$column ILIKE ?"; + push @filters, "p.$column ILIKE ?"; push @values, '%' . $params{$column} . '%'; } } @@ -81,22 +82,32 @@ sub search_projects { WHERE NOT $project_id_column_prefixes{$table}project_id ISNULL|; } - push @filters, "id NOT IN (" . join(" UNION ", @sub_filters) . ")"; + push @filters, "p.id NOT IN (" . join(" UNION ", @sub_filters) . ")"; } if ($params{active} eq "active") { - push @filters, 'active'; + push @filters, 'p.active'; } elsif ($params{active} eq "inactive") { - push @filters, 'NOT COALESCE(active, FALSE)'; + push @filters, 'NOT COALESCE(p.active, FALSE)'; } + my ($cvar_where, @cvar_values) = CVar->build_filter_query('module' => 'Projects', + 'trans_id_field' => 'p.id', + 'filter' => $form); + + if ($cvar_where) { + push @filters, $cvar_where; + push @values, @cvar_values; + } + + my $where = 'WHERE ' . join(' AND ', map { "($_)" } @filters) if (scalar @filters); my $sortorder = $params{sort} ? $params{sort} : "projectnumber"; $sortorder =~ s/[^a-z_]//g; - my $query = qq|SELECT id, projectnumber, description, active - FROM project + my $query = qq|SELECT p.id, p.projectnumber, p.description, p.active + FROM project p $where ORDER BY $sortorder|; @@ -173,6 +184,11 @@ sub save_project { @values = ($params{projectnumber}, $params{description}, $params{active} ? 't' : 'f', conv_i($params{id})); do_query($form, $dbh, $query, @values); + CVar->save_custom_variables('dbh' => $dbh, + 'module' => 'Projects', + 'trans_id' => $params{id}, + 'variables' => $form); + $dbh->commit(); $main::lxdebug->leave_sub(); diff --git a/bin/mozilla/projects.pl b/bin/mozilla/projects.pl index 768a21292..5a0b2ee3c 100644 --- a/bin/mozilla/projects.pl +++ b/bin/mozilla/projects.pl @@ -32,6 +32,7 @@ use POSIX qw(strftime); +use SL::CVar; use SL::Projects; use SL::ReportGenerator; @@ -75,6 +76,12 @@ sub search { $form->{title} = $locale->text('Projects'); + $form->{CUSTOM_VARIABLES} = CVar->get_configs('module' => 'Projects'); + ($form->{CUSTOM_VARIABLES_FILTER_CODE}, + $form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables' => $form->{CUSTOM_VARIABLES}, + 'include_prefix' => 'l_', + 'include_value' => 'Y'); + $form->header(); print $form->parse_html_template('projects/search'); @@ -87,22 +94,39 @@ sub project_report { $auth->assert('project_edit'); $form->{sort} ||= 'projectnumber'; - my $filter = $form->{filter} || { }; + Projects->search_projects(%{ $filter }, 'sort' => $form->{sort}); - my $report = SL::ReportGenerator->new(\%myconfig, $form); + my $cvar_configs = CVar->get_configs('module' => 'Projects'); + + my $report = SL::ReportGenerator->new(\%myconfig, $form); + + my @columns = qw(projectnumber description active); + my @hidden_vars = ('filter'); + my $href = build_std_url('action=project_report', @hidden_vars); - my @columns = qw(projectnumber description active); - my @hidden_vars = ('filter'); - my $href = build_std_url('action=project_report', @hidden_vars); + my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs }; + my %column_defs_cvars = (); + foreach (@includeable_custom_variables) { + $column_defs_cvars{"cvar_$_->{name}"} = { + 'text' => $_->{description}, + 'visible' => $form->{"l_cvar_$_->{name}"} eq 'Y', + }; + } + + push @columns, map { "cvar_$_->{name}" } @includeable_custom_variables; - my %column_defs = ( + my %column_defs = ( 'projectnumber' => { 'text' => $locale->text('Number'), }, 'description' => { 'text' => $locale->text('Description'), }, 'active' => { 'text' => $locale->text('Active'), 'visible' => 'both' eq $filter->{active}, }, + %column_defs_cvars, ); + $main::lxdebug->dump(0, "cdc", \@columns); + $main::lxdebug->dump(0, "cdc", \%column_defs); + foreach (qw(projectnumber description)) { $column_defs{$_}->{link} = $href . "&sort=$_"; $column_defs{$_}->{visible} = 1; @@ -133,6 +157,12 @@ sub project_report { ); $report->set_options_from_form(); + CVar->add_custom_variables_to_report('module' => 'Projects', + 'trans_id_field' => 'id', + 'configs' => $cvar_configs, + 'column_defs' => \%column_defs, + 'data' => $form->{project_list}); + my $edit_url = build_std_url('action=edit&type=project'); my $callback = $form->escape($href) . '&sort=' . E($form->{sort}); @@ -160,6 +190,10 @@ sub display_project_form { $form->{title} = $form->{project}->{id} ? $locale->text("Edit Project") : $locale->text("Add Project"); + $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} }); + $form->header(); print $form->parse_html_template('projects/project_form'); diff --git a/locale/de/all b/locale/de/all index ffc76be2f..935a69070 100644 --- a/locale/de/all +++ b/locale/de/all @@ -94,6 +94,7 @@ $self->{texts} = { 'Add' => 'Erfassen', 'Add ' => 'Hinzufügen', 'Add (Customers and Vendors)' => 'Erfassen (Kunden und Lieferanten)', + 'Add (Projects)' => 'Erfassen (Projekte)', 'Add AP Transaction' => 'Kreditorenbuchung', 'Add AR Transaction' => 'Debitorenbuchung', 'Add Account' => 'Konto erfassen', @@ -218,6 +219,7 @@ $self->{texts} = { 'Bank Connection Tax Office' => 'Bankverbindung des Finanzamts', 'Bank Connections' => 'Bankverbindungen', 'Base unit' => 'Basiseinheit', + 'Basic data' => 'Basisdaten', 'Batch Printing' => 'Druck', 'Bcc' => 'Bcc', 'Belegnummer' => 'Buchungsnummer', @@ -816,6 +818,7 @@ $self->{texts} = { 'Line Total' => 'Zeilensumme', 'Line endings' => 'Zeilenumbrüche', 'List (Customers and Vendors)' => 'Auflisten (Kunden und Lieferanten)', + 'List (Projects)' => 'Auflisten (Projekte)', 'List Accounting Groups' => 'Buchungsgruppen anzeigen', 'List Accounts' => 'Konten anzeigen', 'List Businesses' => 'Kunden-/Lieferantentypen anzeigen', diff --git a/locale/de/arap b/locale/de/arap index 4a76f0425..ca1550198 100644 --- a/locale/de/arap +++ b/locale/de/arap @@ -63,6 +63,7 @@ $self->{texts} = { 'Missing parameter (at least one of #1) in call to sub #2.' => 'Fehlernder Parameter (mindestens einer aus \'#1\') in Funktionsaufruf \'#2\'.', 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.', 'Name' => 'Name', + 'No' => 'Nein', 'No %s was found matching the search parameters.' => 'Es wurde kein %s gefunden, auf den die Suchparameter zutreffen.', 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden', 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden', @@ -121,6 +122,7 @@ $self->{texts} = { 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!', 'View warehouse content' => 'Lagerbestand ansehen', 'Warehouse management' => 'Lagerverwaltung/Bestandsveränderung', + 'Yes' => 'Ja', 'You do not have the permissions to access this function.' => 'Sie verfügen nicht über die notwendigen Rechte, um auf diese Funktion zuzugreifen.', '[email]' => '[email]', 'bin_list' => 'Lagerliste', diff --git a/locale/de/ic b/locale/de/ic index 96ea335d0..7ed0646b1 100644 --- a/locale/de/ic +++ b/locale/de/ic @@ -346,7 +346,6 @@ $self->{subs} = { 'calculate_qty' => 'calculate_qty', 'call_sub' => 'call_sub', 'check_form' => 'check_form', - 'choice' => 'choice', 'confirm_price_update' => 'confirm_price_update', 'continue' => 'continue', 'cov_selection_internal' => 'cov_selection_internal', @@ -365,7 +364,6 @@ $self->{subs} = { 'invoicetotal' => 'invoicetotal', 'item_selected' => 'item_selected', 'link_part' => 'link_part', - 'list' => 'list', 'makemodel_row' => 'makemodel_row', 'mark_as_paid_common' => 'mark_as_paid_common', 'new_item' => 'new_item', diff --git a/locale/de/menu b/locale/de/menu index 5a868741a..2f9227aec 100644 --- a/locale/de/menu +++ b/locale/de/menu @@ -7,6 +7,7 @@ $self->{texts} = { 'AR Aging' => 'Offene Forderungen', 'Accounting Menu' => 'Kontoverwaltung', 'Add (Customers and Vendors)' => 'Erfassen (Kunden und Lieferanten)', + 'Add (Projects)' => 'Erfassen (Projekte)', 'Add AP Transaction' => 'Kreditorenbuchung', 'Add AR Transaction' => 'Debitorenbuchung', 'Add Account' => 'Konto erfassen', @@ -100,6 +101,7 @@ $self->{texts} = { 'Lead' => 'Kundenquelle', 'Licenses' => 'Lizenzen', 'List (Customers and Vendors)' => 'Auflisten (Kunden und Lieferanten)', + 'List (Projects)' => 'Auflisten (Projekte)', 'List Accounting Groups' => 'Buchungsgruppen anzeigen', 'List Accounts' => 'Konten anzeigen', 'List Businesses' => 'Kunden-/Lieferantentypen anzeigen', diff --git a/locale/de/menunew b/locale/de/menunew index 26e3b5104..aebe64d93 100644 --- a/locale/de/menunew +++ b/locale/de/menunew @@ -6,6 +6,7 @@ $self->{texts} = { 'AR' => 'Verkauf', 'AR Aging' => 'Offene Forderungen', 'Add (Customers and Vendors)' => 'Erfassen (Kunden und Lieferanten)', + 'Add (Projects)' => 'Erfassen (Projekte)', 'Add AP Transaction' => 'Kreditorenbuchung', 'Add AR Transaction' => 'Debitorenbuchung', 'Add Account' => 'Konto erfassen', @@ -99,6 +100,7 @@ $self->{texts} = { 'Lead' => 'Kundenquelle', 'Licenses' => 'Lizenzen', 'List (Customers and Vendors)' => 'Auflisten (Kunden und Lieferanten)', + 'List (Projects)' => 'Auflisten (Projekte)', 'List Accounting Groups' => 'Buchungsgruppen anzeigen', 'List Accounts' => 'Konten anzeigen', 'List Businesses' => 'Kunden-/Lieferantentypen anzeigen', diff --git a/locale/de/rp b/locale/de/rp index e6a5acbc7..e8a2d462f 100644 --- a/locale/de/rp +++ b/locale/de/rp @@ -125,6 +125,7 @@ $self->{texts} = { 'Monthly' => 'monatlich', 'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.', 'Name' => 'Name', + 'No' => 'Nein', 'No %s was found matching the search parameters.' => 'Es wurde kein %s gefunden, auf den die Suchparameter zutreffen.', 'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden', 'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden', @@ -229,6 +230,7 @@ $self->{texts} = { 'YYYY' => 'JJJJ', 'Year' => 'Jahr', 'Yearly' => 'jährlich', + 'Yes' => 'Ja', 'You do not have the permissions to access this function.' => 'Sie verfügen nicht über die notwendigen Rechte, um auf diese Funktion zuzugreifen.', '[email]' => '[email]', 'ap_aging_list' => 'liste_offene_verbindlichkeiten', diff --git a/menu.ini b/menu.ini index b52a6b120..ede1f8397 100644 --- a/menu.ini +++ b/menu.ini @@ -679,6 +679,16 @@ module=amcvar.pl action=list_cvar_configs cvar_module=CT +[System--Custom Variables--Add (Projects)] +module=amcvar.pl +action=add_cvar_config +cvar_module=Projects + +[System--Custom Variables--List (Projects)] +module=amcvar.pl +action=list_cvar_configs +cvar_module=Projects + [System--Warehouses] module=menu.pl action=acc_menu diff --git a/templates/webpages/projects/project_form_de.html b/templates/webpages/projects/project_form_de.html index 231797b05..797a408b4 100644 --- a/templates/webpages/projects/project_form_de.html +++ b/templates/webpages/projects/project_form_de.html @@ -6,46 +6,75 @@
[%- END %] +
[% title %]
+
+ + + -
[% title %]
+
-

- - - - - - - - -
Nummer
Beschreibung - [%- SET rows = LxERP.numtextrows(project.description, 60) %] - [%- IF rows > 1 %] - - [%- ELSE %] - +
+ + + + + + + + + + + + + [%- IF project.id %] + + + + + [%- END %] +
Nummer
Beschreibung + [%- SET rows = LxERP.numtextrows(project.description, 60) %] + [%- IF rows > 1 %] + + [%- ELSE %] + + [%- END %] +
  + + +
+ +
+
+ + [%- IF CUSTOM_VARIABLES.size %] +
+ +

+ + [%- FOREACH var = CUSTOM_VARIABLES %] + + + + [%- END %] - - - - [%- IF project.id %] - - - - - [%- END %] -
[% HTML.escape(var.description) %][% var.HTML_CODE %]
  - - -
-

+
+

-


+
+
+ [%- END %] - +

@@ -59,5 +88,11 @@

+ + diff --git a/templates/webpages/projects/project_form_master.html b/templates/webpages/projects/project_form_master.html index c299818e9..4158262c7 100644 --- a/templates/webpages/projects/project_form_master.html +++ b/templates/webpages/projects/project_form_master.html @@ -6,46 +6,75 @@
[%- END %] +
[% title %]
+
+ + + -
[% title %]
+
-

- - - - - - - - -
Number
Description - [%- SET rows = LxERP.numtextrows(project.description, 60) %] - [%- IF rows > 1 %] - - [%- ELSE %] - +
+ + + + + + + + + + + + + [%- IF project.id %] + + + + + [%- END %] +
Number
Description + [%- SET rows = LxERP.numtextrows(project.description, 60) %] + [%- IF rows > 1 %] + + [%- ELSE %] + + [%- END %] +
  + + +
+ +
+
+ + [%- IF CUSTOM_VARIABLES.size %] +
+ +

+ + [%- FOREACH var = CUSTOM_VARIABLES %] + + + + [%- END %] - - - - [%- IF project.id %] - - - - - [%- END %] -
[% HTML.escape(var.description) %][% var.HTML_CODE %]
  - - -
-

+
+

-


+
+
+ [%- END %] - +

@@ -59,5 +88,11 @@

+ + diff --git a/templates/webpages/projects/search_de.html b/templates/webpages/projects/search_de.html index 94bd529ca..40ed6eff0 100644 --- a/templates/webpages/projects/search_de.html +++ b/templates/webpages/projects/search_de.html @@ -16,25 +16,42 @@ - -   - - - - - - - - - + [% CUSTOM_VARIABLES_FILTER_CODE %] -   + In Bericht aufnehmen - - - - + + + + + + + + + + + + + [% CUSTOM_VARIABLES_INCLUSION_CODE %] + +
+ + + + + + + + +
+ + + + + +
+

diff --git a/templates/webpages/projects/search_master.html b/templates/webpages/projects/search_master.html index 4f4138392..c5925b91f 100644 --- a/templates/webpages/projects/search_master.html +++ b/templates/webpages/projects/search_master.html @@ -16,25 +16,42 @@ - -   - - - - - - - - - + [% CUSTOM_VARIABLES_FILTER_CODE %] -   + Include in Report - - - - + + + + + + + + + + + + + [% CUSTOM_VARIABLES_INCLUSION_CODE %] + +
+ + + + + + + + +
+ + + + + +
+