Details
- 
    Type:
Bug
 - 
    Status: Done/Fixed
 - 
    Priority:
Critical
 - 
    Resolution: Fixed/Completed
 - 
    Affects Version/s: 4.2.0
 - 
    Fix Version/s: 4.2.0
 - 
    Component/s: CiviContribute
 - 
    Labels:None
 
Description
Hi Pradeep - the price set script failed to complete for us due to bad data - for some reason - related to the payment processor there was more than one membership linked to on contribution. The patch below worked to get me through & seems better than a hard fail. It's just the addition of the word distinct (since anything not distinct will not meet the unique field criteria)
Index: CRM/Upgrade/Incremental/php/FourTwo.php
===================================================================
— CRM/Upgrade/Incremental/php/FourTwo.php	(revision 41766)
+++ CRM/Upgrade/Incremental/php/FourTwo.php	(working copy)
@@ -335,7 +335,7 @@
     $upgrade = new CRM_Upgrade_Form();
     $query = "
  INSERT INTO civicrm_line_item(`entity_table` ,`entity_id` ,`price_field_id` ,`label` , `qty` ,`unit_price` ,`line_total` ,`participant_count` ,`price_field_value_id`)
- SELECT 'civicrm_contribution',cc.id, cpf.id as price_field_id, cpfv.label, 1, cc.total_amount, cc.total_amount line_total, 0, cpfv.id as price_field_value
+ SELECT DISTINCT 'civicrm_contribution',cc.id, cpf.id as price_field_id, cpfv.label, 1, cc.total_amount, cc.total_amount line_total, 0, cpfv.id as price_field_value
FROM civicrm_membership_payment cmp
LEFT JOIN `civicrm_contribution` cc ON cc.id = cmp.contribution_id
LEFT JOIN civicrm_line_item cli ON cc.id=cli.entity_id and cli.entity_table = 'civicrm_contribution' 
Attachments
Issue Links
- has patch in
 - 
                    
CRM-11120 4.2 drush upgrade deletes valid membership and activity records
-         
 - Done/Fixed
 
 -