From: Sven Donath Date: Tue, 5 Oct 2010 20:23:58 +0000 (+0200) Subject: Merge branch 'html_menu' X-Git-Tag: release-2.6.2beta1~106^2~1 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/596cce1fb449f9400899105d5fc3f793b18cb142?hp=492189e2b9dc5bec00292e9e9cc2647d3b3b3e07 Merge branch 'html_menu' --- diff --git a/SL/AM.pm b/SL/AM.pm index f5736f14b..d637e2a59 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -1108,106 +1108,6 @@ sub swap_sortkeys { $main::lxdebug->leave_sub(); } -sub printer { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my $query = qq|SELECT id, printer_description, template_code, printer_command - FROM printers - ORDER BY 2|; - - my $sth = $dbh->prepare($query); - $sth->execute || $form->dberror($query); - - $form->{"ALL"} = []; - while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { - push @{ $form->{ALL} }, $ref; - } - - $sth->finish; - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - -sub get_printer { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my $query = - qq|SELECT p.printer_description, p.template_code, p.printer_command - FROM printers p - WHERE p.id = ?|; - my $sth = $dbh->prepare($query); - $sth->execute($form->{id}) || $form->dberror($query . " ($form->{id})"); - - my $ref = $sth->fetchrow_hashref("NAME_lc"); - - map { $form->{$_} = $ref->{$_} } keys %$ref; - - $sth->finish; - - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - -sub save_printer { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - my $query; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my @values = ($form->{printer_description}, - $form->{template_code}, - $form->{printer_command}); - - # id is the old record - if ($form->{id}) { - $query = qq|UPDATE printers SET - printer_description = ?, template_code = ?, printer_command = ? - WHERE id = ?|; - push(@values, $form->{id}); - } else { - $query = qq|INSERT INTO printers - (printer_description, template_code, printer_command) - VALUES (?, ?, ?)|; - } - do_query($form, $dbh, $query, @values); - - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - -sub delete_printer { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - # connect to database - my $dbh = $form->dbconnect($myconfig); - - my $query = qq|DELETE FROM printers - WHERE id = ?|; - do_query($form, $dbh, $query, $form->{id}); - - $dbh->disconnect; - - $main::lxdebug->leave_sub(); -} - sub payment { $main::lxdebug->enter_sub(); diff --git a/SL/AR.pm b/SL/AR.pm index 04af97350..fe3e4431b 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -435,7 +435,8 @@ sub ar_transactions { 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}) { @@ -445,11 +446,16 @@ sub ar_transactions { $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 ?"; diff --git a/SL/Auth.pm b/SL/Auth.pm index bf2a6a851..eb5a7805a 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -33,6 +33,26 @@ sub new { return $self; } +sub get_user_dbh { + my ($self, $login) = @_; + my %user = $self->read_user($login); + my $dbh = DBI->connect( + $user{dbconnect}, + $user{dbuser}, + $user{dbpasswd}, + { + pg_enable_utf8 => $::locale->is_utf8, + AutoCommit => 0 + } + ) or $::form->dberror; + + if ($user{dboptions}) { + $dbh->do($user{dboptions}) or $::form->dberror($user{dboptions}); + } + + return $dbh; +} + sub DESTROY { my $self = shift; diff --git a/SL/Form.pm b/SL/Form.pm index 2647cec37..fad6e8ea6 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -268,7 +268,7 @@ sub new { #$self->{version} = "2.6.1"; # Old hardcoded but secure style open VERSION_FILE, "VERSION"; # New but flexible code reads version from VERSION-file $self->{version} = ; - close VERSION_FILE; + close VERSION_FILE; $self->{version} =~ s/[^0-9A-Za-z\.\_\-]//g; # only allow numbers, letters, points, underscores and dashes. Prevents injecting of malicious code. $main::lxdebug->leave_sub(); @@ -475,7 +475,7 @@ sub info { print qq|

$msg

- + - + |; @@ -672,9 +672,9 @@ sub header { | if $self->{"fokus"}; - # if there is a title, we put some JavaScript in to the page, wich writes a + # if there is a title, we put some JavaScript in to the page, wich writes a # meaningful title-tag for our frameset. - my $title_hack; + my $title_hack; if ($self->{"title"}){ $title_hack = qq| |; } - + #Set Calendar my $jsscript = ""; if ($self->{jsscript} == 1) { @@ -723,7 +723,7 @@ sub header { $ajax $fokus $title_hack - + diff --git a/SL/Printer.pm b/SL/Printer.pm new file mode 100644 index 000000000..ed42b01af --- /dev/null +++ b/SL/Printer.pm @@ -0,0 +1,89 @@ +package SL::Printer; + +use SL::DBUtils; + +sub all_printers { + $::lxdebug->enter_sub; + + my ($self, %params) = @_; + + my $dbh = $::auth->get_user_dbh($params{login}); + + 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; +} + +sub get_printer { + $::lxdebug->enter_sub; + + my ($self, %params) = @_; + + my $dbh = $::auth->get_user_dbh($params{login}); + + 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; +} + +sub save_printer { + $main::lxdebug->enter_sub(); + + my ($self, %params) = @_; + + # connect to database + my $dbh = $::auth->get_user_dbh($params{login}); + my $printer = $params{printer}; + + unless ($printer->{id}) { + ($printer->{id}) = selectfirst_array_query($::form, $dbh, "SELECT nextval('id'::text)"); + do_query($::form, $dbh, "INSERT INTO printers (id, printer_description) VALUES (?, '')", $printer->{id}); + } + + my $query = <{printer_description}, + $printer->{template_code}, + $printer->{printer_command}, + $printer->{id}, + ); + + $dbh->commit; + $dbh->disconnect; + + $::lxdebug->leave_sub; +} + +sub delete_printer { + $::lxdebug->enter_sub; + + my ($self, %params) = @_; + + my $dbh = $::auth->get_user_dbh($params{login}); + + my $query = qq|DELETE FROM printers WHERE id = ?|; + do_query($::form, $dbh, $query, $params{id}); + + $dbh->commit; + $dbh->disconnect; + + $::lxdebug->leave_sub; +} + +1; diff --git a/SL/Template/LaTeX.pm b/SL/Template/LaTeX.pm index 4377b6d0f..c515187ce 100644 --- a/SL/Template/LaTeX.pm +++ b/SL/Template/LaTeX.pm @@ -320,6 +320,7 @@ sub parse { $self->{"error"} = "$!"; return 0; } + binmode IN, ":utf8" if $::locale->is_utf8; my @lines = ; close(IN); @@ -346,6 +347,7 @@ sub parse { return 0; } + binmode OUT, ":utf8" if $::locale->is_utf8; print(OUT $new_contents); if ($form->{"format"} =~ /postscript/i) { diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index ebf01c679..3a5e810c2 100755 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -52,6 +52,7 @@ use SL::DBUtils; require "bin/mozilla/common.pl"; require "bin/mozilla/admin_groups.pl"; +require "bin/mozilla/admin_printer.pl"; use strict; diff --git a/bin/mozilla/admin_printer.pl b/bin/mozilla/admin_printer.pl new file mode 100644 index 000000000..e397868ae --- /dev/null +++ b/bin/mozilla/admin_printer.pl @@ -0,0 +1,117 @@ +use strict; + +use SL::Printer; + +sub get_login { + unless ($::form->{login}) { + get_login_form(); + ::end_of_request(); + } + return $::form->{login}; +} + +sub get_login_form { + my %users = $::auth->read_all_users; + + $::form->header; + print $::form->parse_html_template('admin_printer/login', { + users => [ values %users ], + }); +} + +sub printer_dispatcher { + 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() + } + } + die "cannot find sub"; +} + +sub printer_management { + &get_login_form; +} + +sub add_printer { + $::lxdebug->enter_sub; + + my $login = get_login(); + my %users = $::auth->read_all_users; + + $::form->header; + print $::form->parse_html_template('admin_printer/edit', { + title => $::locale->text("Add Printer"), + printer => { }, + users => [ values %users ], + }); + + $::lxdebug->leave_sub +} + +sub edit_printer { + $::lxdebug->enter_sub; + + my $login = get_login(); + my $id = $::form->{id} or $::form->{printer}{id} or &add_printer; + my %users = $::auth->read_all_users; + + my $printer = SL::Printer->get_printer(id => $id, login => $login); + + $::form->header; + print $::form->parse_html_template('admin_printer/edit', { + title => $::locale->text("Edit Printer"), + printer => $printer, + users => [ values %users ], + }); + + $::lxdebug->leave_sub; +} + +sub list_printers { + $::lxdebug->enter_sub; + + my $login = get_login(); + my $printers = SL::Printer->all_printers(login => $login); + my %users = $::auth->read_all_users; + + $::form->header; + print $::form->parse_html_template('admin_printer/list', { + title => $::locale->text('Printer'), + all_printers => $printers, + edit_link => build_std_url("login=$login", 'action=edit_printer', 'id='), + users => [ values %users ], + }); + + $::lxdebug->leave_sub; +} + + +sub save_printer { + $::lxdebug->enter_sub; + + my $login = get_login(); + my $printer = $::form->{printer} || die 'no printer to save'; + + $::form->error($::locale->text('Description missing!')) unless $printer->{printer_description}; + $::form->error($::locale->text('Printer Command missing!')) unless $printer->{printer_command}; + + SL::Printer->save_printer(%$::form); + + list_printers(); + $::lxdebug->leave_sub; +} + +sub delete_printer { + $::lxdebug->enter_sub; + + my $login = get_login(); + my $printer = $::form->{printer} || die 'no printer to delete'; + + SL::Printer->delete_printer(%$::form); + list_printers(); + + $::lxdebug->leave_sub; +} + +1; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 4a7840281..ecf4f2b37 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -39,6 +39,7 @@ use SL::User; use SL::USTVA; use SL::Iconv; use SL::TODO; +use SL::Printer; use CGI::Ajax; use CGI; @@ -2014,234 +2015,6 @@ sub swap_buchungsgruppen { $main::lxdebug->leave_sub(); } - -sub add_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - - $main::auth->assert('config'); - - $form->{title} = "Add"; - - $form->{callback} = "am.pl?action=add_printer" unless $form->{callback}; - - &printer_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Edit"; - - AM->get_printer(\%myconfig, \%$form); - - &printer_header; - - $form->{orphaned} = 1; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->printer(\%myconfig, \%$form); - - $form->{callback} = "am.pl?action=list_printer"; - - my $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Printer'); - - my @column_index = qw(printer_description printer_command template_code); - my %column_header; - $column_header{printer_description} = - qq|| - . $locale->text('Printer Description') - . qq||; - $column_header{printer_command} = - qq|| - . $locale->text('Printer Command') - . qq||; - $column_header{template_code} = - qq|| - . $locale->text('Template Code') - . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - my ($i, %column_data); - foreach my $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - - $column_data{printer_description} = qq||; - $column_data{printer_command} = qq||; - $column_data{template_code} = - qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
$ref->{printer_description}$ref->{printer_command}$ref->{template_code}
-

- -
-
- - - - - - - -
- - - -|; - - $main::lxdebug->leave_sub(); -} - -sub printer_header { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text("$form->{title} Printer"); - - # $locale->text('Add Printer') - # $locale->text('Edit Printer') - - $form->{printer_description} =~ s/\"/"/g; - $form->{template_code} =~ s/\"/"/g; - $form->{printer_command} =~ s/\"/"/g; - - - $form->header; - - print qq| - - -
- -{id}> - - - - - - - - - - - - - - - - - - - - - -
$form->{title}
| . $locale->text('Printer') . qq|
| . $locale->text('Printer Command') . qq|
| . $locale->text('Template Code') . qq|

-|; - - $main::lxdebug->leave_sub(); -} - -sub save_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("printer_description", $locale->text('Description missing!')); - $form->isblank("printer_command", $locale->text('Printer Command missing!')); - AM->save_printer(\%myconfig, \%$form); - $form->redirect($locale->text('Printer saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_printer(\%myconfig, \%$form); - $form->redirect($locale->text('Printer deleted!')); - - $main::lxdebug->leave_sub(); -} - sub add_payment { $main::lxdebug->enter_sub(); @@ -2722,10 +2495,8 @@ sub config { { 'name' => $locale->text('Queue'), 'value' => 'queue', 'selected' => $selected{queue}, }, ]; - AM->printer(\%myconfig, $form); - $form->{PRINTERS} = []; - foreach my $printer (@{$form->{"ALL"}}) { + foreach my $printer (SL::Printer->all_printers(%::myconfig)) { push @{ $form->{PRINTERS} }, { 'name' => $printer->{printer_description}, 'value' => $printer->{id}, diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 35f23d6dd..8efd498fa 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -1398,6 +1398,9 @@ sub ar_transactions { 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}"; } diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index adaa39946..b40e7ed9a 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -1166,7 +1166,7 @@ sub print_options { push @MEDIA, grep $_, opthash("screen", $form->{OP}{screen}, $locale->text('Screen')), - (scalar @{ $form->{printers} } && $main::latex_templates) ? + ($form->{printers} && scalar @{ $form->{printers} } && $main::latex_templates) ? opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef, ($main::latex_templates && !$options{no_queue}) ? opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef diff --git a/locale/de/all b/locale/de/all index c256452e9..9d78ab9a6 100644 --- a/locale/de/all +++ b/locale/de/all @@ -1,5 +1,5 @@ #!/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. @@ -942,7 +942,6 @@ $self->{texts} = { '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', @@ -1206,6 +1205,7 @@ $self->{texts} = { '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', @@ -1249,9 +1249,8 @@ $self->{texts} = { '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.', diff --git a/locale/de_DE/all b/locale/de_DE/all index 5e0ec9d54..85789fca0 100644 --- a/locale/de_DE/all +++ b/locale/de_DE/all @@ -942,7 +942,6 @@ $self->{texts} = { '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', @@ -1206,6 +1205,7 @@ $self->{texts} = { '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', @@ -1249,9 +1249,8 @@ $self->{texts} = { '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.', diff --git a/locale/en/all b/locale/en/all index 4e8ae757a..0f43a94c3 100644 --- a/locale/en/all +++ b/locale/en/all @@ -942,7 +942,6 @@ $self->{texts} = { 'List Price' => '', 'List Price Factors' => '', 'List Pricegroups' => '', - 'List Printer' => '', 'List Tax' => '', 'List Transactions' => '', 'List Warehouses' => '', @@ -1206,6 +1205,7 @@ $self->{texts} = { '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' => '', @@ -1249,9 +1249,8 @@ $self->{texts} = { '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.' => '', diff --git a/lxo-import/import_lib.php b/lxo-import/import_lib.php index cc228a0d6..238eb45c2 100644 --- a/lxo-import/import_lib.php +++ b/lxo-import/import_lib.php @@ -279,6 +279,11 @@ function getAllBG($db) { $rs=$db->getAll($sql); return $rs; } +function getAllUnits($db,$type) { + $sql = "select * from units where type = '$type' order by sortkey"; + $rs=$db->getAll($sql); + return $rs; +} function anmelden() { ini_set("gc_maxlifetime","3600"); diff --git a/lxo-import/partsB.php b/lxo-import/partsB.php index 62fc53101..8a7563df6 100644 --- a/lxo-import/partsB.php +++ b/lxo-import/partsB.php @@ -8,6 +8,9 @@ Henry Margies Holger Lindemann */ +$dir="../users/"; +$gz_bin = "/bin/gzip -df "; +$zip_bin = "/usr/bin/unzip -o -d ".$dir; function ende($txt) { echo "Abbruch: $txt
"; @@ -44,7 +47,7 @@ if ($_POST["ok"]) { define("ServerCode",$tmpcode); } //Zeichensatz sollte gleich sein, sonst ist die Datenkonvertierung nutzlos - //DB und LxO müssen ja nicht auf der gleichen Maschiene sein. + //DB und LxO müssen ja nicht auf der gleichen Maschine sein. if($tmpcode<>$db->getClientCode()) { $rc = $db->setClientCode($tmpcode); } @@ -82,7 +85,8 @@ if ($_POST["ok"]) { echo "Jeder Artikel muß einer Buchungsgruppe zugeordnet werden. "; echo "Dazu muß entweder in der Maske eine Standardbuchungsgruppe gewählt werden
"; echo "oder es wird ein gültiges Konto in 'income_accno_id' und 'expense_accno_id' eingegeben. "; - echo "Das Programm versucht dann eine passende Buchungsgruppe zu finden."; + echo "Das Programm versucht dann eine passende Buchungsgruppe zu finden.
"; + echo "Preisgruppen müssen zunächst angelegt werden. Die Spalten für die Preisgruppen beginnen mit 'pg_' gefolgt vom Preisgruppenname."; exit(0); }; @@ -103,10 +107,22 @@ if ($_POST["ok"]) { ende ("Kein Datenfile angegeben"); /* copy file */ - $dir="../users/"; - if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file.".csv")) { + if (substr($_FILES["Datei"]["name"],-2)=="gz") { + if (move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file.".csv.gz")) { + echo $gz_bin.$dir.$file.".csv.gz"; + exec ($gz_bin.$dir.$file.".csv.gz"); + } else { + ende ("Upload von Datei fehlerhaft.".$_FILES["Datei"]["error"]); + }; + } else if (substr($_FILES["Datei"]["name"],-3)=="zip") { + if (move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file.".zip")) { + exec ($zip_bin.$dir.$file.".zip"); + } else { + ende ("Upload von Datei fehlerhaft.".$_FILES["Datei"]["error"]); + }; + } else if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file.".csv")) { ende ("Upload von Datei fehlerhaft.".$_FILES["Datei"]["error"]); - } + }; /* check if file is really there */ if (!file_exists($dir.$file.'.csv') or filesize($dir.$file.'.csv')==0) @@ -128,6 +144,8 @@ if ($_POST["ok"]) { } else { $bugrus=getAllBG($db); + $serviceunit=getAllUnits($db,"service"); + $dimensionunit=getAllUnits($db,"dimension"); ?>

Artikelimport für die ERP

@@ -165,14 +183,23 @@ if ($_POST["ok"]) { ArtWare   Dienstleistung gemischt (Spalte 'art' vorhanden) +Default Einheiten
+ Default Bugru
- nie
- für alle Artikel verwenden - für Artikel ohne passende Bugru + für alle Artikel verwenden + für Artikel ohne passende Bugru Daten Verwendete
Zeichecodierung diff --git a/lxo-import/parts_import.php b/lxo-import/parts_import.php index 0107c39db..4159eff29 100644 --- a/lxo-import/parts_import.php +++ b/lxo-import/parts_import.php @@ -21,10 +21,19 @@ function getPartsgroupId($db, $value, $add) { } return $rs[0]["id"]; } -function insertParts($db,$insert,$show,$data) { +function getPricegroup($db) { + $sql="SELECT * from pricegroup"; + $rs=$db->getAll($sql); + $data = false; + if ($rs) foreach ($rs as $row) { + $data["pg_".strtolower($row["pricegroup"])]=$row["id"]; + }; + return $data; +} +function insertParts($db,$insert,$show,$data,$pricegroup) { if ($show) { show('',false); - show($data["partnumber"]); show($data["lastcost"]); show($data["sellprice"]); + show($data["partnumber"]); show($data["lastcost"]); show($data["sellprice"]); show($data["listprice"]); show($data["description"]); show(substr($data["notes"],0,25));show($data["ean"]); show($data["weight"]); show($data["image"]); show($data["partsgroup_id"]); show($data["buchungsgruppen_id"]);show($data["income_accno"]); show($data["expense_accno"]); @@ -32,21 +41,31 @@ function insertParts($db,$insert,$show,$data) { show($data["rop"]); show($data["assembly"]); show($data["makemodel"]); show($data["shop"]); } + /*foreach ($data as $key=>$val) { echo $key.":".gettype($val).":".gettype($data[$key]).":".$val."
"; }*/ if ($insert) { + $data["import"]=time(); $sqlIa = 'INSERT INTO parts ('; $sqlIa .= 'partnumber,description,notes,ean,unit,'; - $sqlIa .= 'weight,image,sellprice,lastcost,partsgroup_id,'; + $sqlIa .= 'weight,image,sellprice,listprice,lastcost,partsgroup_id,'; $sqlIa .= 'buchungsgruppen_id,income_accno_id,expense_accno_id,inventory_accno_id,'; $sqlIa .= 'microfiche,drawing,rop,assembly,shop,makemodel,import) '; - $sqlIa .= 'VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'; - $data["import"]=time(); - $rc=$db->execute($sqlIa,$data); + //$sqlIa .= 'VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'; + //$rc=$db->execute($sqlIa,$data); + $sqlIa .= "VALUES ('%s','%s','%s','%s','%s',%0.5f,'%s',%0.5f,%0.5f,%0.5f,%d,%d,%d,%d,%d,'%s','%s',%.0f,'%s','%s','%s',%s)"; + $sql = sprintf($sqlIa,$data['partnumber'],$data['description'],$data['notes'],$data['ean'], + $data['unit'],$data['weight'],$data['image'],$data['sellprice'], + $data['listprice'],$data['lastcost'],$data['partsgroup_id'], + $data['buchungsgruppen_id'],$data['income_accno_id'],$data['expense_accno_id'], + $data['inventory_accno_id'],$data['microfiche'],$data['drawing'],$data['rop'], + $data['assembly'],$data['shop'],$data['makemodel'],$data['import']); + $rc = $db->query($sql); } else { $rc = true; } + if ($pricegroup) $ok = insPrices($db,$data["partnumber"],$pricegroup); if ($show) { if ($rc) show('ok'); @@ -56,19 +75,20 @@ function insertParts($db,$insert,$show,$data) { } return $rc; } -function updPrice($db,$insert,$show,$partnumber,$lastcost,$sellprice,$shop) { +function updPrice($db,$insert,$show,$partnumber,$lastcost,$sellprice,$listprice,$pricegroup,$shop) { if ($show) { show('',false); - show($partnumber); show($lastcost); show($sellprice); + show($partnumber); show($lastcost); show($sellprice); show($listprice); } if ($insert) { $sqlPr = 'UPDATE PARTS SET '; - $sqlPr .= 'sellprice = ?, lastcost = ?, shop = ? '; + $sqlPr .= 'sellprice = ?, listprice = ?, lastcost = ?, shop = ? '; $sqlPr .= 'WHERE partnumber = ?'; - $rc=$db->execute($sqlPr,array("sellprice"=>$sellprice,"lastcost"=>$lastcost,"shop"=>$shop,"partnumber"=>$partnumber)); + $rc=$db->execute($sqlPr,array("sellprice"=>$sellprice,"listprice"=>$listprice,"lastcost"=>$lastcost,"shop"=>$shop,"partnumber"=>$partnumber)); } else { $rc = true; } + if ($pricegroup) $ok = insPrices($db,$partnumber,$pricegroup); if ($show) { if ($rc) show('ok'); @@ -78,25 +98,26 @@ function updPrice($db,$insert,$show,$partnumber,$lastcost,$sellprice,$shop) { } return $rc; } -function updParts($db,$insert,$show,$partnumber,$lastcost,$sellprice, +function updParts($db,$insert,$show,$partnumber,$lastcost,$sellprice,$listprice, $description,$notes,$ean,$weight,$image, - $partsgroup_id, $shop) { + $partsgroup_id,$pricegroup, $shop) { if ($show) { show('',false); - show($partnumber); show($lastcost); show($sellprice); + show($partnumber); show($lastcost); show($sellprice); show($listprice); show($description); show(substr($notes,0,25));show($ean); show($weight); show($image); show($partsgroup_id); } if ($insert) { $sqlUa = 'UPDATE PARTS SET '; $sqlUa .= 'description = ?, notes = ?, ean = ?, weight = ?, image = ?, '; - $sqlUa .= 'sellprice = ?, lastcost = ?, partsgroup_id = ?, shop = ? '; + $sqlUa .= 'sellprice = ?, listprice = ?, lastcost = ?, partsgroup_id = ?, shop = ? '; $sqlUa .= 'WHERE partnumber = ?'; $rc=$db->execute($sqlUa,array($description,$notes,$ean,$weight,$image, - $sellprice,$lastcost,$partsgroup_id,$shop,$partnumber)); + $sellprice,$listprice,$lastcost,$partsgroup_id,$shop,$partnumber)); } else { $rc = true; } + if ($pricegroup) $ok = insPrices($db,$partnumber,$pricegroup); if ($show) { if ($rc) show('ok'); @@ -139,7 +160,6 @@ function newPartNumber($db,$check) { $rs=$db->getAll($sql); if ($rs[0]["articlenumber"]) { preg_match("/([^0-9]+)?([0-9]+)([^0-9]+)?/", $rs[0]["articlenumber"] , $regs); - print_r($regs); $number=$regs[1].($regs[2]+1).$regs[3]; } $sql = "update defaults set articlenumber = '$number'"; @@ -190,6 +210,22 @@ function getStdUnit($db,$type) { return $rs[0]["name"]; } +function insPrices($db,$pid,$prices) { + $rc = $db->query("BEGIN"); + $sql="delete from prices where parts_id = (select id from parts where partnumber = '$pid')"; + $rc = $db->query($sql); + $sql = "insert into prices (parts_id,pricegroup_id,price) values ((select id from parts where partnumber = '%s'),%d,%0.5f)"; + foreach ($prices as $key => $val) { + $rc = $db->query(sprintf($sql,$pid,$key,$val)); + if (!$rc) { + $db->query("ROLLBACK"); + return false; + } + } + $db->query("COMMIT"); + return true; +} + function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $insert, $show ,$maske) { $precision=$maske["precision"]; $quotation=$maske["quotation"]; @@ -199,25 +235,48 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins $Update=($maske["update"]=="U")?true:false; $UpdText=($maske["TextUpd"]=="1")?true:false; - $stdunitW=getStdUnit($db,"dimension"); - $stdunitD=getStdUnit($db,"service"); + //$stdunitW=getStdUnit($db,"dimension"); + //$stdunitD=getStdUnit($db,"service"); + $stdunitW=$maske["dimensionunit"]; + $stdunitD=$maske["serviceunit"]; if ($quottype=="P") $quotation=($quotation+100)/100; if ($show && !$insert) show("Testimport",false); if ($show) show("\n",false); /* field description */ - $parts_fld = array_keys($fields); + $prices = getPricegroup($db); + if ($prices) { + $priceskey = array_keys($prices); + $parts_fld = array_merge(array_keys($fields),$priceskey); + } else { + $parts_fld = array_keys($fields); + } + + if ($trenner=="other") $trenner=trim($trennzeichen); + if (substr($trenner,0,1)=="#") if (strlen($trenner)>1) $trenner=chr(substr($trenner,1)); /* open csv file */ - $f=fopen($file.'.csv',"r"); - + if (file_exists($file."head.csv")) { + $fh=fopen($file.'head.csv',"r"); + // Erst einmal die erste Zeile mit den richtigen Feldbezeichnungen einlesen. + $infld=fgetcsv($fh,1200,$trenner); + fclose($fh); + $f=fopen($file.'.csv',"r"); + // Erst einmal die erste Zeile mit den falschen Feldbezeichnungen einlesen. + $tmp=fgetcsv($f,1200,$trenner); + } else { + $f=fopen($file.'.csv',"r"); + // Erst einmal die erste Zeile mit den Feldbezeichnungen einlesen. + $infld=fgetcsv($f,1200,$trenner); + } + /* * read first line with table descriptions */ if ($show) { show('',false); - show("partnumber"); show("lastcost"); show("sellprice"); + show("partnumber"); show("lastcost"); show("sellprice"); show("listprice"); show("description");show("notes"); show("ean"); show("weight"); show("image"); show("partsgroup_id"); show("bg"); show("income_accno"); show("expense_accno"); @@ -226,11 +285,7 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins show("\n",false); } - if ($trenner=="other") $trenner=trim($trennzeichen); - if (substr($trenner,0,1)=="#") if (strlen($trenner)>1) $trenner=chr(substr($trenner,1)); - // Erst einmal die erste Zeile mit den Feldbezeichnungen einlesen. - $infld=fgetcsv($f,1200,$trenner); $p=0; foreach ($infld as $fld) { $fld = strtolower(trim(strtr($fld,array("\""=>"","'"=>"")))); @@ -264,13 +319,21 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins /* VK-Preis bilden */ $sellprice = str_replace(",", ".", $zeile[$fldpos["sellprice"]]); + $listprice = str_replace(",", ".", $zeile[$fldpos["listprice"]]); $lastcost = str_replace(",", ".", $zeile[$fldpos["lastcost"]]); + if ($prices) { + foreach ($prices as $pkey=>$val) { + if (array_key_exists($pkey,$fldpos)) + $pricegroup[$val] = str_replace(",", ".", $zeile[$fldpos[$pkey]]); + } + } if ($quotation<>0) { if ($quottype=="A") { $sellprice += $quotation; } else { $sellprice = $sellprice * $quotation; } }; if ($lastcost=="") unset($lastcost); if ($sellprice=="") unset($sellprice); + if ($listprice=="") unset($listprice); /* Langtext zusammenbauen */ if ($zeile[$fldpos["notes"]]) { @@ -283,9 +346,7 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins //Kundenspezifisch: //$notes1 = preg_replace('/""[^ ]/','"',$zeile[$fldpos["notes1"]]); $notes1 = addslashes($zeile[$fldpos["notes1"]]); -echo "!".$notes1."!
"; if (Translate) translate($notes1); -echo "!".$notes1."!
"; if ($notes) { $notes .= "\n".$notes1; } else { @@ -307,6 +368,7 @@ echo "!".$notes1."!
"; /* sind Hersteller und Modelnummer hinterlegt wenn ja, erfolgt er insert später */ + $makemodel = 'f'; if (!empty($zeile[$fldpos["makemodel"]]) and !$artikel) { $mm = $zeile[$fldpos["makemodel"]]; if (Translate) translate($mm); @@ -402,7 +464,6 @@ echo "!".$notes1."!
"; } else { $shop = $maske["shop"]; } - // Artikel updaten if (getPartsid($db,trim($zeile[$fldpos["partnumber"]]))) { @@ -410,11 +471,11 @@ echo "!".$notes1."!
"; if ($Update) { /* Updates durchführen */ if ($UpdText=='1') { - $u += updParts($db,$insert,$show,$zeile[$fldpos["partnumber"]],$lastcost,$sellprice, + $u += updParts($db,$insert,$show,$zeile[$fldpos["partnumber"]],$lastcost,$sellprice,$listprice, $description,$notes,$zeile[$fldpos["ean"]],$weight, - $zeile[$fldpos["image"]],$partsgroup_id, $shop); + $zeile[$fldpos["image"]],$partsgroup_id,$pricegroup, $shop); } else { - $u += updPrice($db,$insert,$show,$zeile[$fldpos["partnumber"]],$lastcost,$sellprice,$shop); + $u += updPrice($db,$insert,$show,$zeile[$fldpos["partnumber"]],$lastcost,$sellprice,$listprice,$pricegroup,$shop); } continue; // nächste Zeile @@ -435,13 +496,15 @@ echo "!".$notes1."!
"; "description"=>$description,"notes"=>$notes, "ean"=>$zeile[$fldpos["ean"]],"unit"=>$unit, "weight"=>$weight,"image"=>$zeile[$fldpos["image"]], - "sellprice"=>$sellprice,"lastcost"=>$lastcost, + "sellprice"=>$sellprice, + "lastcost"=>$lastcost, + "listprice"=>$listprice, "partsgroup_id"=>$partsgroup_id, - "buchungsgruppen_id"=>$bg,"income_accno"=>$income_accno, - "expense_accno"=>$expense_accno,"inventory_accno"=>$inventory_accno, + "buchungsgruppen_id"=>$bg,"income_accno_id"=>$income_accno, + "expense_accno_id"=>$expense_accno,"inventory_accno_id"=>$inventory_accno, "microfiche"=>$zeile[$fldpos["microfiche"]],"drawing"=>$zeile[$fldpos["drawing"]], "rop"=>$rop,"assembly"=>$assembly, - "shop"=>$shop,"makemodel"=>$makemodel) + "shop"=>$shop,"makemodel"=>$makemodel),$pricegroup ); if ($hersteller>0 && $model) { $partsid=getPartsid($db,$zeile[$fldpos["partnumber"]]); diff --git a/menu.ini b/menu.ini index 643a4e9ac..310c7b568 100644 --- a/menu.ini +++ b/menu.ini @@ -667,20 +667,6 @@ module=generictranslations.pl action=edit_greetings -[System--Printer] -module=menu.pl -action=acc_menu -target=acc_menu -submenu=1 - -[System--Printer--Add Printer] -module=am.pl -action=add_printer - -[System--Printer--List Printer] -module=am.pl -action=list_printer - [System--Payment Terms] module=menu.pl action=acc_menu diff --git a/scripts/locales.pl b/scripts/locales.pl index 24b06877f..fa787a24b 100755 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@ -576,7 +576,7 @@ sub strip_base { sub _single_quote { my $val = shift; - $val =~ s/('|\\$)/\\$1/g; + $val =~ s/(\'|\\$)/\\$1/g; return "'" . $val . "'"; } @@ -601,7 +601,9 @@ sub generate_file { 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; diff --git a/templates/webpages/admin/list_users.html b/templates/webpages/admin/list_users.html index 7d66002d1..e2011908e 100644 --- a/templates/webpages/admin/list_users.html +++ b/templates/webpages/admin/list_users.html @@ -36,6 +36,7 @@ + [% IF LOCKED %] diff --git a/templates/webpages/admin_printer/_login_form.html b/templates/webpages/admin_printer/_login_form.html new file mode 100644 index 000000000..411661cba --- /dev/null +++ b/templates/webpages/admin_printer/_login_form.html @@ -0,0 +1,4 @@ +[%- USE T8 %] +[%- USE L %] +

[% 'Please select a user' | $T8 %]: [% L.select_tag('login', L.options_for_select(users, value => 'login', title => 'login', default => login)) %]

+ diff --git a/templates/webpages/admin_printer/edit.html b/templates/webpages/admin_printer/edit.html new file mode 100644 index 000000000..c8edd609c --- /dev/null +++ b/templates/webpages/admin_printer/edit.html @@ -0,0 +1,41 @@ +[%- USE T8 %] + + + + +

[% title %]

+ +[%- PROCESS 'admin_printer/_login_form.html' %] + + +
+ + + + + + + + + + + + + + + +
[% 'Printer' | $T8 %]
[% 'Printer Command' | $T8 %]
[% 'Template Code' | $T8 %]

+ +
+ + + +[%- IF id %] + +[%- END %] + + +

+ + + diff --git a/templates/webpages/admin_printer/list.html b/templates/webpages/admin_printer/list.html new file mode 100644 index 000000000..92a7095d4 --- /dev/null +++ b/templates/webpages/admin_printer/list.html @@ -0,0 +1,44 @@ +[%- USE T8 %] + + +
+ +

[% title %]

+ +[%- PROCESS 'admin_printer/_login_form.html' %] + + + + + + + + +
+ + + + + + +[%- IF all_printers.size %] +[%- FOREACH row = all_printers %] + + + + + +[%- END %] +[%- ELSE %] + +[%- END %] +
[% 'Description' | $T8 %][% 'Printer Command' | $T8 %][% 'Template Code' | $T8 %]
[% row.printer_description %][% row.printer_command | html %][% row.template_code | html %]
[% 'No data was found.' | $T8 %]
+

+ +
+ + + +
+ + diff --git a/templates/webpages/admin_printer/login.html b/templates/webpages/admin_printer/login.html new file mode 100644 index 000000000..d45f1ce85 --- /dev/null +++ b/templates/webpages/admin_printer/login.html @@ -0,0 +1,16 @@ +[% USE T8 %] +[% USE L %] + +

[% 'Printer Management' | $T8 %]

+
+

[% 'Printers are created for a user database. Please select a user. The associated database will be edited.' | $T8 %]

+ +[%- PROCESS 'admin_printer/_login_form.html' %] + + +

+ + +

+ +
diff --git a/templates/webpages/ar/search.html b/templates/webpages/ar/search.html index cf8c70a54..9245d6b29 100644 --- a/templates/webpages/ar/search.html +++ b/templates/webpages/ar/search.html @@ -31,6 +31,7 @@ [%- INCLUDE 'generic/multibox.html' name = 'department', + select_name = 'department_id', style = 'width: 250px', DATA = ALL_DEPARTMENTS, id_key = 'id', diff --git a/templates/webpages/generic/multibox.html b/templates/webpages/generic/multibox.html index ccb87cb15..b26f86f0d 100644 --- a/templates/webpages/generic/multibox.html +++ b/templates/webpages/generic/multibox.html @@ -23,13 +23,18 @@ 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) @@ -39,7 +44,7 @@ row.selected = default == row.id -%] [%- END -%] -[%- IF allow_textbox and DATA.size and limit < DATA.size %] +[%- IF show_text %]