use Data::Dumper;
use SL::DBUtils;
+use SL::CVar;
my %project_id_column_prefixes = ("ar" => "global",
"ap" => "global",
foreach my $column (qw(projectnumber description)) {
if ($params{$column}) {
- push @filters, "$column ILIKE ?";
+ push @filters, "p.$column ILIKE ?";
push @values, '%' . $params{$column} . '%';
}
}
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|;
@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();
use POSIX qw(strftime);
+use SL::CVar;
use SL::Projects;
use SL::ReportGenerator;
$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');
$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;
);
$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});
$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');
'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',
'Bank Connection Tax Office' => 'Bankverbindung des Finanzamts',
'Bank Connections' => 'Bankverbindungen',
'Base unit' => 'Basiseinheit',
+ 'Basic data' => 'Basisdaten',
'Batch Printing' => 'Druck',
'Bcc' => 'Bcc',
'Belegnummer' => 'Buchungsnummer',
'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',
'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',
'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',
'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',
'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',
'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',
'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',
'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',
'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',
'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',
'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',
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
<hr>
[%- END %]
+ <div class="listtop">[% title %]</div>
+
<form method="post" action="projects.pl">
<input type="hidden" name="project.id" value="[% HTML.escape(project.id) %]">
+ <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
+
+ <ul id="maintab" class="shadetabs">
+ <li class="selected"><a href="#" rel="basic_data">Basisdaten</a></li>
+ [%- IF CUSTOM_VARIABLES.size %]
+ <li><a href="#" rel="custom_variables">Benutzerdefinierte Variablen</a></li>
+ [%- END %]
+ </ul>
- <div class="listtop">[% title %]</div>
+ <div class="tabcontentstyle">
- <p>
- <table>
- <tr>
- <th align="right">Nummer</th>
- <td><input name="project.projectnumber" size="20" value="[% HTML.escape(project.projectnumber) %]"></td>
- </tr>
-
- <tr>
- <th align="right">Beschreibung</th>
- <td>
- [%- SET rows = LxERP.numtextrows(project.description, 60) %]
- [%- IF rows > 1 %]
- <textarea name="project.description" rows="rows" cols="60" style="width: 100%" wrap="soft">[% HTML.escape(project.description) %]</textarea>
- [%- ELSE %]
- <input name="project.description" size="60" value="[% HTML.escape(project.description) %]">
+ <div id="basic_data" class="tabcontent">
+
+ <table>
+ <tr>
+ <th align="right">Nummer</th>
+ <td><input name="project.projectnumber" size="20" value="[% HTML.escape(project.projectnumber) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right">Beschreibung</th>
+ <td>
+ [%- SET rows = LxERP.numtextrows(project.description, 60) %]
+ [%- IF rows > 1 %]
+ <textarea name="project.description" rows="rows" cols="60" style="width: 100%" wrap="soft">[% HTML.escape(project.description) %]</textarea>
+ [%- ELSE %]
+ <input name="project.description" size="60" value="[% HTML.escape(project.description) %]">
+ [%- END %]
+ </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">Aktiv</label>
+ <input type="radio" name="project.active" id="active_0" value="0"[% IF !project.active %] checked[% END %]><label for="active_0">Inaktiv</label>
+ </td>
+ </tr>
+ [%- END %]
+ </table>
+
+ <br style="clear: left" />
+ </div>
+
+ [%- IF CUSTOM_VARIABLES.size %]
+ <div id="custom_variables" class="tabcontent">
+
+ <p>
+ <table>
+ [%- FOREACH var = CUSTOM_VARIABLES %]
+ <tr>
+ <td align="right" valign="top">[% HTML.escape(var.description) %]</td>
+ <td valign="top">[% var.HTML_CODE %]</td>
+ </tr>
[%- END %]
- </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">Aktiv</label>
- <input type="radio" name="project.active" id="active_0" value="0"[% IF !project.active %] checked[% END %]><label for="active_0">Inaktiv</label>
- </td>
- </tr>
- [%- END %]
- </table>
- </p>
+ </table>
+ </p>
- <p><hr size="3" noshade></p>
+ <br style="clear: left" />
+ </div>
+ [%- END %]
- <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
+ </div>
<p>
<input type="submit" class="submit" name="action" value="Speichern">
</p>
</form>
+ <script type="text/javascript">
+ <!--
+ initializetabcontent("maintab");
+ -->
+ </script>
+
</body>
</html>
<hr>
[%- END %]
+ <div class="listtop">[% title %]</div>
+
<form method="post" action="projects.pl">
<input type="hidden" name="project.id" value="[% HTML.escape(project.id) %]">
+ <input type="hidden" name="callback" value="[% HTML.escape(callback) %]">
+
+ <ul id="maintab" class="shadetabs">
+ <li class="selected"><a href="#" rel="basic_data"><translate>Basic data</translate></a></li>
+ [%- IF CUSTOM_VARIABLES.size %]
+ <li><a href="#" rel="custom_variables"><translate>Custom Variables</translate></a></li>
+ [%- END %]
+ </ul>
- <div class="listtop">[% title %]</div>
+ <div class="tabcontentstyle">
- <p>
- <table>
- <tr>
- <th align="right"><translate>Number</translate></th>
- <td><input name="project.projectnumber" size="20" value="[% HTML.escape(project.projectnumber) %]"></td>
- </tr>
-
- <tr>
- <th align="right"><translate>Description</translate></th>
- <td>
- [%- SET rows = LxERP.numtextrows(project.description, 60) %]
- [%- IF rows > 1 %]
- <textarea name="project.description" rows="rows" cols="60" style="width: 100%" wrap="soft">[% HTML.escape(project.description) %]</textarea>
- [%- ELSE %]
- <input name="project.description" size="60" value="[% HTML.escape(project.description) %]">
+ <div id="basic_data" class="tabcontent">
+
+ <table>
+ <tr>
+ <th align="right"><translate>Number</translate></th>
+ <td><input name="project.projectnumber" size="20" value="[% HTML.escape(project.projectnumber) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right"><translate>Description</translate></th>
+ <td>
+ [%- SET rows = LxERP.numtextrows(project.description, 60) %]
+ [%- IF rows > 1 %]
+ <textarea name="project.description" rows="rows" cols="60" style="width: 100%" wrap="soft">[% HTML.escape(project.description) %]</textarea>
+ [%- ELSE %]
+ <input name="project.description" size="60" value="[% HTML.escape(project.description) %]">
+ [%- END %]
+ </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"><translate>Active</translate></label>
+ <input type="radio" name="project.active" id="active_0" value="0"[% IF !project.active %] checked[% END %]><label for="active_0"><translate>Inactive</translate></label>
+ </td>
+ </tr>
+ [%- END %]
+ </table>
+
+ <br style="clear: left" />
+ </div>
+
+ [%- IF CUSTOM_VARIABLES.size %]
+ <div id="custom_variables" class="tabcontent">
+
+ <p>
+ <table>
+ [%- FOREACH var = CUSTOM_VARIABLES %]
+ <tr>
+ <td align="right" valign="top">[% HTML.escape(var.description) %]</td>
+ <td valign="top">[% var.HTML_CODE %]</td>
+ </tr>
[%- END %]
- </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"><translate>Active</translate></label>
- <input type="radio" name="project.active" id="active_0" value="0"[% IF !project.active %] checked[% END %]><label for="active_0"><translate>Inactive</translate></label>
- </td>
- </tr>
- [%- END %]
- </table>
- </p>
+ </table>
+ </p>
- <p><hr size="3" noshade></p>
+ <br style="clear: left" />
+ </div>
+ [%- END %]
- <input name="callback" type="hidden" value="[% HTML.escape(callback) %]">
+ </div>
<p>
<input type="submit" class="submit" name="action" value="<translate>Save</translate>">
</p>
</form>
+ <script type="text/javascript">
+ <!--
+ initializetabcontent("maintab");
+ -->
+ </script>
+
</body>
</html>
<td><input name="filter.description" size="60"></td>
</tr>
- <tr>
- <th> </th>
- <td>
- <input type="radio" name="filter.active" id="active_active" value="active" checked>
- <label for="active_active">Aktiv</label>
- <input type="radio" name="filter.active" id="active_inactive" value="inactive">
- <label for="active_inactive">Inaktiv</label>
- <input type="radio" name="filter.active" id="active_both" value="both">
- <label for="active_both">Beide</label>
- </td>
- </tr>
+ [% CUSTOM_VARIABLES_FILTER_CODE %]
<tr>
- <td> </td>
+ <th>In Bericht aufnehmen</th>
<td>
- <input type="radio" name="filter.status" id="status_all" value="all" checked>
- <label for="status_all">Alle</label>
- <input type="radio" name="filter.status" id="status_orphaned" value="orphaned">
- <label for="status_orphaned">Nie benutzt</label>
+ <table>
+ <tr>
+ <td>
+ <input type="radio" name="filter.active" id="active_active" value="active" checked>
+ <label for="active_active">Aktiv</label>
+ </td>
+ <td>
+ <input type="radio" name="filter.active" id="active_inactive" value="inactive">
+ <label for="active_inactive">Inaktiv</label>
+ </td>
+ <td>
+ <input type="radio" name="filter.active" id="active_both" value="both">
+ <label for="active_both">Beide</label>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input type="radio" name="filter.status" id="status_all" value="all" checked>
+ <label for="status_all">Alle</label>
+ </td>
+ <td>
+ <input type="radio" name="filter.status" id="status_orphaned" value="orphaned">
+ <label for="status_orphaned">Nie benutzt</label>
+ </td>
+ </tr>
+
+ [% CUSTOM_VARIABLES_INCLUSION_CODE %]
+
+ </table>
+ </td>
</tr>
</table>
</p>
<td><input name="filter.description" size="60"></td>
</tr>
- <tr>
- <th> </th>
- <td>
- <input type="radio" name="filter.active" id="active_active" value="active" checked>
- <label for="active_active"><translate>Active</translate></label>
- <input type="radio" name="filter.active" id="active_inactive" value="inactive">
- <label for="active_inactive"><translate>Inactive</translate></label>
- <input type="radio" name="filter.active" id="active_both" value="both">
- <label for="active_both"><translate>Both</translate></label>
- </td>
- </tr>
+ [% CUSTOM_VARIABLES_FILTER_CODE %]
<tr>
- <td> </td>
+ <th><translate>Include in Report</translate></th>
<td>
- <input type="radio" name="filter.status" id="status_all" value="all" checked>
- <label for="status_all"><translate>All</translate></label>
- <input type="radio" name="filter.status" id="status_orphaned" value="orphaned">
- <label for="status_orphaned"><translate>Orphaned</translate></label>
+ <table>
+ <tr>
+ <td>
+ <input type="radio" name="filter.active" id="active_active" value="active" checked>
+ <label for="active_active"><translate>Active</translate></label>
+ </td>
+ <td>
+ <input type="radio" name="filter.active" id="active_inactive" value="inactive">
+ <label for="active_inactive"><translate>Inactive</translate></label>
+ </td>
+ <td>
+ <input type="radio" name="filter.active" id="active_both" value="both">
+ <label for="active_both"><translate>Both</translate></label>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <input type="radio" name="filter.status" id="status_all" value="all" checked>
+ <label for="status_all"><translate>All</translate></label>
+ </td>
+ <td>
+ <input type="radio" name="filter.status" id="status_orphaned" value="orphaned">
+ <label for="status_orphaned"><translate>Orphaned</translate></label>
+ </td>
+ </tr>
+
+ [% CUSTOM_VARIABLES_INCLUSION_CODE %]
+
+ </table>
+ </td>
</tr>
</table>
</p>