Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 58966151

Von Thomas Heck vor etwa 12 Jahren hinzugefügt

  • ID 5896615180704b3dddba46f4064a47ff1f094c3c
  • Vorgänger 261cfce2
  • Nachfolger 51d0274d

SL::Template::Plugin::L::select_tag und SL::Template::Plugin::L::options_for_select fusionieren.

Unterschiede anzeigen:

SL/Template/Plugin/L.pm
86 86
sub select_tag {
87 87
  my $self            = shift;
88 88
  my $name            = shift;
89
  my $options_str     = shift;
89
  my $collection      = shift;
90 90
  my %attributes      = _hashify(@_);
91 91

  
92 92
  $attributes{id}   ||= $self->name_to_id($name);
93
  $options_str        = $self->options_for_select($options_str) if ref $options_str;
94 93

  
95
  return $self->html_tag('select', $options_str, %attributes, name => $name);
94
  my $value_key       = delete($attributes{value_key}) || 'id';
95
  my $title_key       = delete($attributes{title_key}) || $value_key;
96
  my $default_key     = delete($attributes{default_key}) || 'selected';
97

  
98

  
99
  my $value_title_sub = delete($attributes{value_title_sub});
100

  
101
  my $value_sub       = delete($attributes{value_sub});
102
  my $title_sub       = delete($attributes{title_sub});
103
  my $default_sub     = delete($attributes{default_sub});
104

  
105

  
106
  my %selected;
107

  
108
  if ( ref($attributes{default}) eq 'ARRAY' ) {
109

  
110
    foreach my $entry (@{$attributes{default}}) {
111
      $selected{$entry} = 1;
112
    }
113
  } elsif ( defined($attributes{default}) ) {
114
    $selected{$attributes{default}} = 1;
115
  }
116

  
117
  delete($attributes{default});
118

  
119

  
120
  my @options;
121

  
122
  if ( delete($attributes{with_empty}) ) {
123
    push(@options, [undef, $attributes{empty_title} || '']);
124
  }
125

  
126
  my $normalize_entry = sub {
127

  
128
    my ($type, $entry, $sub, $key) = @_;
129

  
130
    if ( $sub ) {
131
      return $sub->($entry);
132
    }
133

  
134
    my $ref = ref($entry);
135

  
136
    if ( !$ref ) {
137

  
138
      if ( $type eq 'value' || $type eq 'title' ) {
139
        return $entry;
140
      }
141

  
142
      return 0;
143
    }
144

  
145
    if ( $ref eq 'ARRAY' ) {
146

  
147
      if ( $type eq 'value' ) {
148
        return $entry->[0];
149
      }
150

  
151
      if ( $type eq 'title' ) {
152
        return $entry->[1];
153
      }
154

  
155
      return $entry->[2];
156
    }
157

  
158
    if ( $ref eq 'HASH' ) {
159
      return $entry->{$key};
160
    }
161

  
162
    if ( $type ne 'default' || $entry->can($key) ) {
163
      return $entry->$key;
164
    }
165

  
166
    return undef;
167
  };
168

  
169
  foreach my $entry ( @{ $collection } ) {
170
    my $value;
171
    my $title;
172

  
173
    if ( $value_title_sub ) {
174
      ($value, $title) = $value_title_sub->($entry);
175
    } else {
176

  
177
      $value = $normalize_entry->('value', $entry, $value_sub, $value_key);
178
      $title = $normalize_entry->('title', $entry, $title_sub, $title_key);
179
    }
180

  
181
    my $default = $normalize_entry->('default', $entry, $default_sub, $default_key);
182

  
183
    push(@options, [$value, $title, $default]);
184
  }
185

  
186
  foreach my $entry (@options) {
187
    if ( exists($selected{$entry->[0]}) ) {
188
      $entry->[2] = 1;
189
    }
190
  }
191

  
192
  my $code = '';
193

  
194
  foreach my $entry (@options) {
195
    my %args = (value => $entry->[0]);
196

  
197
    $args{selected} = $entry->[2];
198

  
199
    $code .= $self->html_tag('option', _H($entry->[1]), %args);
200
  }
201

  
202
  $code = $self->html_tag('select', $code, %attributes, name => $name);
203

  
204
  return $code;
96 205
}
97 206

  
98 207
sub textarea_tag {
......
207 316
  return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick);
208 317
}
209 318

  
210
sub options_for_select {
211
  my $self            = shift;
212
  my $collection      = shift;
213
  my %options         = _hashify(@_);
214

  
215
  my $value_key       = $options{value} || 'id';
216
  my $title_key       = $options{title} || $value_key;
217

  
218
  my $value_sub       = $options{value_sub};
219
  my $title_sub       = $options{title_sub};
220

  
221
  my $value_title_sub = $options{value_title_sub};
222

  
223
  my %selected        = map { ( $_ => 1 ) } @{ ref($options{default}) eq 'ARRAY' ? $options{default} : defined($options{default}) ? [ $options{default} ] : [] };
224

  
225
  my $access = sub {
226
    my ($element, $index, $key, $sub) = @_;
227
    my $ref = ref $element;
228
    return  $sub            ? $sub->($element)
229
         : !$ref            ? $element
230
         :  $ref eq 'ARRAY' ? $element->[$index]
231
         :  $ref eq 'HASH'  ? $element->{$key}
232
         :                    $element->$key;
233
  };
234

  
235
  my @elements = ();
236
  push @elements, [ undef, $options{empty_title} || '' ] if $options{with_empty};
237
  push @elements, map [
238
    $value_title_sub ? @{ $value_title_sub->($_) } : (
239
      $access->($_, 0, $value_key, $value_sub),
240
      $access->($_, 1, $title_key, $title_sub),
241
    )
242
  ], @{ $collection } if $collection && ref $collection eq 'ARRAY';
243

  
244
  my $code = '';
245
  foreach my $result (@elements) {
246
    my %attributes = ( value => $result->[0] );
247
    $attributes{selected} = 'selected' if $selected{ defined($result->[0]) ? $result->[0] : '' };
248

  
249
    $code .= $self->html_tag('option', _H($result->[1]), %attributes);
250
  }
251

  
252
  return $code;
253
}
254

  
255 319
sub yes_no_tag {
256 320
  my ($self, $name, $value) = splice @_, 0, 3;
257 321
  my %attributes            = _hashify(@_);
258 322

  
259
  my $options               = $self->options_for_select([ [ 1, $::locale->text('Yes') ], [ 0, $::locale->text('No') ] ], default => $value ? 1 : 0);
260
  return $self->select_tag($name, $options, %attributes);
323
  return $self->select_tag($name, [ [ 1 => $::locale->text('Yes') ], [ 0 => $::locale->text('No') ] ], default => $value ? 1 : 0, %attributes);
261 324
}
262 325

  
263 326
sub javascript {
......
356 419

  
357 420
  my $actual_vendor_id = (defined $::form->{"$name"})? ((ref $::form->{"$name"}) ? $::form->{"$name"}->id : $::form->{"$name"}) :
358 421
                         (ref $value && $value->can('id')) ? $value->id : '';
359
  my $options_str = $self->options_for_select(SL::DB::Manager::Vendor->get_all(),
360
                                              default      => $actual_vendor_id,
361
                                              title_sub    => sub { $_[0]->vendornumber . " : " . $_[0]->name },
362
                                              'with_empty' => 1);
363 422

  
364
  return $self->select_tag($name, $options_str, %params);
423
  return $self->select_tag($name, SL::DB::Manager::Vendor->get_all(),
424
                                  default      => $actual_vendor_id,
425
                                  title_sub    => sub { $_[0]->vendornumber . " : " . $_[0]->name },
426
                                  'with_empty' => 1,
427
                                  %params);
365 428
}
366 429

  
367 430

  
......
371 434

  
372 435
  my $actual_part_id = (defined $::form->{"$name"})? ((ref $::form->{"$name"})? $::form->{"$name"}->id : $::form->{"$name"}) :
