From 67e285299d38f83906c15b343610c537c44197c7 Mon Sep 17 00:00:00 2001 From: finlayt Date: Fri, 9 Aug 2002 04:03:43 +0000 Subject: [PATCH] fixed up the todays issues and previous issues tables so that they are both listed in reverse order by issue date. --- circ/circulation.pl | 65 ++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index f167f86432..d24c961919 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -43,7 +43,9 @@ $env{'printer'}=$printer; $env{'queue'}=$printer; my @datearr = localtime(time()); -my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", $datearr[3]); +my $tday = localtime(time()); +warn "today: $tday \n"; +my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", ($datearr[3])); #warn $todaysdate; @@ -366,17 +368,23 @@ EOF my $todaysissues=''; my $previssues=''; if ($borrower) { + my @todaysissues; + my @previousissues; my $issueslist = getissues($borrower); - my $tcolor = ''; - my $pcolor = ''; - foreach my $it (sort keys %$issueslist) { - my $dd = $issueslist->{$it}->{'date_due'}; + foreach my $it (keys %$issueslist) { my $issuedate = $issueslist->{$it}->{'timestamp'}; $issuedate = substr($issuedate, 0, 8); - - my $bookissue = $issueslist->{$it}; - my $bgcolor=''; - my $datedue = $bookissue->{'date_due'}; + if ($todaysdate == $issuedate) { + push @todaysissues, $issueslist->{$it}; + } else { + push @previousissues, $issueslist->{$it}; + } + } + my $tcolor = ''; + my $pcolor = ''; + foreach my $book (sort {$b->{'timestamp'} <=> $a->{'timestamp'}} @todaysissues){ + my $dd = $book->{'date_due'}; + my $datedue = $book->{'date_due'}; #convert to nz style dates #this should be set with some kinda config variable my @tempdate=split(/-/,$dd); @@ -385,27 +393,36 @@ if ($borrower) { if ($datedue < $todaysdate) { $dd="$dd\n"; } - if ($todaysdate == $issuedate) { - ($tcolor eq $linecolor1) ? ($tcolor=$linecolor2) : ($tcolor=$linecolor1); - $todaysissues .=<< "EOF"; + ($tcolor eq $linecolor1) ? ($tcolor=$linecolor2) : ($tcolor=$linecolor1); + $todaysissues .=<< "EOF"; $dd -{'biblionumber'}&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$bookissue->{'barcode'} -$bookissue->{'title'} -$bookissue->{'author'} -$bookissue->{'dewey'} $bookissue->{'subclass'} +{'biblionumber'}&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$book->{'barcode'} +$book->{'title'} +$book->{'author'} +$book->{'dewey'} $book->{'subclass'} EOF - } else { - ($pcolor eq $linecolor1) ? ($pcolor=$linecolor2) : ($pcolor=$linecolor1); - $previssues .= << "EOF"; + } + foreach my $book (sort {$b->{'timestamp'} <=> $a->{'timestamp'}} @previousissues){ + my $dd = $book->{'date_due'}; + my $datedue = $book->{'date_due'}; + #convert to nz style dates + #this should be set with some kinda config variable + my @tempdate=split(/-/,$dd); + $dd="$tempdate[2]/$tempdate[1]/$tempdate[0]"; + $datedue=~s/-//g; + if ($datedue < $todaysdate) { + $dd="$dd\n"; + } + ($pcolor eq $linecolor1) ? ($pcolor=$linecolor2) : ($pcolor=$linecolor1); + $previssues .= << "EOF"; $dd -{'biblionumber'}&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$bookissue->{'barcode'} -$bookissue->{'title'} -$bookissue->{'author'} -$bookissue->{'dewey'} $bookissue->{'subclass'} +{'biblionumber'}&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$book->{'barcode'} +$book->{'title'} +$book->{'author'} +$book->{'dewey'} $book->{'subclass'} EOF - } } } -- 2.39.2