X-Git-Url: http://git.pippins.net/embedvideo/.git/static/git-logo.png?a=blobdiff_plain;f=inc%2Fclass.eq.inc.php;h=9bc77a08047864924c5f710379d6b678ce167707;hb=822abf1339b489e81ccfcd3a30d467d437af449a;hp=b0a9fd016dbe352e263c79904f91fcaed6dbf817;hpb=9e24999ac4e155679e9c8bf05e92b4f0742096a6;p=eq%2F.git diff --git a/inc/class.eq.inc.php b/inc/class.eq.inc.php index b0a9fd0..9bc77a0 100644 --- a/inc/class.eq.inc.php +++ b/inc/class.eq.inc.php @@ -763,7 +763,7 @@ class eq . " AND date='".$activity['date']."' AND notes='".$activity['notes']."'"; $this->db->query($sql,__LINE__,__FILE__); if($this->db->next_record()) { - print "activity: " . $this->db->f('activity') . "
"; + //print "activity: " . $this->db->f('activity') . "
"; $activity['activity'] = $this->db->f('activity'); } @@ -1096,6 +1096,23 @@ class eq $this->t->set_block('willing_view_t','header_list','list1'); $this->t->set_block('willing_view_t','elder_list','list2'); + $this->t->set_var('lang_filter','Filter'); + $this->t->set_var('lang_filter_unwilling','Filter out unwilling Elders:'); + + $filter_unwilling = get_var('filter_unwilling',array('POST')); + $this->t->set_var('filter_unwilling',$filter_unwilling); + + if($filter_unwilling == 'y' || $filter_unwilling == '') { + $filter_input = "Y"; + $filter_input.= "N"; + $filter_input.= "  "; + } else { + $filter_input = "Y"; + $filter_input.= "N"; + $filter_input.= "  "; + } + $this->t->set_var('filter_input',$filter_input); + $sql = "SELECT * FROM eq_elder where valid=1"; $this->db->query($sql,__LINE__,__FILE__); $i=0; @@ -1144,14 +1161,13 @@ class eq } for ($i=0; $i < count($elder_id); $i++) { - $willing_table = ''; - $this->nextmatchs->template_alternate_row_color(&$this->t); + $willing_table = ''; $elder_willing=0; $this->t->set_var('elder_name',$elder_name[$i]); $this->t->set_var('elder_phone',$elder_phone[$elder_id[$i]]); $this->t->set_var('editurl',$GLOBALS['phpgw']->link('/eq/index.php','menuaction=eq.eq.willing_update&elder_id=' . $elder_id[$i] . '&action=' . 'edit')); for ($j=0; $j < count($assignment_list); $j++) { - $found_willingness=0; + $found_willingness=0; $sql = "SELECT * FROM eq_willingness where " . " assignment=" . $assignment_list[$j]['assignment'] . " AND elder=" . $elder_id[$i]; @@ -1177,21 +1193,27 @@ class eq if($this->db->f('willing') == 'y') { $total_willing[$j]++; + $elder_willing=1; $willing_table .= '
'.$date_part.''; } else if($this->db->f('willing') == 'n') { $willing_table .= ''; } else { + $elder_willing=1; $willing_table .= " "; } } if(!$found_willingness) { + $elder_willing=1; $willing_table .= " "; } } - $this->t->set_var('willing_table',$willing_table); - $this->t->fp('list2','elder_list',True); + if(($elder_willing == 1) || ($filter_unwilling == 'n')) { + $this->t->set_var('willing_table',$willing_table); + $this->t->fp('list2','elder_list',True); + $this->nextmatchs->template_alternate_row_color(&$this->t); + } } $stat_table = 'Total Willing to Serve'; @@ -1409,6 +1431,7 @@ class eq $president_name = $this->db->f('name'); $president_id = $this->db->f('elder'); $presidency_id = $this->db->f('presidency'); + $interviewer = $this->db->f('elder'); $district_number = '*'; $district_name = $president_name; } else { @@ -1531,6 +1554,7 @@ class eq $link_data['ppi'] = ''; $link_data['eqpresppi'] = 1; $link_data['action'] = 'add'; + $link_data['interviewer'] = $interviewer; $link = $GLOBALS['phpgw']->link('/eq/index.php',$link_data); $tr_color = $this->nextmatchs->alternate_row_color($tr_color); $this->t->set_var('tr_color',$tr_color); @@ -1883,6 +1907,7 @@ class eq $link_data['name'] = $name; $link_data['interview'] = ''; $link_data['action'] = 'add'; + $link_data['interviewer'] = $districts[$d]['supervisor']; $link = $GLOBALS['phpgw']->link('/eq/index.php',$link_data); $table_data.= "$name"; $table_data.= "$phone"; @@ -2407,25 +2432,14 @@ class eq $notes = get_var('notes',array('GET','POST')); $eqpresppi = get_var('eqpresppi',array('GET','POST')); - $sql = "SELECT * FROM eq_district where valid=1 ORDER BY district ASC"; - $this->db->query($sql,__LINE__,__FILE__); - while ($this->db->next_record()) - { - $supervisor = $this->db->f('supervisor'); - $sql = "SELECT * FROM eq_elder WHERE elder=" . $supervisor; - $this->db2->query($sql,__LINE__,__FILE__); - $this->db2->next_record(); - $interviewer_name = $this->db2->f('name'); - - if($supervisor == $interviewer) { - $this->t->set_var('interviewer',$supervisor . ' selected'); - } else { - $this->t->set_var('interviewer',$interviewer); - } - $this->t->set_var('interviewer_name',$interviewer_name); - $this->t->fp('int_list','interviewer_list',True); - } - + $sql = "SELECT * FROM eq_elder WHERE elder=" . $interviewer; + $this->db2->query($sql,__LINE__,__FILE__); + $this->db2->next_record(); + $interviewer_name = $this->db2->f('name'); + $this->t->set_var('interviewer',$interviewer . ' selected'); + $this->t->set_var('interviewer_name',$interviewer_name); + $this->t->fp('int_list','interviewer_list',True); + if($action == 'save') { $notes = get_var('notes',array('POST')); @@ -3524,40 +3538,64 @@ class eq $time = $hour.':'.$minute.':'.'00'; $uid = 0; + // Zero out the family or elder if date = NULL + if($date == "") { + $elder = 0; + $family = 0; + } + // Update an existing appointment if($appointment < $this->max_appointments) { //Only perform a database update if we have made a change to this appointment $sql = "SELECT * FROM eq_appointment where " . "appointment='$appointment'" . - "and elder='$elder'" . - "and family='$family'" . - "and date='$date'" . - "and time='$time'"; + " and presidency='$presidency'" . + " and elder='$elder'" . + " and family='$family'" . + " and date='$date'" . + " and time='$time'"; $this->db->query($sql,__LINE__,__FILE__); if(!$this->db->next_record()) { - $this->db->query("UPDATE eq_appointment set" . + $old_date = $this->db->f('date'); + $old_time = $this->db->f('time'); + $this->db2->query("UPDATE eq_appointment set" . " family=" . $family . " ,elder=" . $elder . " ,date='" . $date . "'" . " ,time='" . $time . "'" . + " ,presidency='" . $presidency . "'" . " WHERE appointment=" . $appointment,__LINE__,__FILE__); // Email the appointment - if(($date != "") && ($time != "")) { - $this->email_appt($appointment); - } + $this->email_appt($appointment); } } // Add a new appointment else if(($appointment >= $this->max_appointments) && ($date != "") && ($time != "")) { - $this->db->query("INSERT INTO eq_appointment (appointment,presidency,family,elder,date,time,uid) " + //print "adding entry: appt=$appointment date: $date time: $time elder: $elder family: $family
"; + $this->db2->query("INSERT INTO eq_appointment (appointment,presidency,family,elder,date,time,uid) " . "VALUES (NULL,'" . $presidency . "','" . $family . "','" . $elder . "','" . $date . "','" . $time . "','" . $uid ."')",__LINE__,__FILE__); - - //print "adding entry: appt=$appointment date: $date time: $time elder: $elder family: $family
"; + + // Now reselect this entry from the database to see if we need + // to send an appointment out for it. + $sql = "SELECT * FROM eq_appointment where " . + "elder='$elder'" . + " and family='$family'" . + " and presidency='$presidency'" . + " and date='$date'" . + " and time='$time'" . + " and uid='$uid'"; + $this->db3->query($sql,__LINE__,__FILE__); + if($this->db3->next_record()) { + // Email the appointment if warranted + if(($date != "") && ($time != "") && (($elder > 0) || $family > 0)) { + $this->email_appt($this->db3->f('appointment')); + } + } } } }