From: <gem...@li...> - 2012-01-12 12:00:58
|
Revision: 406 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=406&view=rev Author: matijsdejong Date: 2012-01-12 12:00:47 +0000 (Thu, 12 Jan 2012) Log Message: ----------- Extension + cleanup of code after fex 401 Modified Paths: -------------- trunk/library/classes/Gems/Tracker/RespondentTrack.php Modified: trunk/library/classes/Gems/Tracker/RespondentTrack.php =================================================================== --- trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-01-11 15:18:41 UTC (rev 405) +++ trunk/library/classes/Gems/Tracker/RespondentTrack.php 2012-01-12 12:00:47 UTC (rev 406) @@ -459,13 +459,11 @@ public function getFirstToken() { if (! $this->_firstToken) { - if ($this->_tokens) { - $this->_firstToken = reset($this->_tokens); - } else { + if (! $this->_tokens) { //No cache yet, but we might need all tokens later - $tokens = $this->getTokens(); - $this->_firstToken = reset($tokens); + $this->getTokens(); } + $this->_firstToken = reset($this->_tokens); } return $this->_firstToken; @@ -526,16 +524,13 @@ /** * Returns all the tokens in this track * + * @param boolean $refresh When true, always reload * @return array of Gems_Tracker_Token */ public function getTokens($refresh = false) { - if (! $this->_tokens || true === $refresh) { - if (true === $refresh) { - unset($this->_tokens); - unset($this->_activeTokens); - //Next line will cause errors later on when we refresh the tokens, getFirstToken() will then throw an error - //unset($this->_firstToken); + if (! $this->_tokens || $refresh) { + if ($refresh) { $this->_firstToken = null; } $this->_tokens = array(); @@ -686,7 +681,7 @@ // Reload reception code values $this->_ensureReceptionCode($code->getAllData()); } - + // Stopcodes have a different logic. if ($code->isStopCode()) { // Cascade stop to tokens This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |