$config->{precision} = $1 if ($config->{options} =~ m/precision=(\d+)/i);
}
+
+ $self->_unpack_flags($config);
}
$main::lxdebug->leave_sub();
my $config = selectfirst_hashref_query($form, $dbh, $query, conv_i($params{id})) || { };
+ $self->_unpack_flags($config);
+
$main::lxdebug->leave_sub();
return $config;
}
+sub _unpack_flags {
+ $main::lxdebug->enter_sub();
+
+ my $self = shift;
+ my $config = shift;
+
+ foreach my $flag (split m/:/, $config->{flags}) {
+ if ($flag =~ m/(.*?)=(.*)/) {
+ $config->{"flag_${1}"} = $2;
+ } else {
+ $config->{"flag_${flag}"} = 1;
+ }
+ }
+
+ $main::lxdebug->leave_sub();
+}
+
sub save_config {
$main::lxdebug->enter_sub();
qq|SELECT text_value, timestamp_value, timestamp_value::date AS date_value, number_value, bool_value
FROM custom_variables
WHERE (config_id = ?) AND (trans_id = ?)|;
+ $q_var .= qq| AND (sub_module = ?)| if $params{sub_module};
my $h_var = prepare_query($form, $dbh, $q_var);
my $custom_variables = selectall_hashref_query($form, $dbh, $q_cfg, $params{module});
my $act_var;
if ($params{trans_id}) {
- do_statement($form, $h_var, $q_var, conv_i($cvar->{id}), conv_i($params{trans_id}));
+ my @values = (conv_i($cvar->{id}), conv_i($params{trans_id}));
+ push @values, $params{sub_module} if $params{sub_module};
+
+ do_statement($form, $h_var, $q_var, @values);
$act_var = $h_var->fetchrow_hashref();
}
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
- my @configs = grep { $_->{module} eq $params{module} } @{ CVar->get_configs() };
+ my @configs = $params{configs} ? @{ $params{configs} } : grep { $_->{module} eq $params{module} } @{ CVar->get_configs() };
my $query =
qq|DELETE FROM custom_variables
AND (config_id IN (SELECT DISTINCT id
FROM custom_variable_configs
WHERE module = ?))|;
- do_query($form, $dbh, $query, conv_i($params{trans_id}), $params{module});
+ my @values = (conv_i($params{trans_id}), $params{module});
+
+ if ($params{sub_module}) {
+ $query .= qq| AND (sub_module = ?)|;
+ push @values, $params{sub_module};
+ }
+
+ do_query($form, $dbh, $query, @values);
$query =
- qq|INSERT INTO custom_variables (config_id, trans_id, bool_value, timestamp_value, text_value, number_value)
- VALUES (?, ?, ?, ?, ?, ?)|;
+ qq|INSERT INTO custom_variables (config_id, sub_module, trans_id, bool_value, timestamp_value, text_value, number_value)
+ VALUES (?, ?, ?, ?, ?, ?, ?)|;
my $sth = prepare_query($form, $dbh, $query);
foreach my $config (@configs) {
- my @values = (conv_i($config->{id}), conv_i($params{trans_id}));
+ my @values = (conv_i($config->{id}), "$params{sub_module}", conv_i($params{trans_id}));
- my $value = $params{variables}->{"cvar_$config->{name}"};
+ my $value = $params{variables}->{"$params{name_prefix}cvar_$config->{name}$params{name_postfix}"};
if (($config->{type} eq 'text') || ($config->{type} eq 'textfield') || ($config->{type} eq 'select')) {
push @values, undef, undef, $value, undef;
my $myconfig = \%main::myconfig;
my $form = $main::form;
+ my %options = ( name_prefix => "$params{name_prefix}",
+ name_postfix => "$params{name_postfix}",
+ hide_non_editable => $params{hide_non_editable},
+ );
+
foreach my $var (@{ $params{variables} }) {
- $var->{HTML_CODE} = $form->parse_html_template('amcvar/render_inputs', { 'var' => $var });
+ $var->{HTML_CODE} = $form->parse_html_template('amcvar/render_inputs', { 'var' => $var, %options });
}
$main::lxdebug->leave_sub();
}
if (@sub_where) {
+ push @sub_where, qq|cvar.sub_module = ?|;
+ push @sub_values, "$params{sub_module}";
+
push @where,
qq|$not EXISTS(
SELECT cvar.id
my $query =
qq|SELECT text_value, timestamp_value, timestamp_value::date AS date_value, number_value, bool_value, config_id
FROM custom_variables
- WHERE (config_id IN (| . join(', ', ('?') x scalar(@cfg_ids)) . qq|)) AND (trans_id = ?)|;
+ WHERE (config_id IN (| . join(', ', ('?') x scalar(@cfg_ids)) . qq|))
+ AND (trans_id = ?)
+ AND (sub_module = ?)|;
my $sth = prepare_query($form, $dbh, $query);
foreach my $row (@{ $params{data} }) {
- do_statement($form, $sth, $query, @cfg_ids, conv_i($row->{$params{trans_id_field}}));
+ do_statement($form, $sth, $query, @cfg_ids, conv_i($row->{$params{trans_id_field}}), "$params{sub_module}");
while (my $ref = $sth->fetchrow_hashref()) {
my $cfg = $cfg_map{$ref->{config_id}};
}
}
$sth->finish;
+
+ foreach my $item (@{ $form->{item_list} }) {
+ my $custom_variables = CVar->get_custom_variables(module => 'IC',
+ trans_id => $item->{id},
+ dbh => $dbh,
+ );
+
+ $main::lxdebug->dump(0, "cvar", $custom_variables);
+ map { $item->{"ic_cvar_" . $_->{name} } = $_->{value} } @{ $custom_variables };
+ }
+
+ $main::lxdebug->dump(0, "items", $form->{item_list});
+
$dbh->disconnect;
$main::lxdebug->leave_sub();
use List::Util qw(max first);
use SL::AM;
use SL::Common;
+use SL::CVar;
use SL::DBUtils;
use SL::IC;
my $all_units = AM->retrieve_units($myconfig, $form);
$form->{all_units} = $all_units;
+ my $ic_cvar_configs = CVar->get_configs(module => 'IC',
+ dbh => $dbh);
+
$form->{employee_id} = (split /--/, $form->{employee})[1] if !$form->{employee_id};
unless ($form->{employee_id}) {
$form->get_employee($dbh);
my $ml = ($form->{type} eq 'sales_order') ? 1 : -1;
if ($form->{id}) {
+ $query = qq|DELETE FROM custom_variables
+ WHERE (config_id IN (SELECT id FROM custom_variable_configs WHERE module = 'IC'))
+ AND (sub_module = 'orderitems')
+ AND (trans_id IN (SELECT id FROM orderitems WHERE trans_id = ?))|;
+ do_query($form, $dbh, $query, $form->{id});
$query = qq|DELETE FROM orderitems WHERE trans_id = ?|;
do_query($form, $dbh, $query, $form->{id});
$pricegroup_id *= 1;
# save detail record in orderitems table
+ my $orderitems_id = $form->{"orderitems_id_$i"};
+ ($orderitems_id) = selectfirst_array_query($form, $dbh, qq|SELECT nextval('orderitemsid')|) if (!$orderitems_id);
+
@values = ();
- $query = qq|INSERT INTO orderitems (|;
- if ($form->{"orderitems_id_$i"}) {
- $query .= "id, ";
- }
- $query .= qq|trans_id, parts_id, description, longdescription, qty, base_qty, | .
- qq|sellprice, discount, unit, reqdate, project_id, serialnumber, ship, | .
- qq|pricegroup_id, ordnumber, transdate, cusordnumber, subtotal, | .
- qq|marge_percent, marge_total, lastcost, price_factor_id, price_factor, marge_price_factor) | .
- qq|VALUES (|;
- if($form->{"orderitems_id_$i"}) {
- $query .= qq|?,|;
- push(@values, $form->{"orderitems_id_$i"});
- }
- $query .= qq|?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
- (SELECT factor FROM price_factors WHERE id = ?), ?)|;
+ $query = qq|INSERT INTO orderitems (
+ id, trans_id, parts_id, description, longdescription, qty, base_qty,
+ sellprice, discount, unit, reqdate, project_id, serialnumber, ship,
+ pricegroup_id, ordnumber, transdate, cusordnumber, subtotal,
+ marge_percent, marge_total, lastcost, price_factor_id, price_factor, marge_price_factor)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
+ (SELECT factor FROM price_factors WHERE id = ?), ?)|;
push(@values,
- conv_i($form->{id}), conv_i($form->{"id_$i"}),
+ conv_i($orderitems_id), conv_i($form->{id}), conv_i($form->{"id_$i"}),
$form->{"description_$i"}, $form->{"longdescription_$i"},
$form->{"qty_$i"}, $baseqty,
$fxsellprice, $form->{"discount_$i"},
$form->{"sellprice_$i"} = $fxsellprice;
$form->{"discount_$i"} *= 100;
+
+ CVar->save_custom_variables(module => 'IC',
+ sub_module => 'orderitems',
+ trans_id => $orderitems_id,
+ configs => $ic_cvar_configs,
+ variables => $form,
+ name_prefix => 'ic_',
+ name_postfix => "_$i",
+ dbh => $dbh);
}
}
my ($query, $query_add, @values, @ids, $sth);
+ my $ic_cvar_configs = CVar->get_configs(module => 'IC',
+ dbh => $dbh);
+
# translate the ids (given by id_# and trans_id_#) into one array of ids, so we can join them later
map {
push @ids, $form->{"trans_id_$_"}
$sth = prepare_execute_query($form, $dbh, $query, @values);
while ($ref = $sth->fetchrow_hashref(NAME_lc)) {
+ # Retrieve custom variables.
+ my $cvars = CVar->get_custom_variables(dbh => $dbh,
+ module => 'IC',
+ sub_module => 'orderitems',
+ trans_id => $ref->{orderitems_id},
+ );
+ # $main::lxdebug->dump(0, "cv", $cvars);
+ map { $ref->{"ic_cvar_$_->{name}"} = $_->{value} } @{ $cvars };
+
+ # Handle accounts.
if (!$ref->{"part_inventory_accno_id"}) {
map({ delete($ref->{$_}); } qw(inventory_accno inventory_new_chart inventory_valid));
}
}
chop $ref->{taxaccounts};
+
push @{ $form->{form_details} }, $ref;
$stw->finish;
}
IC->prepare_parts_for_printing();
+ my $ic_cvar_configs = CVar->get_configs(module => 'IC');
+
my @arrays =
qw(runningnumber number description longdescription qty ship unit bin
partnotes serialnumber reqdate sellprice listprice netprice
linetotal nodiscount_linetotal tax_rate projectnumber
price_factor price_factor_name partsgroup);
+ push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs };
+
my @tax_arrays = qw(taxbase tax taxdescription taxrate taxnumber);
$form->{TEMPLATE_ARRAYS} = { map { $_ => [] } (@arrays, @tax_arrays) };
$sth->finish;
}
+ map { push @{ $form->{TEMPLATE_ARRAYS}->{"ic_cvar_$_->{name}"} }, $form->{"ic_cvar_$_->{name}_$i"} } @{ $ic_cvar_configs };
}
}
foreach my $config (@configs) {
$config->{type_tr} = $translations{$config->{type}};
- foreach my $flag (split m/:/, $config->{flags}) {
- if ($flag =~ m/(.*?)=(.*)/) {
- $config->{"flag_${1}"} = $2;
- } else {
- $config->{"flag_${flag}"} = 1;
- }
- }
-
if ($previous_config) {
$previous_config->{next_id} = $config->{id};
$config->{previous_id} = $previous_config->{id};
# don't trample on previous variables
map { delete $form->{$_} } keys %newform;
+ my $ic_cvar_configs = CVar->get_configs(module => 'IC');
+ my @ic_cvar_fields = map { "cvar_$_->{name}" } @{ $ic_cvar_configs };
+
# now take it apart and restore original values
foreach my $item (split /&/, $previousform) {
my ($key, $value) = split m/=/, $item, 2;
# change/add values for assembly item
map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno price_factor_id);
+ map { $form->{"ic_${_}_$i"} = $newform{$_} } @ic_cvar_fields;
# das ist __voll__ bekloppt, dass so auszurechnen jb 22.5.09
#$form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"};
$form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice lastcost price_factor_id);
+ map { $form->{"ic_${_}_$i"} = $newform{$_} } @ic_cvar_fields;
$form->{"longdescription_$i"} = $newform{notes};
_update_part_information();
_update_ship() if ($is_s_p_order);
+ _update_custom_variables();
# rows
for $i (1 .. $numrows) {
$form->{invsubtotal} += $linetotal;
+ # Benutzerdefinierte Variablen für Waren/Dienstleistungen/Erzeugnisse
+ _render_custom_variables_inputs(ROW2 => \@ROW2, row => $i);
+
push @ROWS, { ROW1 => \@ROW1, ROW2 => \@ROW2, HIDDENS => \@HIDDENS, colspan => $colspan, error => $form->{"row_error_$i"}, };
}
print qq|</tr>|;
+ my @new_fields =
+ qw(bin listprice inventory_accno income_accno expense_accno unit weight
+ assembly taxaccounts partsgroup formel longdescription not_discountable
+ part_payment_id partnotes id lastcost price_factor_id price_factor);
+ push @new_fields, "lizenzen" if ($lizenzen);
+ push @new_fields, grep { m/^ic_cvar_/ } keys %{ $form->{item_list}->[0] };
+
my $i = 0;
foreach $ref (@{ $form->{item_list} }) {
$checked = ($i++) ? "" : "checked";
print("</tr>\n");
- my @new_fields =
- qw(bin listprice inventory_accno income_accno expense_accno unit weight
- assembly taxaccounts partsgroup formel longdescription not_discountable
- part_payment_id partnotes id lastcost price_factor_id price_factor);
- push(@new_fields, "lizenzen") if ($lizenzen);
-
print join "\n", map { $cgi->hidden("-name" => "new_${_}_$i", "-value" => $ref->{$_}) } @new_fields;
print "\n";
}
partsgroup formel longdescription not_discountable partnotes lastcost
price_factor_id price_factor);
+ my $ic_cvar_configs = CVar->get_configs(module => 'IC');
+ push @new_fields, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs };
+
map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } @new_fields;
$form->{"marge_price_factor_$i"} = $form->{"new_price_factor_$j"};
my @a = ();
my $count = 0;
- my @flds = qw(id partnumber description qty ship sellprice unit
- discount inventory_accno income_accno expense_accno listprice
- taxaccounts bin assembly weight projectnumber project_id
- oldprojectnumber runningnumber serialnumber partsgroup payment_id
- not_discountable shop ve gv buchungsgruppen_id language_values
- sellprice_pg pricegroup_old price_old price_new unit_old ordnumber
- transdate longdescription basefactor marge_total marge_percent
- marge_price_factor lastcost price_factor_id partnotes
- stock_out stock_in);
-
# remove any makes or model rows
if ($form->{item} eq 'part') {
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(listprice sellprice rop stock);
- @flds =
- qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup lastcost);
+ my @flds = qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup lastcost);
for my $i (1 .. ($form->{assembly_rows} - 1)) {
if ($form->{"qty_$i"}) {
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(listprice sellprice lastcost);
} else {
+ my @flds = qw(id partnumber description qty ship sellprice unit
+ discount inventory_accno income_accno expense_accno listprice
+ taxaccounts bin assembly weight projectnumber project_id
+ oldprojectnumber runningnumber serialnumber partsgroup payment_id
+ not_discountable shop ve gv buchungsgruppen_id language_values
+ sellprice_pg pricegroup_old price_old price_new unit_old ordnumber
+ transdate longdescription basefactor marge_total marge_percent
+ marge_price_factor lastcost price_factor_id partnotes
+ stock_out stock_in);
+
+ my $ic_cvar_configs = CVar->get_configs(module => 'IC');
+ push @flds, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs };
# this section applies to invoices and orders
# remove any empty numbers
$lxdebug->leave_sub();
}
+
+sub _update_custom_variables {
+ $lxdebug->enter_sub();
+
+ $form->{CVAR_CONFIGS} ||= { };
+ $form->{CVAR_CONFIGS}->{IC} = CVar->get_configs(module => 'IC');
+
+ $lxdebug->leave_sub();
+}
+
+sub _render_custom_variables_inputs {
+ $lxdebug->enter_sub();
+
+ my %params = @_;
+
+ if (!$form->{CVAR_CONFIGS}->{IC}) {
+ $lxdebug->leave_sub();
+ return;
+ }
+
+ foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) {
+ $cvar->{value} = $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"};
+ }
+
+ CVar->render_inputs(hide_non_editable => 1,
+ variables => $form->{CVAR_CONFIGS}->{IC},
+ name_prefix => 'ic_',
+ name_postfix => "_$params{row}");
+
+ my $num_visible_cvars = 0;
+ foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) {
+ my $description = '';
+ if ($cvar->{flag_editable}) {
+ $num_visible_cvars++;
+ $description = $cvar->{description} . ' ';
+ }
+
+ push @{ $params{ROW2} }, { line_break => $num_visible_cvars == 1,
+ value => $description . $cvar->{HTML_CODE},
+ };
+ }
+
+ $lxdebug->leave_sub();
+}
'NTI' => 'NTI',
'Q' => 'Q',
'_check_io_auth' => '_check_io_auth',
+ '_render_custom_variables_inputs' => '_render_custom_variables_inputs',
+ '_update_custom_variables' => '_update_custom_variables',
'_update_part_information' => '_update_part_information',
'_update_ship' => '_update_ship',
'add' => 'add',
'NTI' => 'NTI',
'Q' => 'Q',
'_check_io_auth' => '_check_io_auth',
+ '_render_custom_variables_inputs' => '_render_custom_variables_inputs',
+ '_update_custom_variables' => '_update_custom_variables',
'_update_part_information' => '_update_part_information',
'_update_ship' => '_update_ship',
'add' => 'add',
'NTI' => 'NTI',
'Q' => 'Q',
'_check_io_auth' => '_check_io_auth',
+ '_render_custom_variables_inputs' => '_render_custom_variables_inputs',
+ '_update_custom_variables' => '_update_custom_variables',
'_update_part_information' => '_update_part_information',
'_update_ship' => '_update_ship',
'add' => 'add',
'NTI' => 'NTI',
'Q' => 'Q',
'_check_io_auth' => '_check_io_auth',
+ '_render_custom_variables_inputs' => '_render_custom_variables_inputs',
+ '_update_custom_variables' => '_update_custom_variables',
'_update_part_information' => '_update_part_information',
'_update_ship' => '_update_ship',
'ap_transaction' => 'ap_transaction',
'NTI' => 'NTI',
'Q' => 'Q',
'_check_io_auth' => '_check_io_auth',
+ '_render_custom_variables_inputs' => '_render_custom_variables_inputs',
+ '_update_custom_variables' => '_update_custom_variables',
'_update_part_information' => '_update_part_information',
'_update_ship' => '_update_ship',
'add' => 'add',
'NTI' => 'NTI',
'Q' => 'Q',
'_check_io_auth' => '_check_io_auth',
+ '_render_custom_variables_inputs' => '_render_custom_variables_inputs',
+ '_update_custom_variables' => '_update_custom_variables',
'_update_part_information' => '_update_part_information',
'_update_ship' => '_update_ship',
'add' => 'add',
'Q' => 'Q',
'_check_io_auth' => '_check_io_auth',
'_collect_links' => '_collect_links',
+ '_render_custom_variables_inputs' => '_render_custom_variables_inputs',
+ '_update_custom_variables' => '_update_custom_variables',
'_update_part_information' => '_update_part_information',
'_update_ship' => '_update_ship',
'add' => 'add',
'NTI' => 'NTI',
'Q' => 'Q',
'_check_io_auth' => '_check_io_auth',
+ '_render_custom_variables_inputs' => '_render_custom_variables_inputs',
+ '_update_custom_variables' => '_update_custom_variables',
'_update_part_information' => '_update_part_information',
'_update_ship' => '_update_ship',
'add' => 'add',
'Q' => 'Q',
'_check_io_auth' => '_check_io_auth',
'_collect_links' => '_collect_links',
+ '_render_custom_variables_inputs' => '_render_custom_variables_inputs',
+ '_update_custom_variables' => '_update_custom_variables',
'_update_part_information' => '_update_part_information',
'_update_ship' => '_update_ship',
'add' => 'add',
-- @description: Benutzerdefinierte Variablen für Waren, Dienstleistungen, Erzeugnisse.
-- @depends: release_2_6_0
ALTER TABLE custom_variable_configs ADD COLUMN flags text;
+ALTER TABLE custom_variables ADD COLUMN sub_module text;
+UPDATE custom_variables SET sub_module = '';
[% USE HTML %]
-[%- IF var.type == 'bool' %]
-<input type="checkbox" name="cvar_[% HTML.escape(var.name) %]" value="1"[% IF var.value %] checked[% END %]>
+[%- SET var_name = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) -%]
+
+[%- IF hide_non_editable && !var.flag_editable %]
+<input type="hidden" name="[% var_name %]" value="[% HTML.escape(var.value) %]">
+
+[%- ELSIF var.type == 'bool' %]
+<input type="checkbox" name="[% var_name %]" value="1"[% IF var.value %] checked[% END %]>
[%- ELSIF var.type == 'textfield' %]
-<textarea name="cvar_[% HTML.escape(var.name) %]" cols="[% HTML.escape(var.width) %]" rows="[% HTML.escape(var.height) %]">[% HTML.escape(var.value) %]</textarea>
+<textarea name="[% var_name %]" cols="[% HTML.escape(var.width) %]" rows="[% HTML.escape(var.height) %]">[% HTML.escape(var.value) %]</textarea>
[%- ELSIF var.type == 'date' %]
-<input name="cvar_[% HTML.escape(var.name) %]" id="cvar_[% HTML.escape(var.name) %]" size="12" value="[% HTML.escape(var.value) %]">
-<input type="button" name="cvar_[% HTML.escape(var.name) %]_button" id="cvar_[% HTML.escape(var.name) %]_trigger" value="?">
+<input name="[% var_name %]" id="[% var_name %]" size="12" value="[% HTML.escape(var.value) %]">
+<input name="[% var_name %]_button" id="[% var_name %]_trigger" type="button" value="?">
<script type="text/javascript">
<!--
- Calendar.setup({ inputField : "cvar_[% HTML.escape(var.name) %]",
- ifFormat :"[% myconfig_jsc_dateformat %]",
+ Calendar.setup({ inputField : "[% var_name %]",
+ ifFormat : "[% myconfig_jsc_dateformat %]",
align : "BR",
- button : "cvar_[% HTML.escape(var.name) %]_trigger" });
+ button : "[% var_name %]_trigger" });
-->
</script>
[%- ELSIF var.type == 'timestamp' %]
-<input name="cvar_[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]">
+<input name="[% var_name %]" value="[% HTML.escape(var.value) %]">
[%- ELSIF var.type == 'select' %]
-<select name="cvar_[% HTML.escape(var.name) %]">
+<select name="[% var_name %]">
[%- FOREACH option = var.OPTIONS %]
<option[% IF option.value == var.value %] selected[% END %]>[% HTML.escape(option.value) %]</option>
[%- END %]
</select>
[%- ELSE %]
-<input name="cvar_[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]"[% IF var.maxlength %]maxlength="[% HTML.escape(var.maxlength) %]"[% END %]>
+<input name="[% var_name %]" value="[% HTML.escape(var.value) %]" [%- IF var.maxlength %] maxlength="[% HTML.escape(var.maxlength) %]"[% END -%]>
[%- END %]
[% USE HTML %]
-[%- IF var.type == 'bool' %]
-<input type="checkbox" name="cvar_[% HTML.escape(var.name) %]" value="1"[% IF var.value %] checked[% END %]>
+[%- SET var_name = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) -%]
+
+[%- IF hide_non_editable && !var.flag_editable %]
+<input type="hidden" name="[% var_name %]" value="[% HTML.escape(var.value) %]">
+
+[%- ELSIF var.type == 'bool' %]
+<input type="checkbox" name="[% var_name %]" value="1"[% IF var.value %] checked[% END %]>
[%- ELSIF var.type == 'textfield' %]
-<textarea name="cvar_[% HTML.escape(var.name) %]" cols="[% HTML.escape(var.width) %]" rows="[% HTML.escape(var.height) %]">[% HTML.escape(var.value) %]</textarea>
+<textarea name="[% var_name %]" cols="[% HTML.escape(var.width) %]" rows="[% HTML.escape(var.height) %]">[% HTML.escape(var.value) %]</textarea>
[%- ELSIF var.type == 'date' %]
-<input name="cvar_[% HTML.escape(var.name) %]" id="cvar_[% HTML.escape(var.name) %]" size="12" value="[% HTML.escape(var.value) %]">
-<input type="button" name="cvar_[% HTML.escape(var.name) %]_button" id="cvar_[% HTML.escape(var.name) %]_trigger" value="?">
+<input name="[% var_name %]" id="[% var_name %]" size="12" value="[% HTML.escape(var.value) %]">
+<input name="[% var_name %]_button" id="[% var_name %]_trigger" type="button" value="?">
<script type="text/javascript">
<!--
- Calendar.setup({ inputField : "cvar_[% HTML.escape(var.name) %]",
- ifFormat :"[% myconfig_jsc_dateformat %]",
+ Calendar.setup({ inputField : "[% var_name %]",
+ ifFormat : "[% myconfig_jsc_dateformat %]",
align : "BR",
- button : "cvar_[% HTML.escape(var.name) %]_trigger" });
+ button : "[% var_name %]_trigger" });
-->
</script>
[%- ELSIF var.type == 'timestamp' %]
-<input name="cvar_[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]">
+<input name="[% var_name %]" value="[% HTML.escape(var.value) %]">
[%- ELSIF var.type == 'select' %]
-<select name="cvar_[% HTML.escape(var.name) %]">
+<select name="[% var_name %]">
[%- FOREACH option = var.OPTIONS %]
<option[% IF option.value == var.value %] selected[% END %]>[% HTML.escape(option.value) %]</option>
[%- END %]
</select>
[%- ELSE %]
-<input name="cvar_[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]"[% IF var.maxlength %]maxlength="[% HTML.escape(var.maxlength) %]"[% END %]>
+<input name="[% var_name %]" value="[% HTML.escape(var.value) %]" [%- IF var.maxlength %] maxlength="[% HTML.escape(var.maxlength) %]"[% END -%]>
[%- END %]
[% END %]
<tr class="listrow[% loop.count % 2 %]" [% UNLESS show_details %]style="display:none;"[% END %]><td colspan="[% row.colspan %]">[% FOREACH row2 = row.ROW2 %]
+ [% IF row2.line_break %]<br/>[% END %]
[% row2.value %][% END %]
</td></tr>
[% END %]
[% END %]
<tr class="listrow[% loop.count % 2 %]" [% UNLESS show_details %]style="display:none;"[% END %]><td colspan="[% row.colspan %]">[% FOREACH row2 = row.ROW2 %]
+ [% IF row2.line_break %]<br/>[% END %]
[% row2.value %][% END %]
</td></tr>
[% END %]