From f797899c6416d6731e4c014fd9b1cfd0dd94a829 Mon Sep 17 00:00:00 2001 From: Alan Jack Pippin Date: Thu, 9 Feb 2006 20:09:11 -0700 Subject: [PATCH] Fixed bug with valid qualifier missing from eq_companionship table access during ht_update. --- import_ward_data | 2 +- inc/class.eq.inc.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/import_ward_data b/import_ward_data index a691a91..522386e 100755 --- a/import_ward_data +++ b/import_ward_data @@ -265,7 +265,7 @@ sub update_eq_companionship_table my $rows = scalar @data; if($rows == 0) { # No existing records found for this companionship, make a new entry - print " Adding Elder to companionship: $elder_name -> $id\n"; + print " Adding Companion to companionship: $elder_name -> $id\n"; $sth = $dbh->prepare("insert into eq_companionship values ($id,'$elder','$aaronic','$district',1)"); $sth->execute or die "-E- DB error: $DBI::errstr\n"; } else { diff --git a/inc/class.eq.inc.php b/inc/class.eq.inc.php index 0512ca0..8f62c1b 100644 --- a/inc/class.eq.inc.php +++ b/inc/class.eq.inc.php @@ -328,7 +328,7 @@ class eq if($action == 'save') { // Get a list of all the companionships in this district - $sql = "SELECT distinct companionship FROM eq_companionship where district=". $district; + $sql = "SELECT distinct companionship FROM eq_companionship where valid=1 and district=". $district; $this->db->query($sql,__LINE__,__FILE__); $j=0; while ($this->db->next_record()) @@ -344,7 +344,9 @@ class eq // companionship. This will lead to duplicate visits being entered for an older // month for the same family, making it impossible to change the past history once // a family is reassigned. However, you will be able to view the history just fine. - + + //$comp=$unique_companionships[$j]['companionship']; + //print "deleting from eq_visit where companionship=$comp and date=$date and district=$district
"; // Delete all the visits that have taken place for all families for this month $this->db->query("DELETE from eq_visit where companionship=" . $unique_companionships[$j]['companionship'] . " AND " . "date='" . $date . "'",__LINE__,__FILE__); @@ -905,7 +907,7 @@ class eq // Select all the unique companionship numbers for this district if($eqpresppi == 1) { - $sql = "SELECT distinct companionship FROM eq_companionship"; + $sql = "SELECT distinct companionship FROM eq_companionship where valid=1"; } else { $sql = "SELECT distinct companionship FROM eq_companionship where valid=1 and district=". $districts[$i]['district']; -- 2.34.1