From: <gem...@li...> - 2011-09-28 13:59:45
|
Revision: 85 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=85&view=rev Author: matijsdejong Date: 2011-09-28 13:59:38 +0000 (Wed, 28 Sep 2011) Log Message: ----------- - documentation changes for GemsEscort.php and ModelAbstract.php - fix for RespondentModel.php: auto organization filter now applied in _checkFilterUsed Modified Paths: -------------- trunk/library/classes/Gems/Model/RespondentModel.php trunk/library/classes/GemsEscort.php trunk/library/classes/MUtil/Model/ModelAbstract.php Modified: trunk/library/classes/Gems/Model/RespondentModel.php =================================================================== --- trunk/library/classes/Gems/Model/RespondentModel.php 2011-09-28 12:56:41 UTC (rev 84) +++ trunk/library/classes/Gems/Model/RespondentModel.php 2011-09-28 13:59:38 UTC (rev 85) @@ -50,6 +50,8 @@ */ class Gems_Model_RespondentModel extends Gems_Model_HiddenOrganizationModel { + protected $hashBsn = true; + public function __construct() { // gems__respondents MUST be first table for INSERTS!! @@ -65,10 +67,32 @@ $this->setOnSave('gr2o_opened_by', GemsEscort::getInstance()->session->user_id); $this->setSaveOnChange('gr2o_opened_by'); - $this->setSaveWhenNotNull('grs_bsn'); - $this->setOnSave('grs_bsn', array($this, 'formatBSN')); + if ($this->hashBsn) { + $this->setSaveWhenNotNull('grs_bsn'); + $this->setOnSave('grs_bsn', array($this, 'formatBSN')); + } } + /** + * Add an organization filter if it wasn't specified in the filter. + * + * Checks the filter on sematic correctness and replaces the text seacrh filter + * with the real filter. + * + * @param mixed $filter True for the filter stored in this model or a filter array + * @return array The filter to use + */ + protected function _checkFilterUsed($filter) + { + $filter = parent::_checkFilterUsed($filter); + + if (! isset($filter['gr2o_id_organization'])) { + $filter['gr2o_id_organization'] = $this->getCurrentOrganization(); + } + + return $filter; + } + public function formatBSN($name, $value, $new = false) { return md5($value); @@ -90,16 +114,6 @@ return $this; } - public function getSelect() - { - $select = parent::getSelect(); - $adapter = $select->getAdapter(); - - $select->where($adapter->quoteIdentifier('gr2o_id_organization') . ' = ?', $this->getCurrentOrganization()); - - return $select; - } - public function getRespondentTracksModel() { $model = new Gems_Model_JoinModel('surveys', 'gems__respondent2track'); Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2011-09-28 12:56:41 UTC (rev 84) +++ trunk/library/classes/GemsEscort.php 2011-09-28 13:59:38 UTC (rev 85) @@ -139,6 +139,8 @@ /** * Initialize the logger + * + * @return Gems_Log */ protected function _initLogger() { Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelAbstract.php 2011-09-28 12:56:41 UTC (rev 84) +++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2011-09-28 13:59:38 UTC (rev 85) @@ -79,6 +79,13 @@ $this->_model_name = $modelName; } + /** + * Checks the filter on sematic correctness and replaces the text seacrh filter + * with the real filter. + * + * @param mixed $filter True for the filter stored in this model or a filter array + * @return array The filter to use + */ protected function _checkFilterUsed($filter) { if (true === $filter) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |