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

(-)a/C4/Search.pm (-1 / +1 lines)
Lines 2082-2088 sub searchResults { Link Here
2082
            {
2082
            {
2083
                $onloan_count++;
2083
                $onloan_count++;
2084
                my $key = $prefix . $item->{onloan} . $item->{barcode};
2084
                my $key = $prefix . $item->{onloan} . $item->{barcode};
2085
                $onloan_items->{$key}->{due_date} = output_pref( { dt => dt_from_string( $item->{onloan} ), dateonly => 1 } );
2085
                $onloan_items->{$key}->{due_date} = output_pref( { dt => scalar dt_from_string( $item->{onloan} ), dateonly => 1 } );
2086
                $onloan_items->{$key}->{count}++ if $item->{$hbranch};
2086
                $onloan_items->{$key}->{count}++ if $item->{$hbranch};
2087
                $onloan_items->{$key}->{branchname}     = $item->{branchname};
2087
                $onloan_items->{$key}->{branchname}     = $item->{branchname};
2088
                $onloan_items->{$key}->{location}       = $shelflocations->{ $item->{location} };
2088
                $onloan_items->{$key}->{location}       = $shelflocations->{ $item->{location} };
(-)a/Koha/DateUtils.pm (-1 / +1 lines)
Lines 219-225 sub output_pref { Link Here
219
        carp "Invalid date '$str' passed to output_pref\n" if $@;
219
        carp "Invalid date '$str' passed to output_pref\n" if $@;
220
    }
220
    }
221
221
222
    return unless defined $dt;
222
    return unless defined $dt && ref($dt) eq 'DateTime';
223
223
224
    # FIXME: see bug 13242 => no TZ for dates 'infinite'
224
    # FIXME: see bug 13242 => no TZ for dates 'infinite'
225
    if ( $dt->ymd !~ /^9999/ ) {
225
    if ( $dt->ymd !~ /^9999/ ) {
(-)a/t/DateUtils.t (-2 / +8 lines)
Lines 4-10 use DateTime::TimeZone; Link Here
4
4
5
use C4::Context;
5
use C4::Context;
6
6
7
use Test::More tests => 60;
7
use Test::More tests => 63;
8
8
9
use Test::MockModule;
9
use Test::MockModule;
10
use Test::Warn;
10
use Test::Warn;
Lines 219-224 is( output_pref( { dt => $dt, dateonly => 1 } ), '01/01/1900', 'dt_from_string s Link Here
219
$dt = dt_from_string('2015-01-31 01:02:03');
219
$dt = dt_from_string('2015-01-31 01:02:03');
220
is( output_pref( {dt => $dt} ), '31/01/2015 01:02', 'dt_from_string should fallback to sql format' );
220
is( output_pref( {dt => $dt} ), '31/01/2015 01:02', 'dt_from_string should fallback to sql format' );
221
221
222
# output_pref with no parameters, single parameter (no hash)
223
is( output_pref(), undef, 'output_pref without parameters' );
224
is( output_pref( 'no_dt' ), undef, 'Passed single invalid dt to output_pref' );
225
226
# pass invalid dt via hash
227
is( output_pref({ dt => 'no_dt' }), undef, 'Passed invalid dt in hash to output_pref' );
228
222
# output_pref with str parameter
229
# output_pref with str parameter
223
is( output_pref( { 'str' => $testdate_iso, dateformat => 'iso', dateonly => 1 } ), $testdate_iso, 'output_pref should handle correctly the iso parameter' );
230
is( output_pref( { 'str' => $testdate_iso, dateformat => 'iso', dateonly => 1 } ), $testdate_iso, 'output_pref should handle correctly the iso parameter' );
224
my $output_for_invalid_date;
231
my $output_for_invalid_date;
225
- 

Return to bug 17502