From 87c021d9b2c91d55551d86ce7e92fad59a0a2f32 Mon Sep 17 00:00:00 2001 From: Kyle Hall Date: Fri, 21 Oct 2022 08:20:33 -0400 Subject: [PATCH] Bug 31713: (QA follow-up) Add current date to slip Signed-off-by: Kyle M Hall --- Koha/Template/Plugin/KohaDates.pm | 4 ++++ installer/data/mysql/atomicupdate/bug_31713.pl | 5 +++-- installer/data/mysql/en/mandatory/sample_notices.yml | 5 +++-- t/db_dependent/Template/Plugin/KohaDates.t | 4 +++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Koha/Template/Plugin/KohaDates.pm b/Koha/Template/Plugin/KohaDates.pm index 783833f7df..446e9bb7d1 100644 --- a/Koha/Template/Plugin/KohaDates.pm +++ b/Koha/Template/Plugin/KohaDates.pm @@ -47,4 +47,8 @@ sub tz { return C4::Context->tz->name; } +sub now { + return dt_from_string; +} + 1; diff --git a/installer/data/mysql/atomicupdate/bug_31713.pl b/installer/data/mysql/atomicupdate/bug_31713.pl index 9ab4132d89..31bc185f7e 100644 --- a/installer/data/mysql/atomicupdate/bug_31713.pl +++ b/installer/data/mysql/atomicupdate/bug_31713.pl @@ -8,8 +8,9 @@ return { my ($dbh, $out) = @$args{qw(dbh out)}; my $slip_content = <<~'END_CONTENT'; -[% USE Koha %] [% USE Branches %] +[% USE Koha %] +[% USE KohaDates %] [% USE Price %] [% PROCESS 'accounts.inc' %] @@ -85,7 +86,7 @@ return { - + [% IF ( borrower.account.balance <= 0 ) %] diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml index 367da957ba..af980245dc 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.yml +++ b/installer/data/mysql/en/mandatory/sample_notices.yml @@ -1216,8 +1216,9 @@ tables: message_transport_type: print lang: default content: - - "[% USE Koha %]" - "[% USE Branches %]" + - "[% USE Koha %]" + - "[% USE KohaDates %]" - "[% USE Price %]" - "[% PROCESS 'accounts.inc' %]" - "
Total outstanding dues as on date: Total outstanding dues as of [% KohaDates.output_preference( KohaDates.now ) %]: [% ELSE %][% END %][% borrower.account.balance | $Price %]
" @@ -1293,7 +1294,7 @@ tables: - "" - " " - " " - - " " + - " " - " [% IF ( borrower.account.balance <= 0 ) %]" - " " - " " diff --git a/t/db_dependent/Template/Plugin/KohaDates.t b/t/db_dependent/Template/Plugin/KohaDates.t index 5d7300c6f5..52d76ba98d 100755 --- a/t/db_dependent/Template/Plugin/KohaDates.t +++ b/t/db_dependent/Template/Plugin/KohaDates.t @@ -6,7 +6,7 @@ use C4::Context; use Koha::DateUtils qw( dt_from_string output_pref ); use Test::MockModule; -use Test::More tests => 9; +use Test::More tests => 10; use t::lib::Mocks; BEGIN { @@ -64,3 +64,5 @@ $module_context->mock( $filtered_date = $filter->filter('2014-03-30 02:00:00'); is( $filtered_date, '30/03/2014', 'us: dt_from_string should return a DateTime object if a DST is given' ); + +is( $filter->now->iso8601, dt_from_string->iso8601, "Method 'now' matches current date and time" ); -- 2.30.2
Total outstanding dues as on date: Total outstanding dues as of [% KohaDates.output_preference( KohaDates.now ) %]: [% ELSE %][% END %][% borrower.account.balance | $Price %]