<?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$
*
*/
}
}
- if (CRM_Utils_Array::value('mem_price_field_id', $defaults)) {
+ if (!empty($defaults['mem_price_field_id'])) {
$options = array();
$priceFieldOptions = CRM_Price_BAO_PriceFieldValue::getValues($defaults['mem_price_field_id'], $options, 'id', 1);
foreach ($options as $k => $v) {
$this->assign('auto_renew', $this->_renewOption);
}
$this->addGroup($membership, 'membership_type', ts('Membership Types'));
- $this->addGroup($membershipDefault, 'membership_type_default', ts('Membership Types Default'));
+ $this->addGroup($membershipDefault, 'membership_type_default', ts('Membership Types Default'))->setAttribute('allowClear', TRUE);
$this->addFormRule(array('CRM_Member_Form_MembershipBlock', 'formRule'), $this->_id);
}
*
* @param array $params (ref.) an assoc array of name/value pairs
*
+ * @param $files
+ * @param null $contributionPageId
+ *
* @return mixed true or array of errors
* @access public
* @static
static function formRule($params, $files, $contributionPageId = NULL) {
$errors = array();
- if (CRM_Utils_Array::value('member_price_set_id', $params)) {
+ if (!empty($params['member_price_set_id'])) {
//check if this price set has membership type both auto-renew and non-auto-renew memberships.
$bothTypes = CRM_Price_BAO_PriceSet::checkMembershipPriceSet($params['member_price_set_id']);
}
}
}
- if (CRM_Utils_Array::value('member_is_active', $params)) {
+ if (!empty($params['member_is_active'])) {
// don't allow price set w/ membership signup, CRM-5095
if ($contributionPageId && ($setID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $contributionPageId, NULL, 1))) {
}
}
- if ($contributionPageId && CRM_Utils_Array::value('member_price_set_id', $params) &&
+ if ($contributionPageId && !empty($params['member_price_set_id']) &&
CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'amount_block_is_active')) {
$errors['member_price_set_id'] = ts('You cannot use Membership Price Sets with the Contribution Amounts section. However, a membership price set may include additional fields for non-membership options that requires an additional fee (e.g. magazine subscription) or an additional voluntary contribution.');
}
- if (CRM_Utils_Array::value('member_price_set_id', $params)) {
+ if (!empty($params['member_price_set_id'])) {
return $errors;
}
if ($contributionPageId) {
$amountBlock = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'amount_block_is_active');
- if (!$amountBlock && CRM_Utils_Array::value('is_separate_payment', $params)) {
+ if (!$amountBlock && !empty($params['is_separate_payment'])) {
$errors['is_separate_payment'] = ts('Please enable the contribution amount section to use this option.');
}
}
// check for price set.
$priceSetID = CRM_Utils_Array::value('member_price_set_id', $params);
- if (CRM_Utils_Array::value('member_is_active', $params) && is_array($membershipTypes) && !$priceSetID) {
+ if (!empty($params['member_is_active']) && is_array($membershipTypes) && !$priceSetID) {
$usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 2);
- if (!CRM_Utils_Array::value('mem_price_field_id', $params) && !$usedPriceSetId) {
+ if (empty($params['mem_price_field_id']) && !$usedPriceSetId) {
$pageTitle = strtolower(CRM_Utils_String::munge($this->_values['title'], '_', 245));
$setParams['title'] = $this->_values['title'];
if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $pageTitle, 'id', 'name')) {
);
$editedResults = array();
CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
- if (!CRM_Utils_Array::value('id', $editedResults)) {
+ if (empty($editedResults['id'])) {
$fieldParams['name'] = strtolower(CRM_Utils_String::munge('Membership Amount', '_', 245));
- $fieldParams['label'] = CRM_Utils_Array::value('new_title', $params) ? $params['new_title'] : ts('Membership');
- if (!CRM_Utils_Array::value('mem_price_field_id', $params)) {
+ $fieldParams['label'] = !empty($params['new_title']) ? $params['new_title'] : ts('Membership');
+ if (empty($params['mem_price_field_id'])) {
CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceField', 0, 1, array('price_set_id' => $priceSetID));
}
$fieldParams['weight'] = 1;
$fieldParams['is_active'] = 1;
$fieldParams['html_type'] = 'Radio';
- $fieldParams['is_required'] = CRM_Utils_Array::value('is_required', $params) ? 1 : 0;
- $fieldParams['is_display_amounts'] = CRM_Utils_Array::value('display_min_fee', $params) ? 1 : 0;
+ $fieldParams['is_required'] = !empty($params['is_required']) ? 1 : 0;
+ $fieldParams['is_display_amounts'] = !empty($params['display_min_fee']) ? 1 : 0;
$rowCount = 1;
$options = array();
- if (CRM_Utils_Array::value('id', $fieldParams)) {
+ if (!empty($fieldParams['id'])) {
CRM_Core_PseudoConstant::populate($options, 'CRM_Price_DAO_PriceFieldValue', TRUE, 'membership_type_id', NULL, " price_field_id = {$fieldParams['id']} ");
}
);
CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceField', $conditionParams, $pFIDs);
- if (!CRM_Utils_Array::value('id', $pFIDs)) {
+ if (empty($pFIDs['id'])) {
CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $this->_id);
CRM_Price_BAO_PriceSet::setIsQuickConfig($this->_memPriceSetId, '0');
}