From: <gem...@li...> - 2011-11-03 17:40:39
|
Revision: 174 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=174&view=rev Author: matijsdejong Date: 2011-11-03 17:40:33 +0000 (Thu, 03 Nov 2011) Log Message: ----------- When searching on a hashed SSN for #37 the hash should be applied to the search value automatically. Modified Paths: -------------- trunk/library/classes/Gems/Model/RespondentModel.php Modified: trunk/library/classes/Gems/Model/RespondentModel.php =================================================================== --- trunk/library/classes/Gems/Model/RespondentModel.php 2011-11-03 13:37:18 UTC (rev 173) +++ trunk/library/classes/Gems/Model/RespondentModel.php 2011-11-03 17:40:33 UTC (rev 174) @@ -107,10 +107,30 @@ $filter['gr2o_id_organization'] = $this->getCurrentOrganization(); } + if (self::SSN_HASH === $this->hashSsn) { + // Make sure a search for a SSN is hashed when needed. + array_walk_recursive($filter, array($this, 'applyHash')); + } + return $filter; } /** + * Apply hash function for array_walk_recursive in _checkFilterUsed() + * + * @see _checkFilterUsed() + * + * @param string $filterValue + * @param string $filterKey + */ + public function applyHash(&$filterValue, $filterKey) + { + if ('grs_ssn' === $filterKey) { + $filterValue = $this->project->getValueHash($filterValue); + } + } + + /** * Return a hashed version of the input value. * * @param string $name Optional name, is here for ModelAbstract setOnSave compatibility This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |