Commit d59c8361e2d22a63a461f6e6003a7ed4c9389957

Authored by Megan Watson
1 parent 42eb481f

KTS-2892

"Search for user by username returns all users and filter is ignored."
Fixed. The sql function to get the list of users was overwriting the filter.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8028 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 13 additions and 4 deletions
lib/users/User.inc
... ... @@ -323,10 +323,19 @@ class User extends KTEntity {
323 323 * @return Array array of User objects, false otherwise and set $_SESSION["errorMessage"]
324 324 */
325 325 function getList($sWhereClause = null, $aOptions = null) {
326   - if(!is_array($aOptions)) $aOptions = array($aOptions);
327   - $aOptions['orderby'] = KTUtil::arrayGet($aOptions, 'orderby', 'name');
328   - //if disabled = 2 then the user is deleted
329   - $sWhereClause = 'disabled != \'2\'';
  326 + if(!is_array($aOptions)) $aOptions = array($aOptions);
  327 + $aOptions['orderby'] = KTUtil::arrayGet($aOptions, 'orderby', 'name');
  328 +
  329 + // don't include deleted users: disabled = 2
  330 + if(!empty($sWhereClause)){
  331 + if(strpos(strtolower($sWhereClause), 'where ') === false){
  332 + $sWhereClause = '('.$sWhereClause.')';
  333 + }
  334 + $sWhereClause .= ' AND disabled != 2';
  335 + }else{
  336 + $sWhereClause = 'disabled != 2';
  337 + }
  338 +
330 339 return KTEntityUtil::getList2('User', $sWhereClause, $aOptions);
331 340 }
332 341  
... ...