}
foreach ($this->_columns as $tableName => $table) {
- // set alias
- if (!isset($table['alias'])) {
- $this->_columns[$tableName]['alias'] = substr($tableName, 8) .
- '_civireport';
- }
- else {
- $this->_columns[$tableName]['alias'] = $table['alias'] . '_civireport';
- }
+ $this->setTableAlias($table, $tableName);
- $this->_aliases[$tableName] = $this->_columns[$tableName]['alias'];
-
- $daoOrBaoName = NULL;
+ $expFields = array();
// higher preference to bao object
- if (array_key_exists('bao', $table)) {
- $daoOrBaoName = $table['bao'];
- $expFields = $daoOrBaoName::exportableFields();
- }
- elseif (array_key_exists('dao', $table)) {
- $daoOrBaoName = $table['dao'];
- $expFields = $daoOrBaoName::export();
- }
- else {
- $expFields = array();
+ $daoOrBaoName = CRM_Utils_Array::value('bao', $table, CRM_Utils_Array::value('dao', $table));
+
+ if ($daoOrBaoName) {
+ if (method_exists($daoOrBaoName, 'exportableFields')) {
+ $expFields = $daoOrBaoName::exportableFields();
+ }
+ else {
+ $expFields = $daoOrBaoName::export();
+ }
}
- $doNotCopy = array('required');
+ $doNotCopy = array('required', 'default');
$fieldGroups = array('fields', 'filters', 'group_bys', 'order_bys');
foreach ($fieldGroups as $fieldGrp) {
$smartGroups = array_keys($groups['values']);
$query = "
- SELECT group_contact.contact_id as id
+ SELECT DISTINCT group_contact.contact_id as id
FROM civicrm_group_contact group_contact
WHERE group_contact.group_id IN (" . implode(', ', $filteredGroups) . ")
AND group_contact.status = 'Added' ";
'street_address' => ts('Street Address'),
'supplemental_address_1' => ts('Supplementary Address Field 1'),
'supplemental_address_2' => ts('Supplementary Address Field 2'),
+ 'supplemental_address_3' => ts('Supplementary Address Field 3'),
'street_number' => ts('Street Number'),
'street_name' => ts('Street Name'),
'street_unit' => ts('Street Unit'),
return $select;
}
+ /**
+ * Set table alias.
+ *
+ * @param array $table
+ * @param string $tableName
+ *
+ * @return string
+ * Alias for table.
+ */
+ protected function setTableAlias($table, $tableName) {
+ if (!isset($table['alias'])) {
+ $this->_columns[$tableName]['alias'] = substr($tableName, 8) .
+ '_civireport';
+ }
+ else {
+ $this->_columns[$tableName]['alias'] = $table['alias'] . '_civireport';
+ }
+
+ $this->_aliases[$tableName] = $this->_columns[$tableName]['alias'];
+ return $this->_aliases[$tableName];
+ }
+
}