373 436
                       (ref $value && $value->can('id')) ? $value->id : '';
374
  my $options_str = $self->options_for_select(SL::DB::Manager::Part->get_all(),
375
                                              default      => $actual_part_id,
376
                                              title_sub    => sub { $_[0]->partnumber . " : " . $_[0]->description },
377
                                              'with_empty' => 1);
378 437

  
379
  return $self->select_tag($name, $options_str, %params);
438
  return $self->select_tag($name, SL::DB::Manager::Part->get_all(),
439
                           default      => $actual_part_id,
440
                           title_sub    => sub { $_[0]->partnumber . " : " . $_[0]->description },
441
                           with_empty   => 1,
442
                           %params);
380 443
}
381 444

  
382 445

  
......
619 682

  
620 683
  [% USE L %]
621 684

  
622
  [% L.select_tag('direction', [ [ 'left', 'To the left' ], [ 'right', 'To the right' ] ]) %]
685
  [% L.select_tag('direction', [ [ 'left', 'To the left' ], [ 'right', 'To the right', 1 ] ]) %]
623 686

  
624
  [% L.select_tag('direction', L.options_for_select([ { direction => 'left',  display => 'To the left'  },
625
                                                      { direction => 'right', display => 'To the right' } ],
626
                                                    value => 'direction', title => 'display', default => 'right')) %]
687
  [% L.select_tag('direction', [ { direction => 'left',  display => 'To the left'  },
688
                                 { direction => 'right', display => 'To the right' } ],
689
                               value_key => 'direction', title_key => 'display', default => 'right')) %]
690

  
691
  [% L.select_tag('direction', [ { direction => 'left',  display => 'To the left'  },
692
                                 { direction => 'right', display => 'To the right', selected => 1 } ],
693
                               value_key => 'direction', title_key => 'display')) %]
627 694

  
628 695
=head1 DESCRIPTION
629 696

  
......
661 728

  
662 729
=over 4
663 730

  
664
=item C<select_tag $name, $options_string, %attributes>
731
=item C<select_tag $name, \@collection, %attributes>
732

  
733
Creates a HTML 'select' tag named C<$name> with the contents of one
734
'E<lt>optionE<gt>' tag for each element in C<\@collection> and with arbitrary
735
HTML attributes from C<%attributes>. The value
736
to use and the title to display are extracted from the elements in
737
C<\@collection>. Each element can be one of four things:
738

  
739
=over 12
740

  
741
=item 1. An array reference with at least two elements. The first element is
742
the value, the second element is its title. The third element is optional and and should contain a boolean.
743
If it is true, than the element will be used as default.
744

  
745
=item 2. A scalar. The scalar is both the value and the title.
746

  
747
=item 3. A hash reference. In this case C<%attributes> must contain
748
I<value_key>, I<title_key> and may contain I<default_key> keys that name the keys in the element to use
749
for the value, title and default respectively.
750

  
751
=item 4. A blessed reference. In this case C<%attributes> must contain
752
I<value_key>, I<title_key> and may contain I<default_key> keys that name functions called on the blessed
753
reference whose return values are used as the value, title and default
754
respectively.
755

  
756
=back
757

  
758
For cases 3 and 4 C<$attributes{value_key}> defaults to C<id>,
759
C<$attributes{title_key}> defaults to C<$attributes{value_key}>
760
and C<$attributes{default_key}> defaults to C<selected>.
761

  
762
In addition to pure keys/method you can also provide coderefs as I<value_sub>
763
and/or I<title_sub> and/or I<default_sub>. If present, these take precedence over keys or methods,
764
and are called with the element as first argument. It must return the value, title or default.
765

  
766
Lastly a joint coderef I<value_title_sub> may be provided, which in turn takes
767
precedence over the C<value_sub> and C<title_sub> subs. It will only be called once for each
768
element and must return a list of value and title.
769

  
770
If the option C<with_empty> is set then an empty element (value
771
C<undef>) will be used as the first element. The title to display for
772
this element can be set with the option C<empty_title> and defaults to
773
an empty string.
665 774

  
666
Creates a HTML 'select' tag named C<$name> with the contents
667
C<$options_string> and with arbitrary HTML attributes from
668
C<%attributes>. The tag's C<id> defaults to C<name_to_id($name)>.
775
The option C<default> can be either a scalar or an array reference
776
containing the values of the options which should be set to be
777
selected.
669 778

  
670
The C<$options_string> is usually created by the
671
L</options_for_select> function. If C<$options_string> is an array
672
reference then it will be passed to L</options_for_select>
673
automatically.
779
The tag's C<id> defaults to C<name_to_id($name)>.
674 780

  
675 781
=item C<yes_no_tag $name, $value, %attributes>
676 782

  
677 783
Creates a HTML 'select' tag with the two entries C<yes> and C<no> by
678
calling L<select_tag> and L<options_for_select>. C<$value> determines
784
calling L<select_tag>. C<$value> determines
679 785
which entry is selected. The C<%attributes> are passed through to
680 786
L<select_tag>.
681 787

  
......
909 1015

  
910 1016
=over 4
911 1017

  
912
=item C<options_for_select \@collection, %options>
913

  
914
Creates a string suitable for a HTML 'select' tag consisting of one
915
'E<lt>optionE<gt>' tag for each element in C<\@collection>. The value
916
to use and the title to display are extracted from the elements in
917
C<\@collection>. Each element can be one of four things:
918

  
919
=over 12
920

  
921
=item 1. An array reference with at least two elements. The first element is
922
the value, the second element is its title.
923

  
924
=item 2. A scalar. The scalar is both the value and the title.
925

  
926
=item 3. A hash reference. In this case C<%options> must contain
927
I<value> and I<title> keys that name the keys in the element to use
928
for the value and title respectively.
929

  
930
=item 4. A blessed reference. In this case C<%options> must contain
931
I<value> and I<title> keys that name functions called on the blessed
932
reference whose return values are used as the value and title
933
respectively.
934

  
935
=back
936

  
937
For cases 3 and 4 C<$options{value}> defaults to C<id> and
938
C<$options{title}> defaults to C<$options{value}>.
939

  
940
In addition to pure keys/method you can also provide coderefs as I<value_sub>
941
and/or I<title_sub>. If present, these take precedence over keys or methods,
942
and are called with the element as first argument. It must return the value or
943
title.
944

  
945
Lastly a joint coderef I<value_title_sub> may be provided, which in turn takes
946
precedence over each individual sub. It will only be called once for each
947
element and must return a list of value and title.
948

  
949
If the option C<with_empty> is set then an empty element (value
950
C<undef>) will be used as the first element. The title to display for
951
this element can be set with the option C<empty_title> and defaults to
952
an empty string.
953

  
954
The option C<default> can be either a scalar or an array reference
955
containing the values of the options which should be set to be
956
selected.
957

  
958 1018
=item C<tab, description, target, %PARAMS>
959 1019

  
960 1020
Creates a tab for C<tabbed>. The description will be used as displayed name.
templates/webpages/admin/edit_group.html
17 17
  <h3 class="listheading">[%- LxERP.t8('Edit membership') %]</h3>
18 18

  
19 19
  <div class="clearfix">
20
   [% L.select_tag("user_ids[]", L.options_for_select(ALL_USERS, value => 'id', title => 'login', default => USER_IDS_IN_GROUP), 'multiple' => 'multiple') %]
