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

(-)a/Koha/Notice/Message.pm (-2 / +17 lines)
Lines 156-164 sub stylesheets { Link Here
156
156
157
=head3 patron
157
=head3 patron
158
158
159
    my $patron = $checkout->patron
159
    my $patron = $message->patron
160
160
161
Return the patron by whom the checkout was done
161
Return the patron by whom this message is for
162
162
163
=cut
163
=cut
164
164
Lines 169-174 sub patron { Link Here
169
    return Koha::Patron->_new_from_dbic($patron_rs);
169
    return Koha::Patron->_new_from_dbic($patron_rs);
170
}
170
}
171
171
172
=head3 template
173
174
    my $template = $message->template
175
176
Return the template from which this message may have been generated
177
178
=cut
179
180
sub template {
181
    my ($self) = @_;
182
    my $template_rs = $self->_result->letter;
183
    return unless $template_rs;
184
    return Koha::Notice::Template->_new_from_dbic($template_rs);
185
}
186
172
=head3 type
187
=head3 type
173
188
174
=cut
189
=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