X-Git-Url: http://git.pippins.net/embedvideo/.git/static/git-logo.png?a=blobdiff_plain;f=bin%2Fimport_ward_data;h=37fb24869615dcbad74fd17a69be1b442c64559b;hb=8720abcdfd49bddf12b95383e558525efd8fed72;hp=b3696616902b888348a922fb2d6067058a5a78cf;hpb=fd3afb11f083a1d2610997ee85c550ff67586314;p=eq%2F.git diff --git a/bin/import_ward_data b/bin/import_ward_data index b369661..37fb248 100755 --- a/bin/import_ward_data +++ b/bin/import_ward_data @@ -199,6 +199,8 @@ sub update_eq_elder_table ) { $attending = 1; } if($phone =~ /(\d\d\d-\d\d\d\d)/) { $phone = "$areacode-$1"; } if($phone =~ /^\(\d\d\d\) (\d\d\d-\d\d\d\d)/) { $phone = "$1-$2"; } + $email = $membership_data{$index}{'Individual E-mail'}; + if ($email eq "") { $email = $membership_data{$index}{'Household E-mail'}; } $sth = $dbh->prepare("select * from eq_elder where name='$elder_name'"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; my @data = (); @@ -207,7 +209,7 @@ sub update_eq_elder_table if($rows == 0) { # No existing records found for this elder, make a new entry print " Adding new Elder: $elder_name\n"; - $sth = $dbh->prepare("insert into eq_elder values (NULL,'$id','$elder_name','$phone','','1','','1','',$attending,1)"); + $sth = $dbh->prepare("insert into eq_elder values (NULL,'$id','$elder_name','$phone','$email','1','','1','',$attending,1)"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; } elsif($rows == 1) { # An existing record was found for this elder, update it @@ -224,6 +226,8 @@ sub update_eq_elder_table $sth->execute or die "-E- DB error: $DBI::errstr\n"; $sth = $dbh->prepare("update eq_elder set indiv_id='$id' where name='$elder_name'"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; + $sth = $dbh->prepare("update eq_elder set email='$email' where name='$elder_name'"); + $sth->execute or die "-E- DB error: $DBI::errstr\n"; } else { # More than one record was found. Error! This shouldn't happen. print " -E- More than one record found ($rows) for Elder: $elder_name\n"; @@ -841,6 +845,7 @@ print "\n-> Processing all ward data files in $datadir\n"; ################################################### # Parse Ward Data Files +#&optional_csv_to_hash("$datadir/EQ\ Prospective\ Elders.csv", \%prospective_elder_data); &csv_to_hash("$datadir/Membership.csv",\%membership_data); &csv_to_hash("$datadir/HomeTeaching.csv",\%hometeaching_data); &csv_to_hash("$datadir/Organization.csv",\%organization_data);