From 7667f227a08459cbe446ba56e675c09020296e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Fri, 13 Mar 2015 13:26:20 +0100 Subject: [PATCH] Bug 13813 - Remove C4::Dates from C4/Members.pm This patch removes C4::Dates from C4/Members.pm Note: This patch can be tested independently from other patches in this Bug, but it depends on patches from Bug 13601 To test: Make sure that patches from 13601 are applied Apply patch Check changes in code Make sure that following functionality works as before: - Add a patron - Renew patrons - Go to checkout page and create message for patron --- C4/Members.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index a98d16f..fcf45ee 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -23,7 +23,6 @@ package C4::Members; use strict; #use warnings; FIXME - Bug 2505 use C4::Context; -use C4::Dates qw(format_date_in_iso format_date); use String::Random qw( random_string ); use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/; use C4::Log; # logaction @@ -864,12 +863,12 @@ sub AddMember { # add expiration date if it isn't already there unless ( $data{'dateexpiry'} ) { - $data{'dateexpiry'} = GetExpiryDate( $data{'categorycode'}, C4::Dates->new()->output("iso") ); + $data{'dateexpiry'} = GetExpiryDate( $data{'categorycode'}, output_pref({ dt=>DateTime->now(), dateformat => 'iso', dateonly=>1 }) ); } # add enrollment date if it isn't already there unless ( $data{'dateenrolled'} ) { - $data{'dateenrolled'} = C4::Dates->new()->output("iso"); + $data{'dateenrolled'} = output_pref({ dt=>DateTime->now(), dateformat => 'iso', dateonly=>1 }); } my $patron_category = @@ -1965,8 +1964,8 @@ sub ExtendMemberSubscriptionTo { my $borrower = GetMember('borrowernumber'=>$borrowerid); unless ($date){ $date = (C4::Context->preference('BorrowerRenewalPeriodBase') eq 'dateexpiry') ? - C4::Dates->new($borrower->{'dateexpiry'}, 'iso')->output("iso") : - C4::Dates->new()->output("iso"); + output_pref({ dt=>dt_from_string( $borrower->{'dateexpiry'} ), dateformat => 'iso', dateonly=>1}) : + output_pref({ dt=>DateTime->now(), dateformat => 'iso', dateonly=>1 }); $date = GetExpiryDate( $borrower->{'categorycode'}, $date ); } my $sth = $dbh->do(<fetchrow_hashref ) { - my $d = C4::Dates->new( $data->{message_date}, 'iso' ); - $data->{message_date_formatted} = $d->output; + $data->{message_date_formatted} = output_pref({ dt=>dt_from_string( $data->{message_date} ), dateformat => 'iso', dateonly=>1 }); push @results, $data; } return \@results; -- 1.7.10.4