+ // If we deleted the appointment, we still need to send a cancellation to the right people
+ // Make a note of the old email now in case we need it later
+ $old_indiv_email = "";
+ $sql = "SELECT * FROM tc_appointment where appointment='$appointment'";
+ $this->db->query($sql,__LINE__,__FILE__);
+ if($this->db->next_record()) {
+ $old_individual = $this->db->f('individual');
+ $old_family = $this->db->f('family');
+ if($old_individual > 0) {
+ $sql = "SELECT * FROM tc_individual where individual='$old_individual'";
+ $this->db2->query($sql,__LINE__,__FILE__);
+ if($this->db2->next_record()) {
+ $old_indiv_email = $this->db2->f('email');
+ }
+ }
+ if($old_family > 0) {
+ $sql = "SELECT * FROM tc_family WHERE family='$old_family'";
+ $this->db2->query($sql,__LINE__,__FILE__);
+ if($this->db2->next_record()) {
+ $old_individual = $this->db2->f('individual');
+ $sql = "SELECT * FROM tc_individual where individual='$old_individual'";
+ $this->db3->query($sql,__LINE__,__FILE__);
+ if($this->db3->next_record()) {
+ $old_indiv_email = $this->db3->f('email');
+ }
+ }
+ }
+ }
+