View | Details | Raw Unified | Return to bug 24398
Collapse All | Expand All

(-)a/Koha/NewsItem.pm (-1 / +7 lines)
Lines 22-27 use Modern::Perl; Link Here
22
use Carp;
22
use Carp;
23
23
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::Patrons;
25
26
26
use base qw(Koha::Object);
27
use base qw(Koha::Object);
27
28
Lines 37-43 Koha::NewsItem represents a single piece of news from the opac_news table Link Here
37
38
38
=cut
39
=cut
39
40
40
=head3 type
41
sub author {
42
    my ( $self ) = @_;
43
    return Koha::Patron->_new_from_dbic($self->_result->borrowernumber);
44
}
45
46
=head3 _type
41
47
42
=cut
48
=cut
43
49
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt (-1 / +6 lines)
Lines 106-112 Link Here
106
                            <div class="newsfooter">
106
                            <div class="newsfooter">
107
                                Published on [% koha_new.published_on | $KohaDates %]
107
                                Published on [% koha_new.published_on | $KohaDates %]
108
                                [% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %]
108
                                [% IF ( (newsdisp == 'opac' || newsdisp == 'both') && koha_new.borrowernumber ) %]
109
                                    by <span class="newsauthor_title">[% koha_new.author_title | html %] </span>[% koha_new.author_firstname | html %] [% koha_new.author_surname | html %]
109
                                    [% IF news_item %]
110
                                        [% SET author = koha_new.author %]
111
                                        by <span class="newsauthor_title">[% author.title | html %] </span>[% author.firstname | html %] [% author.surname | html %]
112
                                    [% ELSE %]
113
                                        by <span class="newsauthor_title">[% koha_new.author_title | html %] </span>[% koha_new.author_firstname | html %] [% koha_new.author_surname | html %]
114
                                    [% END %]
110
                                [% END %]
115
                                [% END %]
111
                                [% IF ( news_item ) %]
116
                                [% IF ( news_item ) %]
112
                                    &bull; <a href="/cgi-bin/koha/opac-main.pl">Show all news</a>
117
                                    &bull; <a href="/cgi-bin/koha/opac-main.pl">Show all news</a>
(-)a/t/db_dependent/Koha/News.t (-2 / +8 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 5;
22
use Test::More tests => 6;
23
23
24
use Koha::NewsItem;
24
use Koha::NewsItem;
25
use Koha::News;
25
use Koha::News;
Lines 54-58 is( $retrieved_news_item_1->content, $new_news_item_1->content, 'The content met Link Here
54
$retrieved_news_item_1->delete;
54
$retrieved_news_item_1->delete;
55
is( Koha::News->search->count, $nb_of_news + 1, 'Delete should have deleted the news_item' );
55
is( Koha::News->search->count, $nb_of_news + 1, 'Delete should have deleted the news_item' );
56
56
57
subtest '->author' => sub {
58
    plan tests => 1;
59
60
    my $news_item = $builder->build_object({ class => 'Koha::News' });
61
    is( ref($news_item->author), 'Koha::Patron', 'Koha::NewsItem->author returns a Koha::Patron object' );
62
};
63
57
$schema->storage->txn_rollback;
64
$schema->storage->txn_rollback;
58
65
59
- 

Return to bug 24398