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

(-)a/Koha/Notice/Message.pm (-2 / +17 lines)
Lines 126-134 sub restrict_patron_when_notice_fails { Link Here
126
126
127
=head3 patron
127
=head3 patron
128
128
129
    my $patron = $checkout->patron
129
    my $patron = $message->patron
130
130
131
Return the patron by whom the checkout was done
131
Return the patron by whom this message is for
132
132
133
=cut
133
=cut
134
134
Lines 139-144 sub patron { Link Here
139
    return Koha::Patron->_new_from_dbic($patron_rs);
139
    return Koha::Patron->_new_from_dbic($patron_rs);
140
}
140
}
141
141
142
=head3 template
143
144
    my $template = $message->template
145
146
Return the template from which this message may have been generated
147
148
=cut
149
150
sub template {
151
    my ($self) = @_;
152
    my $template_rs = $self->_result->letter;
153
    return unless $template_rs;
154
    return Koha::Notice::Template->_new_from_dbic($template_rs);
155
}
156
142
=head3 type
157
=head3 type
143
158
144
=cut
159
=cut
(-)a/t/db_dependent/Koha/Notice/Message.t (-2 / +20 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 4;
22
use Test::More tests => 5;
23
23
24
use C4::Letters qw( GetPreparedLetter EnqueueLetter );
24
use C4::Letters qw( GetPreparedLetter EnqueueLetter );
25
25
Lines 239-244 subtest 'patron() tests' => sub { Link Here
239
    $schema->storage->txn_rollback;
239
    $schema->storage->txn_rollback;
240
};
240
};
241
241
242
subtest 'template() tests' => sub {
243
    plan tests => 2;
244
245
    $schema->storage->txn_begin;
246
247
    my $template = $builder->build_object( { class => 'Koha::Notice::Templates' } );
248
    my $message  = $builder->build_object(
249
        {
250
            class => 'Koha::Notice::Messages',
251
            value => { letter_id => $template->id }
252
        }
253
    );
254
255
    is( ref( $message->template ), 'Koha::Notice::Template', 'Object type is correct' );
256
    is( $message->template->id,    $template->id,            'Right template linked' );
257
258
    $schema->storage->txn_rollback;
259
};
260
242
subtest 'search_limited' => sub {
261
subtest 'search_limited' => sub {
243
    plan tests => 2;
262
    plan tests => 2;
244
263
245
- 

Return to bug 33260