X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=blobdiff_plain;f=inc%2Fclass.eq.inc.php;h=8c2984e511210cbe2e203254bdb40552d074112f;hb=4d253dd156e29b53b2b2d0307d71eaef3379df8d;hp=d2396c4faed2339bd2b8ea73de9052d8cb2f2b11;hpb=2d62fe2d30e68f295572b6ae87597b882537511b;p=eq%2F.git diff --git a/inc/class.eq.inc.php b/inc/class.eq.inc.php index d2396c4..8c2984e 100644 --- a/inc/class.eq.inc.php +++ b/inc/class.eq.inc.php @@ -221,8 +221,10 @@ class eq $month = date('m/Y', strtotime('-'.$m.' month -'.$d.' day')); $month_start = date('Y-m', strtotime('-'.$m.' month -'.$d.' day')); $month_start .= "-01"; $month_end = date('Y-m', strtotime('-'.$m.' month -'.$d.' day')); $month_end .= "-31"; + // Add this to the query to filter on only visits made by this companionship: + // " AND companionship=" . $unique_companionships[$j]['companionship']. $sql = "SELECT * FROM eq_visit WHERE date >= '$month_start' AND date <= '$month_end' ". - " AND companionship=" . $unique_companionships[$j]['companionship']. + " AND companionship!=0". " AND family=". $family_id; $this->db2->query($sql,__LINE__,__FILE__); $link_data['menuaction'] = 'eq.eq.ht_update'; @@ -324,6 +326,13 @@ class eq } for ($j=0; $j < count($unique_companionships); $j++) { + // FIXME: We won't be able to go back and edit history on families that have been + // reassigned to a different companionship. The following delete command will not delete + // the history of visits under an older companionship, only the ones for the existing + // 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. + // 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__); @@ -421,7 +430,7 @@ class eq $header_row="Families"; $sql = "SELECT * FROM eq_visit WHERE date >= '$month_start' AND date <= '$month_end' ". - " AND companionship=" . $unique_companionships[$j]['companionship'] . + " AND companionship!=0". " AND family=". $family_id; $this->db2->query($sql,__LINE__,__FILE__); $value = $family_id . "/" . $unique_companionships[$j]['companionship'] . "/" . $date;