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

(-)a/Koha/Template/Plugin/KohaDates.pm (+5 lines)
Lines 38-43 sub filter { Link Here
38
        output_pref({ dt => $dt, dateonly => !$config->{with_hours}, dateformat => $config->{dateformat} });
38
        output_pref({ dt => $dt, dateonly => !$config->{with_hours}, dateformat => $config->{dateformat} });
39
}
39
}
40
40
41
sub datetime_from_string {
42
    my ( $self, @params ) = @_;
43
    return dt_from_string( @params );
44
}
45
41
sub output_preference {
46
sub output_preference {
42
    my ( $self, @params ) = @_;
47
    my ( $self, @params ) = @_;
43
    return output_pref( @params );
48
    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 1188-1193 EOF Link Here
1188
    is( $letter->{content}, $expected_content );
1188
    is( $letter->{content}, $expected_content );
1189
};
1189
};
1190
1190
1191
subtest 'KohaDates::dt_from_string' => sub {
1192
    plan tests => 1;
1193
    my $code = 'TEST_DATE';
1194
    t::lib::Mocks::mock_preference('dateformat', 'metric'); # MM/DD/YYYY
1195
    my $biblio = $builder->build_object(
1196
        {
1197
            class => 'Koha::Biblios',
1198
            value => {
1199
                timestamp   => '2018-12-13 20:21:22',
1200
                datecreated => '2018-12-13'
1201
            }
1202
        }
1203
    );
1204
    my $template = q{[% USE KohaDates %][% KohaDates.datetime_from_string('2000-12-01').dmy %]};
1205
1206
    reset_template({ template => $template, code => $code, module => 'test' });
1207
    my $letter = GetPreparedLetter(
1208
        module => 'test',
1209
        letter_code => $code,
1210
        tables => {
1211
            biblio => $biblio->biblionumber,
1212
        }
1213
    );
1214
    is( $letter->{content}, '01-12-2000' );
1215
};
1216
1191
subtest 'Execute TT process in a DB transaction' => sub {
1217
subtest 'Execute TT process in a DB transaction' => sub {
1192
    plan tests => 2;
1218
    plan tests => 2;
1193
    my $code = 'TEST_TXN';
1219
    my $code = 'TEST_TXN';
1194
- 

Return to bug 33029