From 5189833f3ee4ad6045de7048b04ede14b9fc0c8b Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 12 Apr 2006 15:11:35 +0000 Subject: [PATCH] fixing open-ils.storage.biblio.record_entry.status_copy_count to give all results, not just the last from an OU git-svn-id: svn://svn.open-ils.org/ILS/trunk@3682 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../Application/Storage/Publisher/biblio.pm | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm index 820c00d6db..c8de87b5b9 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm @@ -335,25 +335,22 @@ sub record_copy_status_count { AND cl.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.holdable - GROUP BY 1,2,3 - ORDER BY 1,2,3; + GROUP BY 1,2,3; SQL my $sth = biblio::record_entry->db_Main->prepare_cached($sql); $sth->execute("$rec"); - my ($ou,$cn) = (0,''); my %data = (); for my $row (@{$sth->fetchall_arrayref}) { - if ($ou and $ou ne $$row[0]) { - my $i = 0; - $client->respond( [$ou, $cn, {%data}] ); - %data = (); + $data{$$row[0]}{$$row[1]}{$$row[2]} += $$row[3]; + } + + for my $ou (keys %data) { + for my $cn (keys %{$data{$ou}}) { + $client->respond( [$ou, $cn, $data{$ou}{$cn}] ); } - ($ou,$cn) = ($$row[0],$$row[1]); - $data{$$row[2]} = $$row[3]; } - return [$ou, $cn, {%data}] if ($ou); return undef; } __PACKAGE__->register_method( -- 2.43.2