CRM-16189, freeze revenue recognition date if contribution is associated with partici...
authorPradeep Nayak <pradpnayak@gmail.com>
Tue, 9 Aug 2016 11:51:28 +0000 (17:21 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Mon, 29 Aug 2016 13:20:32 +0000 (18:50 +0530)
----------------------------------------
* CRM-16189: Improve support for Accrual Method bookkeeping
  https://issues.civicrm.org/jira/browse/CRM-16189

CRM/Contribute/Form/Contribution.php

index 10f86a29addc4f328a78d569600e0796db82ea37..97b24e9ac8ecf23a8bc63e0870e10617880e18d6 100644 (file)
@@ -751,7 +751,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
 
     // 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