From: Owen Leonard Date: Sat, 18 Sep 2010 17:41:52 +0000 (-0600) Subject: fixed updating tc_scheduling_priority so we don't get jumbled information X-Git-Tag: release_1_0_0~27 X-Git-Url: http://git.pippins.net/embedvideo/.git/%27%20%20%20%20.%20%24GLOBALS%5B%27phpgw%27%5D-%3Elink%28%27inc/jquery/static/images/x.gif?a=commitdiff_plain;h=90140f92cb6d1c31d7ef617796b580d22b10ab47;p=eq%2F.git fixed updating tc_scheduling_priority so we don't get jumbled information --- diff --git a/inc/class.tc.inc.php b/inc/class.tc.inc.php index 8de0e85..c47ef95 100644 --- a/inc/class.tc.inc.php +++ b/inc/class.tc.inc.php @@ -109,6 +109,18 @@ class tc echo parse_navbar(); $this->display_app_header(); } + + function logToFile($func, $msg) + { + // open file + $fd = fopen($this->upload_target_path . "/tc_trace.log", "a"); + // append date/time to message + $str = "[" . date("Y/m/d h:i:s", mktime()) . "] [" . $func . "] " . $msg; + // write string + fwrite($fd, $str . "\n"); + // close file + fclose($fd); + } function save_sessiondata() { @@ -1418,17 +1430,9 @@ class tc $this->db->query($sql,__LINE__,__FILE__); if ($this->db->next_record()) { $scheduling_priority = $this->db->f('scheduling_priority'); - $this->db2->query("UPDATE tc_scheduling_priority SET priority='$priority' AND notes=\"$notes\" WHERE scheduling_priority='$scheduling_priority'", __LINE__, __FILE__); + //$this->logToFile("ppi_sched", "UPDATE tc_scheduling_priority SET priority='$priority', notes=\"$notes\" WHERE scheduling_priority='$scheduling_priority'"); + $this->db2->query("UPDATE tc_scheduling_priority SET priority='$priority', notes=\"$notes\" WHERE scheduling_priority='$scheduling_priority'", __LINE__, __FILE__); } - -/* - $this->db->query("UPDATE tc_individual set " . - " notes='" . $notes . "'" . - ",priority='" . $priority . "'" . - " WHERE individual=" . $individual,__LINE__,__FILE__); -*/ - - } $take_me_to_url = $GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ppi_sched'); @@ -1519,7 +1523,7 @@ class tc // PPI SCHEDULING TABLE // TODO: changed this so it picks the quorum dynamically - $sql = "SELECT * FROM tc_individual as ti JOIN tc_scheduling_priority as tsp where ti.scheduling_priority=tsp.scheduling_priority and steward='Elder' and valid=1 ORDER by tsp.priority ASC, ti.name ASC"; + $sql = "SELECT * FROM tc_individual AS ti JOIN tc_scheduling_priority AS tsp WHERE ti.scheduling_priority=tsp.scheduling_priority AND steward='Elder' AND valid=1 ORDER BY tsp.priority ASC, ti.name ASC"; $this->db->query($sql,__LINE__,__FILE__); $i=0; @@ -1770,14 +1774,9 @@ class tc $this->db->query("SELECT * FROM tc_companionship WHERE individual=$individual and valid=1",__LINE__,__FILE__); if ($this->db->next_record()) { $scheduling_priority = $this->db->f('scheduling_priority'); - $this->db2->query("UPDATE tc_scheduling_priority SET priority='$hti_pri' and notes=\"hti_notes\" where scheduling_priority=$scheduling_priority",__LINE__,__FILE__); + //$this->logToFile("int_sched", "UPDATE tc_scheduling_priority SET priority='$hti_pri', notes=\"$hti_notes\" WHERE scheduling_priority='$scheduling_priority'"); + $this->db2->query("UPDATE tc_scheduling_priority SET priority='$hti_pri', notes=\"$hti_notes\" WHERE scheduling_priority='$scheduling_priority'",__LINE__,__FILE__); } -/* - $this->db->query("UPDATE tc_individual set " . - " hti_notes='" . $hti_notes . "'" . - ",hti_pri='" . $hti_pri . "'" . - " WHERE individual=" . $individual,__LINE__,__FILE__); -*/ } $take_me_to_url = $GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.int_sched'); @@ -2126,14 +2125,9 @@ class tc $this->db->query("SELECT * FROM tc_family WHERE family='$family'",__LINE__,__FILE__); if ($this->db->next_record()) { $scheduling_priority = $this->db->f('scheduling_priority'); - $this->db2->query("UPDATE tc_scheduling_priority SET priority='$visit_pri' AND notes=\"$visit_notes\" WHERE scheduling_priority='$scheduling_priority'",__LINE__,__FILE__); + //$this->logToFile("vis_sched", "UPDATE tc_scheduling_priority SET priority='$visit_pri', notes=\"$visit_notes\" WHERE scheduling_priority='$scheduling_priority'"); + $this->db2->query("UPDATE tc_scheduling_priority SET priority='$visit_pri', notes=\"$visit_notes\" WHERE scheduling_priority='$scheduling_priority'", __LINE__, __FILE__); } -/* - $this->db->query("UPDATE tc_family set " . - " visit_notes='" . $visit_notes . "'" . - ",visit_pri='" . $visit_pri . "'" . - " WHERE family=" . $family,__LINE__,__FILE__); -*/ } $take_me_to_url = $GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.vis_sched'); diff --git a/sql/tc.sql b/sql/tc.sql index 2fedef1..fddc924 100644 --- a/sql/tc.sql +++ b/sql/tc.sql @@ -202,43 +202,43 @@ CREATE TABLE `tc_willingness` ( -- Table structure for table `tc_scheduling_priority` -- CREATE TABLE `tc_scheduling_priority` ( -`scheduling_priority` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`priority` INT( 10 ) UNSIGNED NOT NULL DEFAULT '30', -`notes` VARCHAR( 128 ) NOT NULL DEFAULT '' + `scheduling_priority` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , + `priority` INT( 10 ) UNSIGNED NOT NULL DEFAULT '30', + `notes` VARCHAR( 128 ) NOT NULL DEFAULT '' ) ENGINE = MYISAM ; -- -- Table structure for table `tc_email_list` -- CREATE TABLE `tc_email_list` ( -`email_list` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`name` VARCHAR( 128 ) NULL DEFAULT NULL + `email_list` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , + `name` VARCHAR( 128 ) NULL DEFAULT NULL ) ENGINE = MYISAM ; -- -- Table structure for table `tc_email_list_membership` -- CREATE TABLE `tc_email_list_membership` ( -`individual` INT( 16 ) UNSIGNED NULL DEFAULT NULL , -`email_list` INT( 16 ) UNSIGNED NULL DEFAULT NULL + `individual` INT( 16 ) UNSIGNED NULL DEFAULT NULL , + `email_list` INT( 16 ) UNSIGNED NULL DEFAULT NULL ) ENGINE = MYISAM ; -- -- Table structure for table `tc_accomplishment` -- CREATE TABLE `tc_accomplishment` ( -`accomplishment` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , -`individual` INT( 16 ) UNSIGNED NULL DEFAULT NULL , -`date` DATE NULL DEFAULT NULL , -`task` INT( 16 ) UNSIGNED NULL DEFAULT NULL , -`note` VARCHAR( 128 ) NOT NULL + `accomplishment` INT( 16 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , + `individual` INT( 16 ) UNSIGNED NULL DEFAULT NULL , + `date` DATE NULL DEFAULT NULL , + `task` INT( 16 ) UNSIGNED NULL DEFAULT NULL , + `note` VARCHAR( 128 ) NOT NULL ) ENGINE = MYISAM ; -- -- Table structure for table `tc_task` -- CREATE TABLE `tc_task` ( -`task` INT( 16 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , -`name` VARCHAR( 128 ) NOT NULL , -`description` VARCHAR( 128 ) NOT NULL + `task` INT( 16 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , + `name` VARCHAR( 128 ) NOT NULL , + `description` VARCHAR( 128 ) NOT NULL ) ENGINE = MYISAM ;