From 53fcb212544cf90957c5e6a3b3a1a36af395b273 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 15 Jan 2014 14:57:16 +0100 Subject: [PATCH] =?utf8?q?Zeilenumbr=C3=BCche=20als=20letztes=20Zeichen=20?= =?utf8?q?bei=20part.description,=20part.notes=20beim=20Speichern=20in=20D?= =?utf8?q?B=20verhindern=20closes=20#2011=20Wie=20Wulf=20vorgeschlagen=20h?= =?utf8?q?at,=20werden=20alle=20whitespaces=20beim=20Beginn=20eines=20Text?= =?utf8?q?blocks=20und=20beim=20Ende=20eines=20Textblocks=20entfernt.=20Fe?= =?utf8?q?rner=20werden=20mehrfach=20Wiederholungen=20von=20Leerzeichen=20?= =?utf8?q?innerhalb=20eines=20Blocks=20auf=20nur=20ein=20Leerzeichen=20red?= =?utf8?q?uziert.=20Konfigurierbar=20(Standard=20an).=20OFFEN:=20Bei=20CSV?= =?utf8?q?-Import=20wird=20dies=20noch=20nicht=20ber=C3=BCcksichtigt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/MetaSetup/Default.pm | 2 +- SL/IC.pm | 21 +++++++++++++++++++ .../webpages/client_config/_features.html | 4 ++-- 3 files changed, 24 insertions(+), 3 deletions(-) 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') %] - + -- 2.20.1