From: Alan J. Pippin Date: Wed, 13 Feb 2008 07:47:35 +0000 (-0700) Subject: Added path local variable for unzip and added "update" option to unzip command. X-Git-Tag: release_0_2_0~1^2~2 X-Git-Url: http://git.pippins.net/embedvideo/.git/static/%7Bupdate_month%7D?a=commitdiff_plain;h=96aa338c7566eb9eec4e2200140358166b223790;p=eq%2F.git Added path local variable for unzip and added "update" option to unzip command. Root caused hometeaching issue with changing visited status in the past for a family that has moved to a new companionship. Added comments for the fix, but I'm not ready to enforce the fix yet. --- diff --git a/bin/import_ward_data b/bin/import_ward_data index 0e04f05..9b830aa 100755 --- a/bin/import_ward_data +++ b/bin/import_ward_data @@ -447,6 +447,16 @@ sub update_eq_family_table $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"; } } } diff --git a/inc/class.eq.inc.php b/inc/class.eq.inc.php index 5ac7c0a..2af40b1 100644 --- a/inc/class.eq.inc.php +++ b/inc/class.eq.inc.php @@ -400,16 +400,9 @@ 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. - //$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 + // 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__); } @@ -3879,12 +3872,11 @@ class eq # unzip the data into this directory print "-> Unzipping the data
\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) . "
"; print ""; - 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 ""; return 0; } diff --git a/setup/eq_config b/setup/eq_config index 5baf6c6..eadd5b4 100644 --- a/setup/eq_config +++ b/setup/eq_config @@ -14,6 +14,9 @@ $this->upload_target_path = "/home/users/eqpres/eq_data"; // 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