From: Jan Büren Date: Wed, 15 Jan 2014 14:00:10 +0000 (+0100) Subject: Merge branch 'master' of github.com:kivitendo/kivitendo-erp X-Git-Tag: release-3.1.0beta1~22^2~2 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/0448fc15357e20ffb74e08f2a8459820494a6eef?hp=8a190e3d53337ef1f4941fbc25ef1b16229f3d67 Merge branch 'master' of github.com:kivitendo/kivitendo-erp --- diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index 0efdbe20e..48551285c 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -55,7 +55,7 @@ __PACKAGE__->meta->columns( language_id => { type => 'integer' }, max_future_booking_interval => { type => 'integer', default => 360 }, mtime => { type => 'timestamp' }, - # normalize_part_descriptions => { type => 'boolean', default => 'true' }, + normalize_part_descriptions => { type => 'boolean', default => 'true' }, normalize_vc_names => { type => 'boolean', default => 'true' }, parts_image_css => { type => 'text', default => 'border:0;float:left;max-width:250px;margin-top:20px:margin-right:10px;margin-left:10px;' }, parts_listing_image => { type => 'boolean', default => 'true' }, 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; diff --git a/templates/webpages/client_config/_features.html b/templates/webpages/client_config/_features.html index 3d3b21678..28a00ec24 100644 --- a/templates/webpages/client_config/_features.html +++ b/templates/webpages/client_config/_features.html @@ -44,11 +44,11 @@ [% L.input_tag('defaults.parts_image_css', SELF.defaults.parts_image_css, style=style) %] [% LxERP.t8('Style the picture with the following CSS code') %] - +