Commit 30a3685b authored by Ruslan Zakirov's avatar Ruslan Zakirov
Browse files

add IsEmpty method to template

git-svn-id: svn+ssh://svn.bestpractical.com/svn/bps-public/rt/branches/3.7-EXPERIMENTAL@8857 e417ac7c-1bcc-0310-8ffa-8f5827389a85
parent 13f24a61
......@@ -252,6 +252,20 @@ sub Delete {
return ( $self->SUPER::Delete(@_) );
}
=head2 IsEmpty
Returns true value if content of the template is empty, otherwise
returns false.
=cut
sub IsEmpty {
my $self = shift;
my $content = $self->Content;
return 0 if defined $content && length $content;
return 1;
}
=head2 MIMEObj
Returns L<MIME::Entity> object parsed using L</Parse> method. Returns
......@@ -336,11 +350,11 @@ sub _ParseContent {
return (undef, $self->loc("Permissions denied"));
}
my $content = $self->SUPER::_Value('Content');
unless ( defined $content && length $content ) {
return ( '', $self->loc("Template is empty") );
if ( $self->IsEmpty ) {
return ( undef, $self->loc("Template is empty") );
}
my $content = $self->SUPER::_Value('Content');
# We need to untaint the content of the template, since we'll be working
# with it
$content =~ s/^(.*)$/$1/;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment