function findPunchControlID() { if ($this->getPunchControlID() != FALSE) { $retval = $this->getPunchControlID(); } else { $pclf = new PunchControlListFactory(); Debug::Text('Checking for incomplete punch control... User: '******' TimeStamp: ' . $this->getTimeStamp() . ' Status: ' . $this->getStatus(), __FILE__, __LINE__, __METHOD__, 10); //Need to make sure the punch is rounded before we can get the proper punch_control_id. However // roundTimeStamp requires punch_control_id before it can round properly. $retval = (int) $pclf->getInCompletePunchControlIdByUserIdAndEpoch($this->getUser(), $this->getTimeStamp(), $this->getStatus()); if ($retval == FALSE) { Debug::Text('Couldnt find already existing PunchControlID, generating new one...', __FILE__, __LINE__, __METHOD__, 10); $retval = (int) $pclf->getNextInsertId(); } } Debug::Text('Punch Control ID: ' . $retval, __FILE__, __LINE__, __METHOD__, 10); return $retval; }