20
   [% L.select_tag('user_ids[]', ALL_USERS, value_key = 'id', title_key = 'login', default = USER_IDS_IN_GROUP, multiple = 1) %]
21 21
  </div>
22 22

  
23 23
  <h3 class="listheading">[% 'Edit rights' | $T8 %]</h3>
templates/webpages/admin/edit_user.html
109 109
     <table>
110 110
      <tr>
111 111
       <th align="right">[% 'Date Format' | $T8 %]</th>
112
       <td>[% L.select_tag('user.dateformat', L.options_for_select(all_dateformats, default=user.dateformat)) %]</td>
112
       <td>[% L.select_tag('user.dateformat', all_dateformats, default = user.dateformat) %]</td>
113 113
      </tr>
114 114

  
115 115
      <tr>
116 116
       <th align="right">[% 'Number Format' | $T8 %]</th>
117
       <td>[% L.select_tag('user.numberformat', L.options_for_select(all_numberformats, default=user.numberformat)) %]</td>
117
       <td>[% L.select_tag('user.numberformat', all_numberformats, default = user.numberformat) %]</td>
118 118
      </tr>
119 119

  
120 120
      <tr>
......
124 124

  
125 125
      <tr>
126 126
       <th align="right">[% 'Language' | $T8 %]</th>
127
       <td>[% L.select_tag('user.countrycode', L.options_for_select(all_countrycodes, title='title', default=user.countrycode)) %]</td>
127
       <td>[% L.select_tag('user.countrycode', all_countrycodes, title_key = 'title', default = user.countrycode) %]</td>
128 128
      </tr>
129 129

  
130 130
      <tr>
131 131
       <th align="right">[% 'Stylesheet' | $T8 %]</th>
132
       <td>[% L.select_tag('user.stylesheet', L.options_for_select(all_stylesheets, default=user.stylesheet)) %]</td>
132
       <td>[% L.select_tag('user.stylesheet', all_stylesheets, default = user.stylesheet) %]</td>
133 133
      </tr>
134 134

  
135 135
      <tr>
......
138 138
      </tr>
139 139
      <tr>
140 140
       <th align="right">[% 'Use Templates' | $T8 %]</th>
141
       <td>[% L.select_tag('usetemplates', L.options_for_select(all_templates, default=user.templates)) %]</td>
141
       <td>[% L.select_tag('usetemplates', all_templates, default = user.templates) %]</td>
142 142
      </tr>
143 143
      <tr>
144 144
       <th align="right">[% 'New Templates' | $T8 %]</th>
......
146 146
      </tr>
147 147
      <tr>
148 148
       <th align="right">[% 'Setup Templates' | $T8 %]</th>
149
       <td>[% L.select_tag('mastertemplates', L.options_for_select(all_master_templates, default='German')) %]</td>
149
       <td>[% L.select_tag('mastertemplates', all_master_templates, default = 'German') %]</td>
150 150
      </tr>
151 151
      <tr>
152 152
       <th align="right">[% 'Setup Menu' | $T8 %]</th>
153
       <td>[% L.select_tag('user.menustyle', L.options_for_select(all_menustyles, title='title', default=user.menustyle)) %]</td>
153
       <td>[% L.select_tag('user.menustyle', all_menustyles, title_key = 'title', default = user.menustyle) %]</td>
154 154
      </tr>
155 155
      <tr>
156 156
       <th align='right'>[% 'Mandatory Departments' | $T8 %]</th>
templates/webpages/admin_printer/_login_form.html
1 1
[%- USE T8 %]
2 2
[%- USE L %]
3
<p>[% 'Please select a user' | $T8 %]: [% L.select_tag('login', L.options_for_select(users, value => 'login', title => 'login', default => login)) %]</p>
3
<p>[% 'Please select a user' | $T8 %]: [% L.select_tag('login', users, value_key = 'login', title_key = 'login', default = login) %]</p>
4 4

  
templates/webpages/am/buchungsgruppe_header.html
19 19
[%- IF INSTANCE_CONF.get_inventory_system == 'perpetual' %]
20 20
  <tr>
21 21
   <th align=right>[% 'Inventory' | $T8 %]</th>
22
   <td>[% L.select_tag('inventory_accno_id', L.options_for_select(accounts.IC, title_sub=\account_label, default=invetory_accno_id)) %]</td>
22
   <td>[% L.select_tag('inventory_accno_id', accounts.IC, title_sub=\account_label, default=invetory_accno_id) %]</td>
23 23
  </tr>
24 24
[%- ELSE %]
25 25
  <tr style='display:none'>
......
28 28
[%- END %]
29 29
  <tr>
30 30
    <th align=right>[% 'National Revenues' | $T8 %]</th>
31
    <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>
31
    <td>[% L.select_tag('income_accno_id_0', accounts.IC_income, title_sub=\account_label, default=income_accno_id_0) %]</td>
32 32
  </tr>
33 33
  <tr>
34 34
    <th align=right>[% 'National Expenses' | $T8 %]</th>
35
    <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>
35
    <td>[% L.select_tag('expense_accno_id_0', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_0) %]</td>
36 36
  </tr>
37 37
  <tr>
38 38
    <th align=right>[% 'Revenues EU with UStId' | $T8 %]</th>
39
    <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>
39
    <td>[% L.select_tag('income_accno_id_1', accounts.IC_income, title_sub=\account_label, default=income_accno_id_1) %]</td>
40 40
  </tr>
41 41
  <tr>
42 42
    <th align=right>[% 'Expenses EU with UStId' | $T8 %]</th>
43
    <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>
43
    <td>[% L.select_tag('expense_accno_id_1', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_1) %]</td>
44 44
  </tr>
45 45
  <tr>
46 46
    <th align=right>[% 'Revenues EU without UStId' | $T8 %]</th>
47
    <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>
47
    <td>[% L.select_tag('income_accno_id_2', accounts.IC_income, title_sub=\account_label, default=income_accno_id_2) %]</td>
48 48
  </tr>
49 49
  <tr>
50 50
    <th align=right>[% 'Expenses EU without UStId' | $T8 %]</th>
51
    <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>
51
    <td>[% L.select_tag('expense_accno_id_2', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_2) %]</td>
52 52
  </tr>
53 53
  <tr>
54 54
    <th align=right>[% 'Foreign Revenues' | $T8 %]</th>
55
    <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>
55
    <td>[% L.select_tag('income_accno_id_3', accounts.IC_income, title_sub=\account_label, default=income_accno_id_3) %]</td>
56 56
  </tr>
57 57
  <tr>
58 58
    <th align=right>[% 'Foreign Expenses' | $T8 %]</th>
59
    <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>
59
    <td>[% L.select_tag('expense_accno_id_3', accounts.IC_expense, title_sub=\account_label, default=expense_accno_id_3) %]</td>
60 60
  </tr>
61 61
  <td colspan=2><hr size=3 noshade></td>
62 62
  </tr>
templates/webpages/am/config.html
80 80
     <tr>
81 81
      <th align="right">[% 'Date Format' | $T8 %]</th>
82 82
      <td>
83
       <select name="dateformat">
84
        [%- FOREACH row = DATEFORMATS %]
85
        <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
86
        [%- END %]
87
       </select>
83
        [% L.select_tag('dateformat', DATEFORMATS, value_key = 'value', title_key = 'name') %]
88 84
      </td>
89 85
     </tr>
90 86
     <tr>
91 87
      <th align="right">[% 'Output Number Format' | $T8 %]</th>
92 88
      <td>
93
       <select name="numberformat">
94
        [%- FOREACH row = NUMBERFORMATS %]
95
        <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
96
        [%- END %]
97
       </select>
