[Koha-patches] [PATCH 3/3] (bug3482) followup :Problems with html

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Wed Mar 17 11:53:56 CET 2010


From: Paul Poulain <paul.poulain at biblibre.com>

html tags in the letter content was stripped out by the processing of
the letter.
This patch only sanitize unfilled values in the letter without removing
html tags
---
 misc/cronjobs/overdue_notices.pl |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl
index ae6c46b..e834a04 100755
--- a/misc/cronjobs/overdue_notices.pl
+++ b/misc/cronjobs/overdue_notices.pl
@@ -494,6 +494,7 @@ END_SQL
                     push (@items, $item_info->{'biblionumber'});
                 }
                 $titles.="</table>" if ($htmlfilename);
+		$debug && warn $titles;
                 $sth2->finish;
                 $letter = parse_letter(
                     {   letter          => $letter,
@@ -511,12 +512,12 @@ END_SQL
                   $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items.";
                 }
 
-                my @misses = grep { /./ } map { /^([^>]*)[>]+/; ( $1 || '' ); } split /\</, $letter->{'content'};
+                my @misses = grep { /./ } map { /^([^>]*)[>]{2,}/; ( $1 || '' ); } split /\<\</, $letter->{'content'};
                 if (@misses) {
                     $verbose and warn "The following terms were not matched and replaced: \n\t" . join "\n\t", @misses;
                 }
-                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # Now that we've warned about them, remove them.
-                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # 2nd pass for the double nesting.
+                $letter->{'content'} =~ s/\<\<[^<>]*?\>\>//g;    # Now that we've warned about them, remove them.
+#                $letter->{'content'} =~ s/\<[^<>]*?\>//g;    # 2nd pass for the double nesting.
     
                 if ($nomail) {
     
@@ -730,6 +731,7 @@ sub prepare_letter_for_printing {
         }
     } elsif ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'html' ) {
       $return = "<pre>\n";
+      $params->{'letter'}->{'content'}=~s#
#<br/>#g;
       $return .= "$params->{'letter'}->{'content'}\n";
       $return .= "\n</pre>\n";
     } else {
-- 
1.6.3.3




More information about the Koha-patches mailing list