[otrs-cvs] CVS: otrs/Kernel/System PDF.pm,1.6,1.7
cvs-log at otrs.org
cvs-log at otrs.org
Tue Aug 8 15:03:20 CEST 2006
Update of /home/cvs/otrs/Kernel/System
In directory lancelot:/tmp/cvs-serv30924/Kernel/System
Modified Files:
PDF.pm
Log Message:
fixed bug with control characters (\r, \t)
Index: PDF.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/PDF.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** PDF.pm 7 Aug 2006 12:40:25 -0000 1.6
--- PDF.pm 8 Aug 2006 12:03:18 -0000 1.7
***************
*** 329,336 ****
LogoFile => '/path/to/file.jpg', # (optional) you can use jpg, gif and png-Images
HeaderRight => 'Header Right Text', # (optional)
- FooterLeft => 'Footer Left Text', # (optional)
- FooterRight => 'Footer Right Text', # (optional)
HeadlineLeft => 'Headline Text', # (optional)
HeadlineRight => 'Headline Text', # (optional)
);
--- 329,336 ----
LogoFile => '/path/to/file.jpg', # (optional) you can use jpg, gif and png-Images
HeaderRight => 'Header Right Text', # (optional)
HeadlineLeft => 'Headline Text', # (optional)
HeadlineRight => 'Headline Text', # (optional)
+ FooterLeft => 'Footer Left Text', # (optional)
+ FooterRight => 'Footer Right Text', # (optional)
);
***************
*** 1611,1614 ****
--- 1611,1620 ----
}
+ # prepare text
+ if (defined($Param{CellData}->[$RowCounter]->[$ColumnCounter]->{Content})) {
+ $Param{CellData}->[$RowCounter]->[$ColumnCounter]->{Content} = $Self->_PrepareText(
+ Text => $Param{CellData}->[$RowCounter]->[$ColumnCounter]->{Content},
+ );
+ }
# set content blank, if not definied
if (!defined($Param{CellData}->[$RowCounter]->[$ColumnCounter]->{Content}) ||
***************
*** 1617,1622 ****
$Param{CellData}->[$RowCounter]->[$ColumnCounter]->{Content} = ' ';
}
- # delete control character at end of content
- chomp($Param{CellData}->[$RowCounter]->[$ColumnCounter]->{Content});
# set default values
--- 1623,1626 ----
***************
*** 1661,1664 ****
--- 1665,1672 ----
$Param{ColumnData}->[$ColumnCounter]->{Width} =
($Param{ColumnData}->[$ColumnCounter]->{MaxColWidth} + $Param{ColumnData}->[$ColumnCounter]->{MinColWidth}) / 2;
+ # reduce calculated width, if calculated width is greater than table width
+ if ($Param{ColumnData}->[$ColumnCounter]->{Width} > $Param{Width}) {
+ $Param{ColumnData}->[$ColumnCounter]->{Width} = $Param{Width};
+ }
}
$RowCounter++;
***************
*** 2028,2031 ****
--- 2036,2044 ----
$Param{Text} = undef;
}
+ else {
+ $Param{Text} = $Self->_PrepareText(
+ Text => $Param{Text},
+ );
+ }
my $Counter1 = 0;
***************
*** 2243,2246 ****
--- 2256,2300 ----
#
+ # _PrepareText()
+ #
+ # prepare given text for output
+ #
+ # $Width = $PDFObject->_PrepareText(
+ # Text => 'Text', # text
+ # );
+ #
+
+ sub _PrepareText {
+ my $Self = shift;
+ my %Param = @_;
+ # check needed stuff
+ foreach (qw(Text)) {
+ if (!defined ($Param{$_})) {
+ $Self->{LogObject}->Log(Priority => 'error', Message => "Need $_!");
+ return;
+ }
+ }
+ if (!$Self->{PDF}) {
+ $Self->{LogObject}->Log(Priority => 'error', Message => "Need a PDF Document!");
+ return;
+ }
+ if (!$Self->{Page}) {
+ $Self->{LogObject}->Log(Priority => 'error', Message => "Need a Page!");
+ return;
+ }
+ # prepare new line
+ $Param{Text} =~ s/(\n\r|\r\r\n|\r\n)/\n/g;
+ $Param{Text} =~ s/\r/\n/g;
+
+ # convert page brake to new lines
+ $Param{Text} =~ s/\f/\n\n/g;
+
+ # convert taps to spaces
+ $Param{Text} =~ s/\t/ /g;
+
+ return $Param{Text};
+ }
+
+ #
# _CurPageNumberSet()
#
More information about the cvs-log
mailing list