From: Sven Schöling Date: Wed, 30 Sep 2009 15:19:22 +0000 (+0200) Subject: Ungültige Custom Variablen in der Verkaufsmaske ausblenden. X-Git-Tag: release-2.6.1beta1~266 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=6988b41a11ed749448acbb44d3faf0ae15257ca3;p=kivitendo-erp.git Ungültige Custom Variablen in der Verkaufsmaske ausblenden. --- diff --git a/SL/CVar.pm b/SL/CVar.pm index 703bbfe3a..d50f2fa13 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -360,11 +360,12 @@ sub render_inputs { 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} = "{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(); diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 8cbb547f7..52d5c8be1 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1545,7 +1545,8 @@ sub form_header { $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}, diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 51326c4b1..dba4ce4d7 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -372,7 +372,7 @@ sub display_row { $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"}, }; } @@ -1980,6 +1980,10 @@ sub _render_custom_variables_inputs { } 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}"}; } @@ -1991,7 +1995,7 @@ sub _render_custom_variables_inputs { 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} . ' '; } diff --git a/locale/de/all b/locale/de/all index 881e3654e..b40c13a47 100644 --- a/locale/de/all +++ b/locale/de/all @@ -643,6 +643,7 @@ $self->{texts} = { '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.', diff --git a/templates/webpages/amcvar/render_checkboxes_de.html b/templates/webpages/amcvar/render_checkboxes_de.html new file mode 100644 index 000000000..3a703d8c3 --- /dev/null +++ b/templates/webpages/amcvar/render_checkboxes_de.html @@ -0,0 +1,3 @@ +[%- USE HTML %] +[%- SET var_valid = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) _ '_valid' -%] + diff --git a/templates/webpages/amcvar/render_checkboxes_master.html b/templates/webpages/amcvar/render_checkboxes_master.html new file mode 100644 index 000000000..3a703d8c3 --- /dev/null +++ b/templates/webpages/amcvar/render_checkboxes_master.html @@ -0,0 +1,3 @@ +[%- USE HTML %] +[%- SET var_valid = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) _ '_valid' -%] + diff --git a/templates/webpages/amcvar/render_inputs_de.html b/templates/webpages/amcvar/render_inputs_de.html index ac2a1b8f8..50fb4cb3e 100644 --- a/templates/webpages/amcvar/render_inputs_de.html +++ b/templates/webpages/amcvar/render_inputs_de.html @@ -5,6 +5,11 @@ [%- IF hide_non_editable && !var.flag_editable %] +[%- ELSIF !var.valid %] + [%- IF show_disabled_message %] +Element deaktiviert + [%- END %] + [%- ELSIF var.type == 'bool' %] diff --git a/templates/webpages/amcvar/render_inputs_master.html b/templates/webpages/amcvar/render_inputs_master.html index ac2a1b8f8..ed746a506 100644 --- a/templates/webpages/amcvar/render_inputs_master.html +++ b/templates/webpages/amcvar/render_inputs_master.html @@ -5,6 +5,11 @@ [%- IF hide_non_editable && !var.flag_editable %] +[%- ELSIF !var.valid %] + [%- IF show_disabled_message %] +Element disabled + [%- END %] + [%- ELSIF var.type == 'bool' %]