89
        [% L.select_tag('numberformat', NUMBERFORMATS, value_key = 'value', title_key = 'name') %]
98 90
      </td>
99 91
     </tr>
100 92

  
......
106 98
     <tr>
107 99
      <th align="right">[% 'Language' | $T8 %]</th>
108 100
      <td>
109
       <select name="countrycode">
110
        [%- FOREACH row = COUNTRYCODES %]
111
        <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
112
        [%- END %]
113
       </select>
101
        [% L.select_tag('countrycode', COUNTRYCODES, value_key = 'value', title_key = 'name') %]
114 102
      </td>
115 103
     </tr>
116 104

  
117 105
     <tr>
118 106
      <th align="right">[% 'Stylesheet' | $T8 %]</th>
119 107
      <td>
120
       <select name="usestylesheet">
121
        [%- FOREACH row = STYLESHEETS %]
122
        <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
123
        [%- END %]
124
       </select>
108
        [% L.select_tag('usestylesheet', STYLESHEETS, value_key = 'value', title_key = 'name') %]
125 109
      </td>
126 110
     </tr>
127 111

  
......
169 153
     <tr>
170 154
      <th align="right">[% 'Default template format' | $T8 %]</th>
171 155
      <td>
172
       <select name="template_format">
173
        [%- FOREACH row = TEMPLATE_FORMATS %]
174
        <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
175
        [%- END %]
176
       </select>
156
        [% L.select_tag('template_format', TEMPLATE_FORMATS, value_key = 'value', title_key = 'name') %]
177 157
      </td>
178 158
     </tr>
179 159

  
180 160
     <tr>
181 161
      <th align="right">[% 'Default output medium' | $T8 %]</th>
182 162
      <td>
183
       <select name="default_media">
184
        [%- FOREACH row = MEDIA %]
185
        <option value="[% HTML.escape(row.value) %]"[% IF row.selected %] selected[% END %]>[% HTML.escape(row.name) %]</option>
186
        [%- END %]
187
       </select>
163
        [% L.select_tag('default_media', MEDIA, value_key = 'value', title_key = 'name') %]
188 164
      </td>
189 165
     </tr>
190 166

  
191 167
     <tr>
192 168
      <th align="right">[% 'Default printer' | $T8 %]</th>
193 169
      <td>
194
       [% L.select_tag('default_printer_id', L.options_for_select(PRINTERS, default => myconfig_default_printer_id, title => 'printer_description', with_empty => 1)) %]
170
       [% L.select_tag('default_printer_id', PRINTERS, default = myconfig_default_printer_id, title_key = 'printer_description', with_empty = 1) %]
195 171
      </td>
196 172
     </tr>
197 173

  
templates/webpages/am/edit_accounts.html
63 63
      <td>
64 64
[% IF AccountIsPosted %]
65 65
        [% L.select_tag('dummy_charttype',
66
                        L.options_for_select(all_charttypes,
67
                                             title => 'name', value => 'value',
68
                                             default => selected_charttype),
66
                        all_charttypes,
67
                        title_key => 'name',
68
                        value_key => 'value',
69
                        default => selected_charttype,
69 70
                        disabled => '1') %]
70 71
        [% L.hidden_tag('charttype', selected_charttype) %]
71 72
[% ELSE %]
72 73
        [% L.select_tag('charttype',
73
                        L.options_for_select(all_charttypes,
74
                                             title => 'name', value => 'value',
75
                                             default => selected_charttype)) %]
74
                        all_charttypes,
75
                        title_key => 'name',
76
                        value_key => 'value',
77
                        default => selected_charttype) %]
76 78
[% END %]
77 79
      </td>
78 80
    </tr>
templates/webpages/am/language_header.html
28 28
  </tr>
29 29
  <tr>
30 30
    <th align=right>[% 'Number Format' | $T8 %]</th>
31
    <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>
31
    <td><select name="output_numberformat">[% numberformats, default = output_numberformat, with_empty = 1, empty_title = LxERP.t8('use program settings') %]</select></td>
32 32
  </tr>
33 33
  <tr>
34 34
    <th align=right>[% 'Date Format' | $T8 %]</th>
35
    <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>
35
    <td><select name="output_dateformat">[% dateformats, default = output_dateformat, with_empty = 1, empty_title=LxERP.t8('use program settings') %]</select></td>
36 36
  </tr>
37 37
  <tr>
38 38
    <th align=right>[% 'Long Dates' | $T8 %]</th>
templates/webpages/ar/form_header.html
114 114
              </tr>
115 115
              <tr>
116 116
                <th align=right nowrap>[% 'Project Number' | $T8 %]</th>
117
                <td>[% L.select_tag('globalproject_id', L.options_for_select(ALL_PROJECTS, title='projectnumber', default=globalproject_id, with_empty=1)) %]</td>
117
                <td>[% L.select_tag('globalproject_id', ALL_PROJECTS, title_key = 'projectnumber', default = globalproject_id, with_empty = 1) %]</td>
118 118
              </tr>
119 119
     </table>
120 120
          </td>
......
142 142
          <td>[% L.input_tag('amount_' _ loop.count, LxERP.format_amount(row.amount, 2)) %]</td>
143 143
          <td>[% L.hidden_tag('tax_' _ loop.count, LxERP.format_tax(row.tax, 2)) %][% LxERP.format_amount(row.tax, 2) | html %]</td>
144 144
          <td>[% row.taxchart %]</td>
145
          <td>[% L.select_tag('project_id_' _ loop.count, L.options_for_select(ALL_PROJECTS, title='projectnumber', default=row.project_id, with_empty=1)) %]</td>
145
          <td>[% L.select_tag('project_id_' _ loop.count, ALL_PROJECTS, title_key = 'projectnumber', default = row.project_id, with_empty = 1) %]</td>
146 146
        </tr>
147 147
[%- END %]
148 148

  
......
245 245
         </td>
246 246
         <td>
247 247
  [%- IF row.changeable %]
248
          [% L.select_tag('paid_project_id_' _ loop.count, L.options_for_select(ALL_PROJECTS, title='projectnumber', default=row.paid_project_id, with_empty=1)) %]
248
          [% L.select_tag('paid_project_id_' _ loop.count, ALL_PROJECTS, title_key = 'projectnumber', default = row.paid_project_id, with_empty=1) %]
249 249
  [%- ELSE %]
250 250
          [% project_labels.${row.paid_project_id} | html %]
251 251
          <input type=hidden name="paid_project_id_[% loop.count %]" value='[% row.paid_project_id %]'>
templates/webpages/ar/search.html
52 52
     </tr>
53 53
     <tr>
54 54
      <th align="right">[% 'Employee' | $T8 %]</th>
55
      <td>[% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), style='width:250px') %]</td>
55
      <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style = 'width:250px') %]</td>
56 56
     </tr>
57 57
    <tr>
58 58
     <th align="right">[% 'Salesman' | $T8 %]</th>
59
     <td>[% L.select_tag('salesman_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), style='width:250px') %]</td>
59
     <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style = 'width:250px') %]</td>
60 60
     </tr>
61 61
     <tr>
62 62
      <th align=right nowrap>[% 'Transaction description' | $T8 %]</th>
templates/webpages/background_job/form.html
14 14

  
15 15
   <tr>
16 16
    <th align="right">[%- LxERP.t8('Execution type') %]</th>
17
    <td>[% L.select_tag("background_job.type", L.options_for_select([ [ 'once', LxERP.t8('one-time execution') ], [ 'interval', LxERP.t8('repeated execution') ] ],
18
                                                                    'default' => SELF.background_job.type)) %]</td>
17
    <td>
