From 995fa23c3ba0605908a93393efdfb127ee93e6c8 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Tue, 14 Jun 2011 16:45:32 +0100 Subject: [PATCH] Bug 5549 : GetPendingIssues now returns duedate as a DateTime object Change the handling/formatting of duedate in those scripts calling it --- members/moremember.pl | 5 ++--- opac/opac-user.pl | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/members/moremember.pl b/members/moremember.pl index 5a988f93e6..4693cc764d 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -251,7 +251,6 @@ my $issuecount = @{$issue}; my $relissuecount = @{$relissue}; my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} ); my $today = POSIX::strftime("%Y-%m-%d", localtime); # iso format -my @issuedata; my @borrowers_with_issues; my $overdues_exist = 0; my $totalprice = 0; @@ -268,7 +267,7 @@ sub build_issue_data { for ( my $i = 0 ; $i < $issuecount ; $i++ ) { my $datedue = $issue->[$i]{'date_due'}; my $issuedate = $issue->[$i]{'issuedate'}; - $issue->[$i]{'date_due'} = C4::Dates->new($issue->[$i]{'date_due'}, 'iso')->output('syspref'); + $issue->[$i]{'date_due'} = format_date($issue->[$i]->{issuedate}); $issue->[$i]{'issuedate'} = C4::Dates->new($issue->[$i]{'issuedate'},'iso')->output('syspref'); my $biblionumber = $issue->[$i]{'biblionumber'}; $issue->[$i]{'issuingbranchname'} = GetBranchName($issue->[$i]{'branchcode'}); @@ -299,7 +298,7 @@ sub build_issue_data { } } # end lost, damaged - if ( $datedue lt $today ) { + if ( $issue->[$i]{overdue}) { $overdues_exist = 1; $row{'red'} = 1; } diff --git a/opac/opac-user.pl b/opac/opac-user.pl index a88bffbae7..85724f1ad7 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -36,6 +36,7 @@ use C4::Items; use C4::Dates qw/format_date/; use C4::Letters; use C4::Branch; # GetBranches +use Koha::DateUtils; use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; @@ -153,7 +154,7 @@ my @issuedat; my $itemtypes = GetItemTypes(); my ($issues) = GetPendingIssues($borrowernumber); if ($issues){ - foreach my $issue ( sort { $b->{'date_due'} cmp $a->{'date_due'} } @$issues ) { + foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) { # check for reserves my ( $restype, $res, undef ) = CheckReserves( $issue->{'itemnumber'} ); if ( $restype ) { @@ -200,7 +201,7 @@ if ($issues){ $issue->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} ); $issue->{'description'} = $itemtypes->{$itemtype}->{'description'}; } - $issue->{date_due} = format_date($issue->{date_due}); + $issue->{date_due} = output_pref($issue->{date_due}); push @issuedat, $issue; $count++; -- 2.39.5