Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.2.0
-
Fix Version/s: 4.2.0
-
Component/s: None
-
Labels:None
Description
My upgrade to 4.2 fell over on the creation of a price line item. In this case the option value for the event had been deleted so no price set had been created. When it went to create the line item I got a fatal error. This is a data issue so I think it's fine for the event to be skipped but the situation should be handled & the upgrade should still complete
#8 C:\utils\eclipseworkspace\civicrm-4.2\packages\DB\DataObject.php(2427): DB_common->query('INSERT INTO civ...')
#9 C:\utils\eclipseworkspace\civicrm-4.2\packages\DB\DataObject.php(1055): DB_DataObject->_query('INSERT INTO civ...')
#10 C:\utils\eclipseworkspace\civicrm-4.2\CRM\Core\DAO.php(287): DB_DataObject->insert()
#11 C:\utils\eclipseworkspace\civicrm-4.2\CRM\Price\BAO\LineItem.php(66): CRM_Core_DAO->save() #12 C:\utils\eclipseworkspace\civicrm-4.2\CRM\Upgrade\Incremental\php\FourTwo.php(416): CRM_Price_BAO_LineItem::create(Array)
#13 [internal function]: CRM_Upgrade_Incremental_php_FourTwo::task_4_2_alpha1_convertContributions(Object(CRM_Queue_TaskContext), '27', 5026
This is probably not the ideal patch but at least it give an indication of where the error happens. (I didn't use it - I just fixed my data)
Index: CRM/Upgrade/Incremental/php/FourTwo.php
===================================================================
— CRM/Upgrade/Incremental/php/FourTwo.php (revision 40900)
+++ CRM/Upgrade/Incremental/php/FourTwo.php (working copy)
@@ -412,9 +412,11 @@
$lineParams['price_field_id'] = $fieldID;
$priceSetId = $defaultPriceSetId;
}
- CRM_Price_BAO_LineItem::create($lineParams);
- CRM_Price_BAO_Set::addTo('civicrm_participant', $dao->participant_id, $priceSetId);
- }
+ if(!empty($params['price_field_value_id'])) { + CRM_Price_BAO_LineItem::create($lineParams); + CRM_Price_BAO_Set::addTo('civicrm_participant', $dao->participant_id, $priceSetId); + }+ }
return TRUE;
}