CRM add remaining missing comment blocks (autogenerated)
[civicrm-core.git] / CRM / Export / Form / Select.php
index 678e3f9f9f0a738cea2a6eafc4573ba3d56d80ef..03dcb9912808eb9ce2e0e8630696b1600f4ab60a 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -112,8 +112,30 @@ class CRM_Export_Form_Select extends CRM_Core_Form {
       $components    = array('Contribute', 'Member', 'Event', 'Pledge', 'Case', 'Grant', 'Activity');
 
       if (in_array($componentName[1], $components)) {
-        $fieldName = strtoupper($componentName[1]) . '_EXPORT';
-        $this->_exportMode = self::$fieldName;
+        switch ($componentName[1]) {
+          case 'Contribute':
+            $this->_exportMode = self::CONTRIBUTE_EXPORT;
+            break;
+          case 'Member':
+            $this->_exportMode = self::MEMBER_EXPORT;
+            break;
+          case 'Event':
+            $this->_exportMode = self::EVENT_EXPORT;
+            break;
+          case 'Pledge':
+            $this->_exportMode = self::PLEDGE_EXPORT;
+            break;
+          case 'Case':
+            $this->_exportMode = self::CASE_EXPORT;
+            break;
+          case 'Grant':
+            $this->_exportMode = self::GRANT_EXPORT;
+            break;
+          case 'Activity':
+            $this->_exportMode = self::ACTIVITY_EXPORT;
+            break;
+        }
+
         $className = "CRM_{$componentName[1]}_Form_Task";
         $className::preProcessCommon( $this, true );
         $values = $this->controller->exportValues('Search');
@@ -313,6 +335,9 @@ FROM   {$this->_componentTable}
    *
    * @param array $params (ref.) an assoc array of name/value pairs
    *
+   * @param $files
+   * @param $self
+   *
    * @return mixed true or array of errors
    * @access public
    * @static
@@ -331,9 +356,7 @@ FROM   {$this->_componentTable}
       foreach ($greetings as $key => $value) {
         $otherOption = CRM_Utils_Array::value($key, $params);
 
-        if ((CRM_Utils_Array::value($otherOption, $self->_greetingOptions[$key]) == ts('Other')) &&
-          !CRM_Utils_Array::value($value, $params)
-        ) {
+        if ((CRM_Utils_Array::value($otherOption, $self->_greetingOptions[$key]) == ts('Other')) && empty($params[$value])) {
 
           $label = ucwords(str_replace('_', ' ', $key));
           $errors[$value] = ts('Please enter a value for %1 (merging > 2 contacts), or select a pre-configured option from the list.', array(1 => $label));
@@ -468,6 +491,9 @@ FROM   {$this->_componentTable}
     }
   }
 
+  /**
+   * @return array
+   */
   static function getGreetingOptions() {
     $options = array();
     $greetings = array(