From fb5c9b318a7d632b49177d1aa5dec5b4afab584b Mon Sep 17 00:00:00 2001 From: sushi Date: Wed, 7 Jun 2006 02:04:48 +0000 Subject: [PATCH] Merging Katipo changes. Added a bit to display the correct item type for a person who has 2 or more reserve this type only reserves on the same day, ie - reserved a dvd and a book with same biblio. --- C4/Reserves2.pm | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/C4/Reserves2.pm b/C4/Reserves2.pm index 3f2609b6d7..fc6f4d80f3 100755 --- a/C4/Reserves2.pm +++ b/C4/Reserves2.pm @@ -283,6 +283,7 @@ SELECT branchcode, my $sth=$dbh->prepare($query); $sth->execute(@bind); my @results; + my $i = 0; while (my $data = $sth->fetchrow_hashref){ # FIXME - What is this if-statement doing? How do constraints work? if ($data->{constrainttype} eq 'o') { @@ -299,16 +300,31 @@ SELECT biblioitemnumber $data->{borrowernumber}, $data->{reservedate}, ); - my ($bibitemno) = $csth->fetchrow_array; - $csth->finish; - # Look up the book we just found. - my $bdata = bibitemdata($bibitemno); - # Add the results of this latest search to the current - # results. - # FIXME - An 'each' would probably be more efficient. - foreach my $key (keys %$bdata) { - $data->{$key} = $bdata->{$key}; - } + + my @bibitemno; + while (my $bibitemnos = $csth->fetchrow_array){ + push (@bibitemno,$bibitemnos); + } + my $count = @bibitemno; + + # if we have two or more different specific itemtypes + # reserved by same person on same day + my $bdata; + if($count > 1){ + warn "bibitemno $bibitemno[$i]"; + $bdata = C4::Search::bibitemdata($bibitemno[$i]); + $i++; + } else { + # Look up the book we just found. + $bdata = C4::Search::bibitemdata($bibitemno[0]); + } + $csth->finish; + # Add the results of this latest search to the current + # results. + # FIXME - An 'each' would probably be more efficient. + foreach my $key (keys %$bdata) { + $data->{$key} = $bdata->{$key}; + } } push @results, $data; } -- 2.39.2