In order to let the KohaDates plugin display a datetime, this patch
modify this plugin.
Now it uses Koha::DateUtils instead of C4::Dates.
Test plan:
- check that the date format on the member notices page
(members/notices.pl) is displayed according your syspref dateformat.
- check that existing dates are always in the good format (without the
hours) e.g. acqui/histsearch.pl, acqui/basket.pl, etc.
- Modify your syspref and recheck the previous pages
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
This is a nice addition, and works according to the test plan. A nice
follow-up would be to create a system pref for formatting times
(12/24hr).
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixed a tab in notices.tt to make QA script happy.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-use strict;
-use warnings;
use Template::Plugin::Filter;
use base qw( Template::Plugin::Filter );
use Template::Plugin::Filter;
use base qw( Template::Plugin::Filter );
-use warnings;
-use strict;
+use Koha::DateUtils;
+our $DYNAMIC = 1;
+
+sub init {
+ my $self = shift;
+ $self->{ _DYNAMIC } = 1;
+ return $self;
+}
- my ($self,$text) = @_;
- return "" if not $text;
- my $date = C4::Dates->new( $text, 'iso' );
- return $date->output("syspref");
+ my ( $self, $text, $args, $config ) = @_;
+ return "" unless $text;
+ $config->{with_hours} //= 0;
+ my $dt = dt_from_string( $text, 'iso' );
+ return output_pref( $dt, undef, !$config->{with_hours} );
[% INCLUDE 'doc-head-open.inc' %]
<title>Sent notices for [% INCLUDE 'patron-title.inc' %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Sent notices for [% INCLUDE 'patron-title.inc' %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% ELSIF ( QUEUED_MESSAGE.status == 'deleted' ) %]deleted
[% ELSE %][% QUEUED_MESSAGE.status %][% END %]
</td>
[% ELSIF ( QUEUED_MESSAGE.status == 'deleted' ) %]deleted
[% ELSE %][% QUEUED_MESSAGE.status %][% END %]
</td>
- <td>[% QUEUED_MESSAGE.time_queued %]</td>
+ <td>[% QUEUED_MESSAGE.time_queued | $KohaDates with_hours => 1 %]</td>