From: Alan J. Pippin Date: Sat, 20 Sep 2008 01:51:10 +0000 (-0600) Subject: Fixed bug with "Add Activity" button to move it outside of the for loop X-Git-Tag: release_0_4_0~9 X-Git-Url: http://git.pippins.net/embedvideo/.git/static/images/%7Blink_ppi%7D?a=commitdiff_plain;h=5b890635d41024cad8348023e9fccae419ddaaca;p=eq%2F.git 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. --- 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; }