use Addressbook list view feature switch to disable query
authorPaul Mehrer <p.mehrer@metaways.de>
Fri, 27 May 2016 15:20:47 +0000 (17:20 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 10 Jun 2016 11:52:19 +0000 (13:52 +0200)
surrounding a query part by a feature switch

Change-Id: If42e2395a785e0499620a9e075bdebc9478e6116
Reviewed-on: http://gerrit.tine20.com/customers/3203
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Addressbook/Backend/List.php
tine20/Addressbook/Config.php

index 2fa5f00..5546354 100644 (file)
@@ -82,15 +82,17 @@ class Addressbook_Backend_List extends Tinebase_Backend_Sql_Abstract
     public function __construct($_dbAdapter = NULL, $_options = array())
     {
         parent::__construct($_dbAdapter, $_options);
-        
-        $this->_additionalColumns['emails'] = new Zend_Db_Expr('(' . 
-            $this->_db->select()
-                ->from($this->_tablePrefix . 'addressbook', array($this->_dbCommand->getAggregate('email')))
-                ->where($this->_db->quoteIdentifier('id') . ' IN ?', $this->_db->select()
-                    ->from(array('addressbook_list_members' => $this->_tablePrefix . 'addressbook_list_members'), array('contact_id'))
-                    ->where($this->_db->quoteIdentifier('addressbook_list_members.list_id') . ' = ' . $this->_db->quoteIdentifier('addressbook_lists.id'))
-            ) . 
-        ')');
+
+        if (Addressbook_Config::getInstance()->featureEnabled(Addressbook_Config::FEATURE_LIST_VIEW)) {
+            $this->_additionalColumns['emails'] = new Zend_Db_Expr('(' .
+                $this->_db->select()
+                    ->from($this->_tablePrefix . 'addressbook', array($this->_dbCommand->getAggregate('email')))
+                    ->where($this->_db->quoteIdentifier('id') . ' IN ?', $this->_db->select()
+                        ->from(array('addressbook_list_members' => $this->_tablePrefix . 'addressbook_list_members'), array('contact_id'))
+                        ->where($this->_db->quoteIdentifier('addressbook_list_members.list_id') . ' = ' . $this->_db->quoteIdentifier('addressbook_lists.id'))
+                    ) .
+                ')');
+        }
     }
 
     /**
index 17064db..efe2534 100644 (file)
@@ -35,9 +35,9 @@ class Addressbook_Config extends Tinebase_Config_Abstract
      * @var string
      */
     const CONTACT_ADDRESS_PARSE_RULES_FILE = 'parseRulesFile';
-    
+
     /**
-     * FEATURE_LIST_VIEW 
+     * FEATURE_LIST_VIEW
      *
      * @var string
      */
@@ -58,15 +58,14 @@ class Addressbook_Config extends Tinebase_Config_Abstract
            'clientRegistryInclude' => TRUE,
            'content'               => array(
                self::FEATURE_LIST_VIEW => array(
-                   'label'         => 'Addressbook List View', //_('Calendar Split View')
-                   'description'   => 'Shows an additional view for lists inside the addressbook', //_('Split day and week views by attendee)
+                   'label'         => 'Addressbook List View', //_('Addressbook List View')
+                   'description'   => 'Shows an additional view for lists inside the addressbook', //_('Shows an additional view for lists inside the addressbook)
                ),
            ),
            'default'               => array(
                self::FEATURE_LIST_VIEW => false,
            ),
         ),
-
         self::CONTACT_DUP_FIELDS => array(
                                    //_('Contact duplicate check fields')
             'label'                 => 'Contact duplicate check fields',