/** * appends sql to given select statement * * @param Tinebase_Backend_Sql_Filter_GroupSelect $_select * @param Tinebase_Backend_Sql_Abstract $_backend */ public function appendFilterSql($_select, $_backend) { $db = $_backend->getAdapter(); $value = $this->_value ? 1 : 0; if ($value) { // nothing to do -> show all lists! if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Query all lists.'); } } else { if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Only query visible lists.'); } $_select->joinLeft(array('groupvisibility' => $db->table_prefix . 'groups'), $db->quoteIdentifier('groupvisibility.list_id') . ' = ' . $db->quoteIdentifier('addressbook_lists.id'), array()); $_select->where($db->quoteIdentifier('groupvisibility.visibility') . ' = ?', 'displayed'); $_select->orWhere($db->quoteIdentifier('groupvisibility.visibility') . ' IS NULL'); } }