qq|LEFT JOIN employee e2 ON (a.salesman_id = e2.id) | .
qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)| .
qq|LEFT JOIN tax_zones tz ON (tz.id = c.taxzone_id)| .
- qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)|;
+ qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)| .
+ qq|LEFT JOIN department d ON (d.id = a.department_id)|;
my $where = "1 = 1";
if ($form->{customer_id}) {
$where .= " AND c.name ILIKE ?";
push(@values, $form->like($form->{customer}));
}
- if ($form->{department}) {
- my ($null, $department_id) = split /--/, $form->{department};
+ if ($form->{department_id}) {
+ my $department_id = $form->{department_id};
$where .= " AND a.department_id = ?";
push(@values, $department_id);
}
+ if ($form->{department}) {
+ my $department = "%" . $form->{department} . "%";
+ $where .= " AND d.description ILIKE ?";
+ push(@values, $department);
+ }
foreach my $column (qw(invnumber ordnumber notes transaction_description)) {
if ($form->{$column}) {
$where .= " AND a.$column ILIKE ?";
my $query = qq|SELECT * FROM printers ORDER BY printer_description|;
my @printers = selectall_hashref_query($::form, $dbh, $query);
+ $dbh->disconnect;
+
$::lxdebug->leave_sub;
return wantarray ? @printers : \@printers;
my $query = qq|SELECT * FROM printers WHERE id = ?|;
my ($printer) = selectfirst_hashref_query($::form, $dbh, $query, $params{id});
+ $dbh->disconnect;
+
$::lxdebug->leave_sub;
return $printer;
);
$dbh->commit;
+ $dbh->disconnect;
$::lxdebug->leave_sub;
}
do_query($::form, $dbh, $query, $params{id});
$dbh->commit;
+ $dbh->disconnect;
$::lxdebug->leave_sub;
}
}
sub printer_dispatcher {
- $::lxdebug->dump(0, "testing", $::form);
- for (qw(get_login_form list_printers add_printer edit_printer save_printer delete_printer list_users)) {
- if ($::form->{$_}) {
- ::call_sub($::locale->findsub($_));
+ for my $action (qw(get_login_form list_printers add_printer edit_printer save_printer delete_printer list_users)) {
+ if ($::form->{$action}) {
+ ::call_sub($::locale->findsub($action));
::end_of_request()
}
}
}
sub printer_management {
- &list_printers;
+ &get_login_form;
}
sub add_printer {
use SL::USTVA;
use SL::Iconv;
use SL::TODO;
+use SL::Printer;
use CGI::Ajax;
use CGI;
my ($department) = split /--/, $form->{department};
push @options, $locale->text('Department') . " : $department";
}
+ if ($form->{department_id}) {
+ push @options, $locale->text('Department Id') . " : $form->{department_id}";
+ }
if ($form->{invnumber}) {
push @options, $locale->text('Invoice Number') . " : $form->{invnumber}";
}
#!/usr/bin/perl
-# -*- coding: ISO-8859-15; -*-
+# -*- coding: iso-8859-15; -*-
# vim: fenc=ISO-8859-15
# These are all the texts to build the translations files.
'List Price' => 'Listenpreis',
'List Price Factors' => 'Preisfaktoren anzeigen',
'List Pricegroups' => 'Preisgruppen anzeigen',
- 'List Printer' => 'Drucker anzeigen',
'List Tax' => 'Bearbeiten',
'List Transactions' => 'Buchungsliste',
'List Warehouses' => 'Lager anzeigen',
'List Price' => 'Listenpreis',
'List Price Factors' => 'Preisfaktoren anzeigen',
'List Pricegroups' => 'Preisgruppen anzeigen',
- 'List Printer' => 'Drucker anzeigen',
'List Tax' => 'Bearbeiten',
'List Transactions' => 'Buchungsliste',
'List Warehouses' => 'Lager anzeigen',
'Please read the file' => 'Bitte lesen Sie die Datei',
'Please select a customer from the list below.' => 'Bitte einen Endkunden aus der Liste auswählen',
'Please select a part from the list below.' => 'Bitte wählen Sie einen Artikel aus der Liste aus.',
+ 'Please select a user' => 'Bitte wählen Sie einen Benutzer aus',
'Please select a vendor from the list below.' => 'Bitte einen Händler aus der Liste auswählen',
'Please select the chart of accounts this installation is using from the list below.' => 'Bitte wählen Sie den Kontenrahmen aus, der bei dieser Installation verwendet wird.',
'Please select the database you want to backup' => 'Bitte wählen Sie die zu sichernde Datenbank gefunden',
'Printer' => 'Drucker',
'Printer Command' => 'Druckbefehl',
'Printer Command missing!' => 'Druckbefehl fehlt',
- 'Printer Description' => 'Druckerbeschreibung',
- 'Printer deleted!' => 'Drucker gelöscht!',
- 'Printer saved!' => 'Drucker gespeichert!',
+ 'Printer Management' => 'Druckeradministration',
+ 'Printers are created for a user database. Please select a user. The associated database will be edited.' => 'Drucker werden für eine Benutzerdatenbank erzeugt. Bitte wählen Sie einen Benutzer aus. Die Drucker werden in der verknüpften Datenbank angelegt.',
'Printing ... ' => 'Es wird gedruckt.',
'Prior to Lx-Office v2.4.0 the user could enter arbitrary strings as units for parts, services and in invoices, sales quotations etc.' => 'Vor Lx-Office 2.4.0 konnte der Benutzer bei Artikeln, Dienstleistungen und Rechnungen, Angeboten etc beliebige Einheiten angeben.',
'Prior to Lx-Office v2.4.0 the user had to chose the accounts for each part and service.' => 'Vor Lx-Office 2.4.0 musste der Benutzer die Konten bei jeder Ware und jeder Dienstleistung einzeln auswählen.',
'List Price' => '',
'List Price Factors' => '',
'List Pricegroups' => '',
- 'List Printer' => '',
'List Tax' => '',
'List Transactions' => '',
'List Warehouses' => '',
'Please read the file' => '',
'Please select a customer from the list below.' => '',
'Please select a part from the list below.' => '',
+ 'Please select a user' => '',
'Please select a vendor from the list below.' => '',
'Please select the chart of accounts this installation is using from the list below.' => '',
'Please select the database you want to backup' => '',
'Printer' => '',
'Printer Command' => '',
'Printer Command missing!' => '',
- 'Printer Description' => '',
- 'Printer deleted!' => '',
- 'Printer saved!' => '',
+ 'Printer Management' => '',
+ 'Printers are created for a user database. Please select a user. The associated database will be edited.' => '',
'Printing ... ' => '',
'Prior to Lx-Office v2.4.0 the user could enter arbitrary strings as units for parts, services and in invoices, sales quotations etc.' => '',
'Prior to Lx-Office v2.4.0 the user had to chose the accounts for each part and service.' => '',
sub _single_quote {
my $val = shift;
- $val =~ s/('|\\$)/\\$1/g;
+ $val =~ s/(\'|\\$)/\\$1/g;
return "'" . $val . "'";
}
open my $fh, '>', $file or die "$! : $file";
- print $fh "#!/usr/bin/perl\n# -*- coding: $charset; -*-\n# vim: fenc=$charset\n\n";
+ my $emacs_charset = lc $charset;
+
+ print $fh "#!/usr/bin/perl\n# -*- coding: $emacs_charset; -*-\n# vim: fenc=$charset\n\n";
print $fh $header, "\n" if $header;
print $fh "$data_name = $delim[0]\n" if $data_name;
<table width=100%>
<tr height="5"></tr>
<tr>
- <th align=right>[% 'Printer' | $T8 %]</th>
+ <th align=left>[% 'Printer' | $T8 %]</th>
<td><input name="printer.printer_description" size=30 value="[% printer.printer_description | html %]"></td>
<tr>
<tr>
- <th align=right>[% 'Printer Command' | $T8 %]</th>
+ <th align=left>[% 'Printer Command' | $T8 %]</th>
<td><input name="printer.printer_command" size=30 value="[% printer.printer_command | html %]"></td>
</tr>
<tr>
- <th align=right>[% 'Template Code' | $T8 %]</th>
+ <th align=left>[% 'Template Code' | $T8 %]</th>
<td><input name="printer.template_code" size=5 value="[% printer.template_code | html %]"></td>
</tr>
<td colspan=2><hr size=3 noshade></td>
[%- FOREACH row = all_printers %]
<tr valign=top class="listrow[% loop.count % 2 %]">
<td><a href="[% edit_link %][% row.id %]">[% row.printer_description %]</a></td>
- <td align=right>[% row.printer_command | html %]</td>
- <td align=right>[% row.template_code | html %]</td>
+ <td align=left>[% row.printer_command | html %]</td>
+ <td align=left>[% row.template_code | html %]</td>
</tr>
[%- END %]
[%- ELSE %]
<td>
[%- INCLUDE 'generic/multibox.html'
name = 'department',
+ select_name = 'department_id',
style = 'width: 250px',
DATA = ALL_DEPARTMENTS,
id_key = 'id',
select : java function call for a selection popup or other magic
allow_textbox : allow to display a textbox instead of a drop down box if there are more entries than 'limit' entries.
limit : defines the limit of entries, after which a textbox is generated. defaults to vclimit, or, failing to find that, 200.
+ select_name : if a select is displayed, use a different name. ex.: department for textinput, but department_id for selects
readonly : softly prevents modification
-%]
[%- DEFAULT
limit = limit != '' ? limit : vclimit != '' ? vclimit : 200
+ show_text = allow_textbox and DATA.size and limit < DATA.size ? 1 : 0
id = id != '' ? id : name
default = default != '' ? default : $name
-%]
+[%-
+ name = (select_name != '' and ! show_text) ? select_name : name
+-%]
[%- FOREACH row = DATA %]
[%-
row.id = row.$id_key != '' ? row.$id_key : $id_sub(row)
row.selected = default == row.id
-%]
[%- END -%]
-[%- IF allow_textbox and DATA.size and limit < DATA.size %]
+[%- IF show_text %]
<input type="text"
[%- IF name %] name="[% HTML.escape(name) %]"[% END -%]
[%- IF id %] id="[% HTML.escape(id) %]"[% END -%]