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
}
}
+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
######################################################################
###################################################
# 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);
&update_tc_family_table();
&update_tc_visit_table();
&update_family_in_tc_indiv_table();
+&update_organization_class_data();
print "\n-> Import Successful! DONE...\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";
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.
$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())
}
$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())
}
// 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;
$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;
//print "year: $year month: $month quarter_start: $quarter_start quarter_end: $quarter_end<br>";
// 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;
$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())
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())
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())
//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())
$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())
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<customReport name="EQ Prospective Elders" description="" isPortrait="false" groupOption="NONE" splitGroups="false">
- <query string="2,7,18,true,-1" />
- <query string="1,0,1,true,-1" />
- <query string="15,0,3,true,-1" />
- <query string="11,1,1,true,-1" />
- <column typeID="27" width="50" />
- <column typeID="31" width="50" />
-</customReport>
-
-
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<customReport name="Organization class per member" description="" isPortrait="false" groupOption="NONE" splitGroups="false">\r
+ <column typeID="31" width="33" />\r
+ <column typeID="27" width="33" />\r
+ <column typeID="21" width="33" />\r
+</customReport>\r
+\r
<MLSField>*</MLSField>\r
</MLSFile>\r
\r
- <MLSFile Name="EQ Prospective Elders.csv">\r
- <Description>A list of prospective elders in the EQ stewardship</Description>\r
+ <MLSFile Name="Organization class per member.csv">\r
+ <Description>A list of members and which organization classes they belong to</Description>\r
<Extension>csv</Extension>\r
<MLSField>*</MLSField>\r
</MLSFile>\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|<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|<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"
shape = "record"
];
companionship [
`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',