From d79ef1cbbfcc523bdac49bdbdf61b6bae43da00b Mon Sep 17 00:00:00 2001
From: Alan Jack Pippin <ajp@pippin.(none)>
Date: Sun, 10 Sep 2006 21:37:32 -0600
Subject: [PATCH] Fixed bug related to preferred name mismatches with
 hometeaching family name.

---
 import_ward_data | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/import_ward_data b/import_ward_data
index d54f8fc..da23ae4 100755
--- a/import_ward_data
+++ b/import_ward_data
@@ -401,8 +401,11 @@ sub update_eq_family_table
 		    $hashref = $hometeaching_data{$index};
 		    foreach $key (keys %$hashref) {
 			if($hometeaching_data{$index}{'Household'} =~ /(\S+)\s+(\S+),\s+(\S+)\s+(.*)/) {
-			    print "I: Adjusting hometeaching match from: $hometeaching_data{$index}{'Household'} to $1, $3 $4\n";
-			    $hometeaching_data{$index}{'Household'} = "$1, $3 $4";
+			    $a = $1; $b = $2; $c = $3; $d = $4;
+			    if($family_name =~ /$a/ && $hometeaching_data{$index}{'Household'} !~ /$family_name/i) { 
+				print "I: Adjusting hometeaching match from: $hometeaching_data{$index}{'Household'} to $a, $c $d\n";
+				$hometeaching_data{$index}{'Household'} = "$a, $c $d";
+			    }
 			}
 			if($key =~ /Quorum/i &&
 			   $hometeaching_data{$index}{$key} =~ /Elders/i &&
-- 
2.34.1