*/
function setDefaultValues() {
$defaults = parent::setDefaultValues();
+ $soft_credit_types = CRM_Core_OptionGroup::values('soft_credit_type', TRUE, FALSE, FALSE, NULL, 'name');
if ($this->_id) {
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage',
}
}
}
+ else {
+ $ufGroupDAO = new CRM_Core_DAO_UFGroup();
+ $ufGroupDAO->name = 'honoree_individual';
+ if ($ufGroupDAO->find(TRUE)) {
+ $defaults['honoree_profile'] = $ufGroupDAO->id;
+ }
+ $defaults['soft_credit_types'] = array(
+ CRM_Utils_Array::value('in_honor_of', $soft_credit_types),
+ CRM_Utils_Array::value('in_memory_of', $soft_credit_types)
+ );
+ }
}
else {
CRM_Utils_System::setTitle(ts('Title and Settings'));
- }
- if (!CRM_Utils_Array::value('soft_credit_types', $defaults)) {
- $defaults['soft_credit_types'] = array(1, 2);
+ $ufGroupDAO = new CRM_Core_DAO_UFGroup();
+ $ufGroupDAO->name = 'honoree_individual';
+ if ($ufGroupDAO->find(TRUE)) {
+ $defaults['honoree_profile'] = $ufGroupDAO->id;
+ }
+ $defaults['soft_credit_types'] = array(
+ CRM_Utils_Array::value('in_honor_of', $soft_credit_types),
+ CRM_Utils_Array::value('in_memory_of', $soft_credit_types)
+ );
}
return $defaults;
$this->addProfileSelector('honoree_profile', ts('Honoree Profile'), $allowCoreTypes, $allowSubTypes, $entities);
- if (CRM_Utils_Array::value('honor_block_is_active', $this->_submitValues)) {
+ if (!empty($this->_submitValues['honor_block_is_active'])) {
$this->addRule('soft_credit_types', ts('At least one value must be selected if Honor Section is active'), 'required');
$this->addRule('honoree_profile', ts('Please select a profile used for honoree'), 'required');
}
$errors['title'] = ts("Please do not use '/' in Title");
}
- if (CRM_Utils_Array::value('is_organization', $values) &&
- !CRM_Utils_Array::value('onbehalf_profile_id', $values)
- ) {
+ if (!empty($values['is_organization']) && empty($values['onbehalf_profile_id'])) {
$errors['onbehalf_profile_id'] = ts('Please select a profile to collect organization information on this contribution page.');
}
$errors['end_date'] = ts('End date should be after Start date.');
}
- if (CRM_Utils_Array::value('payment_processor', $self->_values)
- && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($values['financial_type_id'])) {
+ if (!empty($self->_values['payment_processor']) && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($values['financial_type_id'])) {
$errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType;
}
//dont allow on behalf of save when
//pre or post profile consists of membership fields
- if ($contributionPageId && CRM_Utils_Array::value('is_organization', $values)) {
+ if ($contributionPageId && !empty($values['is_organization'])) {
$ufJoinParams = array(
'module' => 'CiviContribute',
'entity_table' => 'civicrm_contribution_page',
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, FALSE);
$params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, FALSE);
- $params['is_for_organization'] = CRM_Utils_Array::value('is_organization', $params) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
+ $params['is_for_organization'] = !empty($params['is_organization']) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'], TRUE);
$params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], TRUE);
foreach ($ufJoinParams as $index => $ufJoinParam) {
- if (CRM_Utils_Array::value($index, $params)) {
+ if (!empty($params[$index])) {
$ufJoinParam['weight'] = 1;
if ($index == 'honor_block_is_active') {
$ufJoinParam['is_active'] = 1;