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' },
$subq_expense = "NULL";
}
+ normalize_text_blocks();
+
$query =
qq|UPDATE parts SET
partnumber = ?,
$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;
<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>