From bf339f318906f8965f5b81e9e4c5eb431f57219a Mon Sep 17 00:00:00 2001
From: Owen Leonard <owen@balawis.leonard.fam>
Date: Mon, 13 Sep 2010 19:47:10 -0600
Subject: [PATCH] removing birthday field from tc_indiv since we don't use it
 and it is personal info

---
 bin/import_ward_data                          | 10 +-----
 bin/parse_ward_data                           | 33 +------------------
 bin/upgrade_4_0_to_5_0                        |  6 +---
 doc/install.txt                               |  1 -
 .../MLSFileTrimmer/MLSRequiredFields.xml      |  1 -
 sql/schema.dot                                |  2 +-
 sql/tc.sql                                    |  1 -
 7 files changed, 4 insertions(+), 50 deletions(-)

diff --git a/bin/import_ward_data b/bin/import_ward_data
index 909f3ba..da32a0d 100755
--- a/bin/import_ward_data
+++ b/bin/import_ward_data
@@ -134,8 +134,6 @@ sub update_tc_indiv_table
 		$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'};
@@ -162,7 +160,7 @@ sub update_tc_indiv_table
 		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
@@ -175,12 +173,6 @@ sub update_tc_indiv_table
 				$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 {
diff --git a/bin/parse_ward_data b/bin/parse_ward_data
index aeca022..2a5848e 100755
--- a/bin/parse_ward_data
+++ b/bin/parse_ward_data
@@ -10,20 +10,7 @@ else { require "db_config"; }
 
 %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
@@ -68,22 +55,6 @@ sub print_hash
 	}
 }
 
-######################################################################
-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
 ######################################################################
@@ -112,8 +83,6 @@ if($opt_v) {
 	&print_hash(\%hometeaching_data);
 }
 
-if($opt_b) { &print_birthdays(\%membership_data); }
-
 if($opt_s) { $dbh->disconnect(); exit; }
 
 ###################################################
diff --git a/bin/upgrade_4_0_to_5_0 b/bin/upgrade_4_0_to_5_0
index f195223..c27fa3a 100755
--- a/bin/upgrade_4_0_to_5_0
+++ b/bin/upgrade_4_0_to_5_0
@@ -75,12 +75,8 @@ $sth->execute or die "-E- DB error: $DBI::errstr\n";
 $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
diff --git a/doc/install.txt b/doc/install.txt
index 631af6e..47b7ef8 100644
--- a/doc/install.txt
+++ b/doc/install.txt
@@ -78,7 +78,6 @@ Requirements
      HofH ID
      Street 1
      Street 2
-     Birth
      Full Name
      Priesthood
      HH Position
diff --git a/mls/windowsGUI/MLSFileTrimmer/MLSRequiredFields.xml b/mls/windowsGUI/MLSFileTrimmer/MLSRequiredFields.xml
index 02584f6..72d86d6 100644
--- a/mls/windowsGUI/MLSFileTrimmer/MLSRequiredFields.xml
+++ b/mls/windowsGUI/MLSFileTrimmer/MLSRequiredFields.xml
@@ -10,7 +10,6 @@
       <MLSField>HofH ID</MLSField>
       <MLSField>Street 1</MLSField>
       <MLSField>Street 2</MLSField>
-      <MLSField>Birth</MLSField>
       <MLSField>Full Name</MLSField>
       <MLSField>Priesthood</MLSField>
       <MLSField>HH Position</MLSField>
diff --git a/sql/schema.dot b/sql/schema.dot
index ee12da4..fa99b9a 100644
--- a/sql/schema.dot
+++ b/sql/schema.dot
@@ -7,7 +7,7 @@ digraph schema {
     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   [
diff --git a/sql/tc.sql b/sql/tc.sql
index 82e631b..f7cea23 100644
--- a/sql/tc.sql
+++ b/sql/tc.sql
@@ -109,7 +109,6 @@ CREATE TABLE `tc_indiv` (
   `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,
-- 
2.34.1