class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDFLetterCommon

This class provides the common functionality for creating PDF letter for one or a group of contact ids.

Properties

static protected $tokenCategories from CRM_Contact_Form_Task_PDFLetterCommon

Methods

static 
preProcess($form)

Build all the data structures needed to build the form.

static 
buildQuickForm($form)

Build the form object.

static 
setDefaultValues()

Set default values.

static bool
formRule(array $fields, array $files, array $self)

Form rule.

static 
processTemplate($formValues)

Handle the template processing part of the form

static 
formatMessage($message)

No description

static array
getLoggingOptions()

No description

static 
preProcessSingle(CRM_Core_Form $form, int $cid)

No description

static array
processMessageTemplate(array $formValues)

Part of the post process which prepare and extract information from the template.

static 
postProcess(CRM_Core_Form $form, array $formValues = NULL)

Process the form after the input has been submitted and validated.

static array
createActivities(CRM_Core_Form $form, string $html_message, array $contactIds, string $subject, int $campaign_id, array $perContactHtml = [])

No description

static array
getTokenCategories()

Get the categories required for rendering tokens.

static bool
isLiveMode(CRM_Core_Form $form)

Is the form in live mode (as opposed to being run as a preview).

static bool
isValidHTMLWithTableSeparator($tokens, $html)

Check whether any of the tokens exist in the html outside a table cell.

static bool
isHtmlTokenInTableCell(string $token, string $entity, string $textToSearch)

Check that the token only appears in a table cell. The '' separator cannot otherwise work Calculate the number of times it appears IN the cell & the number of times it appears - should be the same!

static array
buildContributionArray(string $groupBy, array $contributionIDs, array $returnProperties, bool $skipOnHold, bool $skipDeceased, array $messageToken, string $task, string $separator, bool $isIncludeSoftCredits)

Generate the contribution array from the form, we fill in the contact details and determine any aggregation around contact_id of contribution_recur_id

static array
combineContributions(array $existing, array $contribution, string $separator)

We combine the contributions by adding the contribution to each field with the separator in between the existing value and the new one. We put the separator there even if empty so it is clear what the value for previous contributions was

static 
assignCombinedContributionValues(array $contact, array $contributions, $groupBy, int $groupByID)

We are going to retrieve the combined contribution and if smarty mail is enabled we will also assign an array of contributions for this contact to the smarty template

static bool
emailLetter(array $contact, string $html, $is_pdf, array $format = [], array $params = [])

Send pdf by email.

static string
generateHtml($contact, $contribution, $groupBy, $contributions, $realSeparator, $tableSeparators, $messageToken, $html_message, $separator, $grouped, $groupByID)

No description

Details

static preProcess($form)

Build all the data structures needed to build the form.

Parameters

$form

at line 14
static buildQuickForm($form)

Build the form object.

Parameters

$form

static setDefaultValues()

Set default values.

static bool formRule(array $fields, array $files, array $self)

Form rule.

Parameters

array $fields The input form values.
array $files
array $self Additional values form 'this'.

Return Value

bool TRUE if no errors, else array of errors.

static processTemplate($formValues)

Handle the template processing part of the form

Parameters

$formValues

static formatMessage($message)

Parameters

$message

static array getLoggingOptions()

Return Value

array Array(string $machineName => string $label).

static preProcessSingle(CRM_Core_Form $form, int $cid)

Parameters

CRM_Core_Form $form
int $cid

static array processMessageTemplate(array $formValues)

Part of the post process which prepare and extract information from the template.

Parameters

array $formValues

Return Value

array [$categories, $html_message, $messageToken, $returnProperties]

at line 29
static postProcess(CRM_Core_Form $form, array $formValues = NULL)

Process the form after the input has been submitted and validated.

Parameters

CRM_Core_Form $form
array $formValues

static array createActivities(CRM_Core_Form $form, string $html_message, array $contactIds, string $subject, int $campaign_id, array $perContactHtml = [])

Parameters

CRM_Core_Form $form
string $html_message
array $contactIds
string $subject
int $campaign_id
array $perContactHtml

Return Value

array List of activity IDs. There may be 1 or more, depending on the system-settings and use-case.

Exceptions

CRM_Core_Exception

static protected array getTokenCategories()

Get the categories required for rendering tokens.

Return Value

array

static protected bool isLiveMode(CRM_Core_Form $form)

Is the form in live mode (as opposed to being run as a preview).

Returns true if the user has clicked the Download Document button on a Print/Merge Document (PDF Letter) search task form, or false if the Preview button was clicked.

Parameters

CRM_Core_Form $form

Return Value

bool TRUE if the Download Document button was clicked (also defaults to TRUE if the form controller does not exist), else FALSE

at line 177
static bool isValidHTMLWithTableSeparator($tokens, $html)

Check whether any of the tokens exist in the html outside a table cell.

If they do the table cell separator is not supported (return false) At this stage we are only anticipating contributions passed in this way but it would be easy to add others

Parameters

$tokens
$html

Return Value

bool

at line 201
static bool isHtmlTokenInTableCell(string $token, string $entity, string $textToSearch)

Check that the token only appears in a table cell. The '' separator cannot otherwise work Calculate the number of times it appears IN the cell & the number of times it appears - should be the same!

Parameters

string $token
string $entity
string $textToSearch

Return Value

bool

at line 257
static array buildContributionArray(string $groupBy, array $contributionIDs, array $returnProperties, bool $skipOnHold, bool $skipDeceased, array $messageToken, string $task, string $separator, bool $isIncludeSoftCredits)

Generate the contribution array from the form, we fill in the contact details and determine any aggregation around contact_id of contribution_recur_id

Parameters

string $groupBy
array $contributionIDs
array $returnProperties
bool $skipOnHold
bool $skipDeceased
array $messageToken
string $task
string $separator
bool $isIncludeSoftCredits

Return Value

array

at line 321
static array combineContributions(array $existing, array $contribution, string $separator)

We combine the contributions by adding the contribution to each field with the separator in between the existing value and the new one. We put the separator there even if empty so it is clear what the value for previous contributions was

Parameters

array $existing
array $contribution
string $separator

Return Value

array

at line 338
static assignCombinedContributionValues(array $contact, array $contributions, $groupBy, int $groupByID)

We are going to retrieve the combined contribution and if smarty mail is enabled we will also assign an array of contributions for this contact to the smarty template

Parameters

array $contact
array $contributions
$groupBy
int $groupByID

at line 358
static bool emailLetter(array $contact, string $html, $is_pdf, array $format = [], array $params = [])

Send pdf by email.

Parameters

array $contact
string $html
$is_pdf
array $format
array $params

Return Value

bool

at line 419
static protected string generateHtml($contact, $contribution, $groupBy, $contributions, $realSeparator, $tableSeparators, $messageToken, $html_message, $separator, $grouped, $groupByID)

Parameters

$contact
$contribution
$groupBy
$contributions
$realSeparator
$tableSeparators
$messageToken
$html_message
$separator
$grouped
$groupByID

Return Value

string