CRM_Contribute_BAO_Contribution_Utils
in package
Tags
Table of Contents
Methods
- calculateTaxAmount() : array<string|int, mixed>
- Calculate the tax amount based on given tax rate.
- contributionChartMonthly() : array<string|int, mixed>|null
- Get the contribution details by month of the year.
- contributionChartYearly() : array<string|int, mixed>|null
- Get the contribution details by year.
- createCMSUser() : mixed
- formatAmount() : float
- Format monetary amount: round and return to desired decimal place
- getContributionPageTitle() : string
- Get either the public title if set or the title of a contribution page for use in workflow message template.
- getContributionStatuses() : array<string|int, mixed>
- Get contribution statuses by entity e.g. contribution, membership or 'participant'
- getFirstLastDetails() : mixed
- getPendingAndCompleteStatuses() : array<string|int, mixed>
- Get the options for pending and completed as an array with labels as values.
- getPendingCompleteFailedAndCancelledStatuses() : array<string|int, mixed>
- Get the options for pending and completed as an array with labels as values.
- overrideDefaultCurrency() : mixed
- CRM-8254 / CRM-6907 - override default currency if applicable these lines exist to support a non-default currency on the form but are probably obsolete & meddling wth the defaultCurrency is not the right approach.
Methods
calculateTaxAmount()
Calculate the tax amount based on given tax rate.
public
static calculateTaxAmount(float $amount, float $taxRate) : array<string|int, mixed>
Parameters
- $amount : float
-
Amount of field.
- $taxRate : float
-
Tax rate of selected financial account for field.
Return values
array<string|int, mixed> —array of tax amount
contributionChartMonthly()
Get the contribution details by month of the year.
public
static contributionChartMonthly(int $param) : array<string|int, mixed>|null
Parameters
- $param : int
-
Year.
Return values
array<string|int, mixed>|null —associated array
contributionChartYearly()
Get the contribution details by year.
public
static contributionChartYearly() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —associated array
createCMSUser()
public
static createCMSUser(array<string|int, mixed> &$params, int $contactID, mixed $mail) : mixed
Parameters
- $params : array<string|int, mixed>
- $contactID : int
- $mail : mixed
formatAmount()
Format monetary amount: round and return to desired decimal place
public
static formatAmount(float $amount[, int $decimals = 2 ]) : float
Parameters
- $amount : float
-
Monetary amount
- $decimals : int = 2
-
How many decimal places to round to and return
Tags
Return values
float —Amount rounded and returned with the desired decimal places
getContributionPageTitle()
Get either the public title if set or the title of a contribution page for use in workflow message template.
public
static getContributionPageTitle(int $contribution_page_id) : string
Parameters
- $contribution_page_id : int
Return values
stringgetContributionStatuses()
Get contribution statuses by entity e.g. contribution, membership or 'participant'
public
static getContributionStatuses([string $usedFor = 'contribution' ][, string $name = NULL ]) : array<string|int, mixed>
This is called from a couple of places outside of core so it has been made unused and deprecated rather than having the now-obsolete parameter change. It should work much the same for the places that call it with a notice. It is not an api function & not supported for use outside core. Extensions should write their own functions.
Parameters
- $usedFor : string = 'contribution'
- $name : string = NULL
-
Contribution ID
Return values
array<string|int, mixed> —Array of contribution statuses in array('status id' => 'label') format
getFirstLastDetails()
public
static getFirstLastDetails(int $contactID) : mixed
Parameters
- $contactID : int
getPendingAndCompleteStatuses()
Get the options for pending and completed as an array with labels as values.
public
static getPendingAndCompleteStatuses() : array<string|int, mixed>
Return values
array<string|int, mixed>getPendingCompleteFailedAndCancelledStatuses()
Get the options for pending and completed as an array with labels as values.
public
static getPendingCompleteFailedAndCancelledStatuses() : array<string|int, mixed>
Return values
array<string|int, mixed>overrideDefaultCurrency()
CRM-8254 / CRM-6907 - override default currency if applicable these lines exist to support a non-default currency on the form but are probably obsolete & meddling wth the defaultCurrency is not the right approach.
public
static overrideDefaultCurrency(array<string|int, mixed> $params) : mixed
...
Parameters
- $params : array<string|int, mixed>