$membership_data{$index}{$key} =~ /^Priest\s*$/i)) {
$aaronic_name = $membership_data{$index}{'Preferred Name'};
$phone = $membership_data{$index}{'Phone 1'};
- if($phone =~ /(\d\d\d-\d\d\d\d)/) { $phone = "970-$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"; }
$sth = $dbh->prepare("select * from eq_aaronic where name='$aaronic_name'");
$sth->execute or die "-E- DB error: $DBI::errstr\n";
#| Field | Type | Null | Key | Default | Extra |
#+-------------+------------------+------+-----+---------+----------------+
#| elder | int(16) unsigned | | PRI | NULL | auto_increment |
+#| indiv_id | int(16) unsigned | | | NULL | |
#| name | varchar(60) | YES | | NULL | |
#| phone | varchar(12) | YES | | NULL | |
+#| email | varchar(120) | YES | | NULL | |
#| ppi_pri | int(10) unsigned | YES | | 1 | |
#| ppi_notes | varchar(128) | YES | | NULL | |
#| int_pri | int(10) unsigned | YES | | 1 | |
($organization =~ /Sunday School/) ||
($organization =~ /Primary/)
) { $attending = 1; }
- if($phone =~ /(\d\d\d-\d\d\d\d)/) { $phone = "970-$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"; }
$sth = $dbh->prepare("select * from eq_elder where name='$elder_name'");
$sth->execute or die "-E- DB error: $DBI::errstr\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,'$elder_name','$phone','1','','1','',$attending,1)");
+ $sth = $dbh->prepare("insert into eq_elder values (NULL,'$id','$elder_name','$phone','','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";
$sth = $dbh->prepare("update eq_elder set attending='$attending' where name='$elder_name'");
$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";
} 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";
$companionship = $hometeaching_data{$index}{'Comp ID'};
$sth = $dbh->prepare("update eq_family set companionship='$companionship' where name_id='$name_id'");
$sth->execute or die "-E- DB error: $DBI::errstr\n";
-
- # In addition to changing the hometeaching assignment, update the eq_visit table
- # so that all previous visits made by the old hometeaching companionship, get
- # updated with the id of the new companionship. This will allow us to go in and
- # edit the history as needed for the family being hometaught under their new
- # companionship. Otherwise, we will not be able to update this history.
- #$family_id = $data[0]->{family};
- #print " update eq_visit set companionship='$companionship' where family='$family_id' and companionship!='0'\n";
- #$sth = $dbh->prepare("update eq_visit set companionship='$companionship' where companionship='$old_companionship'");
- #$sth->execute or die "-E- DB error: $DBI::errstr\n";
}
}
}
$hofh_id = $membership_data{$index}{'HofH ID'};
$id = $membership_data{$index}{'Indiv ID'};
$phone = $membership_data{$index}{'Phone 1'};
- if($phone =~ /(\d\d\d-\d\d\d\d)/) { $phone = "970-$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"; }
$address = $membership_data{$index}{'Street 1'};
if($membership_data{$index}{'Street 2'} ne "") {