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

(-)a/Koha/Template/Plugin/KohaDates.pm (+5 lines)
Lines 53-58 sub _parse_config_for_durations { Link Here
53
    return @results;
53
    return @results;
54
}
54
}
55
55
56
sub datetime_from_string {
57
    my ( $self, @params ) = @_;
58
    return dt_from_string( @params );
59
}
60
56
sub output_preference {
61
sub output_preference {
57
    my ( $self, @params ) = @_;
62
    my ( $self, @params ) = @_;
58
    return output_pref( @params );
63
    return output_pref( @params );
(-)a/t/db_dependent/Letters/TemplateToolkit.t (-2 / +27 lines)
Lines 19-25 Link Here
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
20
20
21
use Modern::Perl;
21
use Modern::Perl;
22
use Test::More tests => 31;
22
use Test::More tests => 32;
23
use Test::MockModule;
23
use Test::MockModule;
24
use Test::Warn;
24
use Test::Warn;
25
25
Lines 1193-1198 EOF Link Here
1193
    is( $letter->{content}, $expected_content );
1193
    is( $letter->{content}, $expected_content );
1194
};
1194
};
1195
1195
1196
subtest 'KohaDates::dt_from_string' => sub {
1197
    plan tests => 1;
1198
    my $code = 'TEST_DATE';
1199
    t::lib::Mocks::mock_preference('dateformat', 'metric'); # MM/DD/YYYY
1200
    my $biblio = $builder->build_object(
1201
        {
1202
            class => 'Koha::Biblios',
1203
            value => {
1204
                timestamp   => '2018-12-13 20:21:22',
1205
                datecreated => '2018-12-13'
1206
            }
1207
        }
1208
    );
1209
    my $template = q{[% USE KohaDates %][% KohaDates.datetime_from_string('2000-12-01').dmy %]};
1210
1211
    reset_template({ template => $template, code => $code, module => 'test' });
1212
    my $letter = GetPreparedLetter(
1213
        module => 'test',
1214
        letter_code => $code,
1215
        tables => {
1216
            biblio => $biblio->biblionumber,
1217
        }
1218
    );
1219
    is( $letter->{content}, '01-12-2000' );
1220
};
1221
1196
subtest 'Execute TT process in a DB transaction' => sub {
1222
subtest 'Execute TT process in a DB transaction' => sub {
1197
    plan tests => 2;
1223
    plan tests => 2;
1198
    my $code = 'TEST_TXN';
1224
    my $code = 'TEST_TXN';
1199
- 

Return to bug 33029