]> wagnertech.de Git - mfinanz.git/commitdiff
Merge branch 'master' of github.com:kivitendo/kivitendo-erp
authorJan Büren <jan@kivitendo-premium.de>
Wed, 15 Jan 2014 14:00:10 +0000 (15:00 +0100)
committerJan Büren <jan@kivitendo-premium.de>
Wed, 15 Jan 2014 14:00:10 +0000 (15:00 +0100)
SL/DB/MetaSetup/Default.pm
SL/IC.pm
templates/webpages/client_config/_features.html

index 0efdbe20eac32330be7dbf59ed61adf86eae7d94..48551285c0377eefe8b3c98ff97eacd01d730594 100644 (file)
@@ -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' },
index d37f66f9028d75dc9cce5d4f59c3955a46dcb679..649ad2fd0659faecc0437c583d357c4ef78172ef 100644 (file)
--- 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;
index 3d3b2167889fd1d6397e1539b3060d8a775125de..28a00ec24a0e1f8d018fb5ced9ea016100bd1d80 100644 (file)
    <td>   [% L.input_tag('defaults.parts_image_css', SELF.defaults.parts_image_css, style=style) %]</td>
    <td>[% LxERP.t8('Style the picture with the following CSS code') %]</td>
   </tr>
- <!-- tr>
+ <tr>
    <td align="right">[% LxERP.t8('Normalize part description and part notes') %]</td>
    <td>   [% L.yes_no_tag('defaults.normalize_part_descriptions', SELF.defaults.normalize_part_descriptions) %]</td>
    <td>[% LxERP.t8('Automatic deletion of leading, trailing and excessive (repetitive) spaces in part description and part notes. Affects also the CSV-Import.') %]</td>
   </tr>
-</tr -->
+</tr>
  </table>
 </div>