<?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. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
}
else {
// we need to determine component export
- $stateMachine = &$this->controller->getStateMachine();
+ $stateMachine = $this->controller->getStateMachine();
+
$formName = CRM_Utils_System::getClassName($stateMachine);
$componentName = explode('_', $formName);
$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');
*
* @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
*/
- public function formRule($params, $files, $self) {
+ static public function formRule($params, $files, $self) {
$errors = array();
if (CRM_Utils_Array::value('mergeOption', $params) == self::EXPORT_MERGE_SAME_ADDRESS &&
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));
}
}
+ /**
+ * @return array
+ */
static function getGreetingOptions() {
$options = array();
$greetings = array(