}\r
}\r
}\r
- // lets delete current entity from recurring-entity table, which is going to be a new parent\r
- CRM_Core_BAO_RecurringEntity::delEntity($params['entity_id'], $params['entity_table'], TRUE);\r
+\r
+ // find all entities from the recurring set. At this point we 'll get entities which were not deleted \r
+ // for e.g due to participants being present. We need to delete them from recurring tables anyway.\r
+ $pRepeatingEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($params['entity_id'], $params['entity_table']);\r
+ foreach($pRepeatingEntities as $val) {\r
+ CRM_Core_BAO_RecurringEntity::delEntity($val['id'], $val['table'], TRUE);\r
+ }\r
}\r
\r
$recursion = new CRM_Core_BAO_RecurringEntity();\r