From 17a8563bf0c532163fa67e8b511169e3e3857458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Fri, 6 Nov 2015 14:07:30 +0100 Subject: [PATCH] Bug 14985: (followup) Remove eval if dates come from database This patch removes some evals from date-formatting where the dates come from the database. See comments #7 - #9 Additionaly, C4/VirtualShelves/Page.pm is removed from the patches (obsolete). --- C4/Members.pm | 2 +- C4/Reserves.pm | 4 ++-- C4/Search.pm | 2 +- C4/Utils/DataTables/Members.pm | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 425fd74..2616598 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -2261,7 +2261,7 @@ sub GetMessages { my @results; while ( my $data = $sth->fetchrow_hashref ) { - $data->{message_date_formatted} = eval { output_pref( { dt => dt_from_string( $data->{message_date} ), dateonly => 1, dateformat => 'iso' } ); }; + $data->{message_date_formatted} = output_pref( { dt => dt_from_string( $data->{message_date} ), dateonly => 1, dateformat => 'iso' } ); push @results, $data; } return \@results; diff --git a/C4/Reserves.pm b/C4/Reserves.pm index d2161cc..29a0aa5 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -165,9 +165,9 @@ sub AddReserve { my $dbh = C4::Context->dbh; - $resdate = eval { output_pref( { dt => dt_from_string( $resdate ), dateonly => 1 }); } + $resdate = eval { output_pref( { dt => dt_from_string( $resdate ), dateonly => 1, dateformat => 'iso' }); } if ( $resdate ); - $resdate = eval { output_pref( { dt => dt_from_string, dateonly => 1 }); } + $resdate = eval { output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' }); } unless ( $resdate ); if ($expdate) { diff --git a/C4/Search.pm b/C4/Search.pm index b3b3a52..b895993 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -2094,7 +2094,7 @@ sub searchResults { { $onloan_count++; my $key = $prefix . $item->{onloan} . $item->{barcode}; - $onloan_items->{$key}->{due_date} = eval { output_pref( { dt => dt_from_string( $item->{onloan} ), dateonly => 1 } ); }; + $onloan_items->{$key}->{due_date} = output_pref( { dt => dt_from_string( $item->{onloan} ), dateonly => 1 } ); $onloan_items->{$key}->{count}++ if $item->{$hbranch}; $onloan_items->{$key}->{branchname} = $item->{branchname}; $onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} }; diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm index 5b1ffee..5e0b812 100644 --- a/C4/Utils/DataTables/Members.pm +++ b/C4/Utils/DataTables/Members.pm @@ -142,7 +142,7 @@ sub search { ($patron->{overdues}, $patron->{issues}, $patron->{fines}) = GetMemberIssuesAndFines($patron->{borrowernumber}); if($patron->{dateexpiry} and $patron->{dateexpiry} ne '0000-00-00') { - $patron->{dateexpiry} = eval { output_pref( { dt => dt_from_string( $patron->{dateexpiry}), dateonly => 1, dateformat => 'iso' } ); }; + $patron->{dateexpiry} = output_pref( { dt => dt_from_string( $patron->{dateexpiry}), dateonly => 1, dateformat => 'iso' } ); } else { $patron->{dateexpiry} = ''; } -- 1.7.10.4