From: Sven Schöling Date: Fri, 29 May 2009 13:25:38 +0000 (+0000) Subject: Pagebreaks müssen auch auf _get_loop_variable umgestellt werden. X-Git-Tag: release-2.6.0~16 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=67cecc96a521c06f29ed352c65b8ae077ab18314;p=kivitendo-erp.git Pagebreaks müssen auch auf _get_loop_variable umgestellt werden. Fix für Bug 1019. (Und hey, wenn der in -r4721 nochmal auftaucht, wissen wir das ja jetzt schon :)) --- diff --git a/SL/Template.pm b/SL/Template.pm index 99ca0f8bf..40169339c 100644 --- a/SL/Template.pm +++ b/SL/Template.pm @@ -172,6 +172,8 @@ sub parse_foreach { my $sum = 0; my $current_page = 1; my ($current_line, $corrent_row) = (0, 1); + my $description_array = $self->_get_loop_variable("description",1); + my $longdescription_array = $self->_get_loop_variable("longdescription",1); for (my $i = 0; $i < scalar(@{$ary}); $i++) { $form->{"__first__"} = $i == 0; @@ -179,14 +181,12 @@ sub parse_foreach { $form->{"__odd__"} = (($i + 1) % 2) == 1; $form->{"__counter__"} = $i + 1; - if ((scalar(@{$form->{"description"}}) == scalar(@{$ary})) && - $self->{"chars_per_line"}) { - my $lines = - int(length($form->{"description"}->[$i]) / $self->{"chars_per_line"}); + if (scalar @{$description_array} == scalar @{$ary} && $self->{"chars_per_line"} != 0) { + my $lines = int(length($description_array->[$i]) / $self->{"chars_per_line"}); my $lpp; - $form->{"description"}->[$i] =~ s/(\\newline\s?)*$//; - my $_description = $form->{"description"}->[$i]; + $description_array->[$i] =~ s/(\\newline\s?)*$//; + my $_description = $description_array->[$i]; while ($_description =~ /\\newline/) { $lines++; $_description =~ s/\\newline//; @@ -200,7 +200,7 @@ sub parse_foreach { } # Yes we need a manual page break -- or the user has forced one - if ((($current_line + $lines) > $lpp) || ($form->{"description"}->[$i] =~ //) || ($form->{"longdescription"}->[$i] =~ //)) { + if ((($current_line + $lines) > $lpp) || ($description_array->[$i] =~ //) || ($longdescription_array->[$i] =~ //)) { my $pb = $self->{"pagebreak_block"}; # replace the special variables <%sumcarriedforward%>