-
-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow template for recurring cancelled
This is a simple template, with a slightly smaller subset of values than the exisiting one. It pulls out the recurring part to a trait...
- Loading branch information
1 parent
4189204
commit 68b19c6
Showing
4 changed files
with
76 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** | ||
* @support template-only | ||
*/ | ||
class CRM_Contribute_WorkflowMessage_RecurringCancelled extends Civi\WorkflowMessage\GenericWorkflowMessage { | ||
use CRM_Contribute_WorkflowMessage_RecurringTrait; | ||
|
||
public const WORKFLOW = 'contribution_recurring_cancelled'; | ||
|
||
/** | ||
* The recurring contribution contact. | ||
* | ||
* @var array|null | ||
* | ||
* @scope tokenContext | ||
* | ||
* @required | ||
*/ | ||
public $contact; | ||
|
||
protected function exportExtraTokenContext(array &$export): void { | ||
$export['smartyTokenAlias']['amount'] = 'contribution_recur.amount'; | ||
$export['smartyTokenAlias']['recur_frequency_unit'] = 'contribution_recur.frequency_unit:label'; | ||
$export['smartyTokenAlias']['recur_frequency_interval'] = 'contribution_recur.frequency_interval'; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* @method array getContributionRecur() | ||
* @method array getContact() | ||
* @method $this setContact(array $contact) | ||
*/ | ||
trait CRM_Contribute_WorkflowMessage_RecurringTrait { | ||
/** | ||
* The recurring contribution. | ||
* | ||
* @var array|null | ||
* | ||
* @scope tokenContext as contribution_recur | ||
* | ||
* @required | ||
*/ | ||
public $contributionRecur; | ||
|
||
/** | ||
* @var int | ||
* @scope tokenContext as contribution_recurId | ||
*/ | ||
public $contributionRecurId; | ||
|
||
/** | ||
* Set recurring contribution object. | ||
* | ||
* @param array $contributionRecur | ||
* | ||
* @return $this | ||
*/ | ||
public function setContributionRecur(array $contributionRecur): self { | ||
$this->contributionRecur = $contributionRecur; | ||
if (!empty($contributionRecur['id'])) { | ||
$this->contributionRecurId = $contributionRecur['id']; | ||
} | ||
return $this; | ||
} | ||
|
||
} |