// FIXME: consider creating a common structure with cidRefs() and eidRefs()
// FIXME: the sub-pages references by the URLs should
// be loaded dynamically on the merge form instead
+ /**
+ * @return array
+ */
static function relTables() {
static $relTables;
while ($dao->fetch()) {
$cidRefs[$dao->table_name][] = $dao->column_name;
}
+
+ // FixME for time being adding below line statically as no Foreign key constraint defined for table 'civicrm_entity_tag'
+ $cidRefs['civicrm_entity_tag'][] = 'entity_id';
$dao->free();
// Allow hook_civicrm_merge() to adjust $cidRefs
return $sqls;
}
+ /**
+ * @param $mainId
+ * @param $otherId
+ * @param $tableName
+ * @param array $tableOperations
+ * @param string $mode
+ *
+ * @return array
+ */
static function operationSql($mainId, $otherId, $tableName, $tableOperations = array(), $mode = 'add') {
$sqls = array();
if (!$tableName || !$mainId || !$otherId) {
foreach ($cidRefs[$table] as $field) {
// carry related contributions CRM-5359
if (in_array($table, $paymentTables)) {
- $payOprSqls = self::operationSql($mainId, $otherId, $table, $tableOperations, 'payment');
- $sqls = array_merge($sqls, $payOprSqls);
-
$paymentSqls = self::paymentSql($table, $mainId, $otherId);
$sqls = array_merge($sqls, $paymentSqls);
+
+ if (!empty($tables) && !in_array('civicrm_contribution', $tables)) {
+ $payOprSqls = self::operationSql($mainId, $otherId, $table, $tableOperations, 'payment');
+ $sqls = array_merge($sqls, $payOprSqls);
+ }
}
$preOperationSqls = self::operationSql($mainId, $otherId, $table, $tableOperations);
}
}
}
-