From: Owen Leonard Date: Mon, 1 Nov 2010 00:51:17 +0000 (-0600) Subject: change tc_interview.interviewer to point to tc_leader.leader instead of tc_individual... X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/images/static/git-favicon.png?a=commitdiff_plain;h=1d7d0afcd39dbd2c4c4ebe13ac110cb984270761;p=eq%2F.git change tc_interview.interviewer to point to tc_leader.leader instead of tc_individual.individual --- diff --git a/bin/upgrade_1_1_0_to_1_1_1 b/bin/upgrade_1_1_0_to_1_1_1 index 21b6bed..0337a6e 100755 --- a/bin/upgrade_1_1_0_to_1_1_1 +++ b/bin/upgrade_1_1_0_to_1_1_1 @@ -86,6 +86,9 @@ $sth->execute or die "-E- DB error: $DBI::errstr\n"; $sth = $dbh->prepare("ALTER TABLE `tc_visit` DROP `companion1`, DROP `companion2`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; +# change tc_interview so interviewer points to tc_leader.leader +$sth = $dbh->prepare("UPDATE tc_interview AS ti JOIN tc_leader AS tl SET ti.interviewer=tl.leader WHERE ti.interviewer=tl.individual"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; print "-> Done!\n"; diff --git a/inc/class.tc.inc.php b/inc/class.tc.inc.php index 3a412eb..b1995ed 100644 --- a/inc/class.tc.inc.php +++ b/inc/class.tc.inc.php @@ -2959,12 +2959,12 @@ class tc if($this->yearly_ppi_interviewer == 3) { $sql .= " (tl.type='P' OR tl.type='C' OR tl.type='S')"; } $this->db2->query($sql,__LINE__,__FILE__); while ($this->db2->next_record()) { - $indiv = $this->db2->f('individual'); + $leader = $this->db2->f('leader'); $interviewer_name = $this->db2->f('name'); - if($indiv == $interviewer) { - $this->t->set_var('interviewer',$indiv . ' selected'); + if($leader == $interviewer) { + $this->t->set_var('interviewer',$leader . ' selected'); } else { - $this->t->set_var('interviewer',$indiv); + $this->t->set_var('interviewer',$leader); } #print "indiv: $indiv interviewer: $interviewer
"; $this->t->set_var('interviewer_name',$interviewer_name); @@ -3285,12 +3285,12 @@ class tc $sql = "SELECT * FROM tc_leader AS tl JOIN (tc_individual AS ti, tc_district AS td) WHERE tl.individual=ti.individual AND tl.leader=td.leader AND tl.valid=1 AND (tl.type='P' OR tl.type='C' OR tl.type='D' OR td.district!=0)"; $this->db2->query($sql,__LINE__,__FILE__); while ($this->db2->next_record()) { - $indiv = $this->db2->f('individual'); + $leader = $this->db2->f('leader'); $interviewer_name = $this->db2->f('name'); - if($indiv == $interviewer) { - $this->t->set_var('interviewer',$indiv . ' selected'); + if($leader == $interviewer) { + $this->t->set_var('interviewer',$leader . ' selected'); } else { - $this->t->set_var('interviewer',$indiv); + $this->t->set_var('interviewer',$leader); } $this->t->set_var('interviewer_name',$interviewer_name); $this->t->fp('int_list','interviewer_list',True); diff --git a/sql/schema.dot b/sql/schema.dot index 136e253..b6f961c 100644 --- a/sql/schema.dot +++ b/sql/schema.dot @@ -127,7 +127,7 @@ digraph schema { participation:a -> activity:a interview:il -> individual:i - interview:i -> individual:i + interview:i -> leader:l leader:i -> individual:i diff --git a/sql/tc.jpg b/sql/tc.jpg index 7885fed..f6eef0b 100644 Binary files a/sql/tc.jpg and b/sql/tc.jpg differ