Merge pull request #4959 from rohankatkar/batch-17
[civicrm-core.git] / CRM / Custom / Form / Option.php
index cc554899ada89aee359d46a898bd71500c12e35c..e91b96e535d4207e0c12ab3e21011d737b37cdf7 100644 (file)
@@ -42,7 +42,6 @@ class CRM_Custom_Form_Option extends CRM_Core_Form {
    * The custom field id saved to the session for an update
    *
    * @var int
-   * @access protected
    */
   protected $_fid;
 
@@ -50,7 +49,6 @@ class CRM_Custom_Form_Option extends CRM_Core_Form {
    * The custom group id saved to the session for an update
    *
    * @var int
-   * @access protected
    */
   protected $_gid;
 
@@ -63,17 +61,13 @@ class CRM_Custom_Form_Option extends CRM_Core_Form {
    * The Option id, used when editing the Option
    *
    * @var int
-   * @access protected
    */
   protected $_id;
 
   /**
    * Set variables up before form is built
    *
-   * @param null
-   *
    * @return void
-   * @access public
    */
   public function preProcess() {
     $this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this);
@@ -107,12 +101,10 @@ class CRM_Custom_Form_Option extends CRM_Core_Form {
    * Set default values for the form. Note that in edit/view mode
    * the default values are retrieved from the database
    *
-   * @param null
-   *
-   * @return array   array of default values
-   * @access public
+   * @return array
+   *   array of default values
    */
-  function setDefaultValues() {
+  public function setDefaultValues() {
     $defaults = $fieldDefaults = array();
     if (isset($this->_id)) {
       $params = array('id' => $this->_id);
@@ -155,10 +147,7 @@ class CRM_Custom_Form_Option extends CRM_Core_Form {
   /**
    * Build the form object
    *
-   * @param null
-   *
    * @return void
-   * @access public
    */
   public function buildQuickForm() {
     if ($this->_action == CRM_Core_Action::DELETE) {
@@ -224,7 +213,6 @@ class CRM_Custom_Form_Option extends CRM_Core_Form {
         )
       );
 
-
       // if view mode pls freeze it with the done button.
       if ($this->_action & CRM_Core_Action::VIEW) {
         $this->freeze();
@@ -245,19 +233,19 @@ class CRM_Custom_Form_Option extends CRM_Core_Form {
   /**
    * Global validation rules for the form
    *
-   * @param array $fields posted values of the form
+   * @param array $fields
+   *   Posted values of the form.
    *
    * @param $files
    * @param CRM_Core_Form $form
    *
-   * @return array list of errors to be posted back to the form
-   * @static
-   * @access public
+   * @return array
+   *   list of errors to be posted back to the form
    */
-  static function formRule($fields, $files, $form) {
-    $optionLabel   = $fields['label'];
-    $optionValue   = $fields['value'];
-    $fieldId       = $form->_fid;
+  public static function formRule($fields, $files, $form) {
+    $optionLabel = $fields['label'];
+    $optionValue = $fields['value'];
+    $fieldId = $form->_fid;
     $optionGroupId = $form->_optionGroupID;
 
     $temp = array();
@@ -398,10 +386,7 @@ SELECT count(*)
   /**
    * Process the form
    *
-   * @param null
-   *
    * @return void
-   * @access public
    */
   public function postProcess() {
     // store the submitted values in an array
@@ -432,8 +417,8 @@ SELECT count(*)
     }
 
     $fieldValues = array('option_group_id' => $this->_optionGroupID);
-    $customOption->weight =
-      CRM_Utils_Weight::updateOtherWeights(
+    $customOption->weight
+      CRM_Utils_Weight::updateOtherWeights(
         'CRM_Core_DAO_OptionValue',
         $oldWeight,
         $params['weight'],
@@ -463,8 +448,8 @@ SELECT count(*)
           else {
             $defVal[] = $customOption->value;
           }
-          $customField->default_value =
-            CRM_Core_DAO::VALUE_SEPARATOR .
+          $customField->default_value
+            CRM_Core_DAO::VALUE_SEPARATOR .
             implode(CRM_Core_DAO::VALUE_SEPARATOR, $defVal) .
             CRM_Core_DAO::VALUE_SEPARATOR;
           $customField->save();
@@ -478,8 +463,8 @@ SELECT count(*)
           }
         }
 
-        $customField->default_value =
-          CRM_Core_DAO::VALUE_SEPARATOR .
+        $customField->default_value
+          CRM_Core_DAO::VALUE_SEPARATOR .
           implode(CRM_Core_DAO::VALUE_SEPARATOR, $tempVal) .
           CRM_Core_DAO::VALUE_SEPARATOR;
         $customField->save();
@@ -528,4 +513,3 @@ SELECT count(*)
     }
   }
 }
-