From 5b890635d41024cad8348023e9fccae419ddaaca Mon Sep 17 00:00:00 2001 From: "Alan J. Pippin" Date: Fri, 19 Sep 2008 19:51:10 -0600 Subject: [PATCH] Fixed bug with "Add Activity" button to move it outside of the for loop that looped over all of the Activities. This prevented it from being displayed when the activity table was empty. --- inc/class.eq.inc.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/inc/class.eq.inc.php b/inc/class.eq.inc.php index 7f0d5a6..9b59778 100644 --- a/inc/class.eq.inc.php +++ b/inc/class.eq.inc.php @@ -660,15 +660,15 @@ class eq $this->t->set_var('edit',$GLOBALS['phpgw']->link('/eq/index.php',$link_data)); $this->t->set_var('lang_edit','Edit'); - $link_data['menuaction'] = 'eq.eq.act_update'; - $link_data['activity'] = '0'; - $link_data['action'] = 'add'; - $this->t->set_var('add','
'); - $this->t->fp('list','act_list',True); } + $link_data['menuaction'] = 'eq.eq.act_update'; + $link_data['activity'] = '0'; + $link_data['action'] = 'add'; + $this->t->set_var('add','
'); + $this->t->pfp('out','act_list_t'); $this->save_sessiondata(); } @@ -772,12 +772,14 @@ class eq // Re-add the elders who are checked as having participated in this activity $elders = get_var('elder_name',array('POST')); - foreach ($elders as $elder) - { - $this->db->query("INSERT INTO eq_participation (elder,activity) " - . "VALUES (" . $elder . ",". $activity['activity'] . ")",__LINE__,__FILE__); - } - + if(is_array($elders)) { // Only do the foreach loop if we have a valid array of elders to work with + foreach ($elders as $elder) + { + $this->db->query("INSERT INTO eq_participation (elder,activity) " + . "VALUES (" . $elder . ",". $activity['activity'] . ")",__LINE__,__FILE__); + } + } + $this->act_list(); return false; } -- 2.34.1