projects
/
eq
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changed from email address, import email addresses to eq_elder, flush temp files...
[eq/.git]
/
bin
/
import_ward_data
diff --git
a/bin/import_ward_data
b/bin/import_ward_data
index b3696616902b888348a922fb2d6067058a5a78cf..37fb24869615dcbad74fd17a69be1b442c64559b 100755
(executable)
--- 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"; }
) { $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 = ();
$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";
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
$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->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";
} 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
###################################################
# 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);
&csv_to_hash("$datadir/Membership.csv",\%membership_data);
&csv_to_hash("$datadir/HomeTeaching.csv",\%hometeaching_data);
&csv_to_hash("$datadir/Organization.csv",\%organization_data);