/** * Check if roll number of applicant already exists * @return bool $applied - if roll no of candidate exists * @param Admsn_Model_Member_Candidate */ public function exists(Admsn_Model_Member_Candidate $candidate) { $select = $this->getDbTable()->getAdapter()->select()->from($this->getDbTable()->info('name'), array('roll_no', 'application_basis', 'is_locked'))->where('roll_no = ?', $candidate->getRoll_no()); $result = $select->query()->fetch(); if (count($result)) { return $result; } return false; }
public function rollnoAction() { $rollNo = $this->getRequest()->getParam('roll_no'); $application_basis = $this->getRequest()->getParam('application_basis'); $candidate = new Admsn_Model_Member_Candidate(); $status = $candidate->setRoll_no($rollNo)->exists(); $applicant = new Zend_Session_Namespace('applicant'); $applicant->unsetAll(); if (isset($status['is_locked']) and $status['is_locked'] == 1) { throw new Zend_Exception($rollNo . ' has locked the application.', Zend_Log::ERR); } elseif ($status) { $applicant->roll_no = $status['roll_no']; $applicant->application_basis = $status['application_basis']; } else { $applicant->roll_no = $rollNo; $applicant->application_basis = $application_basis; } $this->_helper->json($status); }