$companionship = $hometeaching_data{$index}{'Comp ID'};
$sth = $dbh->prepare("update eq_family set companionship='$companionship' where name_id='$name_id'");
$sth->execute or die "-E- DB error: $DBI::errstr\n";
+
+ # In addition to changing the hometeaching assignment, update the eq_visit table
+ # so that all previous visits made by the old hometeaching companionship, get
+ # updated with the id of the new companionship. This will allow us to go in and
+ # edit the history as needed for the family being hometaught under their new
+ # companionship. Otherwise, we will not be able to update this history.
+ #$family_id = $data[0]->{family};
+ #print " update eq_visit set companionship='$companionship' where family='$family_id' and companionship!='0'\n";
+ #$sth = $dbh->prepare("update eq_visit set companionship='$companionship' where companionship='$old_companionship'");
+ #$sth->execute or die "-E- DB error: $DBI::errstr\n";
}
}
}
}
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.
-
//$comp=$unique_companionships[$j]['companionship'];
//print "deleting from eq_visit where companionship=$comp and date=$date and district=$district<br>";
- // Delete all the visits that have taken place for all families for this month
+ // Delete all the visits that have taken place for all families for this companionsthip for this month
$this->db->query("DELETE from eq_visit where companionship=" . $unique_companionships[$j]['companionship'] .
" AND " . "date='" . $date . "'",__LINE__,__FILE__);
}
# unzip the data into this directory
print "-> Unzipping the data<br>\n";
- $data_file = $data_dir . '';
- exec('unzip ' . $data_dir . '/*.zip -d ' . $data_dir . ' 2>&1', $result, $return_code);
+ exec($this->unzip_path .' -u '. $data_dir . '/*.zip -d ' . $data_dir . ' 2>&1', $result, $return_code);
if($return_code != 0) {
print implode('\n',$result) . "<br>";
print "<b><font color=red>";
- print "-E- Unable to unzip the uploaded file into the data dir. Aborting import.";
+ print "-E- Unable to unzip the uploaded file into the data dir: $data_dir. Aborting import.";
print "</font></b>";
return 0;
}
// The full path to the installation location of this module
$this->application_path = "/usr/local/www/data-dist/phpgroupware/eq";
+// The full path to the unzip application
+$this->unzip_path = "/usr/local/bin/unzip";
+
// Use drop down lists when specifying times in the scheduling tools.
// If set to 0, free form text fields for the hour and minutes will be used instead.
// If set to 1, drop down lists will be used for the hour and minute fields