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

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