Bug 28581: Use 'from_email_address' where appropriate
[koha-ffzg.git] / Koha / NewsItem.pm
index 19bed76..75dc787 100644 (file)
@@ -38,9 +38,19 @@ Koha::NewsItem represents a single piece of news from the opac_news table
 
 =cut
 
+=head3 author
+
+    $newsitem->author;
+
+Return the Koha::Patron object for the patron who authored this news item
+
+=cut
+
 sub author {
-    my ( $self ) = @_;
-    return Koha::Patron->_new_from_dbic($self->_result->borrowernumber);
+    my ($self) = @_;
+    my $author_rs = $self->_result->borrowernumber;
+    return unless $author_rs;
+    return Koha::Patron->_new_from_dbic($author_rs);
 }
 
 =head3 _type