From ed4405e96405416a12805cef8bc9cebea3531413 Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 4 Sep 2006 04:23:29 +0000 Subject: [PATCH] fixing the patron clone search git-svn-id: svn://svn.open-ils.org/ILS/trunk@5913 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../OpenILS/Application/Storage/Publisher/actor.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm index 1c9b959a5c..4fef7364f8 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm @@ -317,19 +317,19 @@ sub patron_search { my $u_select = "SELECT id as id FROM $u_table u WHERE $usr_where"; my $a_select = "SELECT usr as id FROM $a_table a WHERE $addr_where"; - my $clone_select = "SELECT cu.id as id FROM $a_table ca ". + my $clone_select = "JOIN (SELECT cu.id as id FROM $a_table ca ". "JOIN $u_table cu ON (cu.mailing_address = ca.id OR cu.billing_address = ca.id) ". - "WHERE $addr_where"; + "WHERE $addr_where) AS clone USING (id)" if ($addr_where); my $select = ''; if ($usr_where) { if ($addr_where) { - $select = "$u_select INTERSECT $a_select UNION $clone_select"; + $select = "$u_select INTERSECT $a_select"; } else { $select = $u_select; } } elsif ($addr_where) { - $select = "$a_select UNION $clone_select"; + $select = "$a_select"; } else { return undef; } @@ -347,6 +347,7 @@ sub patron_search { FROM $u_table AS users JOIN ($select) AS search USING (id) + $clone_select WHERE users.deleted = FALSE $inactive ORDER BY $order_by LIMIT $limit -- 2.43.2