Merge pull request #9566 from totten/master-19690-layout
[civicrm-core.git] / CRM / Price / Form / Set.php
index b78bc7de04e7e8f53994c132d9e65cc6f5c84777..a2127502504835da7276e44b16202ed79108b969 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
  */
 
 /**
@@ -107,9 +107,11 @@ class CRM_Price_Form_Set extends CRM_Core_Form {
       && (array_key_exists(CRM_Core_Component::getComponentID('CiviEvent'), $fields['extends'])
         || array_key_exists(CRM_Core_Component::getComponentID('CiviMember'), $fields['extends']))
     ) {
-      $isError = CRM_Financial_BAO_FinancialAccount::validateFinancialType($fields['financial_type_id']);
-      if ($isError) {
-        $errors['financial_type_id'] = ts('Deferred revenue account is not configured for selected financial type. 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');
+      try {
+        CRM_Financial_BAO_FinancialAccount::validateFinancialType($fields['financial_type_id']);
+      }
+      catch (CRM_Core_Exception $e) {
+        $errors['financial_type_id'] = $e->getMessage();
       }
     }
     return empty($errors) ? TRUE : $errors;
@@ -181,6 +183,8 @@ class CRM_Price_Form_Set extends CRM_Core_Form {
       }
     }
 
+    $this->addElement('text', 'min_amount', ts('Minimum Amount'));
+
     if (CRM_Utils_System::isNull($extends)) {
       $this->assign('extends', FALSE);
     }