$hashref = $membership_data{$index};
$id = $membership_data{$index}{'Indiv ID'};
$indiv_name = $membership_data{$index}{'Preferred Name'};
- $birthday = $membership_data{$index}{'Birth'};
- $birthday =~ /(\d+) (\S+) (\d+)/; $day=$1; $month=$monthname2num{$2}; $year=$3;
$address = $membership_data{$index}{'Street 1'};
if($membership_data{$index}{'Street 2'} ne "") {
$address .= " " . $membership_data{$index}{'Street 2'};
if($rows == 0) {
# No existing records found for this indiv, make a new entry
print " Adding new indiv: $indiv_name\n";
- $sth = $dbh->prepare("insert into tc_indiv values (NULL,'$id',\"$indiv_name\",'$year-$month-$day','$address','$phone','$email','','$hhposition','$priesthood','','$default_interview_pri','','$default_interview_pri','',$attending,1)");
+ $sth = $dbh->prepare("insert into tc_indiv values (NULL,'$id',\"$indiv_name\",'$address','$phone','$email','','$hhposition','$priesthood','','$default_interview_pri','','$default_interview_pri','',$attending,1)");
$sth->execute or die "-E- DB error: $DBI::errstr\n";
} elsif($rows == 1) {
# An existing record was found for this indiv, update it
$sth = $dbh->prepare("update tc_indiv set phone=NULL where name=\"$indiv_name\"");
}
$sth->execute or die "-E- DB error: $DBI::errstr\n";
- if($birthday ne "") {
- $sth = $dbh->prepare("update tc_indiv set birthday='$year-$month-$day' where name=\"$indiv_name\"");
- } else {
- $sth = $dbh->prepare("update tc_indiv set birthday=NULL where name=\"$indiv_name\"");
- }
- $sth->execute or die "-E- DB error: $DBI::errstr\n";
if($address ne "") {
$sth = $dbh->prepare("update tc_indiv set address='$address' where name=\"$indiv_name\"");
} else {
%hometeaching_data = ();
%membership_data = ();
-getopts('vsn:o:b');
-
-$monthname2num{'Jan'} = '01';
-$monthname2num{'Feb'} = '02';
-$monthname2num{'Mar'} = '03';
-$monthname2num{'Apr'} = '04';
-$monthname2num{'May'} = '05';
-$monthname2num{'Jun'} = '06';
-$monthname2num{'Jul'} = '07';
-$monthname2num{'Aug'} = '08';
-$monthname2num{'Sep'} = '09';
-$monthname2num{'Oct'} = '10';
-$monthname2num{'Nov'} = '11';
-$monthname2num{'Dec'} = '12';
+getopts('vsn:o');
######################################################################
# SUBROUTINES
}
}
-######################################################################
-sub print_birthdays
-{
- my ($hashref) = @_;
-
- foreach $key (sort {$a <=> $b} keys %$hashref) {
- $name = "";
- $birthday = "";
- foreach $field (keys %{$hashref->{$key}}) {
- if($field =~ /Full Name/) { $name = $hashref->{$key}{$field}; }
- if($field =~ /Birth/) { $birthday = $hashref->{$key}{$field}; }
- }
- if($name ne "" && $birthday ne "") { printf "%-30s %-10s\n",$name,$birthday; }
- }
-}
-
######################################################################
# MAIN
######################################################################
&print_hash(\%hometeaching_data);
}
-if($opt_b) { &print_birthdays(\%membership_data); }
-
if($opt_s) { $dbh->disconnect(); exit; }
###################################################
$sth = $dbh->prepare("ALTER TABLE `tc_indiv` CHANGE `elder` `indiv` INT(16) NOT NULL AUTO_INCREMENT");
$sth->execute or die "-E- DB error: $DBI::errstr\n";
-# Add a new 'birthday' column to the tc_indiv table
-$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `birthday` DATE NULL DEFAULT NULL AFTER `name` ");
-$sth->execute or die "-E- DB error: $DBI::errstr\n";
-
# Add a new 'address' column to the tc_indiv table
-$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `address` VARCHAR( 255 ) NULL DEFAULT NULL AFTER `birthday`");
+$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `address` VARCHAR( 255 ) NULL DEFAULT NULL AFTER `name`");
$sth->execute or die "-E- DB error: $DBI::errstr\n";
# Add a new 'family' column to the tc_indiv table
HofH ID
Street 1
Street 2
- Birth
Full Name
Priesthood
HH Position
<MLSField>HofH ID</MLSField>\r
<MLSField>Street 1</MLSField>\r
<MLSField>Street 2</MLSField>\r
- <MLSField>Birth</MLSField>\r
<MLSField>Full Name</MLSField>\r
<MLSField>Priesthood</MLSField>\r
<MLSField>HH Position</MLSField>\r
shape = "record"
];
indiv [
- label = "<i> indiv||<id> indiv_id|<n> name|<b> birthday|<a> address|<p> phone|<em> email|<f> family|<hh> hh position|<po> priesthood|<st> steward|<pr> prospective|<pp> ppi_pri|<t> ppi_notes|<ip> int_pri|<in> int_notes|<a> attending|<v> valid"
+ label = "<i> indiv||<id> indiv_id|<n> name|<a> address|<p> phone|<em> email|<f> family|<hh> hh position|<po> priesthood|<st> steward|<pr> prospective|<pp> ppi_pri|<t> ppi_notes|<ip> int_pri|<in> int_notes|<a> attending|<v> valid"
shape = "record"
];
companionship [
`indiv` int(16) unsigned NOT NULL auto_increment,
`indiv_id` int(16) unsigned NOT NULL,
`name` varchar(60) default NULL,
- `birthday` date default NULL,
`address` varchar(255) default NULL,
`phone` varchar(12) default NULL,
`email` varchar(120) default NULL,