$softCreditFields = array(
'contribution_soft_credit_name' => array(
'name' => 'contribution_soft_credit_name',
- 'title' => 'Soft Credit For',
+ 'title' => ts('Soft Credit For'),
'where' => 'civicrm_contact_d.display_name',
'data_type' => CRM_Utils_Type::T_STRING,
),
'contribution_soft_credit_amount' => array(
'name' => 'contribution_soft_credit_amount',
- 'title' => 'Soft Credit Amount',
+ 'title' => ts('Soft Credit Amount'),
'where' => 'civicrm_contribution_soft.amount',
'data_type' => CRM_Utils_Type::T_MONEY,
),
'contribution_soft_credit_type' => array(
'name' => 'contribution_soft_credit_type',
- 'title' => 'Soft Credit Type',
+ 'title' => ts('Soft Credit Type'),
'where' => 'contribution_softcredit_type.label',
'data_type' => CRM_Utils_Type::T_STRING,
),
'contribution_soft_credit_contribution_id' => array(
'name' => 'contribution_soft_credit_contribution_id',
- 'title' => 'Soft Credit For Contribution ID',
+ 'title' => ts('Soft Credit For Contribution ID'),
'where' => 'civicrm_contribution_soft.contribution_id',
'data_type' => CRM_Utils_Type::T_INT,
),
'contribution_soft_credit_contact_id' => array(
'name' => 'contribution_soft_credit_contact_id',
- 'title' => 'Soft Credit For Contact ID',
+ 'title' => ts('Soft Credit For Contact ID'),
'where' => 'civicrm_contact_d.id',
'data_type' => CRM_Utils_Type::T_INT,
),
$extraFields = array(
'contribution_soft_credit_name' => array(
'name' => 'contribution_soft_credit_name',
- 'title' => 'Soft Credit Name',
+ 'title' => ts('Soft Credit Name'),
'headerPattern' => '/^soft_credit_name$/i',
'where' => 'civicrm_contact_d.display_name',
),
'contribution_soft_credit_email' => array(
'name' => 'contribution_soft_credit_email',
- 'title' => 'Soft Credit Email',
+ 'title' => ts('Soft Credit Email'),
'headerPattern' => '/^soft_credit_email$/i',
'where' => 'soft_email.email',
),
'contribution_soft_credit_phone' => array(
'name' => 'contribution_soft_credit_phone',
- 'title' => 'Soft Credit Phone',
+ 'title' => ts('Soft Credit Phone'),
'headerPattern' => '/^soft_credit_phone$/i',
'where' => 'soft_phone.phone',
),
'contribution_soft_credit_contact_id' => array(
'name' => 'contribution_soft_credit_contact_id',
- 'title' => 'Soft Credit Contact ID',
+ 'title' => ts('Soft Credit Contact ID'),
'headerPattern' => '/^soft_credit_contact_id$/i',
'where' => 'civicrm_contribution_soft.contact_id',
),
'contribution_pcp_title' => array(
'name' => 'contribution_pcp_title',
- 'title' => 'Personal Campaign Page Title',
+ 'title' => ts('Personal Campaign Page Title'),
'headerPattern' => '/^contribution_pcp_title$/i',
'where' => 'contribution_pcp.title',
),
$ids
));
- if (!$paymentProcessorID && $this->contribution_page_id) {
+ if (!isset($input['payment_processor_id']) && !$paymentProcessorID && $this->contribution_page_id) {
$paymentProcessorID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage',
$this->contribution_page_id,
'payment_processor'
$partialAmtPay = CRM_Utils_Rule::cleanMoney($params['partial_amount_pay']);
$partialAmtTotal = CRM_Utils_Rule::cleanMoney($params['partial_payment_total']);
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
- $fromFinancialAccountId = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
+ $fromFinancialAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['financial_type_id'], 'Accounts Receivable Account is');
$statusId = CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name');
$params['total_amount'] = $partialAmtPay;
$balanceTrxnInfo = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($params['contribution']->id, $params['financial_type_id']);
if (empty($balanceTrxnInfo['trxn_id'])) {
// create new balance transaction record
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
- $toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
+ $toFinancialAccount = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['financial_type_id'], 'Accounts Receivable Account is');
$balanceTrxnParams['total_amount'] = $partialAmtTotal;
$balanceTrxnParams['to_financial_account_id'] = $toFinancialAccount;
$balanceTrxnParams['status_id'] = $statusId;
$balanceTrxnParams['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
$balanceTrxnParams['check_number'] = CRM_Utils_Array::value('check_number', $params);
+ $balanceTrxnParams['pan_truncation'] = CRM_Utils_Array::value('pan_truncation', $params);
+ $balanceTrxnParams['card_type_id'] = CRM_Utils_Array::value('card_type_id', $params);
if (!empty($balanceTrxnParams['from_financial_account_id']) &&
($statusId == array_search('Completed', $contributionStatuses) || $statusId == array_search('Partially paid', $contributionStatuses))
) {
);
}
elseif (!empty($params['payment_processor'])) {
- $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($params['payment_processor'], 'civicrm_payment_processor', 'financial_account_id');
+ $params['to_financial_account_id'] = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['payment_processor'], NULL, 'civicrm_payment_processor');
$params['payment_instrument_id'] = civicrm_api3('PaymentProcessor', 'getvalue', array(
'id' => $params['payment_processor'],
'return' => 'payment_instrument_id',
'status_id' => $statusId,
'payment_instrument_id' => CRM_Utils_Array::value('payment_instrument_id', $params, $params['contribution']->payment_instrument_id),
'check_number' => CRM_Utils_Array::value('check_number', $params),
+ 'pan_truncation' => CRM_Utils_Array::value('pan_truncation', $params),
+ 'card_type_id' => CRM_Utils_Array::value('card_type_id', $params),
);
if ($contributionStatus == 'Refunded' || $contributionStatus == 'Chargeback' || $contributionStatus == 'Cancelled') {
$trxnParams['trxn_date'] = !empty($params['contribution']->cancel_date) ? $params['contribution']->cancel_date : date('YmdHis');
if (!empty($financialTrxnValues)) {
$trxnParams = array_merge($trxnParams, $financialTrxnValues);
}
+ if (empty($trxnParams['payment_processor_id'])) {
+ unset($trxnParams['payment_processor_id']);
+ }
$params['trxnParams'] = $trxnParams;
if (!empty($params['revenue_recognition_date']) || $params['prevContribution']->revenue_recognition_date) {
$accountRelationship = 'Deferred Revenue Account is';
}
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE '$accountRelationship' "));
- $oldFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $relationTypeId);
- $newFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
+ $oldFinancialAccount = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['prevContribution']->financial_type_id, $accountRelationship);
+ $newFinancialAccount = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['financial_type_id'], $accountRelationship);
if ($oldFinancialAccount != $newFinancialAccount) {
$params['total_amount'] = 0;
if (in_array($params['contribution']->contribution_status_id, $pendingStatus)) {
- $params['trxnParams']['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType(
- $params['prevContribution']->financial_type_id, $relationTypeId);
+ $params['trxnParams']['to_financial_account_id'] = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount(
+ $params['prevContribution']->financial_type_id, $accountRelationship);
}
else {
$lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC');
civicrm_api3('FinancialTrxn', 'create', array('id' => $refundIDs['financialTrxnId'], 'trxn_id' => $params['refund_trxn_id']));
}
}
- $cardType = CRM_Utils_Array::value('card_type', $params);
+ $cardType = CRM_Utils_Array::value('card_type_id', $params);
$panTruncation = CRM_Utils_Array::value('pan_truncation', $params);
CRM_Core_BAO_FinancialTrxn::updateCreditCardDetails($params['contribution']->id, $panTruncation, $cardType);
}
// records finanical trxn and entity financial trxn
// also make it available as return value
self::recordAlwaysAccountsReceivable($trxnParams, $params);
+ $trxnParams['pan_truncation'] = CRM_Utils_Array::value('pan_truncation', $params);
+ $trxnParams['card_type_id'] = CRM_Utils_Array::value('card_type_id', $params);
$return = $financialTxn = CRM_Core_BAO_FinancialTrxn::create($trxnParams);
$params['entity_id'] = $financialTxn->id;
if (empty($params['partial_payment_total']) && empty($params['partial_amount_pay'])) {
&& $params['prevContribution']->is_pay_later) || $previousContributionStatus == 'In Progress'
) {
$financialTypeID = CRM_Utils_Array::value('financial_type_id', $params) ? $params['financial_type_id'] : $params['prevContribution']->financial_type_id;
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
- $arAccountId = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeID, $relationTypeId);
+ $arAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($financialTypeID, 'Accounts Receivable Account is');
if ($params['contribution']->contribution_status_id == array_search('Cancelled', $contributionStatus)) {
$params['trxnParams']['to_financial_account_id'] = $arAccountId;
$params['trxnParams']['net_amount'] = $params['trxnParams']['total_amount'];
$deferredFinancialAccount = CRM_Utils_Array::value('deferred_financial_account_id', $params);
if (empty($deferredFinancialAccount)) {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Deferred Revenue Account is' "));
- $deferredFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $relationTypeId);
+ $deferredFinancialAccount = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['prevContribution']->financial_type_id, 'Deferred Revenue Account is');
}
$lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC', FALSE, NULL, $deferredFinancialAccount);
if (!empty($lastFinancialTrxnId['financialTrxnId'])) {
return;
}
}
+
$trxn = CRM_Core_BAO_FinancialTrxn::create($params['trxnParams']);
$params['entity_id'] = $trxn->id;
if ($context != 'changePaymentInstrument') {
* @return array|bool
*/
public static function validateFinancialType($financialTypeId, $relationName = 'Expense Account is') {
- $expenseTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE '{$relationName}' "));
- $financialAccount = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeId, $expenseTypeId);
+ $financialAccount = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($financialTypeId, $relationName);
if (!$financialAccount) {
return CRM_Contribute_PseudoConstant::financialType($financialTypeId);
$participantId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $contributionId, 'participant_id', 'contribution_id');
}
+ // build params for recording financial trxn entry
+ $params['contribution'] = $contributionDAO;
+ $params = array_merge($defaults, $params);
+ $params['skipLineItem'] = TRUE;
+ $trxnsData['trxn_date'] = !empty($trxnsData['trxn_date']) ? $trxnsData['trxn_date'] : date('YmdHis');
+ $arAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contributionDAO->financial_type_id, 'Accounts Receivable Account is');
if ($paymentType == 'owed') {
- // build params for recording financial trxn entry
- $params['contribution'] = $contributionDAO;
- $params = array_merge($defaults, $params);
- $params['skipLineItem'] = TRUE;
$params['partial_payment_total'] = $contributionDAO->total_amount;
$params['partial_amount_pay'] = $trxnsData['total_amount'];
- $trxnsData['trxn_date'] = !empty($trxnsData['trxn_date']) ? $trxnsData['trxn_date'] : date('YmdHis');
$trxnsData['net_amount'] = !empty($trxnsData['net_amount']) ? $trxnsData['net_amount'] : $trxnsData['total_amount'];
+ $params['pan_truncation'] = CRM_Utils_Array::value('pan_truncation', $trxnsData);
+ $params['card_type_id'] = CRM_Utils_Array::value('card_type_id', $trxnsData);
// record the entry
$financialTrxn = CRM_Contribute_BAO_Contribution::recordFinancialAccounts($params, $trxnsData);
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
- $toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($contributionDAO->financial_type_id, $relationTypeId);
-
+ $toFinancialAccount = $arAccountId;
$trxnId = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($contributionId, $contributionDAO->financial_type_id);
if (!empty($trxnId)) {
$trxnId = $trxnId['trxn_id'];
}
}
elseif ($paymentType == 'refund') {
- // build params for recording financial trxn entry
- $params['contribution'] = $contributionDAO;
- $params = array_merge($defaults, $params);
- $params['skipLineItem'] = TRUE;
- $trxnsData['trxn_date'] = !empty($trxnsData['trxn_date']) ? $trxnsData['trxn_date'] : date('YmdHis');
$trxnsData['total_amount'] = -$trxnsData['total_amount'];
-
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
- $trxnsData['from_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($contributionDAO->financial_type_id, $relationTypeId);
- // @todo remove deprecated fn call.
+ $trxnsData['from_financial_account_id'] = $arAccountId;
$trxnsData['status_id'] = CRM_Core_OptionGroup::getValue('contribution_status', 'Refunded', 'name');
// record the entry
$financialTrxn = CRM_Contribute_BAO_Contribution::recordFinancialAccounts($params, $trxnsData);
$activityType = ($paymentType == 'refund') ? 'Refund' : 'Payment';
self::addActivityForPayment($entityObj, $financialTrxn, $activityType, $component, $contributionId);
+ return $financialTrxn;
}
- return $financialTrxn;
+
}
/**
$paymentBalance = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($id, $entity, FALSE, $total);
$contributionIsPayLater = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'is_pay_later');
- $feeRelationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Expense Account is' "));
$financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'financial_type_id');
- $feeFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeId, $feeRelationTypeId);
+ $feeFinancialAccount = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($financialTypeId, 'Expense Account is');
if ($paymentBalance == 0 && $contributionIsPayLater) {
$paymentBalance = $total;
SELECT GROUP_CONCAT(fa.`name`) as financial_account,
ft.total_amount,
ft.payment_instrument_id,
- ft.trxn_date, ft.trxn_id, ft.status_id, ft.check_number, ft.currency, ft.pan_truncation, ft.card_type
+ ft.trxn_date, ft.trxn_id, ft.status_id, ft.check_number, ft.currency, ft.pan_truncation, ft.card_type_id
FROM civicrm_contribution con
LEFT JOIN civicrm_entity_financial_trxn eft ON (eft.entity_id = con.id AND eft.entity_table = 'civicrm_contribution')
while ($resultDAO->fetch()) {
$paidByLabel = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_FinancialTrxn', 'payment_instrument_id', $resultDAO->payment_instrument_id);
$paidByName = CRM_Core_PseudoConstant::getName('CRM_Core_BAO_FinancialTrxn', 'payment_instrument_id', $resultDAO->payment_instrument_id);
- if ($resultDAO->card_type) {
- $creditCardType = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_FinancialTrxn', 'card_type', $resultDAO->card_type);
+ if ($resultDAO->card_type_id) {
+ $creditCardType = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_FinancialTrxn', 'card_type_id', $resultDAO->card_type_id);
$pantruncation = '';
if ($resultDAO->pan_truncation) {
$pantruncation = ": {$resultDAO->pan_truncation}";
* @param CRM_Core_Transaction $transaction
* @param int $recur
* @param CRM_Contribute_BAO_Contribution $contribution
- * @param bool $isRecurring
- * Duplication of param needs review. Only used by AuthorizeNetIPN
- * @param int $isFirstOrLastRecurringPayment
- * Deprecated param only used by AuthorizeNetIPN.
*
* @return array
*/
- public static function completeOrder(&$input, &$ids, $objects, $transaction, $recur, $contribution, $isRecurring, $isFirstOrLastRecurringPayment) {
+ public static function completeOrder(&$input, &$ids, $objects, $transaction, $recur, $contribution) {
$primaryContributionID = isset($contribution->id) ? $contribution->id : $objects['first_contribution']->id;
// The previous details are used when calculating line items so keep it before any code that 'does something'
if (!empty($contribution->id)) {
'receive_date',
'receipt_date',
'contribution_status_id',
+ 'card_type_id',
+ 'pan_truncation',
);
if (self::isSingleLineItem($primaryContributionID)) {
$inputContributionWhiteList[] = 'financial_type_id';
}
$dao->free();
- $membershipParams['num_terms'] = $contribution->getNumTermsByContributionAndMembershipType(
- $membershipParams['membership_type_id'],
- $primaryContributionID
- );
- $dates = array_fill_keys(array('join_date', 'start_date', 'end_date'), NULL);
- if ($currentMembership) {
- /*
- * Fixed FOR CRM-4433
- * In BAO/Membership.php(renewMembership function), we skip the extend membership date and status
- * when Contribution mode is notify and membership is for renewal )
- */
- CRM_Member_BAO_Membership::fixMembershipStatusBeforeRenew($currentMembership, $changeDate);
-
- // @todo - we should pass membership_type_id instead of null here but not
- // adding as not sure of testing
- $dates = CRM_Member_BAO_MembershipType::getRenewalDatesForMembershipType($membershipParams['id'],
- $changeDate, NULL, $membershipParams['num_terms']
- );
-
- $dates['join_date'] = $currentMembership['join_date'];
+ if (CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'contribution_status_id', CRM_Utils_Array::value('contribution_status_id', $input)) === 'Pending') {
+ $membershipParams['num_terms'] = 0;
}
+ else {
+ $membershipParams['num_terms'] = $contribution->getNumTermsByContributionAndMembershipType(
+ $membershipParams['membership_type_id'],
+ $primaryContributionID
+ );
+ // @todo remove all this stuff in favour of letting the api call further down handle in
+ // (it is a duplication of what the api does).
+ $dates = array_fill_keys(array('join_date', 'start_date', 'end_date'), NULL);
+ if ($currentMembership) {
+ /*
+ * Fixed FOR CRM-4433
+ * In BAO/Membership.php(renewMembership function), we skip the extend membership date and status
+ * when Contribution mode is notify and membership is for renewal )
+ */
+ CRM_Member_BAO_Membership::fixMembershipStatusBeforeRenew($currentMembership, $changeDate);
+
+ // @todo - we should pass membership_type_id instead of null here but not
+ // adding as not sure of testing
+ $dates = CRM_Member_BAO_MembershipType::getRenewalDatesForMembershipType($membershipParams['id'],
+ $changeDate, NULL, $membershipParams['num_terms']
+ );
+
+ $dates['join_date'] = $currentMembership['join_date'];
+ }
- //get the status for membership.
- $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($dates['start_date'],
- $dates['end_date'],
- $dates['join_date'],
- 'today',
- TRUE,
- $membershipParams['membership_type_id'],
- $membershipParams
- );
+ //get the status for membership.
+ $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($dates['start_date'],
+ $dates['end_date'],
+ $dates['join_date'],
+ 'today',
+ TRUE,
+ $membershipParams['membership_type_id'],
+ $membershipParams
+ );
- $membershipParams['status_id'] = CRM_Utils_Array::value('id', $calcStatus, 'New');
- //we might be renewing membership,
- //so make status override false.
- $membershipParams['is_override'] = FALSE;
+ unset($dates['end_date']);
+ $membershipParams['status_id'] = CRM_Utils_Array::value('id', $calcStatus, 'New');
+ //we might be renewing membership,
+ //so make status override false.
+ $membershipParams['is_override'] = FALSE;
+ }
//CRM-17723 - reset static $relatedContactIds array()
+ // @todo move it to Civi Statics.
$var = TRUE;
CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE);
civicrm_api3('Membership', 'create', $membershipParams);
}
CRM_Core_Error::debug_log_message("Success: Database updated");
- if ($isRecurring) {
- CRM_Contribute_BAO_ContributionRecur::sendRecurringStartOrEndNotification($ids, $recur,
- $isFirstOrLastRecurringPayment);
- }
return $contributionResult;
}
);
$statusId = array_search('Completed', $contributionStatuses);
if (in_array(CRM_Utils_Array::value('contribution_status_id', $contribution), $pendingStatus)) {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
- $balanceTrxnParams['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($contribution['financial_type_id'], $relationTypeId);
+ $balanceTrxnParams['to_financial_account_id'] = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contribution['financial_type_id'], 'Accounts Receivable Account is');
}
elseif (!empty($params['payment_processor'])) {
- $balanceTrxnParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($contribution['payment_processor'], 'civicrm_payment_processor', 'financial_account_id');
+ $balanceTrxnParams['to_financial_account_id'] = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contribution['payment_processor'], NULL, 'civicrm_payment_processor');
}
elseif (!empty($params['payment_instrument_id'])) {
$balanceTrxnParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($contribution['payment_instrument_id']);
$queryParams = array(1 => array($relationTypeId, 'Integer'));
$balanceTrxnParams['to_financial_account_id'] = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = %1", $queryParams);
}
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
- $fromFinancialAccountId = CRM_Contribute_PseudoConstant::financialAccountType($contribution['financial_type_id'], $relationTypeId);
+ $fromFinancialAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contribution['financial_type_id'], 'Accounts Receivable Account is');
$balanceTrxnParams['from_financial_account_id'] = $fromFinancialAccountId;
$balanceTrxnParams['total_amount'] = $params['total_amount'];
$balanceTrxnParams['contribution_id'] = $params['contribution_id'];
$params = $trxnParams;
$financialTypeID = CRM_Utils_Array::value('financial_type_id', $contributionParams) ? $contributionParams['financial_type_id'] : $contributionParams['prevContribution']->financial_type_id;
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
- $arAccountId = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeID, $relationTypeId);
+ $arAccountId = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($financialTypeID, 'Accounts Receivable Account is');
$params['to_financial_account_id'] = $arAccountId;
$params['status_id'] = array_search('Pending', $contributionStatuses);
$params['is_payment'] = FALSE;