Bug 5549 : GetPendingIssues now returns duedate as a DateTime object

Change the handling/formatting of duedate in those
scripts calling it
This commit is contained in:
Colin Campbell 2011-06-14 16:45:32 +01:00 committed by Chris Cormack
parent 00bf7cc774
commit 995fa23c3b
2 changed files with 5 additions and 5 deletions

View file

@ -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;
}

View file

@ -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++;