From: Owen Leonard Date: Sun, 12 Sep 2010 08:35:08 +0000 (-0600) Subject: added steward field to tc_indiv so we can list prospective elders X-Git-Tag: release_1_0_0~54 X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/images/%7Bediturl%7D?a=commitdiff_plain;h=1c42e4dcbd4ebc672c7be3059a6e36ef1c9b0b74;p=eq%2F.git added steward field to tc_indiv so we can list prospective elders --- diff --git a/bin/import_ward_data b/bin/import_ward_data index 97823c4..7e8b7ac 100755 --- a/bin/import_ward_data +++ b/bin/import_ward_data @@ -160,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','1','','1','',$attending,1)"); + $sth = $dbh->prepare("insert into tc_indiv values (NULL,'$id',\"$indiv_name\",'$year-$month-$day','$address','$phone','$email','','$hhposition','$priesthood','','1','','1','',$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 @@ -609,6 +609,29 @@ sub update_family_in_tc_indiv_table } } +sub update_organization_class_data +{ + print "\n-> Updating organization class info in tc_indiv table\n"; + + foreach $index (keys %organization_class_data) + { + # get name and organization info for each individual + $name = $organization_class_data{$index}{'Preferred Name'}; + $org_class = $organization_class_data{$index}{'Organization Class'}; + + if ($org_class =~ m/Elder/i) { + #print " $name: Elder\n"; + $sth = $dbh->prepare("update tc_indiv set steward='Elder' where name=\"$name\""); + $sth->execute or die "-E- DB error: $DBI::errstr\n"; + } + if ($org_class =~ m/High Priest/i) { + #print " $name: High Priest\n"; + $sth = $dbh->prepare("update tc_indiv set steward='High Priest' where name=\"$name\""); + $sth->execute or die "-E- DB error: $DBI::errstr\n"; + } + } +} + ###################################################################### # MAIN ###################################################################### @@ -650,7 +673,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/Organization\ class\ per\ member.csv", \%organization_class_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); @@ -679,6 +702,7 @@ if($opt_s) { $dbh->disconnect(); exit; } &update_tc_family_table(); &update_tc_visit_table(); &update_family_in_tc_indiv_table(); +&update_organization_class_data(); print "\n-> Import Successful! DONE...\n"; diff --git a/bin/upgrade_4_0_to_5_0 b/bin/upgrade_4_0_to_5_0 index 7401ea4..4c88c2a 100755 --- a/bin/upgrade_4_0_to_5_0 +++ b/bin/upgrade_4_0_to_5_0 @@ -87,10 +87,14 @@ $sth->execute or die "-E- DB error: $DBI::errstr\n"; $sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `family` INT(16) UNSIGNED NULL DEFAULT NULL AFTER `email`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; -# Add a new 'family' column to the tc_indiv table +# Add a new 'hh_position' column to the tc_indiv table $sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `hh_position` ENUM( 'Head of Household', 'Spouse', 'Other' ) NOT NULL DEFAULT 'Other' AFTER `family`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; +# Add a new 'steward' column to the tc_indiv table +$sth = $dbh->prepare("ALTER TABLE `tc_indiv` ADD `steward` ENUM( 'High Priest', 'Elder', '' ) NULL DEFAULT NULL AFTER `priesthood`"); +$sth->execute or die "-E- DB error: $DBI::errstr\n"; + # Rename eq_family table to tc_family $sth = $dbh->prepare("RENAME TABLE `eq_family` TO `tc_family`"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; diff --git a/doc/install.txt b/doc/install.txt index 1cac9d1..631af6e 100644 --- a/doc/install.txt +++ b/doc/install.txt @@ -102,10 +102,10 @@ Requirements Org Seq Sustained - EQ Prospective Elders.csv - Optional file that lists the prospective elders for which the EQ has stewardship. - Use this file if you want them listed in the PPI/attendence/etc lists - import mls/EQ\ Prospective\ Elders.mls as a new report into MLS to create the csv file. + Organization class per member.csv + File that contains information about which organization classes each member belongs to. + We use this to determine the prospective elders assigned to HP or EQ. + import mls/Organization\ class\ per\ member.mls as a new report into MLS to create the csv file. Home Teacher per Companionship.csv (optional file that lists home teaching stats - use all fields) import mls/Home\ Teacher\ per\ Companionship.mls as a new report into MLS to create the csv file. diff --git a/inc/class.tc.inc.php b/inc/class.tc.inc.php index 543aed8..3582c2f 100644 --- a/inc/class.tc.inc.php +++ b/inc/class.tc.inc.php @@ -1004,7 +1004,8 @@ class tc $this->t->set_block('par_view_t','header_list','list1'); $this->t->set_block('par_view_t','indiv_list','list2'); - $sql = "SELECT * FROM tc_indiv where valid=1"; + // TODO: changed this so it picks the quorum dynamically + $sql = "SELECT * FROM tc_indiv where steward='Elder' and valid=1"; $this->db->query($sql,__LINE__,__FILE__); $i=0; while ($this->db->next_record()) @@ -1114,7 +1115,8 @@ class tc } $this->t->set_var('filter_input',$filter_input); - $sql = "SELECT * FROM tc_indiv where valid=1"; + // TODO: changed this so it picks the quorum dynamically + $sql = "SELECT * FROM tc_indiv where steward='Elder' and valid=1"; $this->db->query($sql,__LINE__,__FILE__); $i=0; while ($this->db->next_record()) @@ -1457,7 +1459,8 @@ class tc } // create the individual id -> individual name mapping - $sql = "SELECT * FROM tc_indiv where valid=1 ORDER BY name ASC"; + // TODO: changed this so it picks the quorum dynamically + $sql = "SELECT * FROM tc_indiv where valid=1 and steward='Elder' ORDER BY name ASC"; $this->db->query($sql,__LINE__,__FILE__); $i=0; $indiv_id = NULL; @@ -1536,7 +1539,8 @@ class tc $this->t->set_var('appt_table_width',$appt_table_width); // PPI SCHEDULING TABLE - $sql = "SELECT * FROM tc_indiv where valid=1 ORDER BY ppi_pri ASC"; + // TODO: changed this so it picks the quorum dynamically + $sql = "SELECT * FROM tc_indiv where valid=1 and steward='Elder' ORDER BY ppi_pri ASC"; $this->db->query($sql,__LINE__,__FILE__); $i=0; @@ -1698,6 +1702,7 @@ class tc //print "year: $year month: $month quarter_start: $quarter_start quarter_end: $quarter_end
"; // create the individual id -> individual name mapping + // TODO: changed this so it picks the quorum dynamically $sql = "SELECT * FROM tc_indiv where valid=1 ORDER BY name ASC"; $this->db->query($sql,__LINE__,__FILE__); $i=0; @@ -2384,7 +2389,8 @@ class tc $this->t->set_var('district_number','*'); $this->t->set_var('district_name',$president_name); - $sql = "SELECT * FROM tc_indiv where valid=1 ORDER BY indiv ASC"; + // TODO: changed this so it picks the quorum dynamically + $sql = "SELECT * FROM tc_indiv where steward='Elder' and valid=1 ORDER BY indiv ASC"; $this->db->query($sql,__LINE__,__FILE__); $i=0; while ($this->db->next_record()) @@ -3149,7 +3155,8 @@ class tc else if($current_month >= 7 && $current_month <= 9) { $current_month=9; } else if($current_month >= 10 && $current_month <= 12) { $current_month=12; } - $sql = "SELECT * FROM tc_indiv where valid=1"; + // TODO: changed this so it picks the quorum dynamically + $sql = "SELECT * FROM tc_indiv where steward='Elder' and valid=1"; $this->db->query($sql,__LINE__,__FILE__); $i=0; while ($this->db->next_record()) @@ -3341,7 +3348,8 @@ class tc return false; } - $sql = "SELECT * FROM tc_indiv where valid=1"; + // TODO: changed this so it picks the quorum dynamically + $sql = "SELECT * FROM tc_indiv where steward='Elder' and valid=1"; $this->db->query($sql,__LINE__,__FILE__); $i=0; while ($this->db->next_record()) @@ -3725,7 +3733,8 @@ class tc //Header('Location: ' . $take_me_to_url); } - $sql = "SELECT * FROM tc_indiv where valid=1 ORDER BY indiv ASC"; + // TODO: changed this so it picks the quorum dynamically + $sql = "SELECT * FROM tc_indiv where steward='Elder' and valid=1 ORDER BY indiv ASC"; $this->db->query($sql,__LINE__,__FILE__); $i=0; while ($this->db->next_record()) @@ -3943,7 +3952,8 @@ class tc $this->t->pfp('out','admin_t'); - $sql = "SELECT * FROM tc_indiv where valid=1 ORDER BY indiv ASC"; + // TODO: changed this so it picks the quorum dynamically + $sql = "SELECT * FROM tc_indiv where steward='Elder' and valid=1 ORDER BY indiv ASC"; $this->db->query($sql,__LINE__,__FILE__); $i=0; while ($this->db->next_record()) diff --git a/mls/EQ Prospective Elders.mls b/mls/EQ Prospective Elders.mls deleted file mode 100644 index a0472b9..0000000 --- a/mls/EQ Prospective Elders.mls +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/mls/Organization class per member.mls b/mls/Organization class per member.mls new file mode 100644 index 0000000..eb174af --- /dev/null +++ b/mls/Organization class per member.mls @@ -0,0 +1,7 @@ + + + + + + + diff --git a/mls/windowsGUI/MLSFileTrimmer/MLSRequiredFields.xml b/mls/windowsGUI/MLSFileTrimmer/MLSRequiredFields.xml index d2958f4..02584f6 100644 --- a/mls/windowsGUI/MLSFileTrimmer/MLSRequiredFields.xml +++ b/mls/windowsGUI/MLSFileTrimmer/MLSRequiredFields.xml @@ -47,8 +47,8 @@ * - - A list of prospective elders in the EQ stewardship + + A list of members and which organization classes they belong to csv * diff --git a/sql/schema.dot b/sql/schema.dot index e6059e5..ee12da4 100644 --- a/sql/schema.dot +++ b/sql/schema.dot @@ -7,7 +7,7 @@ digraph schema { shape = "record" ]; indiv [ - label = " indiv|| indiv_id| name| birthday| address|

phone| email| family| hh position| priesthood| prospective| ppi_pri| ppi_notes| int_pri| int_notes| attending| valid" + label = " indiv|| indiv_id| name| birthday| address|

phone| email| family| hh position| priesthood| steward| prospective| ppi_pri| ppi_notes| int_pri| int_notes| attending| valid" shape = "record" ]; companionship [ diff --git a/sql/tc.jpg b/sql/tc.jpg index 8244f5e..d771d39 100644 Binary files a/sql/tc.jpg and b/sql/tc.jpg differ diff --git a/sql/tc.sql b/sql/tc.sql index ab47cce..82e631b 100644 --- a/sql/tc.sql +++ b/sql/tc.sql @@ -116,6 +116,7 @@ CREATE TABLE `tc_indiv` ( `family` int(16) unsigned default NULL, `hh_position` enum('Head of Household','Spouse','Other') DEFAULT 'Other', `priesthood` enum('High Priest','Elder','Priest','Teacher','Deacon','Unordained') DEFAULT NULL, + `steward` enum('High Priest','Elder') DEFAULT NULL, `ppi_pri` int(10) unsigned NOT NULL default '1', `ppi_notes` varchar(128) default NULL, `int_pri` int(10) unsigned default '1',