X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/83381f25d171ab6b6a085d1f82851c8e31c1527f..602e604a5d2e2b07c142c3d47fc9a2337ca36301:/SL/IC.pm diff --git a/SL/IC.pm b/SL/IC.pm index d37f66f90..649ad2fd0 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -324,6 +324,8 @@ sub save { $subq_expense = "NULL"; } + normalize_text_blocks(); + $query = qq|UPDATE parts SET partnumber = ?, @@ -1697,5 +1699,24 @@ sub prepare_parts_for_printing { $main::lxdebug->leave_sub(); } +sub normalize_text_blocks { + $main::lxdebug->enter_sub(); + + my $self = shift; + my %params = @_; + + my $form = $params{form} || $main::form; + + # check if feature is enabled (select normalize_part_descriptions from defaults) + return unless ($::instance_conf->get_normalize_part_descriptions); + + foreach (qw(description notes)) { + $form->{$_} =~ s/\s+$//s; + $form->{$_} =~ s/^\s+//s; + $form->{$_} =~ s/ {2,}/ /g; + } + $main::lxdebug->leave_sub(); +} + 1;