fix campaign cloning
This commit is contained in:
parent
baa23f8639
commit
f17a899b79
2 changed files with 6 additions and 3 deletions
|
@ -91,8 +91,8 @@ class CRM_TwingleCampaign_BAO_TwingleProject extends Campaign {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function clone() {
|
||||
unset($this->values['id']);
|
||||
unset($this->values['identifier']);
|
||||
$this->values['id'] = 0;
|
||||
$this->values['identifier'] = 0;
|
||||
$this->create(); // this will also trigger the postSave hook
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,10 @@ function twinglecampaign_postSave_callback (
|
|||
$result = civicrm_api3($entity, 'getsingle',
|
||||
['id' => $campaign_id]
|
||||
)['values'][$campaign_id];
|
||||
$project = new $entity($result);
|
||||
$className = 'CRM_TwingleCampaign_BAO_' . $entity;
|
||||
$id = $result['id'];
|
||||
unset($result['id']);
|
||||
$project = new $className($result, $id);
|
||||
try {
|
||||
$project->clone();
|
||||
} catch (Exception $e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue