protected $_limitDetailClause = NULL;
- protected $_limitNumber = 10;
+ protected $_limitNumber = 10;
protected $_limitNumberPlus1 = 11; // this should be one more than self::LIMIT
protected $_foundRows = array();
function __construct(&$formValues) {
- $this->_formValues = &$formValues;
+ $this->_formValues = $formValues;
$this->_text = CRM_Utils_Array::value('text', $formValues);
$this->_table = CRM_Utils_Array::value('table', $formValues);
'subject' => 'varchar(255)',
'details' => 'varchar(255)',
'contribution_id' => 'int unsigned',
- 'financial_type' => 'varchar(255)',
+ 'financial_type' => 'varchar(255)',
'contribution_page' => 'varchar(255)',
'contribution_receive_date' => 'datetime',
'contribution_total_amount' => 'decimal(20,2)',
CRM_Core_DAO::executeQuery($sql, $params);
}
- function fillCustomInfo(&$tables,
- $extends
- ) {
-
+ function fillCustomInfo(&$tables, $extends) {
$sql = "
SELECT cg.table_name, cf.column_name
FROM civicrm_custom_group cg
if ($tableName == 'final') {
continue;
}
- else if ($tableName == 'sql') {
- foreach ($tableValues as $sqlStatement) {
- $sql = "
+ else {
+ if ($tableName == 'sql') {
+ foreach ($tableValues as $sqlStatement) {
+ $sql = "
REPLACE INTO {$this->_entityIDTableName} ( entity_id )
$sqlStatement
{$this->_limitClause}
";
- CRM_Core_DAO::executeQuery($sql);
+ CRM_Core_DAO::executeQuery($sql);
+ }
}
- }
- else {
- $clauses = array();
+ else {
+ $clauses = array();
- foreach ($tableValues['fields'] as $fieldName => $fieldType) {
- if ($fieldType == 'Int') {
- if ($this->_textID) {
- $clauses[] = "$fieldName = {$this->_textID}";
+ foreach ($tableValues['fields'] as $fieldName => $fieldType) {
+ if ($fieldType == 'Int') {
+ if ($this->_textID) {
+ $clauses[] = "$fieldName = {$this->_textID}";
+ }
+ }
+ else {
+ $clauses[] = "$fieldName LIKE {$this->_text}";
}
}
- else {
- $clauses[] = "$fieldName LIKE {$this->_text}";
- }
- }
- if (empty($clauses)) {
- continue;
- }
+ if (empty($clauses)) {
+ continue;
+ }
- $whereClause = implode(' OR ', $clauses);
+ $whereClause = implode(' OR ', $clauses);
- //resolve conflict between entity tables.
- if ($tableName == 'civicrm_note' &&
- $entityTable = CRM_Utils_Array::value('entity_table', $tableValues)
- ) {
- $whereClause .= " AND entity_table = '{$entityTable}'";
- }
+ //resolve conflict between entity tables.
+ if ($tableName == 'civicrm_note' &&
+ $entityTable = CRM_Utils_Array::value('entity_table', $tableValues)
+ ) {
+ $whereClause .= " AND entity_table = '{$entityTable}'";
+ }
- $sql = "
+ $sql = "
REPLACE INTO {$this->_entityIDTableName} ( entity_id )
SELECT {$tableValues['id']}
FROM $tableName
GROUP BY {$tableValues['id']}
{$this->_limitClause}
";
- CRM_Core_DAO::executeQuery($sql);
+ CRM_Core_DAO::executeQuery($sql);
+ }
}
}
'note' => NULL,
),
),
- 'sql' => $contactSQL,
+ 'sql' => $contactSQL,
'final' => $final,
);
$final = array();
$tables = array(
- 'civicrm_activity' => array( 'fields' => array() ),
+ 'civicrm_activity' => array('fields' => array()),
'sql' => $contactSQL,
'final' => $final,
);
}
function fillCase() {
- $this->fillCaseIDs( );
+ $this->fillCaseIDs();
//move data from entity table to detail table
$this->moveEntityToDetail('Case');
}
- function fillCaseIDs( ) {
+ function fillCaseIDs() {
$contactSQL = array();
$contactSQL[] = "
";
$tables = array(
- 'civicrm_case' => array( 'fields' => array( ) ),
+ 'civicrm_case' => array('fields' => array()),
'sql' => $contactSQL,
);
c.display_name LIKE {$this->_text})
";
$tables = array(
- 'civicrm_contribution' => array('id' => 'id',
+ 'civicrm_contribution' => array(
+ 'id' => 'id',
'fields' => array(
'source' => NULL,
'amount_level' => NULL,
WHERE (c.sort_name LIKE {$this->_text} OR c.display_name LIKE {$this->_text})
";
$tables = array(
- 'civicrm_participant' => array('id' => 'id',
+ 'civicrm_participant' => array(
+ 'id' => 'id',
'fields' => array(
'source' => NULL,
'fee_level' => NULL,
WHERE (c.sort_name LIKE {$this->_text} OR c.display_name LIKE {$this->_text})
";
$tables = array(
- 'civicrm_membership' => array('id' => 'id',
+ 'civicrm_membership' => array(
+ 'id' => 'id',
'fields' => array('source' => NULL),
),
'sql' => $contactSQL,
function summary() {
$this->initialize();
- $summary = array('Contact' => array(),
+ $summary = array(
+ 'Contact' => array(),
'Activity' => array(),
'Case' => array(),
'Contribution' => array(),
return CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM {$this->_tableName}");
}
- function all($offset = 0, $rowcount = 0, $sort = NULL,
- $includeContactIDs = FALSE, $justIDs = FALSE
- ) {
+ function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) {
$this->initialize();
if ($justIDs) {
return array();
}
- function alterRow(&$row) {}
+ function alterRow(&$row) {
+ }
function setTitle($title) {
if ($title) {
{$this->_limitDetailClause}
";
break;
-
}
if ($sql) {