18
      [% L.select_tag('background_job.type', [
19
                [ 'once', LxERP.t8('one-time execution') ],
20
                [ 'interval', LxERP.t8('repeated execution') ]
21
              ],
22
              'default' = SELF.background_job.type) %]
23
    </td>
19 24
   </tr>
20 25

  
21 26
   <tr>
templates/webpages/bp/list_spool.html
77 77
[% L.submit_tag('action', LxERP.t8('Remove'), confirm=LxERP.t8('Are you sure you want to remove the marked entries from the queue?')) %]
78 78
[% L.submit_tag('action', LxERP.t8('Print')) %]
79 79

  
80
[% L.select_tag('printer', L.options_for_select(ALL_PRINTERS, title='printer_description')) %]
80
[% L.select_tag('printer', ALL_PRINTERS, title_key = 'printer_description') %]
81 81

  
82 82
</form>
83 83

  
templates/webpages/bp/search.html
30 30
[% IF show_accounts %]
31 31
  <tr>
32 32
    <th align=right>[% 'Account' | $T8 %]</th>
33
    <td colspan=3>[% L.select_tag('account', L.options_for_select(accounts, value_title_sub=\account_sub)) %]</td>
33
    <td colspan=3>[% L.select_tag('account', accounts, value_title_sub=\account_sub) %]</td>
34 34
  </tr>
35 35
[% END %]
36 36
[%- IF label.$type.invnumber %]
templates/webpages/csv_import/_form_customers_vendors.html
5 5
 <th align="right">[%- LxERP.t8('Target table') %]:</th>
6 6
 <td colspan="10">
7 7
  [% opts = [ [ 'customer', LxERP.t8('Customers') ], [ 'vendor', LxERP.t8('Vendors') ] ] %]
8
  [% L.select_tag('settings.table', L.options_for_select(opts, default => SELF.profile.get('table')), style => 'width: 300px') %]
8
  [% L.select_tag('settings.table', opts, default = SELF.profile.get('table'), style = 'width: 300px') %]
9 9
 </td>
10 10
</tr>
templates/webpages/csv_import/_form_parts.html
4 4
 <th align="right">[%- LxERP.t8('Parts with existing part numbers') %]:</th>
5 5
 <td colspan="10">
6 6
  [% opts = [ [ 'update_prices', LxERP.t8('Update prices of existing entries') ], [ 'insert_new', LxERP.t8('Insert with new part number') ], [ 'skip', LxERP.t8('Skip entry') ] ] %]
7
  [% L.select_tag('settings.article_number_policy', L.options_for_select(opts, default => SELF.profile.get('article_number_policy')), style => 'width: 300px') %]
7
  [% L.select_tag('settings.article_number_policy', opts, default = SELF.profile.get('article_number_policy'), style = 'width: 300px') %]
8 8
 </td>
9 9
</tr>
10 10

  
11 11
<tr>
12 12
 <th align="right">[%- LxERP.t8('Sellprice significant places') %]:</th>
13 13
 <td colspan="10">
14
  [% 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') %]
14
  [% L.select_tag('settings.sellprice_places', [ 0, 1, 2, 3, 4, 5 ], default = SELF.profile.get('sellprice_places')), style = 'width: 300px') %]
15 15
 </td>
16 16
</tr>
17 17

  
......
20 20
 <td colspan="10">
21 21
  [% L.input_tag('settings.sellprice_adjustment', LxERP.format_amount(SELF.profile.get('sellprice_adjustment')), size => "5") %]
22 22
  [% opts = [ [ 'percent', LxERP.t8('percental') ], [ 'absolute', LxERP.t8('absolute') ] ] %]
23
  [% L.select_tag('settings.sellprice_adjustment_type', L.options_for_select(opts, default => SELF.profile.get('sellprice_adjustment_type'))) %]
23
  [% L.select_tag('settings.sellprice_adjustment_type', opts, default = SELF.profile.get('sellprice_adjustment_type')) %]
24 24
 </td>
25 25
</tr>
26 26

  
......
28 28
 <th align="right">[%- LxERP.t8('Mark as shop article if column missing') %]:</th>
29 29
 <td colspan="10">
30 30
  [% opts = [ [ '1', LxERP.t8('yes') ], [ '0', LxERP.t8('no') ] ] %]
31
  [% L.select_tag('settings.shoparticle_if_missing', L.options_for_select(opts, default => SELF.profile.get('shoparticle_if_missing')), style => 'width: 300px') %]
31
  [% L.select_tag('settings.shoparticle_if_missing', opts, default = SELF.profile.get('shoparticle_if_missing'), style = 'width: 300px') %]
32 32
 </td>
33 33
</tr>
34 34

  
......
36 36
 <th align="right">[%- LxERP.t8('Type') %]:</th>
37 37
 <td colspan="10">
38 38
  [% opts = [ [ 'part', LxERP.t8('Parts') ], [ 'service', LxERP.t8('Services') ], [ 'mixed', LxERP.t8('Mixed (requires column "type")') ] ] %]
39
  [% L.select_tag('settings.parts_type', L.options_for_select(opts, default => SELF.profile.get('parts_type')), style => 'width: 300px') %]
39
  [% L.select_tag('settings.parts_type', opts, default = SELF.profile.get('parts_type'), style = 'width: 300px') %]
40 40
 </td>
41 41
</tr>
42 42

  
43 43
<tr>
44 44
 <th align="right" valign="top">[%- LxERP.t8('Default buchungsgruppe') %]:</th>
45 45
 <td colspan="10" valign="top">
46
  [% opts = L.options_for_select(SELF.all_buchungsgruppen, title => 'description', default => SELF.profile.get('default_buchungsgruppe')) %]
46
  [% opts = SELF.all_buchungsgruppen, title_key = 'description', default = SELF.profile.get('default_buchungsgruppe') %]
47 47
  [% L.select_tag('settings.default_buchungsgruppe', opts, style => 'width: 300px') %]
48 48
  <br>
49 49
  [% opts = [ [ 'never', LxERP.t8('Do not set default buchungsgruppe') ], [ 'all', LxERP.t8('Apply to all parts') ], [ 'missing', LxERP.t8('Apply to parts without buchungsgruppe') ] ] %]
50
  [% L.select_tag('settings.apply_buchungsgruppe', L.options_for_select(opts, default => SELF.profile.get('apply_buchungsgruppe')), style => 'width: 300px') %]
50
  [% L.select_tag('settings.apply_buchungsgruppe', opts, default = SELF.profile.get('apply_buchungsgruppe'), style = 'width: 300px') %]
51 51
 </td>
52 52
</tr>
53 53

  
54 54
<tr>
55 55
 <th align="right" valign="top">[%- LxERP.t8('Default unit') %]:</th>
56 56
 <td colspan="10" valign="top">
57
  [% opts = L.options_for_select(SELF.all_units, title => 'name', value => 'name', default => SELF.profile.get('default_unit')) %]
57
  [% opts = SELF.all_units, title_key = 'name', value_key = 'name', default = SELF.profile.get('default_unit')) %]
58 58
  [% L.select_tag('settings.default_unit', opts, style => 'width: 300px') %]
59 59
 </td>
60 60
</tr>
templates/webpages/csv_import/form.html
27 27
    <tr>
28 28
     <th align="right">[%- LxERP.t8('Existing profiles') %]:</th>
29 29
     <td>
30
      [% L.select_tag('profile.id', L.options_for_select(SELF.all_profiles, title => 'name', default => SELF.profile.id), style => 'width: 300px') %]
30
      [% L.select_tag('profile.id', SELF.all_profiles, title_key = 'name', default = SELF.profile.id, style = 'width: 300px') %]
31 31
     </td>
32 32
     <td>
