Merge pull request #6604 from eileenmcnaughton/4.6
[civicrm-core.git] / CRM / Financial / Form / FinancialType.php
index 67be508ecdaa044e4fa30ff566f083ff3cd98120..0b36e0a09f867e3f1a6a44f513d02009682e78c8 100644 (file)
@@ -1,10 +1,9 @@
 <?php
-
 /*
   +--------------------------------------------------------------------+
   | CiviCRM version 4.6                                                |
   +--------------------------------------------------------------------+
-  | Copyright CiviCRM LLC (c) 2004-2014                                |
+  | Copyright CiviCRM LLC (c) 2004-2015                                |
   +--------------------------------------------------------------------+
   | This file is a part of CiviCRM.                                    |
   |                                                                    |
   | GNU Affero General Public License or the licensing of CiviCRM,     |
   | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
   +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -41,7 +40,7 @@
 class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
 
   /**
-   * Build the form object
+   * Build the form object.
    *
    * @return void
    */
@@ -49,7 +48,7 @@ class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
     parent::buildQuickForm();
     $this->setPageTitle(ts('Financial Type'));
 
-    $this->_id = CRM_Utils_Request::retrieve('id' , 'Positive', $this);
+    $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if ($this->_id) {
       $this->_title = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_id, 'name');
     }
@@ -67,17 +66,17 @@ class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
     if ($this->_action == CRM_Core_Action::UPDATE) {
       $this->assign('aid', $this->_id);
     }
-    if ($this->_action == CRM_Core_Action::UPDATE && CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_id, 'is_reserved','vid')) {
+    if ($this->_action == CRM_Core_Action::UPDATE && CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_id, 'is_reserved', 'vid')) {
       $this->freeze(array('is_active'));
     }
 
-    $this->addRule('name', ts('A financial type with this name already exists. Please select another name.'),'objectExists',
+    $this->addRule('name', ts('A financial type with this name already exists. Please select another name.'), 'objectExists',
       array('CRM_Financial_DAO_FinancialType', $this->_id)
     );
   }
 
   /**
-   * Process the form submission
+   * Process the form submission.
    *
    * @return void
    */
@@ -90,7 +89,7 @@ class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
       CRM_Core_Session::setStatus(ts('Selected financial type has been deleted.'), ts('Record Deleted'), 'success');
     }
     else {
-      $params = $ids = array( );
+      $params = $ids = array();
       // store the submitted values in an array
       $params = $this->exportValues();
 
@@ -101,7 +100,7 @@ class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
       $financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
       if ($this->_action & CRM_Core_Action::UPDATE) {
         $url = CRM_Utils_System::url('civicrm/admin/financial/financialType', 'reset=1&action=browse');
-        CRM_Core_Session::setStatus(ts('The financial type "%1" has been updated.', array( 1 => $financialType->name)), ts('Saved'), 'success');
+        CRM_Core_Session::setStatus(ts('The financial type "%1" has been updated.', array(1 => $financialType->name)), ts('Saved'), 'success');
       }
       else {
         $url = CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', 'reset=1&action=browse&aid=' . $financialType->id);