Bug 13601: get rid of DateTime::Format::DateParse
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 20 Jan 2015 14:32:45 +0000 (15:32 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 30 Mar 2015 16:40:00 +0000 (13:40 -0300)
This module is used in C4::Members::GetPendingIssues too, but we can use
dt_from_string.

Test plan:
1/ Verify that
    prove t/db_dependent/Members/GetPendingIssues.t
returns green
2/ On the patron pending issue list, verify that the issue and the due
dates are correctly displayed.

Tested together with other patches (except "Fix special cases). Worked as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Installer/PerlDependencies.pm
C4/Members.pm

index 34cd8b5..67ec808 100644 (file)
@@ -222,11 +222,6 @@ our $PERL_DEPS = {
         'required' => '1',
         'min_ver'  => '1.20'
     },
-    'DateTime::Format::DateParse' => {
-        'usage'    => 'Core',
-        'required' => '1',
-        'min_ver'  => '0.04'
-    },
     'DateTime::Format::MySQL' => {
         'usage'    => 'Core',
         'required' => '1',
index 4fb845d..a98d16f 100644 (file)
@@ -36,7 +36,6 @@ use C4::SQLHelper qw(InsertInTable UpdateInTable SearchInTable);
 use C4::Members::Attributes qw(SearchIdMatchingAttribute UpdateBorrowerAttribute);
 use C4::NewsChannels; #get slip news
 use DateTime;
-use DateTime::Format::DateParse;
 use Koha::Database;
 use Koha::DateUtils;
 use Koha::Borrower::Debarments qw(IsDebarred);
@@ -1195,14 +1194,13 @@ sub GetPendingIssues {
     my $sth = C4::Context->dbh->prepare($query);
     $sth->execute(@borrowernumbers);
     my $data = $sth->fetchall_arrayref({});
-    my $tz = C4::Context->tz();
-    my $today = DateTime->now( time_zone => $tz);
+    my $today = dt_from_string;
     foreach (@{$data}) {
         if ($_->{issuedate}) {
             $_->{issuedate} = dt_from_string($_->{issuedate}, 'sql');
         }
         $_->{date_due} or next;
-        $_->{date_due} = DateTime::Format::DateParse->parse_datetime($_->{date_due}, $tz->name());
+        $_->{date_due} = dt_from_string($_->{date_due}, 'sql');
         if ( DateTime->compare($_->{date_due}, $today) == -1 ) {
             $_->{overdue} = 1;
         }