33 33
      [% L.submit_tag('action_new', LxERP.t8('Load profile')) %]
......
103 103
   <tr>
104 104
    <th align="right">[%- LxERP.t8('Number Format') %]:</th>
105 105
    <td colspan="10">
106
     [% SET options = L.options_for_select([ '1.000,00', '1000,00', '1,000.00', '1000.00' ], default => SELF.profile.get('numberformat')) %]
107
     [% L.select_tag('settings.numberformat', options, style => 'width: 300px') %]
106
     [% L.select_tag('settings.numberformat', ['1.000,00', '1000,00', '1,000.00', '1000.00'], default = SELF.profile.get('numberformat'), style = 'width: 300px') %]
108 107
    </td>
109 108
   </tr>
110 109

  
111 110
   <tr>
112 111
    <th align="right">[%- LxERP.t8('Charset') %]:</th>
113
    <td colspan="10">[% L.select_tag('settings.charset', L.options_for_select(SELF.all_charsets, default => SELF.profile.get('charset')), style => 'width: 300px') %]</td>
112
    <td colspan="10">[% L.select_tag('settings.charset', SELF.all_charsets, default = SELF.profile.get('charset'), style = 'width: 300px') %]</td>
114 113
   </tr>
115 114

  
116 115
   <tr>
......
181 180
         [% opts = [ [ 'no_check',  LxERP.t8('Do not check for duplicates') ],
182 181
                     [ 'check_csv', LxERP.t8('Discard duplicate entries in CSV file') ],
183 182
                     [ 'check_db',  LxERP.t8('Discard entries with duplicates in database or CSV file') ] ] %]
184
         [% L.select_tag('settings.duplicates', L.options_for_select(opts, default => SELF.profile.get('duplicates')), style => 'width: 300px') %]
183
         [% L.select_tag('settings.duplicates', opts, default = SELF.profile.get('duplicates'), style = 'width: 300px') %]
185 184
       </td>
186 185
     </tr>
187 186
   [% END %]
......
244 243
    -->
245 244
 </script>
246 245
</body>
247
</html>
246
</html>
templates/webpages/ct/_contact.html
4 4
     <tr>
5 5
      <th align="left">[% 'Contacts' | $T8 %]</th>
6 6
      <td>
7
       [%- 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),
8
                        onchange => "\$('#contacts').load('ct.pl?action=get_contact&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&cp_id=' + \$('#cp_id').attr('value'))") %]
7
       [%- 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,
8
                        onchange = "\$('#contacts').load('ct.pl?action=get_contact&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&cp_id=' + \$('#cp_id').attr('value'))") %]
9 9
      </td>
10 10
     </tr>
11 11

  
......
23 23
      <th align="left" nowrap>[% 'Title' | $T8 %]</th>
24 24
      <td>
25 25
       <input id="cp_title" name="cp_title" size="40" maxlength="75" value="[% HTML.escape(cp_title) %]">&nbsp;
26
       [% L.select_tag('selected_cp_title', L.options_for_select(TITLES, with_empty => 1)) %]
26
       [% L.select_tag('selected_cp_title', TITLES, with_empty = 1) %]
27 27
      </td>
28 28
     </tr>
29 29

  
......
31 31
      <th align="left" nowrap>[% 'Department' | $T8 %]</th>
32 32
      <td>
33 33
       <input id="cp_abteilung" name="cp_abteilung" size="40" value="[% HTML.escape(cp_abteilung) %]">&nbsp;
34
       [% L.select_tag('selected_cp_abteilung', L.options_for_select(DEPARTMENT, with_empty => 1)) %]
34
       [% L.select_tag('selected_cp_abteilung', DEPARTMENT, with_empty = 1) %]
35 35
      </td>
36 36
     </tr>
37 37

  
templates/webpages/ct/_shipto.html
3 3
     <tr>
4 4
      <th align="right">[% 'Shipping Address' | $T8 %]</th>
5 5
      <td>
6
       [% 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')),
7
                       onchange => "\$('#shipto').load('ct.pl?action=get_shipto&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&shipto_id=' + this.value)") %]
6
       [% 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'),
7
                       onchange = "\$('#shipto').load('ct.pl?action=get_shipto&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&shipto_id=' + this.value)") %]
8 8
      </td>
9 9
     </tr>
10 10

  
templates/webpages/ct/form_header.html
215 215
      <td><input name="bic" size="10" maxlength="100" value="[% HTML.escape(bic) %]"></td>
216 216
      [%- IF ALL_CURRENCIES.size %]
217 217
        <th align="right">[% 'Currency' | $T8 %]</th>
218
        <td>[% L.select_tag('currency', L.options_for_select(ALL_CURRENCIES, default=currency, with_empty=1)) %]</td>
218
        <td>[% L.select_tag('currency', ALL_CURRENCIES, default = currency, with_empty = 1) %]</td>
219 219
      [%- END %]
220 220
     </tr>
221 221

  
......
279 279
      </td>
280 280
      [%- IF is_customer && !conf_vertreter %]
281 281
      <th align="right">[% 'Salesman' | $T8 %]</th>
282
      <td>[% L.select_tag('salesman_id', L.options_for_select(ALL_SALESMEN, default=salesman_id, with_empty=1, title='safe_name')) %]</td>
282
      <td>[% L.select_tag('salesman_id', ALL_SALESMEN, default = salesman_id, with_empty = 1, title_key = 'safe_name') %]</td>
283 283
      [%- END %]
284 284
     </tr>
285 285
    </table>
......
310 310
     <tr>
311 311
      <th align="right">[% 'Shipping Address' | $T8 %]</th>
312 312
      <td colspan="3">
313
       [% L.select_tag('delivery_id', L.options_for_select(SHIPTO_ALL, title_sub => \shipto_label, with_empty => 1),
314
                       onchange => "\$('#delivery').load('ct.pl?action=get_delivery&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&shipto_id=' + this.value)") %]
313
       [% L.select_tag('delivery_id', SHIPTO_ALL, title_sub = \shipto_label, with_empty = 1,
314
                       onchange = "\$('#delivery').load('ct.pl?action=get_delivery&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&shipto_id=' + this.value)") %]
315 315
      </td>
316 316
     </tr>
317 317

  
......
399 399
       <td>
400 400
        [% L.date_tag('FU_date', FU_date) %]
401 401
        [% 'for' | $T8 %]
