Browse Source

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 <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Martin Renvoize 3 years ago
parent
commit
0a1fdaf9f2
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt
  2. 7
      pos/register.pl

4
koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt

@ -126,9 +126,9 @@
<ol>
<li>
<label for="trange_f">From: </label>
<input type="text" size="10" id="from" name="trange_f" value="[% trange_f | html %]"/>
<input type="text" size="10" id="from" class="datepickerfrom" name="trange_f" value="[% trange_f | html %]"/>
<label class="inline" for="trange_t">To: </label>
<input size="10" id="to" name="trange_t" value="[% trange_t | $KohaDates with_hours => 0%]" type="text"/>
<input type="text" size="10" id="to" class="datepickerto" name="trange_t" value="[% trange_t | html %]" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
</li>
</ol>

7
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' ) {

Loading…
Cancel
Save