added steward field to tc_indiv so we can list prospective elders
authorOwen Leonard <owen@balawis.leonard.fam>
Sun, 12 Sep 2010 08:35:08 +0000 (02:35 -0600)
committerOwen Leonard <owen@balawis.leonard.fam>
Sun, 12 Sep 2010 08:37:38 +0000 (02:37 -0600)
bin/import_ward_data
bin/upgrade_4_0_to_5_0
doc/install.txt
inc/class.tc.inc.php
mls/EQ Prospective Elders.mls [deleted file]
mls/Organization class per member.mls [new file with mode: 0644]
mls/windowsGUI/MLSFileTrimmer/MLSRequiredFields.xml
sql/schema.dot
sql/tc.jpg
sql/tc.sql

index 97823c43a4fbe7cac26982707491f360b6c7a2ef..7e8b7ac4787b49bd9ab57ab6122e638c37086b44 100755 (executable)
@@ -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";
 
index 7401ea4310af265a3e47fc659892754c59492637..4c88c2a584602ba4476758f15476a3efc303f617 100755 (executable)
@@ -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";
index 1cac9d1853b326772af47fe27ea8945101eb8f63..631af6e61fdc46517c9197d06913b444fd120029 100644 (file)
@@ -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.
index 543aed895317a4f44ff95ab615e15dceb31fa644..3582c2f930fc51edad9b9352511946ae44b41c7f 100644 (file)
@@ -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<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;
@@ -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 (file)
index a0472b9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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>
-
-
diff --git a/mls/Organization class per member.mls b/mls/Organization class per member.mls
new file mode 100644 (file)
index 0000000..eb174af
--- /dev/null
@@ -0,0 +1,7 @@
+<?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
index d2958f4cc91d7f2bab22db55e8fad0d55b3e265a..02584f61594d7b8c7b763cbfe8b3964c2c4e4932 100644 (file)
@@ -47,8 +47,8 @@
       <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
index e6059e5252bb6b01294d3d6164128d9f4f9a0f62..ee12da4683106b7f718c9ab99837e6cb61a23068 100644 (file)
@@ -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|<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   [
index 8244f5e181814ff29b946dea00dceaa26cdaf8d9..d771d39641886772c9c07b7e0e8307666e94a621 100644 (file)
Binary files a/sql/tc.jpg and b/sql/tc.jpg differ
index ab47ccedc66bd29f8dae0908a65db2d29276e647..82e631b271ffcbb6b43f785d4cb37ec86ed658d6 100644 (file)
@@ -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',