$errors['revenue_recognition_date'] = ts('Month and Year are required field for Revenue Recognition.');
}
// CRM-16189
- if (CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($fields, $self->_id, $self)) {
+ if (CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($fields, $self->_id, $self->_priceSet['fields'])) {
$errors['financial_type_id'] = ' ';
$errors['_qf_default'] = ts('Revenue recognition date can only be specified if the financial type selected has a deferred revenue account configured. Please have an administrator set up the deferred revenue account at Administer > CiviContribute > Financial Accounts, then configure it for financial types at Administer > CiviContribution > Financial Types, Accounts');
}
/**
* Validate Financial Type has Deferred Revenue account relationship
- * with Financial Account
+ * with Financial Account.
*
* @param array $params
- * Holds submitted formvalues and params from api for updating/adding contribution
+ * Holds submitted formvalues and params from api for updating/adding contribution.
*
* @param int $contributionID
* Contribution ID
*
- * @param obj $form
- * Holds form object of CRM_Contribute_Form_Contribution
+ * @param array $priceSetFields
+ * Array of price fields of a price set.
*
* @return bool
*
*/
- public static function checkFinancialTypeHasDeferred($params, $contributionID = NULL, $form = NULL) {
+ public static function checkFinancialTypeHasDeferred($params, $contributionID = NULL, $priceSetFields = NULL) {
if (!CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
return FALSE;
}
}
if (($contributionID || !empty($params['price_set_id'])) && empty($lineItems)) {
if (!$contributionID) {
- CRM_Price_BAO_PriceSet::processAmount($form->_priceSet['fields'],
+ CRM_Price_BAO_PriceSet::processAmount($priceSetFields,
$params, $items);
}
else {
* with Financial Account.
*
* @param int $financialTypeId
+ * Financial Type Id.
+ *
+ * @param int $entityID
+ * Holds id for PriceSet/PriceField/PriceFieldValue.
+ *
+ * @param string $entity
+ * Entity like PriceSet/PriceField/PriceFieldValue.
*
* @return bool
*