@@ -73,6 +73,29 @@ class CRM_Upgrade_Incremental_php_FourThree {
CRM_Core_Error::fatal('Please reset the Drupal cache (Administer => Site Configuration => Performance => Clear cached data))');
}
}
if($rev=='4.3.6'){
$constraintArray=array(
'civicrm_contact'=>'contact_id',
'civicrm_campaign'=>'campaign_id'
);
foreach($constraintArrayas$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 ';
}
$dao=CRM_Core_DAO::executeQuery($query);
if($dao->N){
$invalidDataMessage='<strong>'.
ts('Oops, it looks like you have orphaned recurring contribution records in your database. Before this upgrade can complete they will need to be fixed or deleted. <a href="%1" target="_blank">You can review steps to correct this situation on the documentation wiki.</a>',