From 4c8106c717ade1fb6854922662ff87e7ff262c08 Mon Sep 17 00:00:00 2001
From: Owen Leonard <owen@balawis.leonard.fam>
Date: Thu, 21 Oct 2010 14:29:29 -0600
Subject: [PATCH] improve filter of companions

---
 inc/class.tc.inc.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/inc/class.tc.inc.php b/inc/class.tc.inc.php
index dee205c..883884f 100644
--- a/inc/class.tc.inc.php
+++ b/inc/class.tc.inc.php
@@ -544,7 +544,7 @@ class tc
 				$this->db2->query($sql,__LINE__,__FILE__);
 				$companionship_sandbox = mysql_insert_id();
 				
-				$sql = "SELECT * FROM tc_companion WHERE companionship=$companionship AND valid=1";
+				$sql = "SELECT * FROM tc_companion AS tc JOIN tc_individual AS ti WHERE tc.individual=ti.individual AND tc.companionship=$companionship AND tc.valid=1 AND ti.valid=1";
 				$this->db2->query($sql,__LINE__,__FILE__);
 				while ($this->db2->next_record()) {
 					$individual = $this->db2->f('individual');
-- 
2.34.1