402
        [% 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')) %]
402
        [% L.select_tag('FU_created_for_user', ALL_EMPLOYEES, default = (FU_created_for_user ? FU_created_for_user : USER.id), title='safe_name') %]
403 403
       </td>
404 404
      </tr>
405 405

  
templates/webpages/ct/search.html
1 1
[%- USE T8 %]
2
[%- USE L %]
2 3
[% USE HTML %]<body onload="fokus()">
3 4

  
4 5
 <form method="post" action="ct.pl" name="Form">
......
47 48
   <tr>
48 49
    <th align="right" nowrap>[% IF IS_CUSTOMER %][% 'Customer type' | $T8 %][% ELSE %][% 'Vendor type' | $T8 %][% END %]</th>
49 50
    <td>
50
     <select name="business_id"><option value=""></option>
51
      [% FOREACH bt = ALL_BUSINESS_TYPES %]<option value="[% HTML.escape(bt.id) %]">[% HTML.escape(bt.description) %]</option>[% END %]
52
     </select>
51
     [% L.select_tag('business_id', ALL_BUSINESS_TYPES, title_key = 'description', with_empty = 1) %]
53 52
    </td>
54 53
   </tr>
55 54
   [% END %]
templates/webpages/do/form_header.html
132 132
          [%- HTML.escape(row.cp_name) %][%- IF row.cp_abteilung %] ([% HTML.escape(row.cp_abteilung) %])[% END -%]
133 133
          [%- END %]
134 134
          [%- ELSE %]
135
            [% 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') %]
135
            [% L.select_tag('cp_id', ALL_CONTACTS, default = cp_id, value = 'cp_id', title = 'full_name_dep', with_empty = 1, style='width: 250px') %]
136 136
          [%- END %]
137 137
         </td>
138 138
        </tr>
......
154 154
          [%- END %]
155 155

  
156 156
          [%- ELSE %]
157
            [% 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') %]
157
            [% L.select_tag('shipto_id', ALL_SHIPTO, default = shipto_id, value = 'shipto_id', title = 'displayable_id', with_empty = 1, class = 'fixed_width') %]
158 158
          [%- END %]
159 159
         </td>
160 160
        </tr>
......
185 185
          [% IF ( delivered ) %]
186 186
            [% L.hidden_tag('department_id', department_id) %]
187 187
          [% END %]
188
          [% L.select_tag('department_id', L.options_for_select(ALL_DEPARTMENTS, default=department_id, title="description", with_empty=1), style='width: 250px', disabled => delivered )%]
188
          [% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title = 'description', with_empty = 1, style = 'width: 250px', disabled = delivered )%]
189 189
       </td>
190 190
       </tr>
191 191
       [%- END %]
......
246 246
         [% IF row.id == employee_id %][%- IF row.name %][%- HTML.escape(row.name) %][%- ELSE %][% HTML.escape(row.login) %][%- END %][% END %]
247 247
         [%- END %]
248 248
         [%- ELSE %]
249
           [% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, default=employee_id, title='safe_name')) %]
249
           [% L.select_tag('employee_id', ALL_EMPLOYEES, default = employee_id, title = 'safe_name') %]
250 250
         [%- END %]
251 251
        </td>
252 252
       </tr>
......
266 266
         [% IF row.id == the_salesman_id %][%- IF row.name %][%- HTML.escape(row.name) %][%- ELSE %][% HTML.escape(row.login) %][%- END %][% END %]
267 267
         [%- END %]
268 268
         [%- ELSE %]
269
          [% L.select_tag('salesman_id', L.options_for_select(ALL_SALESMEN, default=(salesman_id ? salesman_id : employee_id), title='safe_name')) %]
269
          [% L.select_tag('salesman_id', ALL_SALESMEN, default = (salesman_id ? salesman_id : employee_id), title = 'safe_name') %]
270 270
         [%- END %]
271 271
        </td>
272 272
       </tr>
templates/webpages/do/search.html
71 71

  
72 72
    <tr>
73 73
     <th align="right">[% 'Employee' | $T8 %]</th>
74
     <td>[% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), class='fixed_width') %]</td>
74
     <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, class = 'fixed_width') %]</td>
75 75
    </tr>
76 76

  
77 77
    [%- IF is_customer %]
78 78
    <tr>
79 79
     <th align="right">[% 'Salesman' | $T8 %]</th>
80
     <td>[% L.select_tag('salesman_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), class='fixed_width') %]</td>
80
     <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, class = 'fixed_width') %]</td>
81 81
    </tr>
82 82
    [%- END %]
83 83

  
templates/webpages/dunning/search.html
93 93
      </tr>
94 94
      <tr>
95 95
       <th align="right">[% 'Salesman' | $T8 %]</th>
96
       <td>[% L.select_tag('salesman_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), style='width:250px') %]</td>
96
       <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1, style = 'width:250px') %]</td>
97 97
      </tr>
98 98
     </table>
99 99
    </td>
templates/webpages/gl/search.html
25 25
        [%- IF all_departments %]
26 26
        <tr>
27 27
          <th align=right nowrap>[% 'Department' | $T8 %]</th>
28
          <td colspan=3>[% L.select_tag('department', L.options_for_select(all_departments, value_title_sub=\department_label, with_empty=1)) %]</td>
28
          <td colspan=3>[% L.select_tag('department', all_departments, value_title_sub = \department_label, with_empty = 1) %]</td>
29 29
        </tr>
30 30
        [%- END %]
31 31
        <tr>
......
40 40
        </tr>
41 41
        <tr>
42 42
          <th align=right>[% 'Project Number' | $T8 %]</th>
43
          <td colspan=3>[% L.select_tag('project_id', L.options_for_select(ALL_PROJECTS, title='projectnumber', with_empty=1)) %]</td>
43
          <td colspan=3>[% L.select_tag('project_id', ALL_PROJECTS, title_key = 'projectnumber', with_empty = 1) %]</td>
44 44
        </tr>
45 45
 <tr>
46 46
    <th align=right>[% 'Employee' | $T8 %]</th>
47
    <td colspan=3>[% L.select_tag('employee', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1)) %]</td>
47
    <td colspan=3>[% L.select_tag('employee', ALL_EMPLOYEES, title_key = 'safe_name', with_empty = 1) %]</td>
48 48
  </tr>
49 49
  <tr>
50 50
    <th align=right>[% 'Filter date by' | $T8 %]</th>
templates/webpages/io/ship_to.html
57 57
    <th align="right" nowrap>[% LxERP.t8('Gender') %]</th>
58 58
    <td></td>
59 59
    <td>
60
     [% L.select_tag("shiptocp_gender", L.options_for_select([ [ "m", LxERP.t8("male") ], [ "f", LxERP.t8("female") ] ], "default", shiptocp_gender)) %]
60
     [% L.select_tag('shiptocp_gender', [ [ 'm', LxERP.t8('male') ], [ 'f', LxERP.t8('female') ] ], 'default' = shiptocp_gender) %]
61 61
    </td>
62 62
   </tr>
63 63
   <tr>
templates/webpages/ir/form_header.html
54 54
        <tr>
55 55
          <th align="right">[% 'Contact Person' | $T8 %]</th>
56 56
          <td>
57
            [% 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') %]
57
            [% 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') %]
58 58
          </td>
59 59
        </tr>
60 60
[%- END %]
......
125 125
      <table>
126 126
        <tr>
127 127
          <th align="right">[% 'Employee' | $T8 %]</th>
128
          <td>[% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, default=employee_id, title='safe_name')) %]</td>
128
          <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, default = employee_id, title_key = 'safe_name') %]</td>
129 129
        </tr>
130 130

  
131 131
[%- IF is_type_credit_note %]
templates/webpages/is/form_header.html
55 55
        <tr>
56 56
          <th align="right">[% 'Contact Person' | $T8 %]</th>
57 57
          <td>
