my %options = ( name_prefix => "$params{name_prefix}",
name_postfix => "$params{name_postfix}",
hide_non_editable => $params{hide_non_editable},
+ show_disabled_message => $params{show_disabled_message},
);
foreach my $var (@{ $params{variables} }) {
- $var->{HTML_CODE} = $form->parse_html_template('amcvar/render_inputs', { 'var' => $var, %options });
- $var->{VALID_BOX} = "<input type=checkbox name='$options{name_prefix}cvar_$var->{name}$options{name_postfix}_valid'@{[$var->{valid} ? ' checked' : '']}>";
+ $var->{HTML_CODE} = $form->parse_html_template('amcvar/render_inputs', { var => $var, %options });
+ $var->{VALID_BOX} = $form->parse_html_template('amcvar/render_checkboxes', { var => $var, %options });
}
$main::lxdebug->leave_sub();
$form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'IC', 'trans_id' => $form->{id});
- CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}) if (scalar @{ $form->{CUSTOM_VARIABLES} });
+ CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}, show_disabled_message => 1)
+ if (scalar @{ $form->{CUSTOM_VARIABLES} });
$form->header;
#print $form->parse_html_template('ic/form_header', { ALL_PRICE_FACTORS => $form->{ALL_PRICE_FACTORS},
$form->{invsubtotal} += $linetotal;
# Benutzerdefinierte Variablen für Waren/Dienstleistungen/Erzeugnisse
- _render_custom_variables_inputs(ROW2 => \@ROW2, row => $i);
+ _render_custom_variables_inputs(ROW2 => \@ROW2, row => $i, part_id => $form->{"id_$i"});
push @ROWS, { ROW1 => \@ROW1, ROW2 => \@ROW2, HIDDENS => \@HIDDENS, colspan => $colspan, error => $form->{"row_error_$i"}, };
}
}
foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) {
+ $cvar->{valid} = $params{part_id}
+ ? CVar->get_custom_variables_validity(config_id => $cvar->{id}, trans_id => $params{part_id})
+ : $vcar->{valid};
+
$cvar->{value} = $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"};
}
my $num_visible_cvars = 0;
foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) {
my $description = '';
- if ($cvar->{flag_editable}) {
+ if ($cvar->{flag_editable} && $cvar->{valid}) {
$num_visible_cvars++;
$description = $cvar->{description} . ' ';
}
'Edit the stylesheet' => 'Stilvorlage bearbeiten',
'Edit units' => 'Einheiten bearbeiten',
'Editable' => 'Bearbeitbar',
+ 'Element disabled' => 'Element deaktiviert',
'Employee' => 'Bearbeiter',
'Empty transaction!' => 'Buchung ist leer!',
'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung für diesen Entwurf ein.',
--- /dev/null
+[%- USE HTML %]
+[%- SET var_valid = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) _ '_valid' -%]
+<input type=checkbox name='[% var_valid %]'[% IF var.valid %] checked[% END %]>
--- /dev/null
+[%- USE HTML %]
+[%- SET var_valid = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) _ '_valid' -%]
+<input type=checkbox name='[% var_valid %]'[% IF var.valid %] checked[% END %]>
[%- IF hide_non_editable && !var.flag_editable %]
<input type="hidden" name="[% var_name %]" value="[% HTML.escape(var.value) %]">
+[%- ELSIF !var.valid %]
+ [%- IF show_disabled_message %]
+<i>Element deaktiviert</i>
+ [%- END %]
+
[%- ELSIF var.type == 'bool' %]
<input type="checkbox" name="[% var_name %]" value="1"[% IF var.value %] checked[% END %]>
[%- IF hide_non_editable && !var.flag_editable %]
<input type="hidden" name="[% var_name %]" value="[% HTML.escape(var.value) %]">
+[%- ELSIF !var.valid %]
+ [%- IF show_disabled_message %]
+<i><translate>Element disabled</translate></i>
+ [%- END %]
+
[%- ELSIF var.type == 'bool' %]
<input type="checkbox" name="[% var_name %]" value="1"[% IF var.value %] checked[% END %]>