From 889ab5e2ccaba9befa3b25050aeb4afefd2b1b51 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 14 Apr 2020 10:16:58 +0100 Subject: [PATCH] Bug 25139: Corrections to date picker handling It would appear one has to format the dates in the controller rather than in the template for input fields.. I wasn't aware of this caveat until now. Test plan 1/ Prior to applying patch attempt to look at previous transactions ensuring you enter a 'to' date. 2/ Note a catastrophic failure 3/ Apply patch 4/ Look at the same date range and note you no longer get a failure but are instead faced with the requested transactions. 5/ Signoff Signed-off-by: David Nind --- koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt | 4 ++-- pos/register.pl | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt index 88e5f111f5..2d4bd818e2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt @@ -126,9 +126,9 @@
  1. - + - + [% INCLUDE 'date-format.inc' %]
diff --git a/pos/register.pl b/pos/register.pl index bb0b601683..ada83c470f 100755 --- a/pos/register.pl +++ b/pos/register.pl @@ -78,13 +78,12 @@ else { $input->param('trange_t') ? $input->param('trange_t') : $last_cashup ? $last_cashup->timestamp : ''; - $template->param( trange_t => $transactions_range_to ); + my $end = dt_from_string($transactions_range_to); + if ($transactions_range_from) { - $template->param( trange_f => $transactions_range_from ); my $dtf = $schema->storage->datetime_parser; my $start = dt_from_string($transactions_range_from); - my $end = dt_from_string($transactions_range_to); my $past_accountlines = Koha::Account::Lines->search( { register_id => $registerid, @@ -97,7 +96,9 @@ else { } ); $template->param( past_accountlines => $past_accountlines ); + $template->param( trange_f => output_pref({dt => $start, dateonly => 1})); } + $template->param( trange_t => output_pref({dt => $end, dateonly => 1})); my $op = $input->param('op') // ''; if ( $op eq 'cashup' ) { -- 2.11.0