_filterByStatus; } /** * @param boolean $filterByStatus * @return $this */ public function setFilterByStatus($filterByStatus) { $this->_filterByStatus = $filterByStatus; return $this; } public function initFromForm(array $data) { $data['companyId'] = $this->getLoggedInUser('companyId'); $data['bought'] = 'y'; parent::initFromForm($data); return $this; } public function getLoggedInUser($field = null, $default = null) { return Qs_Array::get($this->_loggedInUser, $field, $default); } public function setLoggedInUser($user) { $this->_loggedInUser = $user; return $this; } protected function _filter(Zend_Db_Select $select) { $this->_filterIndividual($select); return parent::_filter($select); } protected function _filterIndividual(Zend_Db_Select $select) { $filter = [ 'bought' => 'y', 'companyId' => (int) $this->getLoggedInUser('companyId') ]; if ($this->isFilterByStatus()) { $filter['status'] = UserEntity::STATUS_ACTIVE; } Qs_Db::filter($select, $filter, $this->_tableAlias); return $this; } protected function _getFromDbSelect($primaryKey) { $select = parent::_getFromDbSelect($primaryKey); $select->joinLeft($this->_getPair('UserStatus', 'us'), '`us`.`id` = `User`.`status`', ['statusTitle' => 'title']); $this->_filterIndividual($select); return $select; } protected function _insertDependency() { $this->_updateAddresses(); return $this; } protected function _updateDependency() { $this->_updateAddresses(); return $this; } public function prepareEmailData(array &$data) { parent::prepareEmailData($data); $data['loggedInIndividual'] = $this->getLoggedInUser('firstName') . ' ' . $this->getLoggedInUser('lastName'); $data['status'] = $this->_getTable('UserStatus')->search($data['status'], 'title'); return $this; } }