Skip to content

Commit

Permalink
Style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aydun committed Jun 15, 2019
1 parent 6db9404 commit e2515e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions CRM/Activity/Form/Task/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* This class provides the functionality to create PDF/Word letters for activities.
*/
class CRM_Activity_Form_Task_PDF extends CRM_Activity_Form_Task {

/**
* Build all the data structures needed to build the form.
*/
Expand Down
14 changes: 8 additions & 6 deletions CRM/Activity/Tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ class CRM_Activity_Tokens extends \Civi\Token\AbstractTokenSubscriber {
private $customFieldTokens;
private $specialTokens;

// Mapping from tokenName to api return field
// Use lists since we might need multiple fields
/**
* Mapping from tokenName to api return field
* Use lists since we might need multiple fields
*/
private static $fieldMapping = [
'activity_id' => ['id'],
'activity_type' => ['activity_type_id'],
Expand All @@ -75,8 +77,7 @@ public function __construct() {
* @inheritDoc
*/
public function checkActive(\Civi\Token\TokenProcessor $processor) {
return
in_array('activityId', $processor->context['schema']) ||
return in_array('activityId', $processor->context['schema']) ||
(!empty($processor->context['actionMapping'])
&& $processor->context['actionMapping']->getEntity() === 'civicrm_activity');
}
Expand Down Expand Up @@ -126,7 +127,8 @@ public function alterActionScheduleQuery(\Civi\ActionSchedule\Event\MailingQuery
* @return array list of fields needed to generate those tokens
*/
public function getReturnFields($tokens) {
$fields = ['id']; // Make sure we always return something
// Make sure we always return something
$fields = ['id'];

foreach (array_intersect($tokens,
array_merge(array_keys(self::getBasicTokens()), array_keys(self::getCustomFieldTokens()))
Expand Down Expand Up @@ -249,7 +251,7 @@ public function evaluateToken(\Civi\Token\TokenRow $row, $entity, $field, $prefe
if (in_array($field, ['activity_date_time', 'created_date'])) {
$row->tokens($entity, $field, \CRM_Utils_Date::customFormat($activity->$field));
}
elseif (isset($mapping[$field]) AND (isset($activity->{$mapping[$field]}))) {
elseif (isset($mapping[$field]) and (isset($activity->{$mapping[$field]}))) {
$row->tokens($entity, $field, $activity->{$mapping[$field]});
}
elseif (in_array($field, ['activity_type'])) {
Expand Down
5 changes: 3 additions & 2 deletions CRM/Core/Form/Task/PDFLetterCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,9 @@ public static function formatMessage(&$message) {
* Render html from rows
* @param array $rows Array of \Civi\Token\TokenRow
* @param string $msgPart The name registered with the TokenProcessor
* @return string $html if formValues['is_unit_test'] is true,
* otherwise outputs document to browser
* @param string $formValues The values submitted through the form
* @return string $html if formValues['is_unit_test'] is true,
* otherwise outputs document to browser
*
*/
public static function renderFromRows($rows, $msgPart, $formValues) {
Expand Down

0 comments on commit e2515e4

Please sign in to comment.