// CRM-16189
CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($params, $contributionID);
+ if ($contributionID && !empty($params['revenue_recognition_date'])
+ && !($contributionStatus[$params['prevContribution']->contribution_status_id] == 'Pending')
+ && !self::allowUpdateRevenueRecognitionDate($contributionID)
+ ) {
+ unset($params['revenue_recognition_date']);
+ }
- if (!isset($params['tax_amount']) && $setPrevContribution && (isset($params['total_amount']) || isset
- ($params['financial_type_id']))) {
+ if (!isset($params['tax_amount']) && $setPrevContribution && (isset($params['total_amount']) ||
+ isset($params['financial_type_id']))) {
$params = CRM_Contribute_BAO_Contribution::checkTaxAmount($params);
}
FALSE
);
+ $currencyFreeze = FALSE;
+ if (!empty($this->_payNow) && ($this->_action & CRM_Core_Action::UPDATE)) {
+ $statusElement->freeze();
+ $currencyFreeze = TRUE;
+ $attributes['total_amount']['readonly'] = TRUE;
+ }
+
// CRM-16189, add Revenue Recognition Date
if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
- $this->add('date', 'revenue_recognition_date', ts('Revenue Recognition Date'), CRM_Core_SelectValues::date(NULL, 'M Y', NULL, 5));
+ $revenueDate = $this->add('date', 'revenue_recognition_date', ts('Revenue Recognition Date'), CRM_Core_SelectValues::date(NULL, 'M Y', NULL, 5));
+ if ($this->_id && !CRM_Contribute_BAO_Contribution::allowUpdateRevenueRecognitionDate($this->_id)) {
+ $revenueDate->freeze();
+ }
}
// add various dates