From 70003da4ec1b8c243ffec42da55e9d00a8d88617 Mon Sep 17 00:00:00 2001 From: finlayt Date: Thu, 19 Sep 2002 00:24:27 +0000 Subject: [PATCH] Fixed the ordering of bibitems displayed in the request page. Most recent at top, ordered by dateaccessioned on the items table. --- C4/Search.pm | 7 +++++-- request.pl | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 5d3b263b3f..e06fa560be 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1337,7 +1337,7 @@ sub itemcount { if (my $data2=$sth2->fetchrow_hashref){ $nacount++; } else { - if ($data->{'holdingbranch'} eq 'C'){ + if ($data->{'holdingbranch'} eq 'C' || $data->{'holdingbranch'} eq 'LT'){ $lcount++; } if ($data->{'holdingbranch'} eq 'F' || $data->{'holdingbranch'} eq 'FP'){ @@ -1437,7 +1437,10 @@ sub ItemType { sub bibitems { my ($bibnum) = @_; my $dbh = C4Connect; - my $query = "SELECT biblioitems.*, itemtypes.*, MIN(items.itemlost) as itemlost + my $query = "SELECT biblioitems.*, + itemtypes.*, + MIN(items.itemlost) as itemlost, + MIN(items.dateaccessioned) as dateaccessioned FROM biblioitems, itemtypes, items WHERE biblioitems.biblionumber = ? AND biblioitems.itemtype = itemtypes.itemtype diff --git a/request.pl b/request.pl index 1bd575a63f..7844348dc0 100755 --- a/request.pl +++ b/request.pl @@ -71,8 +71,8 @@ my ($count2,@data) = bibitems($bib); my $bibitemrows = ""; -for (my $i=0; $i<$count2; $i++) { - my @barcodes = barcodes($data[$i]->{'biblioitemnumber'}); +foreach my $dat (sort {$b->{'dateaccessioned'} cmp $a->{'dateaccessioned'}} @data) { + my @barcodes = barcodes($dat->{'biblioitemnumber'}); my $barcodestext = ""; foreach my $num (@barcodes) { my $message = $num->{'itemlost'} == 1 ? "(lost)" : @@ -81,26 +81,26 @@ for (my $i=0; $i<$count2; $i++) { } $barcodestext = substr($barcodestext, 0, -4); - $data[$i]->{'dewey'}="" if ($data[$i]->{'dewey'} == 0); + $dat->{'dewey'}="" if ($dat->{'dewey'} == 0); - $data[$i]->{'volumeddesc'} = " " unless $data[$i]->{'volumeddesc'}; - $data[$i]->{'dewey'}=~ s/\.0000$//; - $data[$i]->{'dewey'}=~ s/00$//; - my $class="$data[$i]->{'classification'}$data[$i]->{'dewey'}$data[$i]->{'subclass'}"; + $dat->{'volumeddesc'} = " " unless $dat->{'volumeddesc'}; + $dat->{'dewey'}=~ s/\.0000$//; + $dat->{'dewey'}=~ s/00$//; + my $class="$dat->{'classification'}$dat->{'dewey'}$dat->{'subclass'}"; my $select; - if (($data[$i]->{'notforloan'}) - || ($data[$i]->{'itemlost'} == 1)) { + if (($dat->{'notforloan'}) + || ($dat->{'itemlost'} == 1)) { $select = "Cannot be reserved."; } else { - $select = " {'biblioitemnumber'}>{'biblioitemnumber'}>"; + $select = " {'biblioitemnumber'}>{'biblioitemnumber'}>"; } $bibitemrows .= <<"EOF"; $select -$data[$i]->{'description'} +$dat->{'description'} $class -$data[$i]->{'volumeddesc'} -$data[$i]->{'publicationyear'} +$dat->{'volumeddesc'} +$dat->{'publicationyear'} $barcodestext EOF -- 2.39.5