don't count deactivated users in countNonSystemUsers()
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 9 Mar 2016 16:12:00 +0000 (17:12 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 10 Mar 2016 10:31:18 +0000 (11:31 +0100)
Change-Id: I71ac942ea66a8e653836ca420a426e53fb9d1909
Reviewed-on: http://gerrit.tine20.com/customers/2868
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/User/Sql.php

index b113609..a0dc54c 100644 (file)
@@ -1124,15 +1124,17 @@ class Tinebase_User_Sql extends Tinebase_User_Abstract
 
 
     /**
-     * returns number of current non-system users
-     *
+     * returns number of current not-disabled, non-system users
+     * 
      * @return number
      */
     public function countNonSystemUsers()
     {
         $select = $select = $this->_db->select()
             ->from(SQL_TABLE_PREFIX . 'accounts', 'COUNT(id)')
-            ->where($this->_db->quoteIdentifier('login_name') . " not in ('cronuser', 'calendarscheduling')");
+            ->where($this->_db->quoteIdentifier('login_name') . " not in ('cronuser', 'calendarscheduling')")
+            ->where($this->_db->quoteInto($this->_db->quoteIdentifier('status') . ' != ?', Tinebase_Model_User::ACCOUNT_STATUS_DISABLED));
+
         $userCount = $this->_db->fetchOne($select);
         return $userCount;
     }