From 7eeda65a588aaee914229758f11e6411cd7151a9 Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 4 Apr 2006 13:15:50 +0000 Subject: [PATCH] add the last 5 arrived serials for a given subscription (to enable "rollback") --- C4/Bull.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/C4/Bull.pm b/C4/Bull.pm index bdead27430..9211030e4c 100755 --- a/C4/Bull.pm +++ b/C4/Bull.pm @@ -357,6 +357,18 @@ sub modsubscriptionhistory { sub getserials { my ($subscriptionid) = @_; my $dbh = C4::Context->dbh; + # OK, now add the last 5 issues arrives/missing + my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate,notes from serial where subscriptionid = ? and (status in (2,4,5)) order by serialid DESC"); + $sth->execute($subscriptionid); + my $counter=0; + my @serials; + while((my $line = $sth->fetchrow_hashref) && $counter <5) { + $counter++; + $line->{"status".$line->{status}} = 1; # fills a "statusX" value, used for template status select list + $line->{"planneddate"} = format_date($line->{"planneddate"}); + push @serials,$line; + } + # status = 2 is "arrived" my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate,notes from serial where subscriptionid = ? and status <>2 and status <>4 and status <>5"); $sth->execute($subscriptionid); -- 2.39.5