Skip to content
Snippets Groups Projects
Commit 133b8445 authored by Pradeep Nayak's avatar Pradeep Nayak
Browse files

CRM-13446

----------------------------------------
* CRM-13446: Add ON DELETE Options for constraints fails
  http://issues.civicrm.org/jira/browse/CRM-13446
parent af576aef
Branches
Tags
No related merge requests found
......@@ -77,13 +77,15 @@ class CRM_Upgrade_Incremental_php_FourThree {
if ($rev == '4.3.6') {
$constraintArray = array(
'civicrm_contact' => 'contact_id',
'civicrm_campaign' => 'campaign_id'
'civicrm_campaign' => 'campaign_id',
'civicrm_payment_processor' => 'payment_processor_id',
'civicrm_financial_type' => 'financial_type_id'
);
foreach ($constraintArray as $key => $value) {
$query = "SELECT contri_recur.id FROM civicrm_contribution_recur contri_recur LEFT JOIN {$key} ON contri_recur.{$value} = {$key}.id
WHERE {$key}.id IS NULL";
if ($value == 'campaign_id') {
$query .= ' AND contri_recur.campaign_id IS NOT NULL ';
if ($value != 'contact_id') {
$query .= " AND contri_recur.{$value} IS NOT NULL ";
}
$dao = CRM_Core_DAO::executeQuery($query);
if ($dao->N) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment