Added path local variable for unzip and added "update" option to unzip command.
[eq/.git] / inc / class.eq.inc.php
index ed9b2c4b9e8d5e9d458c237c6cc925505dc00b66..2af40b12a295756e52b9fadcb3a591cf6c302974 100644 (file)
@@ -68,25 +68,15 @@ class eq
  
   function eq()
     {
-      // LOCAL CONFIGURATION. PLEASE UPDATE AS APPROPRIATE.
-      $this->upload_target_path = "/home/users/eqpres/eq_data";
-      $this->script_path = "/usr/share/phpgroupware/eq/bin";
-      $this->default_ht_num_months = 3;
-      $this->default_ppi_num_months = 3;
-      $this->default_ppi_num_years = 0;
-      $this->default_int_num_quarters = 1;
-      $this->default_int_num_years = 0;
-      $this->default_att_num_quarters = 1;
-      $this->default_vis_num_years = 1;
-      $this->max_num_districts = 4;
-      $this->time_drop_down_lists = 1;
-      $this->monthly_hometeaching_interviews = 0;
-      $this->time_drop_down_list_inc = 15;
-      $this->default_visit_appt_duration = 45;
-      $this->default_ppi_appt_duration = 30;
+      if(file_exists('setup/eq_config.local')) {
+       include('setup/eq_config.local');
+      } else {
+       include('setup/eq_config');
+      }
+
+      $this->script_path = "$this->application_path"."/bin";
       $this->max_presidency_members = 99;
       $this->max_appointments = 32768;
-      // END LOCAL CONFIGURATION
       
       $this->db                = $GLOBALS['phpgw']->db;
       $this->db2       = $this->db;
@@ -410,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<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__);
            }
@@ -2719,7 +2702,7 @@ class eq
        $stat_data = "<tr><td><b><font size=-2>$num_companionships Companionships<br>Interview Quarterly Totals:</font></b></td>";
 
        // Print the hometeaching interview stats
-       if($this->monthly_hometeaching_interviews == 0) { //Quarterly
+       if($this->monthly_hometeaching_interview_stats == 0) { //Quarterly
          for($m=$num_months; $m >=0; $m--) {
            $month = $current_month - $m;
            if(($month % 3) == 1) { $quarter_total = $ints[$m]; }
@@ -2745,7 +2728,7 @@ class eq
       }
 
       // Display the totals
-      if($this->monthly_hometeaching_interviews == 0) { //Quarterly
+      if($this->monthly_hometeaching_interview_stats == 0) { //Quarterly
        $quarter_total = 0;
        $totals = "<tr><td><b><font size=-2>$total_companionships Total Comps<br>Interview Quarterly Totals:</font></b></td>";
        for($m=$num_months; $m >=0; $m--) {
@@ -3889,12 +3872,11 @@ class eq
            
            # 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;
            }