sub select_tag {
my $self = shift;
my $name = shift;
- my $options_str = shift;
+ my $collection = shift;
my %attributes = _hashify(@_);
$attributes{id} ||= $self->name_to_id($name);
- $options_str = $self->options_for_select($options_str) if ref $options_str;
- return $self->html_tag('select', $options_str, %attributes, name => $name);
+ my $value_key = delete($attributes{value_key}) || 'id';
+ my $title_key = delete($attributes{title_key}) || $value_key;
+ my $default_key = delete($attributes{default_key}) || 'selected';
+
+
+ my $value_title_sub = delete($attributes{value_title_sub});
+
+ my $value_sub = delete($attributes{value_sub});
+ my $title_sub = delete($attributes{title_sub});
+ my $default_sub = delete($attributes{default_sub});
+
+
+ my %selected;
+
+ if ( ref($attributes{default}) eq 'ARRAY' ) {
+
+ foreach my $entry (@{$attributes{default}}) {
+ $selected{$entry} = 1;
+ }
+ } elsif ( defined($attributes{default}) ) {
+ $selected{$attributes{default}} = 1;
+ }
+
+ delete($attributes{default});
+
+
+ my @options;
+
+ if ( delete($attributes{with_empty}) ) {
+ push(@options, [undef, $attributes{empty_title} || '']);
+ }
+
+ my $normalize_entry = sub {
+
+ my ($type, $entry, $sub, $key) = @_;
+
+ if ( $sub ) {
+ return $sub->($entry);
+ }
+
+ my $ref = ref($entry);
+
+ if ( !$ref ) {
+
+ if ( $type eq 'value' || $type eq 'title' ) {
+ return $entry;
+ }
+
+ return 0;
+ }
+
+ if ( $ref eq 'ARRAY' ) {
+
+ if ( $type eq 'value' ) {
+ return $entry->[0];
+ }
+
+ if ( $type eq 'title' ) {
+ return $entry->[1];
+ }
+
+ return $entry->[2];
+ }
+
+ if ( $ref eq 'HASH' ) {
+ return $entry->{$key};
+ }
+
+ if ( $type ne 'default' || $entry->can($key) ) {
+ return $entry->$key;
+ }
+
+ return undef;
+ };
+
+ foreach my $entry ( @{ $collection } ) {
+ my $value;
+ my $title;
+
+ if ( $value_title_sub ) {
+ ($value, $title) = $value_title_sub->($entry);
+ } else {
+
+ $value = $normalize_entry->('value', $entry, $value_sub, $value_key);
+ $title = $normalize_entry->('title', $entry, $title_sub, $title_key);
+ }
+
+ my $default = $normalize_entry->('default', $entry, $default_sub, $default_key);
+
+ push(@options, [$value, $title, $default]);
+ }
+
+ foreach my $entry (@options) {
+ if ( exists($selected{$entry->[0]}) ) {
+ $entry->[2] = 1;
+ }
+ }
+
+ my $code = '';
+
+ foreach my $entry (@options) {
+ my %args = (value => $entry->[0]);
+
+ $args{selected} = $entry->[2];
+
+ $code .= $self->html_tag('option', _H($entry->[1]), %args);
+ }
+
+ $code = $self->html_tag('select', $code, %attributes, name => $name);
+
+ return $code;
}
sub textarea_tag {
return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick);
}
-sub options_for_select {
- my $self = shift;
- my $collection = shift;
- my %options = _hashify(@_);
-
- my $value_key = $options{value} || 'id';
- my $title_key = $options{title} || $value_key;
-
- my $value_sub = $options{value_sub};
- my $title_sub = $options{title_sub};
-
- my $value_title_sub = $options{value_title_sub};
-
- my %selected = map { ( $_ => 1 ) } @{ ref($options{default}) eq 'ARRAY' ? $options{default} : defined($options{default}) ? [ $options{default} ] : [] };
-
- my $access = sub {
- my ($element, $index, $key, $sub) = @_;
- my $ref = ref $element;
- return $sub ? $sub->($element)
- : !$ref ? $element
- : $ref eq 'ARRAY' ? $element->[$index]
- : $ref eq 'HASH' ? $element->{$key}
- : $element->$key;
- };
-
- my @elements = ();
- push @elements, [ undef, $options{empty_title} || '' ] if $options{with_empty};
- push @elements, map [
- $value_title_sub ? @{ $value_title_sub->($_) } : (
- $access->($_, 0, $value_key, $value_sub),
- $access->($_, 1, $title_key, $title_sub),
- )
- ], @{ $collection } if $collection && ref $collection eq 'ARRAY';
-
- my $code = '';
- foreach my $result (@elements) {
- my %attributes = ( value => $result->[0] );
- $attributes{selected} = 'selected' if $selected{ defined($result->[0]) ? $result->[0] : '' };
-
- $code .= $self->html_tag('option', _H($result->[1]), %attributes);
- }
-
- return $code;
-}
-
sub yes_no_tag {
my ($self, $name, $value) = splice @_, 0, 3;
my %attributes = _hashify(@_);
- my $options = $self->options_for_select([ [ 1, $::locale->text('Yes') ], [ 0, $::locale->text('No') ] ], default => $value ? 1 : 0);
- return $self->select_tag($name, $options, %attributes);
+ return $self->select_tag($name, [ [ 1 => $::locale->text('Yes') ], [ 0 => $::locale->text('No') ] ], default => $value ? 1 : 0, %attributes);
}
sub javascript {
my $actual_vendor_id = (defined $::form->{"$name"})? ((ref $::form->{"$name"}) ? $::form->{"$name"}->id : $::form->{"$name"}) :
(ref $value && $value->can('id')) ? $value->id : '';
- my $options_str = $self->options_for_select(SL::DB::Manager::Vendor->get_all(),
- default => $actual_vendor_id,
- title_sub => sub { $_[0]->vendornumber . " : " . $_[0]->name },
- 'with_empty' => 1);
- return $self->select_tag($name, $options_str, %params);
+ return $self->select_tag($name, SL::DB::Manager::Vendor->get_all(),
+ default => $actual_vendor_id,
+ title_sub => sub { $_[0]->vendornumber . " : " . $_[0]->name },
+ 'with_empty' => 1,
+ %params);
}
my $actual_part_id = (defined $::form->{"$name"})? ((ref $::form->{"$name"})? $::form->{"$name"}->id : $::form->{"$name"}) :
(ref $value && $value->can('id')) ? $value->id : '';
- my $options_str = $self->options_for_select(SL::DB::Manager::Part->get_all(),
- default => $actual_part_id,
- title_sub => sub { $_[0]->partnumber . " : " . $_[0]->description },
- 'with_empty' => 1);
- return $self->select_tag($name, $options_str, %params);
+ return $self->select_tag($name, SL::DB::Manager::Part->get_all(),
+ default => $actual_part_id,
+ title_sub => sub { $_[0]->partnumber . " : " . $_[0]->description },
+ with_empty => 1,
+ %params);
}
[% USE L %]
- [% L.select_tag('direction', [ [ 'left', 'To the left' ], [ 'right', 'To the right' ] ]) %]
+ [% L.select_tag('direction', [ [ 'left', 'To the left' ], [ 'right', 'To the right', 1 ] ]) %]
- [% L.select_tag('direction', L.options_for_select([ { direction => 'left', display => 'To the left' },
- { direction => 'right', display => 'To the right' } ],
- value => 'direction', title => 'display', default => 'right')) %]
+ [% L.select_tag('direction', [ { direction => 'left', display => 'To the left' },
+ { direction => 'right', display => 'To the right' } ],
+ value_key => 'direction', title_key => 'display', default => 'right')) %]
+
+ [% L.select_tag('direction', [ { direction => 'left', display => 'To the left' },
+ { direction => 'right', display => 'To the right', selected => 1 } ],
+ value_key => 'direction', title_key => 'display')) %]
=head1 DESCRIPTION
=over 4
-=item C<select_tag $name, $options_string, %attributes>
+=item C<select_tag $name, \@collection, %attributes>
+
+Creates a HTML 'select' tag named C<$name> with the contents of one
+'E<lt>optionE<gt>' tag for each element in C<\@collection> and with arbitrary
+HTML attributes from C<%attributes>. The value
+to use and the title to display are extracted from the elements in
+C<\@collection>. Each element can be one of four things:
+
+=over 12
+
+=item 1. An array reference with at least two elements. The first element is
+the value, the second element is its title. The third element is optional and and should contain a boolean.
+If it is true, than the element will be used as default.
+
+=item 2. A scalar. The scalar is both the value and the title.
+
+=item 3. A hash reference. In this case C<%attributes> must contain
+I<value_key>, I<title_key> and may contain I<default_key> keys that name the keys in the element to use
+for the value, title and default respectively.
+
+=item 4. A blessed reference. In this case C<%attributes> must contain
+I<value_key>, I<title_key> and may contain I<default_key> keys that name functions called on the blessed
+reference whose return values are used as the value, title and default
+respectively.
+
+=back
+
+For cases 3 and 4 C<$attributes{value_key}> defaults to C<id>,
+C<$attributes{title_key}> defaults to C<$attributes{value_key}>
+and C<$attributes{default_key}> defaults to C<selected>.
+
+In addition to pure keys/method you can also provide coderefs as I<value_sub>
+and/or I<title_sub> and/or I<default_sub>. If present, these take precedence over keys or methods,
+and are called with the element as first argument. It must return the value, title or default.
+
+Lastly a joint coderef I<value_title_sub> may be provided, which in turn takes
+precedence over the C<value_sub> and C<title_sub> subs. It will only be called once for each
+element and must return a list of value and title.
+
+If the option C<with_empty> is set then an empty element (value
+C<undef>) will be used as the first element. The title to display for
+this element can be set with the option C<empty_title> and defaults to
+an empty string.
-Creates a HTML 'select' tag named C<$name> with the contents
-C<$options_string> and with arbitrary HTML attributes from
-C<%attributes>. The tag's C<id> defaults to C<name_to_id($name)>.
+The option C<default> can be either a scalar or an array reference
+containing the values of the options which should be set to be
+selected.
-The C<$options_string> is usually created by the
-L</options_for_select> function. If C<$options_string> is an array
-reference then it will be passed to L</options_for_select>
-automatically.
+The tag's C<id> defaults to C<name_to_id($name)>.
=item C<yes_no_tag $name, $value, %attributes>
Creates a HTML 'select' tag with the two entries C<yes> and C<no> by
-calling L<select_tag> and L<options_for_select>. C<$value> determines
+calling L<select_tag>. C<$value> determines
which entry is selected. The C<%attributes> are passed through to
L<select_tag>.
=over 4
-=item C<options_for_select \@collection, %options>
-
-Creates a string suitable for a HTML 'select' tag consisting of one
-'E<lt>optionE<gt>' tag for each element in C<\@collection>. The value
-to use and the title to display are extracted from the elements in
-C<\@collection>. Each element can be one of four things:
-
-=over 12
-
-=item 1. An array reference with at least two elements. The first element is
-the value, the second element is its title.
-
-=item 2. A scalar. The scalar is both the value and the title.
-
-=item 3. A hash reference. In this case C<%options> must contain
-I<value> and I<title> keys that name the keys in the element to use
-for the value and title respectively.
-
-=item 4. A blessed reference. In this case C<%options> must contain
-I<value> and I<title> keys that name functions called on the blessed
-reference whose return values are used as the value and title
-respectively.
-
-=back
-
-For cases 3 and 4 C<$options{value}> defaults to C<id> and
-C<$options{title}> defaults to C<$options{value}>.
-
-In addition to pure keys/method you can also provide coderefs as I<value_sub>
-and/or I<title_sub>. If present, these take precedence over keys or methods,
-and are called with the element as first argument. It must return the value or
-title.
-
-Lastly a joint coderef I<value_title_sub> may be provided, which in turn takes
-precedence over each individual sub. It will only be called once for each
-element and must return a list of value and title.
-
-If the option C<with_empty> is set then an empty element (value
-C<undef>) will be used as the first element. The title to display for
-this element can be set with the option C<empty_title> and defaults to
-an empty string.
-
-The option C<default> can be either a scalar or an array reference
-containing the values of the options which should be set to be
-selected.
-
=item C<tab, description, target, %PARAMS>
Creates a tab for C<tabbed>. The description will be used as displayed name.
<h3 class="listheading">[%- LxERP.t8('Edit membership') %]</h3>
<div class="clearfix">
- [% L.select_tag("user_ids[]", L.options_for_select(ALL_USERS, value => 'id', title => 'login', default => USER_IDS_IN_GROUP), 'multiple' => 'multiple') %]
+ [% L.select_tag('user_ids[]', ALL_USERS, value_key = 'id', title_key = 'login', default = USER_IDS_IN_GROUP, multiple = 1) %]
</div>
<h3 class="listheading">[% 'Edit rights' | $T8 %]</h3>
<table>
<tr>
<th align="right">[% 'Date Format' | $T8 %]</th>
- <td>[% L.select_tag('user.dateformat', L.options_for_select(all_dateformats, default=user.dateformat)) %]</td>
+ <td>[% L.select_tag('user.dateformat', all_dateformats, default = user.dateformat) %]</td>
</tr>
<tr>
<th align="right">[% 'Number Format' | $T8 %]</th>
- <td>[% L.select_tag('user.numberformat', L.options_for_select(all_numberformats, default=user.numberformat)) %]</td>
+ <td>[% L.select_tag('user.numberformat', all_numberformats, default = user.numberformat) %]</td>
</tr>
<tr>
<tr>
<th align="right">[% 'Language' | $T8 %]</th>
- <td>[% L.select_tag('user.countrycode', L.options_for_select(all_countrycodes, title='title', default=user.countrycode)) %]</td>
+ <td>[% L.select_tag('user.countrycode', all_countrycodes, title_key = 'title', default = user.countrycode) %]</td>
</tr>
<tr>
<th align="right">[% 'Stylesheet' | $T8 %]</th>
- <td>[% L.select_tag('user.stylesheet', L.options_for_select(all_stylesheets, default=user.stylesheet)) %]</td>
+ <td>[% L.select_tag('user.stylesheet', all_stylesheets, default = user.stylesheet) %]</td>
</tr>
<tr>
</tr>
<tr>
<th align="right">[% 'Use Templates' | $T8 %]</th>
- <td>[% L.select_tag('usetemplates', L.options_for_select(all_templates, default=user.templates)) %]</td>
+ <td>[% L.select_tag('usetemplates', all_templates, default = user.templates) %]</td>
</tr>
<tr>
<th align="right">[% 'New Templates' | $T8 %]</th>
</tr>
<tr>
<th align="right">[% 'Setup Templates' | $T8 %]</th>
- <td>[% L.select_tag('mastertemplates', L.options_for_select(all_master_templates, default='German')) %]</td>
+ <td>[% L.select_tag('mastertemplates', all_master_templates, default = 'German') %]</td>
</tr>
<tr>
<th align="right">[% 'Setup Menu' | $T8 %]</th>
- <td>[% L.select_tag('user.menustyle', L.options_for_select(all_menustyles, title='title', default=user.menustyle)) %]</td>
+ <td>[% L.select_tag('user.menustyle', all_menustyles, title_key = 'title', default = user.menustyle) %]</td>
</tr>
<tr>
<th align='right'>[% 'Mandatory Departments' | $T8 %]</th>
[%- USE T8 %]
[%- USE L %]
-<p>[% 'Please select a user' | $T8 %]: [% L.select_tag('login', L.options_for_select(users, value => 'login', title => 'login', default => login)) %]</p>
+<p>[% 'Please select a user' | $T8 %]: [% L.select_tag('login', users, value_key = 'login', title_key = 'login', default = login) %]</p>
[%- IF INSTANCE_CONF.get_inventory_system == 'perpetual' %]
<tr>
<th align=right>[% 'Inventory' | $T8 %]</th>
- <td>[% L.select_tag('inventory_accno_id', L.options_for_select(accounts.IC, title_sub=\account_label, default=invetory_accno_id)) %]</td>
+ <td>[% L.select_tag('inventory_accno_id', accounts.IC, title_sub=\account_label, default=invetory_accno_id) %]</td>
</tr>
[%- ELSE %]
<tr style='display:none'>
[%- END %]
<tr>
<th align=right>[% 'National Revenues' | $T8 %]</th>
- <td>[% L.select_tag('income_accno_id_0', L.options_for_select(accounts.IC_income, title_sub=\account_label, default=income_accno_id_0)) %]</td>
+ <td>[% L.select_tag('income_accno_id_0', accounts.IC_income, title_sub=\account_label, default=income_accno_id_0) %]</td>
</tr>
<tr>
<th align=right>[% 'National Expenses' | $T8 %]</th>
- <td>[% L.select_tag('expense_accno_id_0', L.options_for_select(accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_0)) %]</td>
+ <td>[% L.select_tag('expense_accno_id_0', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_0) %]</td>
</tr>
<tr>
<th align=right>[% 'Revenues EU with UStId' | $T8 %]</th>
- <td>[% L.select_tag('income_accno_id_1', L.options_for_select(accounts.IC_income, title_sub=\account_label, default=income_accno_id_1)) %]</td>
+ <td>[% L.select_tag('income_accno_id_1', accounts.IC_income, title_sub=\account_label, default=income_accno_id_1) %]</td>
</tr>
<tr>
<th align=right>[% 'Expenses EU with UStId' | $T8 %]</th>
- <td>[% L.select_tag('expense_accno_id_1', L.options_for_select(accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_1)) %]</td>
+ <td>[% L.select_tag('expense_accno_id_1', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_1) %]</td>
</tr>
<tr>
<th align=right>[% 'Revenues EU without UStId' | $T8 %]</th>
- <td>[% L.select_tag('income_accno_id_2', L.options_for_select(accounts.IC_income, title_sub=\account_label, default=income_accno_id_2)) %]</td>
+ <td>[% L.select_tag('income_accno_id_2', accounts.IC_income, title_sub=\account_label, default=income_accno_id_2) %]</td>
</tr>
<tr>
<th align=right>[% 'Expenses EU without UStId' | $T8 %]</th>
- <td>[% L.select_tag('expense_accno_id_2', L.options_for_select(accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_2)) %]</td>
+ <td>[% L.select_tag('expense_accno_id_2', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_2) %]</td>
</tr>
<tr>
<th align=right>[% 'Foreign Revenues' | $T8 %]</th>
- <td>[% L.select_tag('income_accno_id_3', L.options_for_select(accounts.IC_income, title_sub=\account_label, default=income_accno_id_3)) %]</td>
+ <td>[% L.select_tag('income_accno_id_3', accounts.IC_income, title_sub=\account_label, default=income_accno_id_3) %]</td>
</tr>
<tr>
<th align=right>[% 'Foreign Expenses' | $T8 %]</th>
- <td>[% L.select_tag('expense_accno_id_3', L.options_for_select(accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_3)) %]</td>
+ <td>[% L.select_tag('expense_accno_id_3', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_3) %]</td>
</tr>
<td colspan=2><hr size=3 noshade></td>
</tr>
<tr>
<th align="right">[% 'Date Format' | $T8 %]</th>
<td>
- <select name="dateformat">
- [%- FOREACH row = DATEFORMATS %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
+ [% L.select_tag('dateformat', DATEFORMATS, value_key = 'value', title_key = 'name') %]
</td>
</tr>
<tr>
<th align="right">[% 'Output Number Format' | $T8 %]</th>
<td>
- <select name="numberformat">
- [%- FOREACH row = NUMBERFORMATS %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
+ [% L.select_tag('numberformat', NUMBERFORMATS, value_key = 'value', title_key = 'name') %]
</td>
</tr>
<tr>
<th align="right">[% 'Language' | $T8 %]</th>
<td>
- <select name="countrycode">
- [%- FOREACH row = COUNTRYCODES %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
+ [% L.select_tag('countrycode', COUNTRYCODES, value_key = 'value', title_key = 'name') %]
</td>
</tr>
<tr>
<th align="right">[% 'Stylesheet' | $T8 %]</th>
<td>
- <select name="usestylesheet">
- [%- FOREACH row = STYLESHEETS %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
+ [% L.select_tag('usestylesheet', STYLESHEETS, value_key = 'value', title_key = 'name') %]
</td>
</tr>
<tr>
<th align="right">[% 'Default template format' | $T8 %]</th>
<td>
- <select name="template_format">
- [%- FOREACH row = TEMPLATE_FORMATS %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
+ [% L.select_tag('template_format', TEMPLATE_FORMATS, value_key = 'value', title_key = 'name') %]
</td>
</tr>
<tr>
<th align="right">[% 'Default output medium' | $T8 %]</th>
<td>
- <select name="default_media">
- [%- FOREACH row = MEDIA %]
- <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
- [%- END %]
- </select>
+ [% L.select_tag('default_media', MEDIA, value_key = 'value', title_key = 'name') %]
</td>
</tr>
<tr>
<th align="right">[% 'Default printer' | $T8 %]</th>
<td>
- [% L.select_tag('default_printer_id', L.options_for_select(PRINTERS, default => myconfig_default_printer_id, title => 'printer_description', with_empty => 1)) %]
+ [% L.select_tag('default_printer_id', PRINTERS, default = myconfig_default_printer_id, title_key = 'printer_description', with_empty = 1) %]
</td>
</tr>
<td>
[% IF AccountIsPosted %]
[% L.select_tag('dummy_charttype',
- L.options_for_select(all_charttypes,
- title => 'name', value => 'value',
- default => selected_charttype),
+ all_charttypes,
+ title_key => 'name',
+ value_key => 'value',
+ default => selected_charttype,
disabled => '1') %]
[% L.hidden_tag('charttype', selected_charttype) %]
[% ELSE %]
[% L.select_tag('charttype',
- L.options_for_select(all_charttypes,
- title => 'name', value => 'value',
- default => selected_charttype)) %]
+ all_charttypes,
+ title_key => 'name',
+ value_key => 'value',
+ default => selected_charttype) %]
[% END %]
</td>
</tr>
</tr>
<tr>
<th align=right>[% 'Number Format' | $T8 %]</th>
- <td><select name="output_numberformat">[% L.options_for_select(numberformats, default=output_numberformat, with_empty=1, empty_title=LxERP.t8('use program settings')) %]</select></td>
+ <td><select name="output_numberformat">[% numberformats, default = output_numberformat, with_empty = 1, empty_title = LxERP.t8('use program settings') %]</select></td>
</tr>
<tr>
<th align=right>[% 'Date Format' | $T8 %]</th>
- <td><select name="output_dateformat">[% L.options_for_select(dateformats, default=output_dateformat, with_empty=1, empty_title=LxERP.t8('use program settings')) %]</select></td>
+ <td><select name="output_dateformat">[% dateformats, default = output_dateformat, with_empty = 1, empty_title=LxERP.t8('use program settings') %]</select></td>
</tr>
<tr>
<th align=right>[% 'Long Dates' | $T8 %]</th>
</tr>
<tr>
<th align=right nowrap>[% 'Project Number' | $T8 %]</th>
- <td>[% L.select_tag('globalproject_id', L.options_for_select(ALL_PROJECTS, title='projectnumber', default=globalproject_id, with_empty=1)) %]</td>
+ <td>[% L.select_tag('globalproject_id', ALL_PROJECTS, title_key = 'projectnumber', default = globalproject_id, with_empty = 1) %]</td>
</tr>
</table>
</td>
<td>[% L.input_tag('amount_' _ loop.count, LxERP.format_amount(row.amount, 2)) %]</td>
<td>[% L.hidden_tag('tax_' _ loop.count, LxERP.format_tax(row.tax, 2)) %][% LxERP.format_amount(row.tax, 2) | html %]</td>
<td>[% row.taxchart %]</td>
- <td>[% L.select_tag('project_id_' _ loop.count, L.options_for_select(ALL_PROJECTS, title='projectnumber', default=row.project_id, with_empty=1)) %]</td>
+ <td>[% L.select_tag('project_id_' _ loop.count, ALL_PROJECTS, title_key = 'projectnumber', default = row.project_id, with_empty = 1) %]</td>
</tr>
[%- END %]
</td>
<td>
[%- IF row.changeable %]
- [% L.select_tag('paid_project_id_' _ loop.count, L.options_for_select(ALL_PROJECTS, title='projectnumber', default=row.paid_project_id, with_empty=1)) %]
+ [% L.select_tag('paid_project_id_' _ loop.count, ALL_PROJECTS, title_key = 'projectnumber', default = row.paid_project_id, with_empty=1) %]
[%- ELSE %]
[% project_labels.${row.paid_project_id} | html %]
<input type=hidden name="paid_project_id_[% loop.count %]" value='[% row.paid_project_id %]'>
</tr>
<tr>
<th align="right">[% 'Employee' | $T8 %]</th>
- <td>[% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), style='width:250px') %]</td>
+ <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style = 'width:250px') %]</td>
</tr>
<tr>
<th align="right">[% 'Salesman' | $T8 %]</th>
- <td>[% L.select_tag('salesman_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), style='width:250px') %]</td>
+ <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style = 'width:250px') %]</td>
</tr>
<tr>
<th align=right nowrap>[% 'Transaction description' | $T8 %]</th>
<tr>
<th align="right">[%- LxERP.t8('Execution type') %]</th>
- <td>[% L.select_tag("background_job.type", L.options_for_select([ [ 'once', LxERP.t8('one-time execution') ], [ 'interval', LxERP.t8('repeated execution') ] ],
- 'default' => SELF.background_job.type)) %]</td>
+ <td>
+ [% L.select_tag('background_job.type', [
+ [ 'once', LxERP.t8('one-time execution') ],
+ [ 'interval', LxERP.t8('repeated execution') ]
+ ],
+ 'default' = SELF.background_job.type) %]
+ </td>
</tr>
<tr>
[% L.submit_tag('action', LxERP.t8('Remove'), confirm=LxERP.t8('Are you sure you want to remove the marked entries from the queue?')) %]
[% L.submit_tag('action', LxERP.t8('Print')) %]
-[% L.select_tag('printer', L.options_for_select(ALL_PRINTERS, title='printer_description')) %]
+[% L.select_tag('printer', ALL_PRINTERS, title_key = 'printer_description') %]
</form>
[% IF show_accounts %]
<tr>
<th align=right>[% 'Account' | $T8 %]</th>
- <td colspan=3>[% L.select_tag('account', L.options_for_select(accounts, value_title_sub=\account_sub)) %]</td>
+ <td colspan=3>[% L.select_tag('account', accounts, value_title_sub=\account_sub) %]</td>
</tr>
[% END %]
[%- IF label.$type.invnumber %]
<th align="right">[%- LxERP.t8('Target table') %]:</th>
<td colspan="10">
[% opts = [ [ 'customer', LxERP.t8('Customers') ], [ 'vendor', LxERP.t8('Vendors') ] ] %]
- [% L.select_tag('settings.table', L.options_for_select(opts, default => SELF.profile.get('table')), style => 'width: 300px') %]
+ [% L.select_tag('settings.table', opts, default = SELF.profile.get('table'), style = 'width: 300px') %]
</td>
</tr>
<th align="right">[%- LxERP.t8('Parts with existing part numbers') %]:</th>
<td colspan="10">
[% opts = [ [ 'update_prices', LxERP.t8('Update prices of existing entries') ], [ 'insert_new', LxERP.t8('Insert with new part number') ], [ 'skip', LxERP.t8('Skip entry') ] ] %]
- [% L.select_tag('settings.article_number_policy', L.options_for_select(opts, default => SELF.profile.get('article_number_policy')), style => 'width: 300px') %]
+ [% L.select_tag('settings.article_number_policy', opts, default = SELF.profile.get('article_number_policy'), style = 'width: 300px') %]
</td>
</tr>
<tr>
<th align="right">[%- LxERP.t8('Sellprice significant places') %]:</th>
<td colspan="10">
- [% L.select_tag('settings.sellprice_places', L.options_for_select([ 0, 1, 2, 3, 4, 5 ], default => SELF.profile.get('sellprice_places')), style => 'width: 300px') %]
+ [% L.select_tag('settings.sellprice_places', [ 0, 1, 2, 3, 4, 5 ], default = SELF.profile.get('sellprice_places')), style = 'width: 300px') %]
</td>
</tr>
<td colspan="10">
[% L.input_tag('settings.sellprice_adjustment', LxERP.format_amount(SELF.profile.get('sellprice_adjustment')), size => "5") %]
[% opts = [ [ 'percent', LxERP.t8('percental') ], [ 'absolute', LxERP.t8('absolute') ] ] %]
- [% L.select_tag('settings.sellprice_adjustment_type', L.options_for_select(opts, default => SELF.profile.get('sellprice_adjustment_type'))) %]
+ [% L.select_tag('settings.sellprice_adjustment_type', opts, default = SELF.profile.get('sellprice_adjustment_type')) %]
</td>
</tr>
<th align="right">[%- LxERP.t8('Mark as shop article if column missing') %]:</th>
<td colspan="10">
[% opts = [ [ '1', LxERP.t8('yes') ], [ '0', LxERP.t8('no') ] ] %]
- [% L.select_tag('settings.shoparticle_if_missing', L.options_for_select(opts, default => SELF.profile.get('shoparticle_if_missing')), style => 'width: 300px') %]
+ [% L.select_tag('settings.shoparticle_if_missing', opts, default = SELF.profile.get('shoparticle_if_missing'), style = 'width: 300px') %]
</td>
</tr>
<th align="right">[%- LxERP.t8('Type') %]:</th>
<td colspan="10">
[% opts = [ [ 'part', LxERP.t8('Parts') ], [ 'service', LxERP.t8('Services') ], [ 'mixed', LxERP.t8('Mixed (requires column "type")') ] ] %]
- [% L.select_tag('settings.parts_type', L.options_for_select(opts, default => SELF.profile.get('parts_type')), style => 'width: 300px') %]
+ [% L.select_tag('settings.parts_type', opts, default = SELF.profile.get('parts_type'), style = 'width: 300px') %]
</td>
</tr>
<tr>
<th align="right" valign="top">[%- LxERP.t8('Default buchungsgruppe') %]:</th>
<td colspan="10" valign="top">
- [% opts = L.options_for_select(SELF.all_buchungsgruppen, title => 'description', default => SELF.profile.get('default_buchungsgruppe')) %]
+ [% opts = SELF.all_buchungsgruppen, title_key = 'description', default = SELF.profile.get('default_buchungsgruppe') %]
[% L.select_tag('settings.default_buchungsgruppe', opts, style => 'width: 300px') %]
<br>
[% opts = [ [ 'never', LxERP.t8('Do not set default buchungsgruppe') ], [ 'all', LxERP.t8('Apply to all parts') ], [ 'missing', LxERP.t8('Apply to parts without buchungsgruppe') ] ] %]
- [% L.select_tag('settings.apply_buchungsgruppe', L.options_for_select(opts, default => SELF.profile.get('apply_buchungsgruppe')), style => 'width: 300px') %]
+ [% L.select_tag('settings.apply_buchungsgruppe', opts, default = SELF.profile.get('apply_buchungsgruppe'), style = 'width: 300px') %]
</td>
</tr>
<tr>
<th align="right" valign="top">[%- LxERP.t8('Default unit') %]:</th>
<td colspan="10" valign="top">
- [% opts = L.options_for_select(SELF.all_units, title => 'name', value => 'name', default => SELF.profile.get('default_unit')) %]
+ [% opts = SELF.all_units, title_key = 'name', value_key = 'name', default = SELF.profile.get('default_unit')) %]
[% L.select_tag('settings.default_unit', opts, style => 'width: 300px') %]
</td>
</tr>
<tr>
<th align="right">[%- LxERP.t8('Existing profiles') %]:</th>
<td>
- [% L.select_tag('profile.id', L.options_for_select(SELF.all_profiles, title => 'name', default => SELF.profile.id), style => 'width: 300px') %]
+ [% L.select_tag('profile.id', SELF.all_profiles, title_key = 'name', default = SELF.profile.id, style = 'width: 300px') %]
</td>
<td>
[% L.submit_tag('action_new', LxERP.t8('Load profile')) %]
<tr>
<th align="right">[%- LxERP.t8('Number Format') %]:</th>
<td colspan="10">
- [% SET options = L.options_for_select([ '1.000,00', '1000,00', '1,000.00', '1000.00' ], default => SELF.profile.get('numberformat')) %]
- [% L.select_tag('settings.numberformat', options, style => 'width: 300px') %]
+ [% L.select_tag('settings.numberformat', ['1.000,00', '1000,00', '1,000.00', '1000.00'], default = SELF.profile.get('numberformat'), style = 'width: 300px') %]
</td>
</tr>
<tr>
<th align="right">[%- LxERP.t8('Charset') %]:</th>
- <td colspan="10">[% L.select_tag('settings.charset', L.options_for_select(SELF.all_charsets, default => SELF.profile.get('charset')), style => 'width: 300px') %]</td>
+ <td colspan="10">[% L.select_tag('settings.charset', SELF.all_charsets, default = SELF.profile.get('charset'), style = 'width: 300px') %]</td>
</tr>
<tr>
[% opts = [ [ 'no_check', LxERP.t8('Do not check for duplicates') ],
[ 'check_csv', LxERP.t8('Discard duplicate entries in CSV file') ],
[ 'check_db', LxERP.t8('Discard entries with duplicates in database or CSV file') ] ] %]
- [% L.select_tag('settings.duplicates', L.options_for_select(opts, default => SELF.profile.get('duplicates')), style => 'width: 300px') %]
+ [% L.select_tag('settings.duplicates', opts, default = SELF.profile.get('duplicates'), style = 'width: 300px') %]
</td>
</tr>
[% END %]
-->
</script>
</body>
-</html>
\ No newline at end of file
+</html>
<tr>
<th align="left">[% 'Contacts' | $T8 %]</th>
<td>
- [%- L.select_tag('cp_id', L.options_for_select(CONTACTS, default => cp_id, with_empty => 1, empty_title => LxERP.t8('New contact'), value => 'cp_id', title_sub => \contacts_label),
- onchange => "\$('#contacts').load('ct.pl?action=get_contact&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&cp_id=' + \$('#cp_id').attr('value'))") %]
+ [%- L.select_tag('cp_id', CONTACTS, default = cp_id, with_empty = 1, empty_title = LxERP.t8('New contact'), value_key = 'cp_id', title_sub = \contacts_label,
+ onchange = "\$('#contacts').load('ct.pl?action=get_contact&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&cp_id=' + \$('#cp_id').attr('value'))") %]
</td>
</tr>
<th align="left" nowrap>[% 'Title' | $T8 %]</th>
<td>
<input id="cp_title" name="cp_title" size="40" maxlength="75" value="[% HTML.escape(cp_title) %]">
- [% L.select_tag('selected_cp_title', L.options_for_select(TITLES, with_empty => 1)) %]
+ [% L.select_tag('selected_cp_title', TITLES, with_empty = 1) %]
</td>
</tr>
<th align="left" nowrap>[% 'Department' | $T8 %]</th>
<td>
<input id="cp_abteilung" name="cp_abteilung" size="40" value="[% HTML.escape(cp_abteilung) %]">
- [% L.select_tag('selected_cp_abteilung', L.options_for_select(DEPARTMENT, with_empty => 1)) %]
+ [% L.select_tag('selected_cp_abteilung', DEPARTMENT, with_empty = 1) %]
</td>
</tr>
<tr>
<th align="right">[% 'Shipping Address' | $T8 %]</th>
<td>
- [% L.select_tag('shipto_id', L.options_for_select(SHIPTO, default => shipto_id, value => 'shipto_id', title_sub => \shipto_label, with_empty => 1, empty_title => LxERP.t8('New shipto')),
- onchange => "\$('#shipto').load('ct.pl?action=get_shipto&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&shipto_id=' + this.value)") %]
+ [% L.select_tag('shipto_id', SHIPTO, default = shipto_id, value_key = 'shipto_id', title_sub = \shipto_label, with_empty = 1, empty_title = LxERP.t8('New shipto'),
+ onchange = "\$('#shipto').load('ct.pl?action=get_shipto&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&shipto_id=' + this.value)") %]
</td>
</tr>
<td><input name="bic" size="10" maxlength="100" value="[% HTML.escape(bic) %]"></td>
[%- IF ALL_CURRENCIES.size %]
<th align="right">[% 'Currency' | $T8 %]</th>
- <td>[% L.select_tag('currency', L.options_for_select(ALL_CURRENCIES, default=currency, with_empty=1)) %]</td>
+ <td>[% L.select_tag('currency', ALL_CURRENCIES, default = currency, with_empty = 1) %]</td>
[%- END %]
</tr>
</td>
[%- IF is_customer && !conf_vertreter %]
<th align="right">[% 'Salesman' | $T8 %]</th>
- <td>[% L.select_tag('salesman_id', L.options_for_select(ALL_SALESMEN, default=salesman_id, with_empty=1, title='safe_name')) %]</td>
+ <td>[% L.select_tag('salesman_id', ALL_SALESMEN, default = salesman_id, with_empty = 1, title_key = 'safe_name') %]</td>
[%- END %]
</tr>
</table>
<tr>
<th align="right">[% 'Shipping Address' | $T8 %]</th>
<td colspan="3">
- [% L.select_tag('delivery_id', L.options_for_select(SHIPTO_ALL, title_sub => \shipto_label, with_empty => 1),
- onchange => "\$('#delivery').load('ct.pl?action=get_delivery&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&shipto_id=' + this.value)") %]
+ [% L.select_tag('delivery_id', SHIPTO_ALL, title_sub = \shipto_label, with_empty = 1,
+ onchange = "\$('#delivery').load('ct.pl?action=get_delivery&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&shipto_id=' + this.value)") %]
</td>
</tr>
<td>
[% L.date_tag('FU_date', FU_date) %]
[% 'for' | $T8 %]
- [% L.select_tag('FU_created_for_user', L.options_for_select(ALL_EMPLOYEES, default=(FU_created_for_user ? FU_created_for_user : USER.id), title='safe_name')) %]
+ [% L.select_tag('FU_created_for_user', ALL_EMPLOYEES, default = (FU_created_for_user ? FU_created_for_user : USER.id), title='safe_name') %]
</td>
</tr>
[%- USE T8 %]
+[%- USE L %]
[% USE HTML %]<body onload="fokus()">
<form method="post" action="ct.pl" name="Form">
<tr>
<th align="right" nowrap>[% IF IS_CUSTOMER %][% 'Customer type' | $T8 %][% ELSE %][% 'Vendor type' | $T8 %][% END %]</th>
<td>
- <select name="business_id"><option value=""></option>
- [% FOREACH bt = ALL_BUSINESS_TYPES %]<option value="[% HTML.escape(bt.id) %]">[% HTML.escape(bt.description) %]</option>[% END %]
- </select>
+ [% L.select_tag('business_id', ALL_BUSINESS_TYPES, title_key = 'description', with_empty = 1) %]
</td>
</tr>
[% END %]
[%- HTML.escape(row.cp_name) %][%- IF row.cp_abteilung %] ([% HTML.escape(row.cp_abteilung) %])[% END -%]
[%- END %]
[%- ELSE %]
- [% L.select_tag('cp_id', L.options_for_select(ALL_CONTACTS, default=cp_id, value='cp_id', title='full_name_dep', with_empty=1), style='width: 250px') %]
+ [% L.select_tag('cp_id', ALL_CONTACTS, default = cp_id, value = 'cp_id', title = 'full_name_dep', with_empty = 1, style='width: 250px') %]
[%- END %]
</td>
</tr>
[%- END %]
[%- ELSE %]
- [% L.select_tag('shipto_id', L.options_for_select(ALL_SHIPTO, default=shipto_id, value='shipto_id', title='displayable_id', with_empty=1), class='fixed_width') %]
+ [% L.select_tag('shipto_id', ALL_SHIPTO, default = shipto_id, value = 'shipto_id', title = 'displayable_id', with_empty = 1, class = 'fixed_width') %]
[%- END %]
</td>
</tr>
[% IF ( delivered ) %]
[% L.hidden_tag('department_id', department_id) %]
[% END %]
- [% L.select_tag('department_id', L.options_for_select(ALL_DEPARTMENTS, default=department_id, title="description", with_empty=1), style='width: 250px', disabled => delivered )%]
+ [% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title = 'description', with_empty = 1, style = 'width: 250px', disabled = delivered )%]
</td>
</tr>
[%- END %]
[% IF row.id == employee_id %][%- IF row.name %][%- HTML.escape(row.name) %][%- ELSE %][% HTML.escape(row.login) %][%- END %][% END %]
[%- END %]
[%- ELSE %]
- [% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, default=employee_id, title='safe_name')) %]
+ [% L.select_tag('employee_id', ALL_EMPLOYEES, default = employee_id, title = 'safe_name') %]
[%- END %]
</td>
</tr>
[% IF row.id == the_salesman_id %][%- IF row.name %][%- HTML.escape(row.name) %][%- ELSE %][% HTML.escape(row.login) %][%- END %][% END %]
[%- END %]
[%- ELSE %]
- [% L.select_tag('salesman_id', L.options_for_select(ALL_SALESMEN, default=(salesman_id ? salesman_id : employee_id), title='safe_name')) %]
+ [% L.select_tag('salesman_id', ALL_SALESMEN, default = (salesman_id ? salesman_id : employee_id), title = 'safe_name') %]
[%- END %]
</td>
</tr>
<tr>
<th align="right">[% 'Employee' | $T8 %]</th>
- <td>[% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), class='fixed_width') %]</td>
+ <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, class = 'fixed_width') %]</td>
</tr>
[%- IF is_customer %]
<tr>
<th align="right">[% 'Salesman' | $T8 %]</th>
- <td>[% L.select_tag('salesman_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), class='fixed_width') %]</td>
+ <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, class = 'fixed_width') %]</td>
</tr>
[%- END %]
</tr>
<tr>
<th align="right">[% 'Salesman' | $T8 %]</th>
- <td>[% L.select_tag('salesman_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), style='width:250px') %]</td>
+ <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style = 'width:250px') %]</td>
</tr>
</table>
</td>
[%- IF all_departments %]
<tr>
<th align=right nowrap>[% 'Department' | $T8 %]</th>
- <td colspan=3>[% L.select_tag('department', L.options_for_select(all_departments, value_title_sub=\department_label, with_empty=1)) %]</td>
+ <td colspan=3>[% L.select_tag('department', all_departments, value_title_sub = \department_label, with_empty = 1) %]</td>
</tr>
[%- END %]
<tr>
</tr>
<tr>
<th align=right>[% 'Project Number' | $T8 %]</th>
- <td colspan=3>[% L.select_tag('project_id', L.options_for_select(ALL_PROJECTS, title='projectnumber', with_empty=1)) %]</td>
+ <td colspan=3>[% L.select_tag('project_id', ALL_PROJECTS, title_key = 'projectnumber', with_empty = 1) %]</td>
</tr>
<tr>
<th align=right>[% 'Employee' | $T8 %]</th>
- <td colspan=3>[% L.select_tag('employee', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1)) %]</td>
+ <td colspan=3>[% L.select_tag('employee', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1) %]</td>
</tr>
<tr>
<th align=right>[% 'Filter date by' | $T8 %]</th>
<th align="right" nowrap>[% LxERP.t8('Gender') %]</th>
<td></td>
<td>
- [% L.select_tag("shiptocp_gender", L.options_for_select([ [ "m", LxERP.t8("male") ], [ "f", LxERP.t8("female") ] ], "default", shiptocp_gender)) %]
+ [% L.select_tag('shiptocp_gender', [ [ 'm', LxERP.t8('male') ], [ 'f', LxERP.t8('female') ] ], 'default' = shiptocp_gender) %]
</td>
</tr>
<tr>
<tr>
<th align="right">[% 'Contact Person' | $T8 %]</th>
<td>
- [% L.select_tag('cp_id', L.options_for_select(ALL_CONTACTS, default=cp_id, value='cp_id', title='full_name_dep', with_empty=1), style='width: 250px') %]
+ [% L.select_tag('cp_id', ALL_CONTACTS, default = cp_id, value_key = 'cp_id', title_key = 'full_name_dep', with_empty = 1, style = 'width: 250px') %]
</td>
</tr>
[%- END %]
<table>
<tr>
<th align="right">[% 'Employee' | $T8 %]</th>
- <td>[% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, default=employee_id, title='safe_name')) %]</td>
+ <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, default = employee_id, title_key = 'safe_name') %]</td>
</tr>
[%- IF is_type_credit_note %]
<tr>
<th align="right">[% 'Contact Person' | $T8 %]</th>
<td>
- [% L.select_tag('cp_id', L.options_for_select(ALL_CONTACTS, default=cp_id, value='cp_id', title='full_name_dep', with_empty=1), style='width: 250px') %]
+ [% L.select_tag('cp_id', ALL_CONTACTS, default = cp_id, value_key = 'cp_id', title_key = 'full_name_dep', with_empty = 1, style = 'width: 250px') %]
</td>
</tr>
[%- END %]
<tr>
<th align="right">[% 'Shipping Address' | $T8 %]</th>
<td>
- [% L.select_tag('shipto_id', L.options_for_select(ALL_SHIPTO, default=shipto_id, value='shipto_id', title='displayable_id', with_empty=1), style='width: 250px', onChange="document.getElementById('update_button').click();") %]
+ [% L.select_tag('shipto_id', ALL_SHIPTO, default = shipto_id, value_key = 'shipto_id', title_key = 'displayable_id', with_empty = 1, style='width: 250px', onChange = "document.getElementById('update_button').click();") %]
</td>
</tr>
[%- END %]
<tr>
<th align="right">[% 'Steuersatz' | $T8 %]</th>
<td>
- [% L.select_tag('taxzone_id', L.options_for_select(ALL_TAXZONES, default=taxzone_id, title='description'), disabled=(id ? 1 : 0), style='width: 250px', onchange="document.getElementById('update_button').click();") %]
+ [% L.select_tag('taxzone_id', ALL_TAXZONES, default = taxzone_id, title_key = 'description', disabled = (id ? 1 : 0), style='width: 250px', onchange = "document.getElementById('update_button').click();") %]
[%- IF id %]
<input type='hidden' name='taxzone_id' value='[% taxzone_id %]'>
[%- END %]
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
<td colspan="3">
- [% L.select_tag('department_id', L.options_for_select(all_departments, default=department_id, title_sub=\department_labels, with_empty=1), style='width:250px') %]
+ [% L.select_tag('department_id', all_departments, default = department_id, title_sub = \department_labels, with_empty = 1, style = 'width:250px') %]
</td>
</tr>
[%- END %]
<tr>
<th align="right">[% 'Employee' | $T8 %]</th>
<td>
- [% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, default=employee_id, title='safe_name')) %]
+ [% L.select_tag('employee_id', ALL_EMPLOYEES, default = employee_id, title_key = 'safe_name') %]
</td>
</tr>
[%- IF ALL_SALESMEN.size %]
<tr>
<th align="right">[% 'Salesman' | $T8 %]</th>
<td>
- [% L.select_tag('salesman_id', L.options_for_select(ALL_SALESMEN, default=(salesman_id ? salesman_id : employee_id), title='safe_name')) %]
+ [% L.select_tag('salesman_id', ALL_SALESMEN, default = (salesman_id ? salesman_id : employee_id), title_key = 'safe_name') %]
</td>
</tr>
[%- END %]
<tr>
<th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
<td>
- [%- L.select_tag('globalproject_id', L.options_for_select(ALL_PROJECTS, title='projectnumber', default=globalproject_id, with_empty='1'), onChange="document.getElementById('update_button').click();") %]
+ [%- L.select_tag('globalproject_id', ALL_PROJECTS, title='projectnumber', default = globalproject_id, with_empty = '1', onChange = "document.getElementById('update_button').click();") %]
</td>
</tr>
</table>
<tr>
<th align="right">[%- LxERP.t8('Record in') %]</th>
<td valign="top">
- [% L.select_tag("ar_chart_id", L.options_for_select(AR, title => 'description', default => ar_chart_id)) %]
+ [% L.select_tag("ar_chart_id", AR, title_key => 'description', default => ar_chart_id)) %]
</td>
</tr>
<tr>
<th align="right">[%- LxERP.t8('Printer') %]</th>
<td valign="top">
- [% L.select_tag("printer_id", L.options_for_select(ALL_PRINTERS, title => 'printer_description', default => printer_id), disabled => !print) %]
+ [% L.select_tag("printer_id", ALL_PRINTERS, title_key = 'printer_description', default = printer_id, disabled = !print) %]
</td>
</tr>
<tr>
<th align="right">[% 'Contact Person' | $T8 %]</th>
<td>
- [% L.select_tag('cp_id', L.options_for_select(ALL_CONTACTS, default=cp_id, value='cp_id', title='full_name_dep', with_empty=1), style='width: 250px') %]
+ [% L.select_tag('cp_id', ALL_CONTACTS, default=cp_id, value_key='cp_id', title_key='full_name_dep', with_empty=1, style='width: 250px') %]
</td>
</tr>
[%- END %]
<tr>
<th align="right">[% 'Shipping Address' | $T8 %]</th>
<td>
- [% L.select_tag('shipto_id', L.options_for_select(ALL_SHIPTO, default=shipto_id, value='shipto_id', title='displayable_id', with_empty=1), style='width: 250px', onChange="document.getElementById('update_button').click();") %]
+ [% L.select_tag('shipto_id', ALL_SHIPTO, default=shipto_id, value_key='shipto_id', title_key='displayable_id', with_empty=1, style='width: 250px', onChange="document.getElementById('update_button').click();") %]
</td>
</tr>
[%- END %]
<tr>
<th align="right">[% 'Steuersatz' | $T8 %]</th>
<td>
- [% L.select_tag('taxzone_id', L.options_for_select(ALL_TAXZONES, default=taxzone_id, title='description'), style='width: 250px') %]
+ [% L.select_tag('taxzone_id', ALL_TAXZONES, default=taxzone_id, title_key='description', style='width: 250px') %]
</td>
</tr>
[%- IF ALL_DEPARTMENTS %]
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
<td colspan="3">
- [% L.select_tag('department_id', L.options_for_select(ALL_DEPARTMENTS, default=department_id, title_sub=\department_labels, with_empty=1), style='width:250px') %]
+ [% L.select_tag('department_id', ALL_DEPARTMENTS, default=department_id, title_sub=\department_labels, with_empty=1, style='width:250px') %]
</td>
</tr>
[%- END %]
<tr>
<th align="right">[% 'Employee' | $T8 %]</th>
<td>
- [% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, default=employee_id, title='safe_name')) %]
+ [% L.select_tag('employee_id', ALL_EMPLOYEES, default=employee_id, title_key='safe_name') %]
</td>
</tr>
[%- IF is_sales and ALL_SALESMEN.size %]
<tr>
<th align="right">[% 'Salesman' | $T8 %]</th>
<td>
- [% L.select_tag('salesman_id', L.options_for_select(ALL_SALESMEN, default=(salesman_id ? salesman_id : employee_id), title='safe_name')) %]
+ [% L.select_tag('salesman_id', ALL_SALESMEN, default=(salesman_id ? salesman_id : employee_id), title_key='safe_name') %]
</td>
</tr>
[%- END %]
<tr>
<th width="70%" align="right" nowrap>[% 'Project Number' | $T8 %]</th>
<td>
- [%- L.select_tag('globalproject_id', L.options_for_select(ALL_PROJECTS, title='projectnumber', default=globalproject_id, with_empty='1'), onChange="document.getElementById('update_button').click();") %]
+ [%- L.select_tag('globalproject_id', ALL_PROJECTS, title_key='projectnumber', default=globalproject_id, with_empty='1', onChange="document.getElementById('update_button').click();") %]
</td>
</tr>
</table>
</tr>
<tr>
<th align="right">[% 'Employee' | $T8 %]</th>
- <td>[% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), style='width:250px') %]</td>
+ <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style='width:250px') %]</td>
</tr>
<tr>
<th align="right">[% 'Salesman' | $T8 %]</th>
- <td>[% L.select_tag('salesman_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), style='width:250px') %]</td>
+ <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style='width:250px') %]</td>
</tr>
<tr>
<th align="right">[% 'Transaction description' | $T8 %]</th>
<table>
<tr>
<th align=right nowrap>[% 'Account' | $T8 %]</th>
- <td colspan=3>[% L.select_tag('accno', L.options_for_select(PR, value_title_sub=\selection_sub)) %]</td>
+ <td colspan=3>[% L.select_tag('accno', PR, value_title_sub=\selection_sub) %]</td>
</tr>
<tr>
<th align=right>[% 'From' | $T8 %]</th>
[%- BLOCK projectnumber %]
<tr>
<th align=right nowrap>[% 'Project' | $T8 %]</th>
- <td colspan=3>[% L.select_tag('project_id', L.options_for_select(ALL_PROJECTS, title='projectnumber', with_empty=1)) %]</td>
+ <td colspan=3>[% L.select_tag('project_id', ALL_PROJECTS, title_key = 'projectnumber', with_empty = 1) %]</td>
</tr>
[%- END %]