Fixed the ordering of bibitems displayed in the request page. Most recent at top, ordered by dateaccessioned on the items table.

This commit is contained in:
finlayt 2002-09-19 00:24:27 +00:00
parent 1e0e50e304
commit 70003da4ec
2 changed files with 18 additions and 15 deletions

View file

@ -1337,7 +1337,7 @@ sub itemcount {
if (my $data2=$sth2->fetchrow_hashref){ if (my $data2=$sth2->fetchrow_hashref){
$nacount++; $nacount++;
} else { } else {
if ($data->{'holdingbranch'} eq 'C'){ if ($data->{'holdingbranch'} eq 'C' || $data->{'holdingbranch'} eq 'LT'){
$lcount++; $lcount++;
} }
if ($data->{'holdingbranch'} eq 'F' || $data->{'holdingbranch'} eq 'FP'){ if ($data->{'holdingbranch'} eq 'F' || $data->{'holdingbranch'} eq 'FP'){
@ -1437,7 +1437,10 @@ sub ItemType {
sub bibitems { sub bibitems {
my ($bibnum) = @_; my ($bibnum) = @_;
my $dbh = C4Connect; 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 FROM biblioitems, itemtypes, items
WHERE biblioitems.biblionumber = ? WHERE biblioitems.biblionumber = ?
AND biblioitems.itemtype = itemtypes.itemtype AND biblioitems.itemtype = itemtypes.itemtype

View file

@ -71,8 +71,8 @@ my ($count2,@data) = bibitems($bib);
my $bibitemrows = ""; my $bibitemrows = "";
for (my $i=0; $i<$count2; $i++) { foreach my $dat (sort {$b->{'dateaccessioned'} cmp $a->{'dateaccessioned'}} @data) {
my @barcodes = barcodes($data[$i]->{'biblioitemnumber'}); my @barcodes = barcodes($dat->{'biblioitemnumber'});
my $barcodestext = ""; my $barcodestext = "";
foreach my $num (@barcodes) { foreach my $num (@barcodes) {
my $message = $num->{'itemlost'} == 1 ? "(lost)" : my $message = $num->{'itemlost'} == 1 ? "(lost)" :
@ -81,26 +81,26 @@ for (my $i=0; $i<$count2; $i++) {
} }
$barcodestext = substr($barcodestext, 0, -4); $barcodestext = substr($barcodestext, 0, -4);
$data[$i]->{'dewey'}="" if ($data[$i]->{'dewey'} == 0); $dat->{'dewey'}="" if ($dat->{'dewey'} == 0);
$data[$i]->{'volumeddesc'} = "&nbsp;" unless $data[$i]->{'volumeddesc'}; $dat->{'volumeddesc'} = "&nbsp;" unless $dat->{'volumeddesc'};
$data[$i]->{'dewey'}=~ s/\.0000$//; $dat->{'dewey'}=~ s/\.0000$//;
$data[$i]->{'dewey'}=~ s/00$//; $dat->{'dewey'}=~ s/00$//;
my $class="$data[$i]->{'classification'}$data[$i]->{'dewey'}$data[$i]->{'subclass'}"; my $class="$dat->{'classification'}$dat->{'dewey'}$dat->{'subclass'}";
my $select; my $select;
if (($data[$i]->{'notforloan'}) if (($dat->{'notforloan'})
|| ($data[$i]->{'itemlost'} == 1)) { || ($dat->{'itemlost'} == 1)) {
$select = "Cannot be reserved."; $select = "Cannot be reserved.";
} else { } else {
$select = " <input type=checkbox name=reqbib value=$data[$i]->{'biblioitemnumber'}><input type=hidden name=biblioitem value=$data[$i]->{'biblioitemnumber'}>"; $select = " <input type=checkbox name=reqbib value=$dat->{'biblioitemnumber'}><input type=hidden name=biblioitem value=$dat->{'biblioitemnumber'}>";
} }
$bibitemrows .= <<"EOF"; $bibitemrows .= <<"EOF";
<tr VALIGN=TOP> <tr VALIGN=TOP>
<TD>$select</td> <TD>$select</td>
<TD>$data[$i]->{'description'}</td> <TD>$dat->{'description'}</td>
<TD>$class</td> <TD>$class</td>
<td>$data[$i]->{'volumeddesc'}</td> <td>$dat->{'volumeddesc'}</td>
<td>$data[$i]->{'publicationyear'}</td> <td>$dat->{'publicationyear'}</td>
<td>$barcodestext</td> <td>$barcodestext</td>
</tr> </tr>
EOF EOF