58
            [% 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') %]
58
            [% 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') %]
59 59
          </td>
60 60
        </tr>
61 61
[%- END %]
......
63 63
        <tr>
64 64
          <th align="right">[% 'Shipping Address' | $T8 %]</th>
65 65
          <td>
66
            [% 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();") %]
66
            [% 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();") %]
67 67
          </td>
68 68
        </tr>
69 69
[%- END %]
......
98 98
        <tr>
99 99
          <th align="right">[% 'Steuersatz' | $T8 %]</th>
100 100
          <td>
101
            [% 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();") %]
101
            [% 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();") %]
102 102
  [%- IF id %]
103 103
          <input type='hidden' name='taxzone_id' value='[% taxzone_id %]'>
104 104
  [%- END %]
......
108 108
        <tr>
109 109
          <th align="right" nowrap>[% 'Department' | $T8 %]</th>
110 110
          <td colspan="3">
111
            [% L.select_tag('department_id', L.options_for_select(all_departments, default=department_id, title_sub=\department_labels, with_empty=1), style='width:250px') %]
111
            [% L.select_tag('department_id', all_departments, default = department_id, title_sub = \department_labels, with_empty = 1, style = 'width:250px') %]
112 112
          </td>
113 113
        </tr>
114 114
[%- END %]
......
155 155
        <tr>
156 156
          <th align="right">[% 'Employee' | $T8 %]</th>
157 157
          <td>
158
            [% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, default=employee_id, title='safe_name')) %]
158
            [% L.select_tag('employee_id', ALL_EMPLOYEES, default = employee_id, title_key = 'safe_name') %]
159 159
          </td>
160 160
        </tr>
161 161
[%- IF ALL_SALESMEN.size %]
162 162
        <tr>
163 163
          <th align="right">[% 'Salesman' | $T8 %]</th>
164 164
          <td>
165
            [% L.select_tag('salesman_id', L.options_for_select(ALL_SALESMEN, default=(salesman_id ? salesman_id : employee_id), title='safe_name')) %]
165
            [% L.select_tag('salesman_id', ALL_SALESMEN, default = (salesman_id ? salesman_id : employee_id), title_key = 'safe_name') %]
166 166
          </td>
167 167
        </tr>
168 168
[%- END %]
......
226 226
        <tr>
227 227
          <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
228 228
          <td>
229
            [%- 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();") %]
229
            [%- L.select_tag('globalproject_id', ALL_PROJECTS, title='projectnumber', default = globalproject_id, with_empty = '1', onChange = "document.getElementById('update_button').click();") %]
230 230
          </td>
231 231
        </tr>
232 232
      </table>
templates/webpages/oe/edit_periodic_invoices_config.html
56 56
    <tr>
57 57
     <th align="right">[%- LxERP.t8('Record in') %]</th>
58 58
     <td valign="top">
59
      [% L.select_tag("ar_chart_id", L.options_for_select(AR, title => 'description', default => ar_chart_id)) %]
59
      [% L.select_tag("ar_chart_id", AR, title_key => 'description', default => ar_chart_id)) %]
60 60
     </td>
61 61
    </tr>
62 62

  
......
70 70
    <tr>
71 71
     <th align="right">[%- LxERP.t8('Printer') %]</th>
72 72
     <td valign="top">
73
      [% L.select_tag("printer_id", L.options_for_select(ALL_PRINTERS, title => 'printer_description', default => printer_id), disabled => !print) %]
73
      [% L.select_tag("printer_id", ALL_PRINTERS, title_key = 'printer_description', default = printer_id, disabled = !print) %]
74 74
     </td>
75 75
    </tr>
76 76

  
templates/webpages/oe/form_header.html
57 57
                  <tr>
58 58
                    <th align="right">[% 'Contact Person' | $T8 %]</th>
59 59
                    <td>
60
                      [% 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') %]
60
                      [% 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') %]
61 61
                    </td>
62 62
                  </tr>
63 63
[%- END %]
......
65 65
                  <tr>
66 66
                    <th align="right">[% 'Shipping Address' | $T8 %]</th>
67 67
                    <td>
68
                      [% 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();") %]
68
                      [% 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();") %]
69 69
                    </td>
70 70
                  </tr>
71 71
[%- END %]
......
93 93
                  <tr>
94 94
                    <th align="right">[% 'Steuersatz' | $T8 %]</th>
95 95
                    <td>
96
                      [% L.select_tag('taxzone_id', L.options_for_select(ALL_TAXZONES, default=taxzone_id, title='description'), style='width: 250px') %]
96
                      [% L.select_tag('taxzone_id', ALL_TAXZONES, default=taxzone_id, title_key='description', style='width: 250px') %]
97 97
                    </td>
98 98
                  </tr>
99 99
[%- IF ALL_DEPARTMENTS %]
100 100
                  <tr>
101 101
                    <th align="right" nowrap>[% 'Department' | $T8 %]</th>
102 102
                    <td colspan="3">
103
                      [% L.select_tag('department_id', L.options_for_select(ALL_DEPARTMENTS, default=department_id, title_sub=\department_labels, with_empty=1), style='width:250px') %]
103
                      [% L.select_tag('department_id', ALL_DEPARTMENTS, default=department_id, title_sub=\department_labels, with_empty=1, style='width:250px') %]
104 104
                    </td>
105 105
                  </tr>
106 106
[%- END %]
......
164 164
                  <tr>
165 165
                    <th align="right">[% 'Employee' | $T8 %]</th>
166 166
                    <td>
167
                      [% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, default=employee_id, title='safe_name')) %]
167
                      [% L.select_tag('employee_id', ALL_EMPLOYEES, default=employee_id, title_key='safe_name') %]
168 168
                    </td>
169 169
                  </tr>
170 170
[%- IF is_sales and ALL_SALESMEN.size %]
171 171
                  <tr>
172 172
                    <th align="right">[% 'Salesman' | $T8 %]</th>
173 173
                    <td>
174
                      [% L.select_tag('salesman_id', L.options_for_select(ALL_SALESMEN, default=(salesman_id ? salesman_id : employee_id), title='safe_name')) %]
174
                      [% L.select_tag('salesman_id', ALL_SALESMEN, default=(salesman_id ? salesman_id : employee_id), title_key='safe_name') %]
175 175
                    </td>
176 176
                  </tr>
177 177
[%- END %]
......
220 220
                  <tr>
221 221
                    <th width="70%" align="right" nowrap>[% 'Project Number' | $T8 %]</th>
222 222
                    <td>
223
                      [%- 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();") %]
223
                      [%- L.select_tag('globalproject_id', ALL_PROJECTS, title_key='projectnumber', default=globalproject_id, with_empty='1', onChange="document.getElementById('update_button').click();") %]
224 224
                    </td>
225 225
                  </tr>
226 226
                </table>
templates/webpages/oe/search.html
54 54
    </tr>
55 55
    <tr>
56 56
     <th align="right">[% 'Employee' | $T8 %]</th>
57
     <td>[% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), style='width:250px') %]</td>
57
     <td>[% L.select_tag('employee_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style='width:250px') %]</td>
58 58
    </tr>
59 59
    <tr>
60 60
     <th align="right">[% 'Salesman' | $T8 %]</th>
61
     <td>[% L.select_tag('salesman_id', L.options_for_select(ALL_EMPLOYEES, title='safe_name', with_empty=1), style='width:250px') %]</td>
61
     <td>[% L.select_tag('salesman_id', ALL_EMPLOYEES, title_key='safe_name', with_empty=1, style='width:250px') %]</td>
62 62
    </tr>
63 63
    <tr>
64 64
     <th align="right">[% 'Transaction description' | $T8 %]</th>
templates/webpages/rc/step1.html
11 11
<table>
12 12
  <tr>
13 13
    <th align=right nowrap>[% 'Account' | $T8 %]</th>
14
    <td colspan=3>[% L.select_tag('accno', L.options_for_select(PR, value_title_sub=\selection_sub)) %]</td>
14
    <td colspan=3>[% L.select_tag('accno', PR, value_title_sub=\selection_sub) %]</td>
15 15
  </tr>
16 16
  <tr>
17 17
    <th align=right>[% 'From' | $T8 %]</th>
templates/webpages/rp/report.html
70 70
[%- BLOCK projectnumber %]
71 71
  <tr>
72 72
    <th align=right nowrap>[% 'Project' | $T8 %]</th>
73
    <td colspan=3>[% L.select_tag('project_id', L.options_for_select(ALL_PROJECTS, title='projectnumber', with_empty=1)) %]</td>
73
    <td colspan=3>[% L.select_tag('project_id', ALL_PROJECTS, title_key = 'projectnumber', with_empty = 1) %]</td>
74 74
  </tr>
75 75
[%- END %]
76 76

  

Auch abrufbar als: Unified diff