CRM_Contribute_BAO_Contribution
extends CRM_Contribute_DAO_Contribution
in package
implements
HookInterface
Placeholder class retained for legacy compatibility.
Tags
Table of Contents
Interfaces
- HookInterface
- Interface HookInterface
Constants
- BULK_INSERT_COUNT = 200
- BULK_INSERT_HIGH_COUNT = 200
- DB_DAO_NOTNULL = 128
- IS_NULL = 2
- NOT_NULL = 1
- QUERY_FORMAT_NO_QUOTES = 2
- QUERY_FORMAT_WILDCARD = 1
- SERIALIZE_COMMA = 5
- Comma separated string, no quotes, no spaces
- SERIALIZE_JSON = 3
- Recommended serialization format
- SERIALIZE_NONE = 0
- No serialization.
- SERIALIZE_PHP = 4
- SERIALIZE_SEPARATOR_BOOKEND = 1
- Serialized string separated by and bookended with VALUE_SEPARATOR
- SERIALIZE_SEPARATOR_TRIMMED = 2
- VALUE_SEPARATOR = "\x01"
Properties
- $_component : string
- Field for the component - either 'event' (participant) or 'contribute' (any item related to a contribution page e.g. membership, pledge, contribution) This is used for composing messages because they have dependency on the contribution_page or event page - although over time we may eliminate that
- $_dbColumnValueCache : mixed
- $_exportableFields : array<string|int, mixed>
- Static field for all the contribution information that we can potentially export
- $_icon : string
- Icon associated with this entity.
- $_importableFields : array<string|int, mixed>
- Static field for all the contribution information that we can potentially import
- $_labelField : string
- Field to show when displaying a record.
- $_nullArray : array<string|int, mixed>
- $_nullObject : null
- $_primaryKey : array<string|int, string>
- Primary key field(s).
- $_relatedObjects : CRM_Member_BAO_Membership|array<string|int, CRM_Event_BAO_Participant>
- Field for all the objects related to this contribution.
- $_testEntitiesToSkip : array<string|int, mixed>
- Define entities that shouldn't be created or deleted when creating/ deleting test objects - this prevents world regions, countries etc from being added / deleted
- $address_id : int|string|null
- $amount_level : string|null
- $campaign_id : int|string|null
- $cancel_date : string|null
- $cancel_reason : string|null
- $check_number : string|null
- $contact_id : int|string
- $contribution_page_id : int|string|null
- $contribution_recur_id : int|string|null
- $contribution_status_id : int|string|null
- $creditnote_id : string|null
- $currency : string|null
- $fee_amount : float|string|null
- $financial_type_id : int|string|null
- $id : int|string|null
- $invoice_id : string|null
- $invoice_number : string|null
- $is_pay_later : bool|string
- $is_template : bool|string
- $is_test : bool|string
- $net_amount : float|string|null
- $non_deductible_amount : float|string|null
- $payment_instrument_id : int|string|null
- $receipt_date : string|null
- $receive_date : string|null
- $revenue_recognition_date : string|null
- $source : string|null
- $tax_amount : float|string
- $thankyou_date : string|null
- $total_amount : float|string
- $trxn_id : string|null
- $trxn_result_code : string
- Possibly obsolete variable.
- $_options : array<string|int, mixed>
- https://issues.civicrm.org/jira/browse/CRM-17748 internal variable for DAO to hold per-query settings
- $resultCopies : int
- How many times has this instance been cloned.
Methods
- __clone() : mixed
- __construct() : static
- Class constructor.
- __destruct() : mixed
- Class destructor.
- _assignMessageVariablesToTemplate() : mixed
- Assign message variables to template but try to break the habit.
- _gatherMessageValues() : array<string|int, mixed>
- Gather values for contribution mail - this function has been created as part of CRM-9996 refactoring as a step towards simplifying the composeMessage function Values related to the contribution in question are gathered
- acceptedSQLOperators() : array<string|int, string>
- add() : CRM_Contribute_BAO_Contribution
- Takes an associative array and creates a contribution object.
- addActivityForPayment() : mixed
- addPremium() : CRM_Contribute_DAO_ContributionProduct
- Takes an associative array and creates a contribution_product object.
- addSelectWhereClause() : array<string|int, mixed>
- Generates acl clauses suitable for adding to WHERE or ON when doing an api.get for this entity
- allowUpdateRevenueRecognitionDate() : bool
- Check if contribution has participant/membership payment.
- alterPaymentInstrument() : mixed
- Pseudoconstant condition_provider for payment_instrument_id field.
- alterStatus() : mixed
- Pseudoconstant condition_provider for contribution_status_id field.
- annual() : array<string|int, mixed>
- Generate summary of amount received in the current fiscal year to date from the contact or contacts.
- appendPseudoConstantsToFields() : mixed
- Update the fields array to also hold keys for pseudoconstant fields that relate to contained fields.
- assignProportionalLineItems() : mixed
- Function use to store line item proportionally in in entity financial trxn table
- buildOptions() : array<string|int, mixed>|bool
- Legacy option getter
- buildOptionsContext() : array<string|int, mixed>
- Provides documentation and validation for the buildOptions $context param
- calculateMissingAmountParams() : mixed
- Calculate net_amount & fee_amount if they are not set.
- cascadeUpdate() : CRM_Core_DAO|null
- Cascade update through related entities.
- checkConstraintExists() : bool
- Checks if a constraint exists for a specified table.
- checkContributeSettings() : string
- Get values of CiviContribute Settings and check if its enabled or not.
- checkDuplicate() : bool
- Check if there is a contribution with the same trxn_id or invoice_id.
- checkDuplicateIds() : array<string|int, mixed>
- Check if there is a contribution with the params passed in.
- checkFieldHasAlwaysValue() : mixed
- Check whether a specific column in a specific table has always the same value.
- checkFieldIsAlwaysNull() : mixed
- Check whether a specific column in a specific table is always NULL.
- checkFinancialTypeChange() : void
- Check financial type validation on update of a contribution.
- checkFKConstraintInFormat() : mixed
- Checks if the FK constraint name is in the format 'FK_tableName_columnName' for a specified column of a table.
- checkOnlinePendingContribution() : int
- This function check online pending contribution associated w/ Online Event Registration or Online Membership signup.
- checkStatusValidation() : void
- Check status validation on update of a contribution.
- checkTableExists() : bool
- Check if there is a given table in the database.
- checkTableHasData() : bool
- Check if a given table has data.
- checkTriggerViewPermission() : bool
- commonRetrieveAll() : object
- Fetch object based on array of properties.
- composeMessageArray() : array<string|int, mixed>
- Create array of message information - ie. return html version, txt version, to field
- composeQuery() : string
- Compose the query by merging the parameters into it.
- contributionCount() : null|string
- copyCustomFields() : mixed
- Method that copies custom fields values from an old entity to a new one.
- copyGeneric() : CRM_Core_DAO|bool
- Make a shallow copy of an object and all the fields in the object.
- copyValues() : bool
- Given an associative array of name/value pairs, extract all the values that belong to this object and initialize the object with said values
- create() : CRM_Contribute_BAO_Contribution
- Takes an associative array and creates a contribution object.
- createAddress() : int
- Create address associated with contribution record.
- createProportionalEntry() : void
- Create tax entry in civicrm_entity_financial_trxn table.
- createProportionalFinancialEntries() : mixed
- Create proportional entries in civicrm_entity_financial_trxn.
- createReferenceColumns() : array<string|int, CRM_Core_Reference_Interface>
- Given a list of fields, create a list of references.
- createSQLFilter() : null|string|array<string|int, mixed>
- Get SQL where clause for SQL filter syntax input parameters.
- createTestObject() : object|array<string|int, mixed>|null
- Creates a test object, including any required objects it needs via recursion createOnly: only create in database, do not store or return the objects (useful for perf testing) ONLY USE FOR TESTING
- createTriggers() : mixed
- debugPrint() : mixed
- delete() : int|false
- Deletes items from table which match current objects variables.
- deleteAddress() : mixed
- Delete billing address record related contribution.
- deleteContactContribution() : mixed
- Delete contribution of contact.
- deleteContribution() : mixed|null
- Delete the indirect records associated with this contribution first.
- deleteEntityContact() : mixed
- Unused function.
- deleteRecord() : static
- Delete a record from supplied params.
- deleteRecords() : array<string|int, static>
- Bulk delete multiple records.
- deleteTestObjects() : mixed
- Deletes the this object plus any dependent objects that are associated with it.
- disableFullGroupByMode() : mixed
- Disables usage of the ONLY_FULL_GROUP_BY Mode if necessary
- dropAllTables() : mixed
- Drop all CiviCRM tables.
- dropTriggers() : mixed
- Wrapper function to drop triggers.
- escapeString() : string
- escapeStrings() : string
- Escape a list of strings for use with "WHERE X IN (...)" queries.
- escapeWildCardString() : string
- executeQuery() : CRM_Core_DAO|object
- Execute a query.
- executeUnbufferedQuery() : CRM_Core_DAO
- Execute an unbuffered query.
- export() : array<string|int, mixed>
- Returns the list of fields that can be exported
- exportableFields() : array<string|int, mixed>
- Combine all the exportable fields from the lower level objects.
- failPayment() : mixed
- React to a financial transaction (payment) failure.
- fetchAll() : array<string|int, mixed>
- Returns all results as array-encoded records.
- fetchGenerator() : mixed
- Return the results as PHP generator.
- fetchMap() : array<string|int, mixed>
- Get all the result records as mapping between columns.
- fetchValue() : mixed|null
- Returns a singular value.
- fieldKeys() : array<string|int, mixed>
- Return a mapping from field-name to the corresponding key (as used in fields()).
- fields() : array<string|int, mixed>
- Returns all the column names of this table.
- fillValues() : array<string|int, mixed>
- Given an incomplete record, attempt to fill missing field values from the database
- findById() : static
- Find a DAO object for the given ID and return it.
- findReferences() : array<string|int, CRM_Core_DAO>
- Find all records which refer to this entity.
- formatFieldValues() : void
- Format field values according to fields() metadata.
- freeResult() : mixed
- generateFromEmailAndName() : array<string|int, mixed>
- Generate From email and from name in an array values
- getAnnualQuery() : string
- Get a query to determine the amount donated by the contact/s in the current financial year.
- getAttribute() : array<string|int, mixed>
- Get the size and maxLength attributes for this text field.
- getComponentDetails() : array<string|int, mixed>
- Returns all contribution related object ids.
- getConnection() : DB_common
- getContactIDsFromComponent() : array<string|int, mixed>
- Given the component id, compute the contact id since its used for things like send email
- getContributionBalance() : float
- Get the outstanding balance on a contribution.
- getContributionDates() : array<string|int, mixed>
- getContributionDetails() : array<string|int, mixed>
- Get the contribution details for component export.
- getContributionFields() : array<string|int, mixed>
- Get list of contribution fields for profile.
- getContributionTokenValues() : array<string|int, mixed>
- Do not use - still called from CRM_Contribute_Form_Task_PDFLetter
- getCurrentandGoalAmount() : array<string|int, mixed>
- getDatabaseName() : string
- Get the name of the CiviCRM database.
- getDbVal() : array<string|int, mixed>|bool|int|string|null
- Fetch a single field value from the database.
- getDefaultFallbackValues() : mixed
- Callback for `default_fallback` field values
- getDefaults() : array<string|int, mixed>
- Get defaults for new entity.
- getDynamicReferencesToTable() : array<string|int, mixed>
- Get all dynamic references to the given table.
- getEntityDescription() : string|null
- Returns user-friendly description of this entity.
- getEntityIcon() : string|null
- Overridable function to get icon for a particular entity.
- getEntityPaths() : array<string|int, mixed>
- Returns system paths related to this entity (as defined in the xml schema)
- getEntityRefFilters() : array<string|int, mixed>
- getEntityTitle() : string
- Returns localized title of this entity.
- getExportableFieldsWithPseudoConstants() : array<string|int, mixed>
- Get exportable fields with pseudoconstants rendered as an extra field.
- getExtensionName() : string|null
- Get name of extension in which this DAO is defined.
- getFieldSpec() : bool|array<string|int, mixed>
- getFieldValue() : string|int|null
- Given a DAO name, a column name and a column value, find the record and GET the value of another column in that record
- getGlobalSetting() : mixed
- Lookup the value of a MySQL global configuration variable.
- getHonorContacts() : array<string|int, mixed>
- Get list of contributions which credit the passed in contact ID.
- getInvoiceNumber() : string|null
- Get invoice_number for contribution.
- getLabelField() : string|null
- getLastFinancialItemIds() : array<string|int, mixed>
- Create array of last financial item id's.
- getLocaleTableName() : string
- Get localized name of this table, if applicable.
- getLog() : bool
- Returns if this table needs to be logged
- getNumTermsByContributionAndMembershipType() : int
- Get the number of terms for this contribution for a given membership type based on querying the line item table and relevant price field values Note that any one contribution should only be able to have one line item relating to a particular membership type
- getOnbehalfIds() : array<string|int, mixed>
- Get individual id for onbehalf contribution.
- getOptionLabels() : mixed
- Populate option labels for this object's fields.
- getPaymentInfo() : mixed
- Get list of payments displayed by Contribute_Page_PaymentInfo.
- getPaymentProcessorReadyAddressParams() : array<string|int, mixed>
- Get address params ready to be passed to the payment processor.
- getReferenceColumns() : array<string|int, CRM_Core_Reference_Basic>
- Returns list of FK relationships.
- getReferenceCounts() : array<string|int, array{name: string, type: string, count: int, table: string|null, key: string|null}>
- getReferencesToContactTable() : mixed
- Get all references to contact table.
- getReferencesToTable() : array<string|int, CRM_Core_Reference_Interface>
- List all tables which have either: - hard foreign keys to this table, or - a dynamic foreign key that includes this table as a possible target.
- getSalesTaxFinancialAccounts() : array<string|int, mixed>
- Retrieve Sales Tax Financial Accounts.
- getSelectWhereClause() : array<string|int, mixed>
- This returns the final permissioned query string for this entity
- getSortString() : mixed
- Unused function.
- getSpecialContributionFields() : mixed
- Add extra fields specific to contribution.
- getSupportedFields() : array<string|int, mixed>
- Returns all usable fields, indexed by name.
- getTableName() : string
- Returns the name of this table
- getTableNames() : array<string|int, mixed>
- Gets the names of all enabled schema tables.
- getToFinancialAccount() : int
- Get the value for the To Financial Account.
- getTotalAmountAndCount() : array<string|int, mixed>|null
- getUnitLabelWithPlural() : string
- Get the unit label with the plural option
- getValues() : CRM_Contribute_BAO_Contribution|null
- Fetch the object and store the values in the values array.
- getValuesWithMappings() : array<string|int, mixed>
- Deprecated contact.get call.
- import() : array<string|int, mixed>
- Returns the list of fields that can be imported
- importableFields() : array<string|int, mixed>
- Combine all the importable fields from the lower levels object.
- indices() : array<string|int, mixed>
- init() : mixed
- Initialize the DAO object.
- initialize() : mixed
- Initialization for all DAO objects. Since we access DB_DO programatically we need to set the links manually.
- isCancelSubscriptionSupported() : bool
- Check whether payment processor supports cancellation of contribution subscription
- isComponentEnabled() : bool
- Check if component is enabled for this DAO class
- isContributionStatusNegative() : bool
- Is this contribution status a reversal.
- isDBMyISAM() : bool
- isSingleLineItem() : bool
- Is there only one line item attached to the contribution.
- isSubscriptionCancelled() : string
- Check whether subscription is already cancelled.
- isUpdateToRecurringContribution() : bool
- Is this contribution updating an existing recurring contribution.
- isValidOption() : bool
- Wrapper to validate internal DAO options before passing to DB_mysql/DB_Common level
- keys() : array<string|int, string>
- Returns primary keys (usually ['id'])
- loadRelatedMembershipObjects() : array<string|int, mixed>
- Load related memberships.
- loadRelatedObjects() : bool
- Load objects relations to contribution object.
- log() : mixed
- lookupValue() : bool
- Convert associative array names to values and vice-versa.
- makeAttribute() : array<string|int, mixed>|null
- Create an attribute for this specific field. We only do this for strings and text
- objectExists() : bool
- Check if there is a record with the same name in the db.
- query() : object
- Execute a query by the current DAO, localizing it along the way (if needed).
- recordFinancialAccounts() : null|CRM_Core_BAO_FinancialTrxn
- Create all financial accounts entry.
- recordPaymentActivity() : mixed
- Record an activity when a payment is received.
- reenableFullGroupByMode() : mixed
- Re-enables ONLY_FULL_GROUP_BY sql_mode as necessary.
- requireSafeDBName() : bool
- ensure database name is 'safe', i.e. only contains word characters (includes underscores) and dashes, and contains at least one [a-z] case insensitive.
- reset() : mixed
- Reset the DAO object.
- resolveDefaults() : mixed
- Get the values for pseudoconstants for name->value and reverse.
- retrieve() : CRM_Contribute_BAO_Contribution
- Retrieve DB object based on input parameters.
- save() : CRM_Core_DAO
- Save DAO object.
- schemaRequiresRebuilding() : mixed
- Checks if CONSTRAINT keyword exists for a specified table.
- self_hook_civicrm_post() : void
- Event fired after modifying a contribution.
- sendMail() : array<string|int, mixed>
- Send receipt from contribution.
- sequenceKey() : array<string|int, mixed>
- Tells DB_DataObject which keys use autoincrement.
- serializeField() : string|null
- Transform an array to a serialized string for database storage.
- setApiFilter() : mixed
- setCreateDefaults() : mixed
- Set defaults when creating new entity.
- setFieldValue() : bool
- Given a DAO name, a column name and a column value, find the record and SET the value of another column in that record
- setOptions() : mixed
- https://issues.civicrm.org/jira/browse/CRM-17748 Sets the internal options to be used on a query
- shortenSQLName() : string
- SQL has a limit of 64 characters on various names: table name, trigger name, column name ... For custom groups and fields we generated names from user entered input which can be longer than this length, this function helps with creating strings that meet various criteria.
- singleValueQuery() : string|null
- Execute a query and get the single result.
- sortName() : null|string
- Get the sort name of a contact for a particular contribution.
- storeValues() : mixed
- Store all the values from this object in an associative array this is a destructive store, calling function is responsible for keeping sanity of id's.
- table() : array<string|int, mixed>
- Get/set an associative array of table columns
- tableHasBeenAdded() : bool
- Checks if this DAO's table ought to exist.
- triggerRebuild() : mixed
- Build a list of triggers via hook and add them to (err, reconcile them with) the database.
- unSerializeField() : array<string|int, mixed>|null
- Transform a serialized string from the database into an array.
- updateMembershipBasedOnCompletionOfContribution() : mixed
- Update the memberships associated with a contribution if it has been completed.
- updateRelatedPledge() : mixed
- Update related pledge payment payments.
- validateFinancialType() : array<string|int, mixed>|bool
- Validate financial type.
- writeRecord() : static
- Create or update a record from supplied params.
- writeRecords() : array<string|int, static>
- Bulk save multiple records
- _setDBOptions() : mixed
- https://issues.civicrm.org/jira/browse/CRM-17748 wrapper to pass internal DAO options down to DB_mysql/DB_Common level
- addContributionPageValuesToValuesHeavyHandedly() : array<string|int, mixed>
- ContributionPage values were being imposed onto values.
- assignTestFK() : mixed
- assignTestValue() : mixed
- Assign Test Value.
- copyLocalizable() : mixed
- Method that copies localizable fields from an old entity to a new one.
- formatFieldValue() : mixed
- Format a value according to field metadata.
- getBillingAddressParams() : array<string|int, mixed>
- getContributionTransactionInformation() : mixed
- Get transaction information about the contribution.
- getDynamicFkAclClauses() : array<string|int, mixed>
- Get an array of ACL clauses for a dynamic FK (entity_id/entity_table combo)
- getFirstPrimaryKey() : string
- getRelatedMemberships() : array<string|int, mixed>
- Get memberships related to the contribution.
- getTableAddVersion() : string
- isEmailReceipt() : bool
- Should an email receipt be sent for this contribution on completion.
- loadEventMessageTemplateParams() : array<string|int, mixed>
- Load the values needed for the event message.
- loadRelatedEntitiesByID() : mixed
- Load entities related to the contribution into $this->_relatedObjects.
- clearDbColumnValueCache() : mixed
- Remove item from static cache during update/delete operations
- getActivitySourceAndTarget() : array<string|int, mixed>
- Get the activity source and target contacts linked to a contribution
- getEntityDefinition() : array<string|int, mixed>
- getEntityInfo() : array<string|int, mixed>
- getFieldLength() : string|null
- getOriginalContribution() : CRM_Contribute_BAO_Contribution|null
- Get the contribution as it is in the database before being updated.
- getSchemaFields() : array<string|int, mixed>
- loadSchemaFields() : array<string|int, mixed>
- makeNameFromLabel() : void
- When creating a record without a supplied name, create a unique, clean name derived from the label.
- setDefaultsFromCallback() : void
- Set default values for fields based on callback functions
Constants
BULK_INSERT_COUNT
public
mixed
BULK_INSERT_COUNT
= 200
BULK_INSERT_HIGH_COUNT
public
mixed
BULK_INSERT_HIGH_COUNT
= 200
DB_DAO_NOTNULL
public
mixed
DB_DAO_NOTNULL
= 128
IS_NULL
public
mixed
IS_NULL
= 2
NOT_NULL
public
mixed
NOT_NULL
= 1
QUERY_FORMAT_NO_QUOTES
public
mixed
QUERY_FORMAT_NO_QUOTES
= 2
QUERY_FORMAT_WILDCARD
public
mixed
QUERY_FORMAT_WILDCARD
= 1
SERIALIZE_COMMA
Comma separated string, no quotes, no spaces
public
mixed
SERIALIZE_COMMA
= 5
SERIALIZE_JSON
Recommended serialization format
public
mixed
SERIALIZE_JSON
= 3
SERIALIZE_NONE
No serialization.
public
mixed
SERIALIZE_NONE
= 0
SERIALIZE_PHP
format using php serialize()
public
mixed
SERIALIZE_PHP
= 4
SERIALIZE_SEPARATOR_BOOKEND
Serialized string separated by and bookended with VALUE_SEPARATOR
public
mixed
SERIALIZE_SEPARATOR_BOOKEND
= 1
SERIALIZE_SEPARATOR_TRIMMED
format separated by VALUE_SEPARATOR
public
mixed
SERIALIZE_SEPARATOR_TRIMMED
= 2
VALUE_SEPARATOR
public
mixed
VALUE_SEPARATOR
= "\x01"
Properties
$_component
Field for the component - either 'event' (participant) or 'contribute' (any item related to a contribution page e.g. membership, pledge, contribution) This is used for composing messages because they have dependency on the contribution_page or event page - although over time we may eliminate that
public
string
$_component
= \NULL
"contribution""event"
$_dbColumnValueCache
public
static mixed
$_dbColumnValueCache
= \NULL
$_exportableFields
Static field for all the contribution information that we can potentially export
public
static array<string|int, mixed>
$_exportableFields
= \NULL
$_icon
Icon associated with this entity.
public
static string
$_icon
= \NULL
$_importableFields
Static field for all the contribution information that we can potentially import
public
static array<string|int, mixed>
$_importableFields
= \NULL
$_labelField
Field to show when displaying a record.
public
static string
$_labelField
= \NULL
$_nullArray
public
static array<string|int, mixed>
$_nullArray
= []
$_nullObject
public
static null
$_nullObject
= \NULL
$_primaryKey
Primary key field(s).
public
static array<string|int, string>
$_primaryKey
= ['id']
$_relatedObjects
Field for all the objects related to this contribution.
public
CRM_Member_BAO_Membership|array<string|int, CRM_Event_BAO_Participant>
$_relatedObjects
= []
This is used from
- deprecated function transitionComponents
- function to send contribution receipts _assignMessageVariablesToTemplate
- some invoice code that is copied from 2
- odds & sods that need to be investigated and fixed.
However, it is no longer used by completeOrder.
$_testEntitiesToSkip
Define entities that shouldn't be created or deleted when creating/ deleting test objects - this prevents world regions, countries etc from being added / deleted
public
static array<string|int, mixed>
$_testEntitiesToSkip
= []
$address_id
public
int|string|null
$address_id
$amount_level
public
string|null
$amount_level
$campaign_id
public
int|string|null
$campaign_id
$cancel_date
public
string|null
$cancel_date
$cancel_reason
public
string|null
$cancel_reason
$check_number
public
string|null
$check_number
$contact_id
public
int|string
$contact_id
$contribution_page_id
public
int|string|null
$contribution_page_id
$contribution_recur_id
public
int|string|null
$contribution_recur_id
$contribution_status_id
public
int|string|null
$contribution_status_id
$creditnote_id
public
string|null
$creditnote_id
$currency
public
string|null
$currency
$fee_amount
public
float|string|null
$fee_amount
$financial_type_id
public
int|string|null
$financial_type_id
$id
public
int|string|null
$id
$invoice_id
public
string|null
$invoice_id
$invoice_number
public
string|null
$invoice_number
$is_pay_later
public
bool|string
$is_pay_later
$is_template
public
bool|string
$is_template
$is_test
public
bool|string
$is_test
$net_amount
public
float|string|null
$net_amount
$non_deductible_amount
public
float|string|null
$non_deductible_amount
$payment_instrument_id
public
int|string|null
$payment_instrument_id
$receipt_date
public
string|null
$receipt_date
$receive_date
public
string|null
$receive_date
$revenue_recognition_date
public
string|null
$revenue_recognition_date
$source
public
string|null
$source
$tax_amount
public
float|string
$tax_amount
$thankyou_date
public
string|null
$thankyou_date
$total_amount
public
float|string
$total_amount
$trxn_id
public
string|null
$trxn_id
$trxn_result_code
Possibly obsolete variable.
public
string
$trxn_result_code
If you use it please explain why it is set in the create function here.
$_options
https://issues.civicrm.org/jira/browse/CRM-17748 internal variable for DAO to hold per-query settings
protected
array<string|int, mixed>
$_options
= []
$resultCopies
How many times has this instance been cloned.
protected
int
$resultCopies
= 0
Methods
__clone()
public
__clone() : mixed
__construct()
Class constructor.
public
__construct() : static
Return values
static__destruct()
Class destructor.
public
__destruct() : mixed
_assignMessageVariablesToTemplate()
Assign message variables to template but try to break the habit.
public
_assignMessageVariablesToTemplate(mixed &$values, mixed $input[, bool $returnMessageText = TRUE ]) : mixed
In order to get away from leaky variables it is better to ensure variables are set in values and assign them from the send function. Otherwise smarty variables can leak if this is called more than once - e.g. processing multiple recurring payments for processors like IATS that use tokens.
Apply variables for message to smarty template - this function is part of analysing what is in the huge function & breaking it down into manageable chunks. Eventually it will be refactored into something else Note we send directly from this function in some cases because it is only partly refactored.
Don't call this function directly as the signature will change.
Parameters
- $values : mixed
- $input : mixed
- $returnMessageText : bool = TRUE
_gatherMessageValues()
Gather values for contribution mail - this function has been created as part of CRM-9996 refactoring as a step towards simplifying the composeMessage function Values related to the contribution in question are gathered
public
_gatherMessageValues(array<string|int, mixed> $values, int|null $eventID, int|null $participantID) : array<string|int, mixed>
Parameters
- $values : array<string|int, mixed>
- $eventID : int|null
- $participantID : int|null
Tags
Return values
array<string|int, mixed>acceptedSQLOperators()
public
static acceptedSQLOperators() : array<string|int, string>
Tags
Return values
array<string|int, string>add()
Takes an associative array and creates a contribution object.
public
static add(array<string|int, mixed> &$params) : CRM_Contribute_BAO_Contribution
the function extract all the params it needs to initialize the create a contribution object. the params array could contain additional unused name/value pairs
Parameters
- $params : array<string|int, mixed>
-
(reference ) an assoc array of name/value pairs.
Tags
Return values
CRM_Contribute_BAO_ContributionaddActivityForPayment()
public
static addActivityForPayment(int $targetCid, mixed $activityType, string $title, int $contributionId, string $totalAmount, string $currency, string $trxn_date) : mixed
Parameters
- $targetCid : int
- $activityType : mixed
- $title : string
- $contributionId : int
- $totalAmount : string
- $currency : string
- $trxn_date : string
Tags
addPremium()
Takes an associative array and creates a contribution_product object.
public
static addPremium(array<string|int, mixed> &$params) : CRM_Contribute_DAO_ContributionProduct
the function extract all the params it needs to initialize the create a contribution_product object. the params array could contain additional unused name/value pairs
Parameters
- $params : array<string|int, mixed>
-
(reference) an assoc array of name/value pairs.
Return values
CRM_Contribute_DAO_ContributionProductaddSelectWhereClause()
Generates acl clauses suitable for adding to WHERE or ON when doing an api.get for this entity
public
addSelectWhereClause([string|null $entityName = NULL ][, int|null $userId = NULL ][, array<string|int, mixed> $conditions = [] ]) : array<string|int, mixed>
Return format is in the form of fieldname => clauses starting with an operator. e.g.:
[
// Each string in the array will get joined with AND
'location_type_id' => ['IS NOT NULL', 'IN (1,2,3)'],
// Each sub-array in the array will get joined with OR, field names must be enclosed in curly braces
'privacy' => [
['= 0', '= 1 AND {contact_id} = 456'],
],
]
Note that all array keys must be actual field names in this entity. Use subqueries to filter on other tables e.g. custom values. The query strings MAY reference other fields in this entity; they must be enclosed in {curly_braces}.
Parameters
- $entityName : string|null = NULL
-
Name of the entity being queried (for normal BAO files implementing this method, this variable is redundant as there is a 1-1 relationship between most entities and most BAOs. However the variable is passed in to support dynamic entities such as ECK).
- $userId : int|null = NULL
-
Contact id of the current user. This param is more aspirational than functional for now. Someday the API may support checking permissions for contacts other than the current user, but at present this is always NULL which defaults to the current user.
- $conditions : array<string|int, mixed> = []
-
Contains field/value pairs gleaned from the WHERE clause or ON clause (depending on how the entity was added to the query). Can be used for optimization/deduping of clauses.
Return values
array<string|int, mixed>allowUpdateRevenueRecognitionDate()
Check if contribution has participant/membership payment.
public
static allowUpdateRevenueRecognitionDate(int $contributionId) : bool
Parameters
- $contributionId : int
-
Contribution ID
Return values
boolalterPaymentInstrument()
Pseudoconstant condition_provider for payment_instrument_id field.
public
static alterPaymentInstrument(string $fieldName, CRM_Utils_SQL_Select $conditions, mixed $params) : mixed
Parameters
- $fieldName : string
- $conditions : CRM_Utils_SQL_Select
- $params : mixed
Tags
alterStatus()
Pseudoconstant condition_provider for contribution_status_id field.
public
static alterStatus(string $fieldName, CRM_Utils_SQL_Select $conditions, mixed $params) : mixed
Parameters
- $fieldName : string
- $conditions : CRM_Utils_SQL_Select
- $params : mixed
Tags
annual()
Generate summary of amount received in the current fiscal year to date from the contact or contacts.
public
static annual(int|array<string|int, mixed> $contactIDs) : array<string|int, mixed>
Parameters
- $contactIDs : int|array<string|int, mixed>
Return values
array<string|int, mixed>appendPseudoConstantsToFields()
Update the fields array to also hold keys for pseudoconstant fields that relate to contained fields.
public
static appendPseudoConstantsToFields(array<string|int, mixed> &$fields) : mixed
This is relevant where we want to offer both the ID field and the label field as an option, e.g. search builder.
It is currently limited for optionGroupName & id+ name+ FK combos for purposes keeping the scope of the change small, but is appropriate for other sorts of pseudoconstants.
Parameters
- $fields : array<string|int, mixed>
assignProportionalLineItems()
Function use to store line item proportionally in in entity financial trxn table
public
static assignProportionalLineItems(array<string|int, mixed> $trxnParams, int $trxnId, float $contributionTotalAmount) : mixed
Parameters
- $trxnParams : array<string|int, mixed>
- $trxnId : int
- $contributionTotalAmount : float
Tags
buildOptions()
Legacy option getter
public
static buildOptions(string $fieldName[, string $context = NULL ][, array<string|int, mixed> $props = [] ]) : array<string|int, mixed>|bool
Parameters
- $fieldName : string
- $context : string = NULL
- $props : array<string|int, mixed> = []
Return values
array<string|int, mixed>|boolbuildOptionsContext()
Provides documentation and validation for the buildOptions $context param
public
static buildOptionsContext([string $context = NULL ]) : array<string|int, mixed>
Parameters
- $context : string = NULL
Tags
Return values
array<string|int, mixed>calculateMissingAmountParams()
Calculate net_amount & fee_amount if they are not set.
public
static calculateMissingAmountParams(array<string|int, mixed> &$params, int|null $contributionID) : mixed
Net amount should be total - fee. This should only be called for new contributions.
Parameters
- $params : array<string|int, mixed>
-
Params for a new contribution before they are saved.
- $contributionID : int|null
-
Contribution ID if we are dealing with an update.
Tags
cascadeUpdate()
Cascade update through related entities.
public
static cascadeUpdate(string $daoName, mixed $fromId, mixed $toId[, array<string|int, mixed> $newData = [] ]) : CRM_Core_DAO|null
Parameters
- $daoName : string
- $fromId : mixed
- $toId : mixed
- $newData : array<string|int, mixed> = []
Return values
CRM_Core_DAO|nullcheckConstraintExists()
Checks if a constraint exists for a specified table.
public
static checkConstraintExists(string $tableName, string $constraint) : bool
Parameters
- $tableName : string
- $constraint : string
Tags
Return values
bool —true if constraint exists, false otherwise
checkContributeSettings()
Get values of CiviContribute Settings and check if its enabled or not.
public
static checkContributeSettings(string $name) : string
since 5.68 will be removed around 5.74.
Note: The CiviContribute settings are stored as single entry in civicrm_setting in serialized form. Usually this should be stored as flat settings for each form fields as per CiviCRM standards. Since this would take more effort to change the current behaviour of CiviContribute settings we will live with an inconsistency because it's too hard to change for now. https://github.com/civicrm/civicrm-core/pull/8562#issuecomment-227874245
Parameters
- $name : string
Return values
stringcheckDuplicate()
Check if there is a contribution with the same trxn_id or invoice_id.
public
static checkDuplicate(array<string|int, mixed> $input, array<string|int, mixed> &$duplicates[, int $id = NULL ]) : bool
Parameters
- $input : array<string|int, mixed>
-
An assoc array of name/value pairs.
- $duplicates : array<string|int, mixed>
-
(reference) store ids of duplicate contribs.
- $id : int = NULL
Return values
bool —true if duplicate, false otherwise
checkDuplicateIds()
Check if there is a contribution with the params passed in.
public
static checkDuplicateIds(array<string|int, mixed> $params) : array<string|int, mixed>
Used for trxn_id,invoice_id and contribution_id
Parameters
- $params : array<string|int, mixed>
-
An assoc array of name/value pairs.
Return values
array<string|int, mixed> —contribution id if success else NULL
checkFieldHasAlwaysValue()
Check whether a specific column in a specific table has always the same value.
public
static checkFieldHasAlwaysValue(mixed $tableName, mixed $columnName, mixed $columnValue) : mixed
in 5.72 will be removed in 5.85
Parameters
- $tableName : mixed
- $columnName : mixed
- $columnValue : mixed
checkFieldIsAlwaysNull()
Check whether a specific column in a specific table is always NULL.
public
static checkFieldIsAlwaysNull(mixed $tableName, mixed $columnName) : mixed
in 5.72 will be removed in 5.85
Parameters
- $tableName : mixed
- $columnName : mixed
checkFinancialTypeChange()
Check financial type validation on update of a contribution.
public
static checkFinancialTypeChange(int $financialTypeId, int $contributionId, array<string|int, mixed> &$errors) : void
Parameters
- $financialTypeId : int
-
Value of latest Financial Type.
- $contributionId : int
-
Contribution Id.
- $errors : array<string|int, mixed>
-
List of errors.
checkFKConstraintInFormat()
Checks if the FK constraint name is in the format 'FK_tableName_columnName' for a specified column of a table.
public
static checkFKConstraintInFormat(mixed $tableName, mixed $columnName) : mixed
in 5.72 will be removed in 5.85
Parameters
- $tableName : mixed
- $columnName : mixed
checkOnlinePendingContribution()
This function check online pending contribution associated w/ Online Event Registration or Online Membership signup.
public
static checkOnlinePendingContribution(int $componentId) : int
Parameters
- $componentId : int
-
Participant id.
Return values
int —pending contribution id.
checkStatusValidation()
Check status validation on update of a contribution.
public
static checkStatusValidation(array<string|int, mixed> $oldContributionValues, array<string|int, mixed> $newContributionValues) : void
Parameters
- $oldContributionValues : array<string|int, mixed>
-
Previous form values before submit.
- $newContributionValues : array<string|int, mixed>
-
The input form values.
Tags
checkTableExists()
Check if there is a given table in the database.
public
static checkTableExists(string $tableName) : bool
Parameters
- $tableName : string
Return values
bool —true if exists, else false
checkTableHasData()
Check if a given table has data.
public
static checkTableHasData(string $tableName) : bool
Parameters
- $tableName : string
Return values
bool —TRUE if $tableName has at least one record.
checkTriggerViewPermission()
public
static checkTriggerViewPermission([bool $view = TRUE ][, bool $trigger = TRUE ]) : bool
Parameters
- $view : bool = TRUE
- $trigger : bool = TRUE
Return values
boolcommonRetrieveAll()
Fetch object based on array of properties.
public
static commonRetrieveAll(string $daoName, string $fieldIdName, int $fieldId, mixed &$details[, array<string|int, mixed> $returnProperities = NULL ]) : object
Parameters
- $daoName : string
-
Name of the dao object.
- $fieldIdName : string
- $fieldId : int
- $details : mixed
- $returnProperities : array<string|int, mixed> = NULL
-
An assoc array of fields that need to be returned, eg array( 'first_name', 'last_name').
Return values
object —an object of type referenced by daoName
composeMessageArray()
Create array of message information - ie. return html version, txt version, to field
public
composeMessageArray(array<string|int, mixed> $input, array<string|int, mixed> $ids[, array<string|int, mixed> $values = [] ][, bool $returnMessageText = TRUE ]) : array<string|int, mixed>
Parameters
- $input : array<string|int, mixed>
-
Incoming information.
- is_recur - should this be treated as recurring (not sure why you wouldn't just check presence of recur object but maintaining legacy approach to be careful)
- $ids : array<string|int, mixed>
-
IDs of related objects.
- $values : array<string|int, mixed> = []
-
Any values that may have already been compiled by calling process. This is augmented by values 'gathered' by gatherMessageValues
- $returnMessageText : bool = TRUE
-
Distinguishes between whether to send message or return. message text. We are working towards this function ALWAYS returning message text & calling function doing emails / pdfs with it
Tags
Return values
array<string|int, mixed> —messages
composeQuery()
Compose the query by merging the parameters into it.
public
static composeQuery(string $query[, array<string|int, mixed> $params = [] ][, bool $abort = TRUE ]) : string
Parameters
- $query : string
- $params : array<string|int, mixed> = []
- $abort : bool = TRUE
Tags
Return values
stringcontributionCount()
public
static contributionCount(int $contactId[, bool $includeSoftCredit = TRUE ]) : null|string
Parameters
- $contactId : int
- $includeSoftCredit : bool = TRUE
Return values
null|stringcopyCustomFields()
Method that copies custom fields values from an old entity to a new one.
public
copyCustomFields(int $entityID, int $newEntityID[, string $parentOperation = NULL ]) : mixed
Fixes bug CRM-19302, where if a custom field of File type was present, left both events using the same file, breaking download URL's for the old event.
Parameters
- $entityID : int
- $newEntityID : int
- $parentOperation : string = NULL
Tags
copyGeneric()
Make a shallow copy of an object and all the fields in the object.
public
static copyGeneric(string $daoName, array<string|int, mixed> $criteria[, array<string|int, mixed> $newData = NULL ][, string $fieldsFix = NULL ][, string $blockCopyOfDependencies = NULL ][, bool $blockCopyofCustomValues = FALSE ]) : CRM_Core_DAO|bool
Parameters
- $daoName : string
-
Name of the dao.
- $criteria : array<string|int, mixed>
-
Array of all the fields & values. on which basis to copy
- $newData : array<string|int, mixed> = NULL
-
Array of all the fields & values. to be copied besides the other fields
- $fieldsFix : string = NULL
-
Array of fields that you want to prefix/suffix/replace.
- $blockCopyOfDependencies : string = NULL
-
Fields that you want to block from. getting copied
- $blockCopyofCustomValues : bool = FALSE
-
Case when you don't want to copy the custom values set in a template as it will override/ignore the submitted custom values
Return values
CRM_Core_DAO|bool —the newly created copy of the object. False if none created.
copyValues()
Given an associative array of name/value pairs, extract all the values that belong to this object and initialize the object with said values
public
copyValues(array<string|int, mixed> $params) : bool
Parameters
- $params : array<string|int, mixed>
-
Array of name/value pairs to save.
Return values
bool —Did we copy all null values into the object
create()
Takes an associative array and creates a contribution object.
public
static create(array<string|int, mixed> &$params) : CRM_Contribute_BAO_Contribution
Parameters
- $params : array<string|int, mixed>
-
(reference ) an assoc array of name/value pairs.
Tags
Return values
CRM_Contribute_BAO_ContributioncreateAddress()
Create address associated with contribution record.
public
static createAddress(array<string|int, mixed> $params) : int
As long as there is one or more billing field in the parameters we will create the address.
(historically the decision to create or not was based on the payment 'type' but these lines are greyer than once thought).
Parameters
- $params : array<string|int, mixed>
Return values
int —address id
createProportionalEntry()
Create tax entry in civicrm_entity_financial_trxn table.
public
static createProportionalEntry(array<string|int, mixed> $entityParams, array<string|int, mixed> $eftParams) : void
Parameters
- $entityParams : array<string|int, mixed>
- $eftParams : array<string|int, mixed>
Tags
createProportionalFinancialEntries()
Create proportional entries in civicrm_entity_financial_trxn.
public
static createProportionalFinancialEntries(array<string|int, mixed> $entityParams, array<string|int, mixed> $lineItems, array<string|int, mixed> $ftIds, array<string|int, mixed> $taxItems) : mixed
Parameters
- $entityParams : array<string|int, mixed>
- $lineItems : array<string|int, mixed>
- $ftIds : array<string|int, mixed>
- $taxItems : array<string|int, mixed>
Tags
createReferenceColumns()
Given a list of fields, create a list of references.
public
static createReferenceColumns(string $className) : array<string|int, CRM_Core_Reference_Interface>
Parameters
- $className : string
-
BAO/DAO class name.
Return values
array<string|int, CRM_Core_Reference_Interface>createSQLFilter()
Get SQL where clause for SQL filter syntax input parameters.
public
static createSQLFilter(string $fieldName, array<string|int, mixed> $filter[, string $type = NULL ][, string $alias = NULL ][, bool $returnSanitisedArray = FALSE ]) : null|string|array<string|int, mixed>
SQL version of api function to assign filters to the DAO based on the syntax $field => array('IN' => array(4,6,9)) OR $field => array('LIKE' => array('%me%)) etc
Parameters
- $fieldName : string
-
Name of fields.
- $filter : array<string|int, mixed>
-
filter to be applied indexed by operator.
- $type : string = NULL
-
type of field (not actually used - nor in api @todo ).
- $alias : string = NULL
-
alternative field name ('as') @todo- not actually used.
- $returnSanitisedArray : bool = FALSE
-
Return a sanitised array instead of a clause. this is primarily so we can add filters @ the api level to the Query object based fields
Tags
Return values
null|string|array<string|int, mixed> —a string is returned if $returnSanitisedArray is not set, otherwise and Array or NULL depending on whether it is supported as yet
createTestObject()
Creates a test object, including any required objects it needs via recursion createOnly: only create in database, do not store or return the objects (useful for perf testing) ONLY USE FOR TESTING
public
static createTestObject(string $daoName[, array<string|int, mixed> $params = [] ][, int $numObjects = 1 ][, bool $createOnly = FALSE ]) : object|array<string|int, mixed>|null
Parameters
- $daoName : string
- $params : array<string|int, mixed> = []
- $numObjects : int = 1
- $createOnly : bool = FALSE
Return values
object|array<string|int, mixed>|null —NULL if $createOnly. A single object if $numObjects==1. Otherwise, an array of multiple objects.
createTriggers()
public
static createTriggers(array<string|int, mixed> &$info[, string $onlyTableName = NULL ]) : mixed
Parameters
- $info : array<string|int, mixed>
-
per hook_civicrm_triggerInfo.
- $onlyTableName : string = NULL
-
the specific table requiring a rebuild; or NULL to rebuild all tables.
debugPrint()
public
static debugPrint([null $message = NULL ][, bool $printDAO = TRUE ]) : mixed
Parameters
- $message : null = NULL
- $printDAO : bool = TRUE
delete()
Deletes items from table which match current objects variables.
public
delete([bool $useWhere = FALSE ]) : int|false
Returns the true on success
for example
Designed to be extended
$object = new mytable(); $object->ID=123; echo $object->delete(); // builds a conditon
$object = new mytable(); $object->whereAdd('age > 12'); $object->limit(1); $object->orderBy('age DESC'); $object->delete(true); // dont use object vars, use the conditions, limit and order.
Parameters
- $useWhere : bool = FALSE
-
(optional) If DB_DATAOBJECT_WHEREADD_ONLY is passed in then we will build the condition only using the whereAdd's. Default is to build the condition only using the object parameters.
Return values
int|false —Int (No. of rows affected) on success, false on failure, 0 on no data affected
deleteAddress()
Delete billing address record related contribution.
public
static deleteAddress([int $contributionId = NULL ][, int $contactId = NULL ]) : mixed
Parameters
- $contributionId : int = NULL
- $contactId : int = NULL
deleteContactContribution()
Delete contribution of contact.
public
static deleteContactContribution(int $contactId) : mixed
Parameters
- $contactId : int
-
Contact id.
Tags
deleteContribution()
Delete the indirect records associated with this contribution first.
public
static deleteContribution(int $id) : mixed|null
Parameters
- $id : int
Tags
Return values
mixed|null —$results no of deleted Contribution on success, false otherwise
deleteEntityContact()
Unused function.
public
static deleteEntityContact(mixed $daoName, mixed $contactId) : mixed
in 5.47 will be removed in 5.80
Parameters
- $daoName : mixed
- $contactId : mixed
deleteRecord()
Delete a record from supplied params.
public
static deleteRecord(array<string|int, mixed> $record) : static
Parameters
- $record : array<string|int, mixed>
-
'id' is required.
Tags
Return values
staticdeleteRecords()
Bulk delete multiple records.
public
static deleteRecords(array<string|int, array<string|int, mixed>> $records) : array<string|int, static>
Parameters
- $records : array<string|int, array<string|int, mixed>>
Tags
Return values
array<string|int, static>deleteTestObjects()
Deletes the this object plus any dependent objects that are associated with it.
public
static deleteTestObjects(string $daoName[, array<string|int, mixed> $params = [] ]) : mixed
ONLY USE FOR TESTING
Parameters
- $daoName : string
- $params : array<string|int, mixed> = []
disableFullGroupByMode()
Disables usage of the ONLY_FULL_GROUP_BY Mode if necessary
public
static disableFullGroupByMode() : mixed
dropAllTables()
Drop all CiviCRM tables.
public
static dropAllTables() : mixed
Tags
dropTriggers()
Wrapper function to drop triggers.
public
static dropTriggers([string $tableName = NULL ]) : mixed
Parameters
- $tableName : string = NULL
-
the specific table requiring a rebuild; or NULL to rebuild all tables.
escapeString()
public
static escapeString(mixed $string) : string
Parameters
- $string : mixed
Return values
stringescapeStrings()
Escape a list of strings for use with "WHERE X IN (...)" queries.
public
static escapeStrings(array<string|int, mixed> $strings[, string $default = NULL ]) : string
Parameters
- $strings : array<string|int, mixed>
- $default : string = NULL
-
the value to use if $strings has no elements.
Return values
string —eg "abc","def","ghi"
escapeWildCardString()
public
static escapeWildCardString(mixed $string) : string
Parameters
- $string : mixed
Return values
stringexecuteQuery()
Execute a query.
public
static & executeQuery(string $query[, array<string|int, mixed> $params = [] ][, bool $abort = TRUE ][, null $daoName = NULL ][, bool $freeDAO = FALSE ][, bool $i18nRewrite = TRUE ][, bool $trapException = FALSE ][, array<string|int, mixed> $options = [] ]) : CRM_Core_DAO|object
Parameters
- $query : string
-
Query to be executed.
- $params : array<string|int, mixed> = []
- $abort : bool = TRUE
- $daoName : null = NULL
- $freeDAO : bool = FALSE
- $i18nRewrite : bool = TRUE
- $trapException : bool = FALSE
- $options : array<string|int, mixed> = []
Tags
Return values
CRM_Core_DAO|object —object that holds the results of the query NB - if this is defined as just returning a DAO phpstorm keeps pointing out all the properties that are not part of the DAO
executeUnbufferedQuery()
Execute an unbuffered query.
public
static executeUnbufferedQuery(string $query[, array<string|int, mixed> $params = [] ][, bool $abort = TRUE ][, null $daoName = NULL ][, bool $freeDAO = FALSE ][, bool $i18nRewrite = TRUE ][, bool $trapException = FALSE ]) : CRM_Core_DAO
This is a wrapper around new functionality exposed with CRM-17748.
Parameters
- $query : string
-
query to be executed
- $params : array<string|int, mixed> = []
- $abort : bool = TRUE
- $daoName : null = NULL
- $freeDAO : bool = FALSE
- $i18nRewrite : bool = TRUE
- $trapException : bool = FALSE
Return values
CRM_Core_DAO —Object that points to an unbuffered result set
export()
Returns the list of fields that can be exported
public
static export([bool $prefix = FALSE ]) : array<string|int, mixed>
Parameters
- $prefix : bool = FALSE
Return values
array<string|int, mixed>exportableFields()
Combine all the exportable fields from the lower level objects.
public
static & exportableFields([bool $checkPermission = TRUE ]) : array<string|int, mixed>
Parameters
- $checkPermission : bool = TRUE
Return values
array<string|int, mixed> —array of exportable Fields
failPayment()
React to a financial transaction (payment) failure.
public
static failPayment(int $contributionID, int $contactID, string $message) : mixed
Prior to CRM-16417 these were simply removed from the database but it has been agreed that seeing attempted payments is important for forensic and outreach reasons.
Parameters
- $contributionID : int
- $contactID : int
- $message : string
Tags
fetchAll()
Returns all results as array-encoded records.
public
fetchAll([mixed $k = FALSE ][, mixed $v = FALSE ][, mixed $method = FALSE ]) : array<string|int, mixed>
Parameters
- $k : mixed = FALSE
- $v : mixed = FALSE
- $method : mixed = FALSE
Return values
array<string|int, mixed>fetchGenerator()
Return the results as PHP generator.
public
fetchGenerator([string $type = 'dao' ]) : mixed
Parameters
- $type : string = 'dao'
-
Whether the generator yields 'dao' objects or 'array's.
fetchMap()
Get all the result records as mapping between columns.
public
fetchMap(string $keyColumn, string $valueColumn) : array<string|int, mixed>
Parameters
- $keyColumn : string
-
Ex: "name"
- $valueColumn : string
-
Ex: "label"
Return values
array<string|int, mixed> —Ex: ["foo" => "The Foo Bar", "baz" => "The Baz Qux"]
fetchValue()
Returns a singular value.
public
fetchValue() : mixed|null
Return values
mixed|nullfieldKeys()
Return a mapping from field-name to the corresponding key (as used in fields()).
public
static fieldKeys() : array<string|int, mixed>
Return values
array<string|int, mixed> —[string $name => string $uniqueName]
fields()
Returns all the column names of this table.
public
static & fields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>fillValues()
Given an incomplete record, attempt to fill missing field values from the database
public
static fillValues(array<string|int, mixed> $existingValues, mixed $fieldsToRetrieve) : array<string|int, mixed>
Parameters
- $existingValues : array<string|int, mixed>
- $fieldsToRetrieve : mixed
Return values
array<string|int, mixed>findById()
Find a DAO object for the given ID and return it.
public
static findById(int $id) : static
Parameters
- $id : int
-
Id of the DAO object being searched for.
Tags
Return values
static —Object of the type of the class that called this function.
findReferences()
Find all records which refer to this entity.
public
findReferences() : array<string|int, CRM_Core_DAO>
Return values
array<string|int, CRM_Core_DAO>formatFieldValues()
Format field values according to fields() metadata.
public
static formatFieldValues(array<string|int, mixed> &$fieldValues) : void
When fetching results from a query, every field is returned as a string. This function automatically converts them to the correct data type.
Parameters
- $fieldValues : array<string|int, mixed>
freeResult()
public
static freeResult([null $ids = NULL ]) : mixed
Parameters
- $ids : null = NULL
generateFromEmailAndName()
Generate From email and from name in an array values
public
static generateFromEmailAndName(array<string|int, mixed> $input, CRM_Contribute_BAO_Contribution $contribution) : array<string|int, mixed>
Parameters
- $input : array<string|int, mixed>
- $contribution : CRM_Contribute_BAO_Contribution
Return values
array<string|int, mixed>getAnnualQuery()
Get a query to determine the amount donated by the contact/s in the current financial year.
public
static getAnnualQuery(array<string|int, mixed> $contactIDs) : string
Parameters
- $contactIDs : array<string|int, mixed>
Return values
stringgetAttribute()
Get the size and maxLength attributes for this text field.
public
static getAttribute(string $class[, string $fieldName = NULL ]) : array<string|int, mixed>
(or for all text fields) in the DAO object.
Parameters
- $class : string
-
Name of DAO class.
- $fieldName : string = NULL
-
Field that i'm interested in or null if. you want the attributes for all DAO text fields
Return values
array<string|int, mixed> —assoc array of name => attribute pairs
getComponentDetails()
Returns all contribution related object ids.
public
static getComponentDetails(mixed $contributionId) : array<string|int, mixed>
Parameters
- $contributionId : mixed
Return values
array<string|int, mixed>getConnection()
public
static getConnection() : DB_common
Return values
DB_commongetContactIDsFromComponent()
Given the component id, compute the contact id since its used for things like send email
public
static getContactIDsFromComponent(mixed $componentIDs, string $tableName[, string $idField = 'id' ]) : array<string|int, mixed>
Parameters
- $componentIDs : mixed
- $tableName : string
- $idField : string = 'id'
Return values
array<string|int, mixed>getContributionBalance()
Get the outstanding balance on a contribution.
public
static getContributionBalance(int $contributionId[, float $contributionTotal = NULL ]) : float
Parameters
- $contributionId : int
- $contributionTotal : float = NULL
-
Optional amount to override the saved amount paid (e.g if calculating what it WILL be).
Tags
Return values
floatgetContributionDates()
public
static getContributionDates() : array<string|int, mixed>
Return values
array<string|int, mixed>getContributionDetails()
Get the contribution details for component export.
public
static getContributionDetails(int $exportMode, array<string|int, mixed> $componentIds) : array<string|int, mixed>
since 5.72 will be removed around 5.90
Parameters
- $exportMode : int
-
Export mode.
- $componentIds : array<string|int, mixed>
-
Component ids.
Return values
array<string|int, mixed> —associated array
getContributionFields()
Get list of contribution fields for profile.
public
static getContributionFields([bool $addExtraFields = TRUE ]) : array<string|int, mixed>
For now we only allow custom contribution fields to be in profile
Parameters
- $addExtraFields : bool = TRUE
-
True if special fields needs to be added.
Return values
array<string|int, mixed> —the list of contribution fields
getContributionTokenValues()
Do not use - still called from CRM_Contribute_Form_Task_PDFLetter
public
static getContributionTokenValues(int $id, array<string|int, mixed> $messageToken) : array<string|int, mixed>
This needs to be refactored out of use & deprecated out of existence.
Get the contribution fields for $id and display labels where appropriate (if the token is present).
Parameters
- $id : int
- $messageToken : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getCurrentandGoalAmount()
public
static getCurrentandGoalAmount(int $pageID) : array<string|int, mixed>
Parameters
- $pageID : int
Return values
array<string|int, mixed>getDatabaseName()
Get the name of the CiviCRM database.
public
static getDatabaseName() : string
use mysql DATABASE() within the query.
Return values
stringgetDbVal()
Fetch a single field value from the database.
public
static getDbVal(string $returnColumn, string|int $searchValue[, string $searchColumn = 'id' ]) : array<string|int, mixed>|bool|int|string|null
Uses static caching and applies formatting.
Parameters
- $returnColumn : string
- $searchValue : string|int
- $searchColumn : string = 'id'
Tags
Return values
array<string|int, mixed>|bool|int|string|null —Returned value will be formatted according to data type.
getDefaultFallbackValues()
Callback for `default_fallback` field values
public
static getDefaultFallbackValues(array<string|int, mixed> $record, string $entityName, string $fieldName, array<string|int, mixed> $field) : mixed
Parameters
- $record : array<string|int, mixed>
- $entityName : string
- $fieldName : string
- $field : array<string|int, mixed>
getDefaults()
Get defaults for new entity.
public
static getDefaults() : array<string|int, mixed>
Return values
array<string|int, mixed>getDynamicReferencesToTable()
Get all dynamic references to the given table.
public
static getDynamicReferencesToTable(string $tableName) : array<string|int, mixed>
Parameters
- $tableName : string
Return values
array<string|int, mixed>getEntityDescription()
Returns user-friendly description of this entity.
public
static getEntityDescription() : string|null
Tags
Return values
string|nullgetEntityIcon()
Overridable function to get icon for a particular entity.
public
static getEntityIcon(string $entityName[, int|null $entityId = NULL ]) : string|null
Parameters
- $entityName : string
-
Short name of the entity. This may seem redundant because the entity name can usually be inferred from the BAO class being called, but not always. Some virtual entities share a BAO class.
- $entityId : int|null = NULL
-
Id of the entity.
Tags
Return values
string|nullgetEntityPaths()
Returns system paths related to this entity (as defined in the xml schema)
public
static getEntityPaths() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getEntityRefFilters()
public
static getEntityRefFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>getEntityTitle()
Returns localized title of this entity.
public
static getEntityTitle([mixed $plural = FALSE ]) : string
Parameters
- $plural : mixed = FALSE
Return values
stringgetExportableFieldsWithPseudoConstants()
Get exportable fields with pseudoconstants rendered as an extra field.
public
static getExportableFieldsWithPseudoConstants(string $baoClass) : array<string|int, mixed>
Parameters
- $baoClass : string
Return values
array<string|int, mixed>getExtensionName()
Get name of extension in which this DAO is defined.
public
static getExtensionName() : string|null
Tags
Return values
string|nullgetFieldSpec()
public
getFieldSpec(string $fieldName) : bool|array<string|int, mixed>
Parameters
- $fieldName : string
Return values
bool|array<string|int, mixed>getFieldValue()
Given a DAO name, a column name and a column value, find the record and GET the value of another column in that record
public
static getFieldValue(string $daoName, int $searchValue[, string $returnColumn = 'name' ][, string $searchColumn = 'id' ][, bool $force = FALSE ]) : string|int|null
Parameters
- $daoName : string
-
Name of the DAO (Example: CRM_Contact_DAO_Contact to retrieve value from a contact).
- $searchValue : int
-
Value of the column you want to search by.
- $returnColumn : string = 'name'
-
Name of the column you want to GET the value of.
- $searchColumn : string = 'id'
-
Name of the column you want to search by.
- $force : bool = FALSE
-
Skip use of the cache.
Tags
Return values
string|int|null —Value of $returnColumn in the retrieved record
getGlobalSetting()
Lookup the value of a MySQL global configuration variable.
public
static getGlobalSetting(string $name[, mixed $default = NULL ]) : mixed
Parameters
- $name : string
-
E.g. "thread_stack".
- $default : mixed = NULL
getHonorContacts()
Get list of contributions which credit the passed in contact ID.
public
static getHonorContacts(int $honorId) : array<string|int, mixed>
The returned array provides details about the original contribution & donor.
Parameters
- $honorId : int
-
In Honor of Contact ID.
Tags
Return values
array<string|int, mixed> —list of contribution fields
getInvoiceNumber()
Get invoice_number for contribution.
public
static getInvoiceNumber(int $contributionID) : string|null
Parameters
- $contributionID : int
Return values
string|nullgetLabelField()
public
static getLabelField() : string|null
Return values
string|nullgetLastFinancialItemIds()
Create array of last financial item id's.
public
static getLastFinancialItemIds(int $contributionId) : array<string|int, mixed>
Parameters
- $contributionId : int
Return values
array<string|int, mixed>getLocaleTableName()
Get localized name of this table, if applicable.
public
static getLocaleTableName([string|null $tableName = NULL ]) : string
If this is a multi-language installation and the table has localized columns, will return table name with language string appended, which points to a sql view. Otherwise, this returns the same output as
Parameters
- $tableName : string|null = NULL
-
Unnecessary deprecated param
Tags
Return values
stringgetLog()
Returns if this table needs to be logged
public
getLog() : bool
Tags
Return values
boolgetNumTermsByContributionAndMembershipType()
Get the number of terms for this contribution for a given membership type based on querying the line item table and relevant price field values Note that any one contribution should only be able to have one line item relating to a particular membership type
public
static getNumTermsByContributionAndMembershipType(int $membershipTypeID, int $contributionID) : int
Parameters
- $membershipTypeID : int
- $contributionID : int
Return values
intgetOnbehalfIds()
Get individual id for onbehalf contribution.
public
static getOnbehalfIds(int $contributionId[, int $contributorId = NULL ]) : array<string|int, mixed>
Parameters
- $contributionId : int
-
Contribution id.
- $contributorId : int = NULL
-
Contributor id.
Return values
array<string|int, mixed> —containing organization id and individual id
getOptionLabels()
Populate option labels for this object's fields.
public
getOptionLabels() : mixed
Tags
getPaymentInfo()
Get list of payments displayed by Contribute_Page_PaymentInfo.
public
static getPaymentInfo(int $id[, string $component = 'contribution' ][, bool $getTrxnInfo = FALSE ]) : mixed
Parameters
- $id : int
- $component : string = 'contribution'
- $getTrxnInfo : bool = FALSE
Tags
getPaymentProcessorReadyAddressParams()
Get address params ready to be passed to the payment processor.
public
static getPaymentProcessorReadyAddressParams(array<string|int, mixed> $params) : array<string|int, mixed>
We need address params in a couple of formats. For the payment processor we wan state_province_id-5. To create an address we need state_province_id.
Parameters
- $params : array<string|int, mixed>
Return values
array<string|int, mixed>getReferenceColumns()
Returns list of FK relationships.
public
static getReferenceColumns() : array<string|int, CRM_Core_Reference_Basic>
Return values
array<string|int, CRM_Core_Reference_Basic>getReferenceCounts()
public
getReferenceCounts() : array<string|int, array{name: string, type: string, count: int, table: string|null, key: string|null}>
Return values
array<string|int, array{name: string, type: string, count: int, table: string|null, key: string|null}> —each item has keys:
- name: string
- type: string
- count: int
- table: string|null SQL table name
- key: string|null SQL column name
getReferencesToContactTable()
Get all references to contact table.
public
static getReferencesToContactTable() : mixed
This includes core tables, custom group tables, tables added by the merge hook and the entity_tag table.
Refer to CRM-17454 for information on the danger of querying the information schema to derive this.
Tags
getReferencesToTable()
List all tables which have either: - hard foreign keys to this table, or - a dynamic foreign key that includes this table as a possible target.
public
static getReferencesToTable(string $tableName) : array<string|int, CRM_Core_Reference_Interface>
Parameters
- $tableName : string
-
Table referred to.
Return values
array<string|int, CRM_Core_Reference_Interface> —structure of table and column, listing every table with a foreign key reference to $tableName, and the column where the key appears.
getSalesTaxFinancialAccounts()
Retrieve Sales Tax Financial Accounts.
public
static getSalesTaxFinancialAccounts() : array<string|int, mixed>
Return values
array<string|int, mixed>getSelectWhereClause()
This returns the final permissioned query string for this entity
public
static getSelectWhereClause([string|null $tableAlias = NULL ][, string|null $entityName = NULL ][, array<string|int, mixed> $conditions = [] ]) : array<string|int, mixed>
With acls from related entities + additional clauses from hook_civicrm_selectWhereClause
DO NOT OVERRIDE THIS FUNCTION
Parameters
- $tableAlias : string|null = NULL
- $entityName : string|null = NULL
- $conditions : array<string|int, mixed> = []
-
Values from WHERE or ON clause
Tags
Return values
array<string|int, mixed>getSortString()
Unused function.
public
static getSortString(mixed $sort[, mixed $default = NULL ]) : mixed
in 5.72 will be removed in 5.85
Parameters
- $sort : mixed
- $default : mixed = NULL
getSpecialContributionFields()
Add extra fields specific to contribution.
public
static getSpecialContributionFields() : mixed
getSupportedFields()
Returns all usable fields, indexed by name.
public
static getSupportedFields([bool $checkPermissions = FALSE ]) : array<string|int, mixed>
This function differs from fields() in that it indexes by name rather than unique_name.
It excludes fields not added yet by pending upgrades. This avoids problems with trying to SELECT a field that exists in code but has not yet been added to the db.
Parameters
- $checkPermissions : bool = FALSE
-
Filter by field permissions.
Return values
array<string|int, mixed>getTableName()
Returns the name of this table
public
static getTableName() : string
Tags
Return values
stringgetTableNames()
Gets the names of all enabled schema tables.
public
static getTableNames() : array<string|int, mixed>
- Includes tables from core, components & enabled extensions.
- Excludes log tables, temp tables, and missing/disabled extensions.
Tags
Return values
array<string|int, mixed>getToFinancialAccount()
Get the value for the To Financial Account.
public
static getToFinancialAccount(mixed $contribution, mixed $params) : int
Parameters
- $contribution : mixed
- $params : mixed
Return values
intgetTotalAmountAndCount()
public
static getTotalAmountAndCount([string $status = NULL ][, null $startDate = NULL ][, null $endDate = NULL ]) : array<string|int, mixed>|null
Parameters
- $status : string = NULL
- $startDate : null = NULL
- $endDate : null = NULL
Return values
array<string|int, mixed>|nullgetUnitLabelWithPlural()
Get the unit label with the plural option
public
static getUnitLabelWithPlural(string $unit) : string
Parameters
- $unit : string
Return values
stringgetValues()
Fetch the object and store the values in the values array.
public
static getValues(array<string|int, mixed> $params[, array<string|int, mixed> &$values = [] ][, array<string|int, mixed> &$ids = [] ]) : CRM_Contribute_BAO_Contribution|null
Parameters
- $params : array<string|int, mixed>
-
Input parameters to find object.
- $values : array<string|int, mixed> = []
-
Output values of the object.
- $ids : array<string|int, mixed> = []
-
The array that holds all the db ids.
Return values
CRM_Contribute_BAO_Contribution|null —The found object or null
getValuesWithMappings()
Deprecated contact.get call.
public
static getValuesWithMappings(array<string|int, mixed> $params) : array<string|int, mixed>
Since contribution status is resolved in almost every function that calls getValues it makes sense to have an extra function to resolve it rather than repeat the code.
Think carefully before adding more mappings to be resolved as there could be performance implications if this function starts to be called from more iterative functions.
Parameters
- $params : array<string|int, mixed>
-
Input parameters to find object.
Tags
Return values
array<string|int, mixed> —Array of the found contribution.
import()
Returns the list of fields that can be imported
public
static import([bool $prefix = FALSE ]) : array<string|int, mixed>
Parameters
- $prefix : bool = FALSE
Return values
array<string|int, mixed>importableFields()
Combine all the importable fields from the lower levels object.
public
static & importableFields([string $contactType = 'Individual' ][, bool $status = TRUE ]) : array<string|int, mixed>
The ordering is important, since currently we do not have a weight scheme. Adding weight is super important and should be done in the next week or so, before this can be called complete.
Parameters
- $contactType : string = 'Individual'
- $status : bool = TRUE
Return values
array<string|int, mixed> —array of importable Fields
indices()
public
static indices([bool $localize = TRUE ]) : array<string|int, mixed>
Parameters
- $localize : bool = TRUE
Tags
Return values
array<string|int, mixed>init()
Initialize the DAO object.
public
static init(string $dsn) : mixed
Parameters
- $dsn : string
-
The database connection string.
initialize()
Initialization for all DAO objects. Since we access DB_DO programatically we need to set the links manually.
public
initialize() : mixed
isCancelSubscriptionSupported()
Check whether payment processor supports cancellation of contribution subscription
public
static isCancelSubscriptionSupported(int $contributionId[, bool $isNotCancelled = TRUE ]) : bool
Parameters
- $contributionId : int
-
Contribution id.
- $isNotCancelled : bool = TRUE
Return values
boolisComponentEnabled()
Check if component is enabled for this DAO class
public
static isComponentEnabled() : bool
Return values
boolisContributionStatusNegative()
Is this contribution status a reversal.
public
static isContributionStatusNegative(int $status_id) : bool
If so we would expect to record a negative value in the financial_trxn table.
Parameters
- $status_id : int
Return values
boolisDBMyISAM()
public
static isDBMyISAM([int $maxTablesToCheck = 10 ]) : bool
Parameters
- $maxTablesToCheck : int = 10
Return values
boolisSingleLineItem()
Is there only one line item attached to the contribution.
public
static isSingleLineItem(int $id) : bool
Parameters
- $id : int
-
Contribution ID.
Tags
Return values
boolisSubscriptionCancelled()
Check whether subscription is already cancelled.
public
static isSubscriptionCancelled(int $contributionId) : string
Parameters
- $contributionId : int
-
Contribution id.
Return values
string —contribution status
isUpdateToRecurringContribution()
Is this contribution updating an existing recurring contribution.
public
static isUpdateToRecurringContribution(array<string|int, mixed> $params) : bool
We need to upd the status of the linked recurring contribution if we have a new payment against it, or the initial pending payment is being confirmed (or failing).
Parameters
- $params : array<string|int, mixed>
Return values
boolisValidOption()
Wrapper to validate internal DAO options before passing to DB_mysql/DB_Common level
public
isValidOption(array<string|int, mixed> $options) : bool
Parameters
- $options : array<string|int, mixed>
Return values
bool —Provided options are valid
keys()
Returns primary keys (usually ['id'])
public
keys() : array<string|int, string>
Tags
Return values
array<string|int, string>loadRelatedMembershipObjects()
Load related memberships.
public
loadRelatedMembershipObjects([array<string|int, mixed> $ids = [] ]) : array<string|int, mixed>
since well before 5.75 will be removed around 5.99. Note some universe usages exist but may be in unused extensions.
Note that in theory it should be possible to retrieve these from the line_item table with the membership_payment table being deprecated. Attempting to do this here causes tests to fail as it seems the api is not correctly linking the line items when the contribution is created in the flow where the contribution is created in the API, followed by the membership (using the api) followed by the membership payment. The membership payment BAO does have code to address this but it doesn't appear to be working.
I don't know if it never worked or broke as a result of https://issues.civicrm.org/jira/browse/CRM-14918.
Parameters
- $ids : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed> —$ids
loadRelatedObjects()
Load objects relations to contribution object.
public
loadRelatedObjects(int $paymentProcessorID, array<string|int, mixed> &$ids) : bool
since 5.75 will be removed around 5.99. Note some universe usages exist but may be in unused extensions.
Objects are stored in the $_relatedObjects property In the first instance we are just moving functionality from BASEIpn -
Parameters
- $paymentProcessorID : int
-
Payment Processor ID.
- $ids : array<string|int, mixed>
-
Ids as Loaded by Payment Processor.
Tags
Return values
boollog()
public
log([bool $created = FALSE ]) : mixed
Parameters
- $created : bool = FALSE
lookupValue()
Convert associative array names to values and vice-versa.
public
static lookupValue(array<string|int, mixed> &$defaults, string $property, array<string|int, mixed> &$lookup, bool $reverse) : bool
This function is used by both the web form layer and the api. Note that the api needs the name => value conversion, also the view layer typically requires value => name conversion
Parameters
- $defaults : array<string|int, mixed>
- $property : string
- $lookup : array<string|int, mixed>
- $reverse : bool
Return values
boolmakeAttribute()
Create an attribute for this specific field. We only do this for strings and text
public
static makeAttribute(array<string|int, mixed> $field) : array<string|int, mixed>|null
Parameters
- $field : array<string|int, mixed>
-
The field under task.
Return values
array<string|int, mixed>|null —the attributes for the object
objectExists()
Check if there is a record with the same name in the db.
public
static objectExists(string $value, string $daoName, string $daoID[, string $fieldName = 'name' ][, string $domainID = NULL ]) : bool
Parameters
- $value : string
-
The value of the field we are checking.
- $daoName : string
-
The dao object name.
- $daoID : string
-
The id of the object being updated. u can change your name. as long as there is no conflict
- $fieldName : string = 'name'
-
The name of the field in the DAO.
- $domainID : string = NULL
-
The id of the domain. Object exists only for the given domain.
Return values
bool —true if object exists
query()
Execute a query by the current DAO, localizing it along the way (if needed).
public
query(string $query[, bool $i18nRewrite = TRUE ]) : object
Parameters
- $query : string
-
The SQL query for execution.
- $i18nRewrite : bool = TRUE
-
Whether to rewrite the query.
Return values
object —the current DAO object after the query execution
recordFinancialAccounts()
Create all financial accounts entry.
public
static recordFinancialAccounts(array<string|int, mixed> &$params, CRM_Contribute_DAO_Contribution $contribution) : null|CRM_Core_BAO_FinancialTrxn
Parameters
- $params : array<string|int, mixed>
-
Contribution object, line item array and params for trxn.
- $contribution : CRM_Contribute_DAO_Contribution
Return values
null|CRM_Core_BAO_FinancialTrxnrecordPaymentActivity()
Record an activity when a payment is received.
public
static recordPaymentActivity(int $contributionId, int $participantId, string $totalAmount, string $currency, string $trxnDate) : mixed
Parameters
- $contributionId : int
- $participantId : int
- $totalAmount : string
- $currency : string
- $trxnDate : string
Tags
reenableFullGroupByMode()
Re-enables ONLY_FULL_GROUP_BY sql_mode as necessary.
public
static reenableFullGroupByMode() : mixed
.
requireSafeDBName()
ensure database name is 'safe', i.e. only contains word characters (includes underscores) and dashes, and contains at least one [a-z] case insensitive.
public
static requireSafeDBName(mixed $database) : bool
Parameters
- $database : mixed
Return values
boolreset()
Reset the DAO object.
public
reset() : mixed
DAO is kinda crappy in that there is an unwritten rule of one query per DAO.
We attempt to get around this crappy restriction by resetting some of DAO's internal fields. Use this with caution
resolveDefaults()
Get the values for pseudoconstants for name->value and reverse.
public
static resolveDefaults(array<string|int, mixed> &$defaults[, bool $reverse = FALSE ]) : mixed
Parameters
- $defaults : array<string|int, mixed>
-
(reference) the default values, some of which need to be resolved.
- $reverse : bool = FALSE
-
True if we want to resolve the values in the reverse direction (value -> name).
retrieve()
Retrieve DB object based on input parameters.
public
static retrieve(array<string|int, mixed> &$params[, array<string|int, mixed> &$defaults = [] ][, array<string|int, mixed> &$ids = [] ]) : CRM_Contribute_BAO_Contribution
It also stores all the retrieved values in the default array.
Parameters
- $params : array<string|int, mixed>
-
(reference ) an assoc array of name/value pairs.
- $defaults : array<string|int, mixed> = []
-
(reference ) an assoc array to hold the name / value pairs. in a hierarchical manner
- $ids : array<string|int, mixed> = []
-
(reference) the array that holds all the db ids.
Return values
CRM_Contribute_BAO_Contributionsave()
Save DAO object.
public
save([bool $hook = TRUE ]) : CRM_Core_DAO
Parameters
- $hook : bool = TRUE
Return values
CRM_Core_DAOschemaRequiresRebuilding()
Checks if CONSTRAINT keyword exists for a specified table.
public
static schemaRequiresRebuilding([mixed $tables = ["civicrm_contact"] ]) : mixed
in 5.72 will be removed in 5.85
Parameters
- $tables : mixed = ["civicrm_contact"]
self_hook_civicrm_post()
Event fired after modifying a contribution.
public
static self_hook_civicrm_post(PostEvent $event) : void
Parameters
- $event : PostEvent
Tags
sendMail()
Send receipt from contribution.
public
static sendMail(array<string|int, mixed> $input, array<string|int, mixed> $ids, int $contributionID[, bool $returnMessageText = FALSE ]) : array<string|int, mixed>
Do not call this directly - it is being refactored. use contribution.sendmessage api call.
Note that the compose message part has been moved to contribution In general LoadObjects is called first to get the objects but the composeMessageArray function now calls it.
Parameters
- $input : array<string|int, mixed>
-
Incoming data from Payment processor.
- $ids : array<string|int, mixed>
-
Related object IDs.
- $contributionID : int
- $returnMessageText : bool = FALSE
-
Should text be returned instead of sent. This. is because the function is also used to generate pdfs
Tags
Return values
array<string|int, mixed>sequenceKey()
Tells DB_DataObject which keys use autoincrement.
public
sequenceKey() : array<string|int, mixed>
'id' is autoincrementing by default.
FIXME: this should return all autoincrement keys not just the first.
Return values
array<string|int, mixed>serializeField()
Transform an array to a serialized string for database storage.
public
static serializeField(array<string|int, mixed>|null $value, int $serializationType) : string|null
Parameters
- $value : array<string|int, mixed>|null
- $serializationType : int
Tags
Return values
string|nullsetApiFilter()
public
setApiFilter(array<string|int, mixed> &$params) : mixed
Parameters
- $params : array<string|int, mixed>
setCreateDefaults()
Set defaults when creating new entity.
public
static setCreateDefaults(array<string|int, mixed> &$params, mixed $defaults) : mixed
(don't call this set defaults as already in use with different signature in some places)
Parameters
- $params : array<string|int, mixed>
- $defaults : mixed
setFieldValue()
Given a DAO name, a column name and a column value, find the record and SET the value of another column in that record
public
static setFieldValue(string $daoName, int $searchValue, string $setColumn, string $setValue[, string $searchColumn = 'id' ]) : bool
Parameters
- $daoName : string
-
Name of the DAO (Example: CRM_Contact_DAO_Contact to retrieve value from a contact).
- $searchValue : int
-
Value of the column you want to search by.
- $setColumn : string
-
Name of the column you want to SET the value of.
- $setValue : string
-
SET the setColumn to this value.
- $searchColumn : string = 'id'
-
Name of the column you want to search by.
Return values
bool —true if we found and updated the object, else false
setOptions()
https://issues.civicrm.org/jira/browse/CRM-17748 Sets the internal options to be used on a query
public
setOptions(array<string|int, mixed> $options) : mixed
Parameters
- $options : array<string|int, mixed>
shortenSQLName()
SQL has a limit of 64 characters on various names: table name, trigger name, column name ... For custom groups and fields we generated names from user entered input which can be longer than this length, this function helps with creating strings that meet various criteria.
public
static shortenSQLName(string $string[, int $length = 60 ][, bool $makeRandom = FALSE ]) : string
Parameters
- $string : string
-
The string to be shortened.
- $length : int = 60
-
The max length of the string.
- $makeRandom : bool = FALSE
Return values
stringsingleValueQuery()
Execute a query and get the single result.
public
static & singleValueQuery(string $query[, array<string|int, mixed> $params = [] ][, bool $abort = TRUE ][, bool $i18nRewrite = TRUE ]) : string|null
Parameters
- $query : string
-
Query to be executed.
- $params : array<string|int, mixed> = []
- $abort : bool = TRUE
- $i18nRewrite : bool = TRUE
Tags
Return values
string|null —the result of the query if any
sortName()
Get the sort name of a contact for a particular contribution.
public
static sortName(int $id) : null|string
Parameters
- $id : int
-
Id of the contribution.
Return values
null|string —sort name of the contact if found
storeValues()
Store all the values from this object in an associative array this is a destructive store, calling function is responsible for keeping sanity of id's.
public
static storeValues(object &$object, array<string|int, mixed> &$values) : mixed
Parameters
- $object : object
-
The object that we are extracting data from.
- $values : array<string|int, mixed>
-
(reference ) associative array of name/value pairs.
table()
Get/set an associative array of table columns
public
table() : array<string|int, mixed>
Return values
array<string|int, mixed> —(associative)
tableHasBeenAdded()
Checks if this DAO's table ought to exist.
public
static tableHasBeenAdded() : bool
If there are pending DB updates, this function compares the CiviCRM version of the table to the current schema version.
Tags
Return values
booltriggerRebuild()
Build a list of triggers via hook and add them to (err, reconcile them with) the database.
public
static triggerRebuild([string $tableName = NULL ][, bool $force = FALSE ]) : mixed
Parameters
- $tableName : string = NULL
-
the specific table requiring a rebuild; or NULL to rebuild all tables.
- $force : bool = FALSE
Tags
unSerializeField()
Transform a serialized string from the database into an array.
public
static unSerializeField(string|null $value, mixed $serializationType) : array<string|int, mixed>|null
Parameters
- $value : string|null
- $serializationType : mixed
Tags
Return values
array<string|int, mixed>|nullupdateMembershipBasedOnCompletionOfContribution()
Update the memberships associated with a contribution if it has been completed.
public
static updateMembershipBasedOnCompletionOfContribution(int $contributionID, string $changeDate) : mixed
Note that the way in which $memberships are loaded as objects is pretty messy & I think we could just load them in this function. Code clean up would compensate for any minor performance implication.
Parameters
- $contributionID : int
-
The Contribution ID that was Completed
- $changeDate : string
-
If provided, specify an alternative date to use as "today" calculation of membership dates
Tags
updateRelatedPledge()
Update related pledge payment payments.
public
static updateRelatedPledge(string $action, int $pledgePaymentID, int $contributionID, bool $adjustTotalAmount, float $total_amount, float $original_total_amount, int $contribution_status_id, int $original_contribution_status_id) : mixed
This function has been refactored out of the back office contribution form and may still overlap with other functions.
Parameters
- $action : string
- $pledgePaymentID : int
- $contributionID : int
- $adjustTotalAmount : bool
- $total_amount : float
- $original_total_amount : float
- $contribution_status_id : int
- $original_contribution_status_id : int
validateFinancialType()
Validate financial type.
public
static validateFinancialType(int $financialTypeId[, string $relationName = 'Expense Account is' ]) : array<string|int, mixed>|bool
Parameters
- $financialTypeId : int
-
Financial Type id.
- $relationName : string = 'Expense Account is'
Tags
Return values
array<string|int, mixed>|boolwriteRecord()
Create or update a record from supplied params.
public
static writeRecord(array<string|int, mixed> $record) : static
If 'id' is supplied, an existing record will be updated Otherwise a new record will be created.
Parameters
- $record : array<string|int, mixed>
Tags
Return values
staticwriteRecords()
Bulk save multiple records
public
static writeRecords(array<string|int, array<string|int, mixed>> $records) : array<string|int, static>
Parameters
- $records : array<string|int, array<string|int, mixed>>
Tags
Return values
array<string|int, static>_setDBOptions()
https://issues.civicrm.org/jira/browse/CRM-17748 wrapper to pass internal DAO options down to DB_mysql/DB_Common level
protected
_setDBOptions(array<string|int, mixed> $options) : mixed
Parameters
- $options : array<string|int, mixed>
addContributionPageValuesToValuesHeavyHandedly()
ContributionPage values were being imposed onto values.
protected
addContributionPageValuesToValuesHeavyHandedly(array<string|int, mixed> &$values) : array<string|int, mixed>
I have made this explicit and removed the couple (is_recur, is_pay_later) we REALLY didn't want superimposed. The rest are left there in their overkill out of cautiousness.
The rationale for making this explicit is that it was a case of carefully set values being seemingly randonly overwritten without much care. In general I think array randomly setting variables en mass is risky.
Parameters
- $values : array<string|int, mixed>
Return values
array<string|int, mixed>assignTestFK()
protected
assignTestFK(string $fieldName, mixed $fieldDef, array<string|int, mixed> $params) : mixed
Parameters
- $fieldName : string
- $fieldDef : mixed
- $params : array<string|int, mixed>
assignTestValue()
Assign Test Value.
protected
assignTestValue(string $fieldName, array<string|int, mixed> &$fieldDef, int $counter) : mixed
Parameters
- $fieldName : string
- $fieldDef : array<string|int, mixed>
- $counter : int
copyLocalizable()
Method that copies localizable fields from an old entity to a new one.
protected
copyLocalizable(int $entityID, int $newEntityID, array<string|int, mixed> $fieldsToPrefix, array<string|int, mixed> $fieldsToSuffix, array<string|int, mixed> $fieldsToReplace) : mixed
Fixes bug dev/core#2479, where non current locale fields are copied from current locale losing translation when copying
Parameters
- $entityID : int
- $newEntityID : int
- $fieldsToPrefix : array<string|int, mixed>
- $fieldsToSuffix : array<string|int, mixed>
- $fieldsToReplace : array<string|int, mixed>
formatFieldValue()
Format a value according to field metadata.
protected
static formatFieldValue(string|null $value, array<string|int, mixed>|null $fieldSpec) : mixed
Parameters
- $value : string|null
- $fieldSpec : array<string|int, mixed>|null
getBillingAddressParams()
protected
static getBillingAddressParams(mixed $params, mixed $billingLocationTypeID) : array<string|int, mixed>
Parameters
- $params : mixed
- $billingLocationTypeID : mixed
Return values
array<string|int, mixed>getContributionTransactionInformation()
Get transaction information about the contribution.
protected
static getContributionTransactionInformation(int $contributionId, int $financialTypeID) : mixed
Parameters
- $contributionId : int
- $financialTypeID : int
getDynamicFkAclClauses()
Get an array of ACL clauses for a dynamic FK (entity_id/entity_table combo)
protected
static getDynamicFkAclClauses(string $entityTableField, string $entityIdField[, mixed|null $entityTableValues = NULL ]) : array<string|int, mixed>
Parameters
- $entityTableField : string
- $entityIdField : string
- $entityTableValues : mixed|null = NULL
Return values
array<string|int, mixed>getFirstPrimaryKey()
protected
getFirstPrimaryKey() : string
Return values
stringgetRelatedMemberships()
Get memberships related to the contribution.
protected
static getRelatedMemberships(int $contributionID) : array<string|int, mixed>
Parameters
- $contributionID : int
Tags
Return values
array<string|int, mixed>getTableAddVersion()
protected
static getTableAddVersion() : string
Tags
Return values
string —Version in which table was added
isEmailReceipt()
Should an email receipt be sent for this contribution on completion.
protected
static isEmailReceipt(array<string|int, mixed> $input, int $contributionID, int $recurringContributionID) : bool
Parameters
- $input : array<string|int, mixed>
- $contributionID : int
- $recurringContributionID : int
Tags
Return values
boolloadEventMessageTemplateParams()
Load the values needed for the event message.
protected
loadEventMessageTemplateParams(int $eventID, int $participantID, int|null $contributionID) : array<string|int, mixed>
Parameters
- $eventID : int
- $participantID : int
- $contributionID : int|null
Tags
Return values
array<string|int, mixed>loadRelatedEntitiesByID()
Load entities related to the contribution into $this->_relatedObjects.
protected
loadRelatedEntitiesByID(array<string|int, mixed> $ids) : mixed
since 5.75 will be removed around 5.99.
Parameters
- $ids : array<string|int, mixed>
Tags
clearDbColumnValueCache()
Remove item from static cache during update/delete operations
private
clearDbColumnValueCache() : mixed
getActivitySourceAndTarget()
Get the activity source and target contacts linked to a contribution
private
static getActivitySourceAndTarget(mixed $activityId) : array<string|int, mixed>
Parameters
- $activityId : mixed
Return values
array<string|int, mixed>getEntityDefinition()
private
static getEntityDefinition() : array<string|int, mixed>
Return values
array<string|int, mixed>getEntityInfo()
private
static getEntityInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>getFieldLength()
private
static getFieldLength(mixed $sqlType) : string|null
Parameters
- $sqlType : mixed
Return values
string|nullgetOriginalContribution()
Get the contribution as it is in the database before being updated.
private
static getOriginalContribution(int $contributionID) : CRM_Contribute_BAO_Contribution|null
Parameters
- $contributionID : int
Return values
CRM_Contribute_BAO_Contribution|nullgetSchemaFields()
private
static getSchemaFields() : array<string|int, mixed>
Return values
array<string|int, mixed>loadSchemaFields()
private
static loadSchemaFields() : array<string|int, mixed>
Return values
array<string|int, mixed>makeNameFromLabel()
When creating a record without a supplied name, create a unique, clean name derived from the label.
private
makeNameFromLabel() : void
Note: this function does nothing unless a unique index exists for "name" column.
setDefaultsFromCallback()
Set default values for fields based on callback functions
private
static setDefaultsFromCallback(string $entityName, array<string|int, mixed> &$record) : void
Parameters
- $entityName : string
-
The entity name
- $record : array<string|int, mixed>
-
The record array to set default values for