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
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function clone() {
|
public function clone() {
|
||||||
unset($this->values['id']);
|
$this->values['id'] = 0;
|
||||||
unset($this->values['identifier']);
|
$this->values['identifier'] = 0;
|
||||||
$this->create(); // this will also trigger the postSave hook
|
$this->create(); // this will also trigger the postSave hook
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,10 @@ function twinglecampaign_postSave_callback (
|
||||||
$result = civicrm_api3($entity, 'getsingle',
|
$result = civicrm_api3($entity, 'getsingle',
|
||||||
['id' => $campaign_id]
|
['id' => $campaign_id]
|
||||||
)['values'][$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 {
|
try {
|
||||||
$project->clone();
|
$project->clone();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue