本文整理汇总了PHP中CRM_Price_BAO_PriceSet::setIsQuickConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Price_BAO_PriceSet::setIsQuickConfig方法的具体用法?PHP CRM_Price_BAO_PriceSet::setIsQuickConfig怎么用?PHP CRM_Price_BAO_PriceSet::setIsQuickConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Price_BAO_PriceSet
的用法示例。
在下文中一共展示了CRM_Price_BAO_PriceSet::setIsQuickConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* Process the form.
*/
public function postProcess()
{
$eventTitle = '';
$params = $this->exportValues();
$this->set('discountSection', 0);
if (!empty($_POST['_qf_Fee_submit'])) {
$this->buildAmountLabel();
$this->set('discountSection', 2);
return;
}
if (!empty($params['payment_processor'])) {
$params['payment_processor'] = str_replace(',', CRM_Core_DAO::VALUE_SEPARATOR, $params['payment_processor']);
} else {
$params['payment_processor'] = 'null';
}
$params['is_pay_later'] = CRM_Utils_Array::value('is_pay_later', $params, 0);
$params['is_billing_required'] = CRM_Utils_Array::value('is_billing_required', $params, 0);
if ($this->_id) {
// delete all the prior label values or discounts in the custom options table
// and delete a price set if one exists
//@todo note that this removes the reference from existing participants -
// even where there is not change - redress?
// note that a more tentative form of this is invoked by passing price_set_id as an array
// to event.create see CRM-14069
// @todo get all of this logic out of form layer (currently partially in BAO/api layer)
if (CRM_Price_BAO_PriceSet::removeFrom('civicrm_event', $this->_id)) {
CRM_Core_BAO_Discount::del($this->_id, 'civicrm_event');
}
}
if ($params['is_monetary']) {
if (!empty($params['price_set_id'])) {
//@todo this is now being done in the event BAO if passed price_set_id as an array
// per notes on that fn - looking at the api converting to an array
// so calling via the api may cause this to be done in the api
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_id, $params['price_set_id']);
if (!empty($params['price_field_id'])) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id');
CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0);
}
} else {
// if there are label / values, create custom options for them
$labels = CRM_Utils_Array::value('label', $params);
$values = CRM_Utils_Array::value('value', $params);
$default = CRM_Utils_Array::value('default', $params);
$options = array();
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (!empty($labels[$i]) && !CRM_Utils_System::isNull($values[$i])) {
$options[] = array('label' => trim($labels[$i]), 'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i])), 'weight' => $i, 'is_active' => 1, 'is_default' => $default == $i);
}
}
if (!empty($options)) {
$params['default_fee_id'] = NULL;
if (empty($params['price_set_id'])) {
if (empty($params['price_field_id'])) {
$setParams['title'] = $eventTitle = $this->_isTemplate ? $this->_defaultValues['template_title'] : $this->_defaultValues['title'];
$eventTitle = strtolower(CRM_Utils_String::munge($eventTitle, '_', 245));
if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle, 'id', 'name')) {
$setParams['name'] = $eventTitle;
} elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle . '_' . $this->_id, 'id', 'name')) {
$setParams['name'] = $eventTitle . '_' . $this->_id;
} else {
$timeSec = explode('.', microtime(TRUE));
$setParams['name'] = $eventTitle . '_' . date('is', $timeSec[0]) . $timeSec[1];
}
$setParams['is_quick_config'] = 1;
$setParams['financial_type_id'] = $params['financial_type_id'];
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviEvent');
$priceSet = CRM_Price_BAO_PriceSet::create($setParams);
$fieldParams['name'] = strtolower(CRM_Utils_String::munge($params['fee_label'], '_', 245));
$fieldParams['price_set_id'] = $priceSet->id;
} else {
foreach ($params['price_field_value'] as $arrayID => $fieldValueID) {
if (empty($params['label'][$arrayID]) && empty($params['value'][$arrayID]) && !empty($fieldValueID)) {
CRM_Price_BAO_PriceFieldValue::setIsActive($fieldValueID, '0');
unset($params['price_field_value'][$arrayID]);
}
}
$fieldParams['id'] = CRM_Utils_Array::value('price_field_id', $params);
$fieldParams['option_id'] = $params['price_field_value'];
$priceSet = new CRM_Price_BAO_PriceSet();
$priceSet->id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('price_field_id', $params), 'price_set_id');
if ($this->_defaultValues['financial_type_id'] != $params['financial_type_id']) {
CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceSet', $priceSet->id, 'financial_type_id', $params['financial_type_id']);
}
}
$fieldParams['label'] = $params['fee_label'];
$fieldParams['html_type'] = 'Radio';
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_id, $priceSet->id);
$fieldParams['option_label'] = $params['label'];
$fieldParams['option_amount'] = $params['value'];
$fieldParams['financial_type_id'] = $params['financial_type_id'];
foreach ($options as $value) {
$fieldParams['option_weight'][$value['weight']] = $value['weight'];
}
$fieldParams['default_option'] = $params['default'];
$priceField = CRM_Price_BAO_PriceField::create($fieldParams);
//.........这里部分代码省略.........
示例2: postProcess
//.........这里部分代码省略.........
$setParams['name'] = $pageTitle . '_' . $this->_id;
} else {
$timeSec = explode(".", microtime(TRUE));
$setParams['name'] = $pageTitle . '_' . date('is', $timeSec[0]) . $timeSec[1];
}
$setParams['is_quick_config'] = 1;
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviMember');
$setParams['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $this->_values);
$priceSet = CRM_Price_BAO_PriceSet::create($setParams);
$priceSetID = $priceSet->id;
$fieldParams['price_set_id'] = $priceSet->id;
} elseif ($usedPriceSetId) {
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviMember');
$setParams['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $this->_values);
$setParams['id'] = $usedPriceSetId;
$priceSet = CRM_Price_BAO_PriceSet::create($setParams);
$priceSetID = $priceSet->id;
$fieldParams['price_set_id'] = $priceSet->id;
} else {
$fieldParams['id'] = CRM_Utils_Array::value('mem_price_field_id', $params);
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('mem_price_field_id', $params), 'price_set_id');
}
$editedFieldParams = array('price_set_id' => $priceSetID, 'name' => 'membership_amount');
$editedResults = array();
CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
if (empty($editedResults['id'])) {
$fieldParams['name'] = strtolower(CRM_Utils_String::munge('Membership Amount', '_', 245));
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;
} else {
$fieldParams['id'] = CRM_Utils_Array::value('id', $editedResults);
}
$fieldParams['label'] = !empty($params['membership_type_label']) ? $params['membership_type_label'] : ts('Membership');
$fieldParams['is_active'] = 1;
$fieldParams['html_type'] = 'Radio';
$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 (!empty($fieldParams['id'])) {
CRM_Core_PseudoConstant::populate($options, 'CRM_Price_DAO_PriceFieldValue', TRUE, 'membership_type_id', NULL, " price_field_id = {$fieldParams['id']} ");
}
foreach ($membershipTypes as $memType => $memAutoRenew) {
if ($priceFieldID = CRM_Utils_Array::key($memType, $options)) {
$fieldParams['option_id'][$rowCount] = $priceFieldID;
unset($options[$priceFieldID]);
}
$membetype = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($memType);
$fieldParams['option_label'][$rowCount] = CRM_Utils_Array::value('name', $membetype);
$fieldParams['option_amount'][$rowCount] = CRM_Utils_Array::value('minimum_fee', $membetype, 0);
$fieldParams['option_weight'][$rowCount] = CRM_Utils_Array::value('weight', $membetype);
$fieldParams['option_description'][$rowCount] = CRM_Utils_Array::value('description', $membetype);
$fieldParams['default_option'] = CRM_Utils_Array::value('membership_type_default', $params);
$fieldParams['option_financial_type_id'][$rowCount] = CRM_Utils_Array::value('financial_type_id', $membetype);
$fieldParams['membership_type_id'][$rowCount] = $memType;
// [$rowCount] = $membetype[''];
$rowCount++;
}
foreach ($options as $priceFieldID => $memType) {
CRM_Price_BAO_PriceFieldValue::setIsActive($priceFieldID, '0');
}
$priceField = CRM_Price_BAO_PriceField::create($fieldParams);
} elseif (!$priceSetID) {
$deletePriceSet = 1;
}
$params['is_required'] = CRM_Utils_Array::value('is_required', $params, FALSE);
$params['is_active'] = CRM_Utils_Array::value('member_is_active', $params, FALSE);
if ($priceSetID) {
$params['membership_types'] = 'null';
$params['membership_type_default'] = CRM_Utils_Array::value('membership_type_default', $params, 'null');
$params['membership_types'] = serialize($membershipTypes);
$params['display_min_fee'] = CRM_Utils_Array::value('display_min_fee', $params, FALSE);
$params['is_separate_payment'] = CRM_Utils_Array::value('is_separate_payment', $params, FALSE);
}
$params['entity_table'] = 'civicrm_contribution_page';
$params['entity_id'] = $this->_id;
$dao = new CRM_Member_DAO_MembershipBlock();
$dao->copyValues($params);
$dao->save();
if ($priceSetID && $params['is_active']) {
CRM_Price_BAO_PriceSet::addTo('civicrm_contribution_page', $this->_id, $priceSetID);
}
if ($deletePriceSet || !CRM_Utils_Array::value('member_is_active', $params, FALSE)) {
if ($this->_memPriceSetId) {
$pFIDs = array();
$conditionParams = array('price_set_id' => $this->_memPriceSetId, 'html_type' => 'radio', 'name' => 'contribution_amount');
CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceField', $conditionParams, $pFIDs);
if (empty($pFIDs['id'])) {
CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $this->_id);
CRM_Price_BAO_PriceSet::setIsQuickConfig($this->_memPriceSetId, '0');
} else {
CRM_Price_BAO_PriceField::setIsActive($params['mem_price_field_id'], '0');
}
}
}
}
parent::endPostProcess();
}
示例3: setIsQuickConfig
/**
* Change is_quick_config priceSet to complex.
*
*/
public static function setIsQuickConfig()
{
$id = $context = NULL;
if (!empty($_REQUEST['id'])) {
$id = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer');
}
if (!empty($_REQUEST['context'])) {
$context = CRM_Utils_Type::escape($_REQUEST['context'], 'String');
}
// return false if $id is null and
// $context is not civicrm_event or civicrm_contribution_page
if (!$id || !in_array($context, array('civicrm_event', 'civicrm_contribution_page'))) {
return FALSE;
}
$priceSetId = CRM_Price_BAO_PriceSet::getFor($context, $id, NULL);
if ($priceSetId) {
$result = CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetId, 0);
if ($context == 'civicrm_event') {
$sql = "UPDATE\n civicrm_price_set cps\n INNER JOIN civicrm_discount cd ON cd.price_set_id = cps.id\n SET cps.is_quick_config = 0\n WHERE cd.entity_id = (%1) AND cd.entity_table = 'civicrm_event' ";
$params = array(1 => array($id, 'Integer'));
CRM_Core_DAO::executeQuery($sql, $params);
CRM_Core_BAO_Discount::del($id, $context);
}
}
if (!$result) {
$priceSetId = NULL;
}
CRM_Utils_JSON::output($priceSetId);
}
示例4: postProcess
//.........这里部分代码省略.........
$fieldParams['option_label'] = $params['label'];
$fieldParams['option_amount'] = $params['value'];
$fieldParams['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $this->_values);
foreach ($options as $value) {
$fieldParams['option_weight'][$value['weight']] = $value['weight'];
}
$fieldParams['default_option'] = $params['default'];
$priceField = CRM_Price_BAO_PriceField::create($fieldParams);
}
if (!empty($params['is_allow_other_amount']) && empty($params['price_field_other'])) {
$editedFieldParams = array('price_set_id' => $priceSetId, 'name' => 'other_amount');
$editedResults = array();
CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
if (!($priceFieldID = CRM_Utils_Array::value('id', $editedResults))) {
$fieldParams = array('name' => 'other_amount', 'label' => ts('Other Amount'), 'price_set_id' => $priceSetId, 'html_type' => 'Text', 'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $this->_values), 'is_display_amounts' => 0, 'weight' => 3);
$fieldParams['option_weight'][1] = 1;
$fieldParams['option_amount'][1] = 1;
if (!$noContriAmount) {
$fieldParams['is_required'] = 1;
$fieldParams['option_label'][1] = $fieldParams['label'] = $params['amount_label'];
} else {
$fieldParams['is_required'] = 0;
$fieldParams['option_label'][1] = $fieldParams['label'] = ts('Other Amount');
}
$priceField = CRM_Price_BAO_PriceField::create($fieldParams);
} else {
if (empty($editedResults['is_active'])) {
$fieldParams = $editedResults;
if (!$noContriAmount) {
$priceFieldValueID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldID, 'id', 'price_field_id');
CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldValueID, 'label', $params['amount_label']);
$fieldParams = array('is_required' => 1, 'label' => $params['amount_label'], 'id' => $priceFieldID);
}
$fieldParams['is_active'] = 1;
$priceField = CRM_Price_BAO_PriceField::add($fieldParams);
}
}
} elseif (empty($params['is_allow_other_amount']) && !empty($params['price_field_other'])) {
CRM_Price_BAO_PriceField::setIsActive($params['price_field_other'], '0');
} elseif ($priceFieldID = CRM_Utils_Array::value('price_field_other', $params)) {
$priceFieldValueID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldID, 'id', 'price_field_id');
if (!$noContriAmount) {
$fieldParams = array('is_required' => 1, 'label' => $params['amount_label'], 'id' => $priceFieldID);
CRM_Price_BAO_PriceField::add($fieldParams);
CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldValueID, 'label', $params['amount_label']);
} else {
CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceField', $priceFieldID, 'is_required', 0);
CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldValueID, 'label', ts('Other Amount'));
}
}
}
if (!empty($params['is_pledge_active'])) {
$deletePledgeBlk = FALSE;
$pledgeBlockParams = array('entity_id' => $contributionPageID, 'entity_table' => ts('civicrm_contribution_page'));
if ($this->_pledgeBlockID) {
$pledgeBlockParams['id'] = $this->_pledgeBlockID;
}
$pledgeBlock = array('pledge_frequency_unit', 'max_reminders', 'initial_reminder_day', 'additional_reminder_day');
foreach ($pledgeBlock as $key) {
$pledgeBlockParams[$key] = CRM_Utils_Array::value($key, $params);
}
$pledgeBlockParams['is_pledge_interval'] = CRM_Utils_Array::value('is_pledge_interval', $params, FALSE);
// create pledge block.
CRM_Pledge_BAO_PledgeBlock::create($pledgeBlockParams);
}
}
} else {
if (!empty($params['price_field_id']) || !empty($params['price_field_other'])) {
$usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3);
if ($usedPriceSetId) {
if (!empty($params['price_field_id'])) {
CRM_Price_BAO_PriceField::setIsActive($params['price_field_id'], '0');
}
if (!empty($params['price_field_other'])) {
CRM_Price_BAO_PriceField::setIsActive($params['price_field_other'], '0');
}
} else {
$deleteAmountBlk = TRUE;
$deletePriceSet = TRUE;
}
}
}
// delete pledge block.
if ($deletePledgeBlk) {
CRM_Pledge_BAO_PledgeBlock::deletePledgeBlock($this->_pledgeBlockID);
}
// delete previous price set.
if ($deletePriceSet) {
CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $contributionPageID);
}
if ($deleteAmountBlk) {
$priceField = !empty($params['price_field_id']) ? $params['price_field_id'] : CRM_Utils_Array::value('price_field_other', $params);
if ($priceField) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceField, 'price_set_id');
CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0);
}
}
}
parent::endPostProcess();
}
示例5: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
$eventTitle = '';
$params = $this->exportValues();
$this->set('discountSection', 0);
if (CRM_Utils_Array::value('_qf_Fee_submit', $_POST)) {
$this->buildAmountLabel();
$this->set('discountSection', 2);
return;
}
if (array_key_exists('payment_processor', $params) && !CRM_Utils_System::isNull($params['payment_processor'])) {
$params['payment_processor'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['payment_processor']));
} else {
$params['payment_processor'] = 'null';
}
$params['is_pay_later'] = CRM_Utils_Array::value('is_pay_later', $params, 0);
if ($this->_id) {
// delete all the prior label values or discounts in the custom options table
// and delete a price set if one exists
if (CRM_Price_BAO_PriceSet::removeFrom('civicrm_event', $this->_id)) {
CRM_Core_BAO_Discount::del($this->_id, 'civicrm_event');
}
}
if ($params['is_monetary']) {
if (CRM_Utils_Array::value('price_set_id', $params)) {
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_id, $params['price_set_id']);
if (CRM_Utils_Array::value('price_field_id', $params)) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id');
CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0);
}
} else {
// if there are label / values, create custom options for them
$labels = CRM_Utils_Array::value('label', $params);
$values = CRM_Utils_Array::value('value', $params);
$default = CRM_Utils_Array::value('default', $params);
$options = array();
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (!empty($labels[$i]) && !CRM_Utils_System::isNull($values[$i])) {
$options[] = array('label' => trim($labels[$i]), 'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i])), 'weight' => $i, 'is_active' => 1, 'is_default' => $default == $i);
}
}
if (!empty($options)) {
$params['default_fee_id'] = NULL;
if (!CRM_Utils_Array::value('price_set_id', $params)) {
if (!CRM_Utils_Array::value('price_field_id', $params)) {
$setParams['title'] = $eventTitle = $this->_isTemplate ? $this->_defaultValues['template_title'] : $this->_defaultValues['title'];
$eventTitle = strtolower(CRM_Utils_String::munge($eventTitle, '_', 245));
if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle, 'id', 'name')) {
$setParams['name'] = $eventTitle;
} elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle . '_' . $this->_id, 'id', 'name')) {
$setParams['name'] = $eventTitle . '_' . $this->_id;
} else {
$timeSec = explode('.', microtime(true));
$setParams['name'] = $eventTitle . '_' . date('is', $timeSec[0]) . $timeSec[1];
}
$setParams['is_quick_config'] = 1;
$setParams['financial_type_id'] = $params['financial_type_id'];
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviEvent');
$priceSet = CRM_Price_BAO_PriceSet::create($setParams);
$fieldParams['name'] = strtolower(CRM_Utils_String::munge($params['fee_label'], '_', 245));
$fieldParams['price_set_id'] = $priceSet->id;
} else {
foreach ($params['price_field_value'] as $arrayID => $fieldValueID) {
if (empty($params['label'][$arrayID]) && empty($params['value'][$arrayID]) && !empty($fieldValueID)) {
CRM_Price_BAO_PriceFieldValue::setIsActive($fieldValueID, '0');
unset($params['price_field_value'][$arrayID]);
}
}
$fieldParams['id'] = CRM_Utils_Array::value('price_field_id', $params);
$fieldParams['option_id'] = $params['price_field_value'];
$priceSet = new CRM_Price_BAO_PriceSet();
$priceSet->id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('price_field_id', $params), 'price_set_id');
if ($this->_defaultValues['financial_type_id'] != $params['financial_type_id']) {
CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceSet', $priceSet->id, 'financial_type_id', $params['financial_type_id']);
}
}
$fieldParams['label'] = $params['fee_label'];
$fieldParams['html_type'] = 'Radio';
CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_id, $priceSet->id);
$fieldParams['option_label'] = $params['label'];
$fieldParams['option_amount'] = $params['value'];
$fieldParams['financial_type_id'] = $params['financial_type_id'];
foreach ($options as $value) {
$fieldParams['option_weight'][$value['weight']] = $value['weight'];
}
$fieldParams['default_option'] = $params['default'];
$priceField = CRM_Price_BAO_PriceField::create($fieldParams);
}
}
}
$discountPriceSets = CRM_Utils_Array::value('discount_price_set', $this->_defaultValues) ? $this->_defaultValues['discount_price_set'] : array();
$discountFieldIDs = CRM_Utils_Array::value('discount_option_id', $this->_defaultValues) ? $this->_defaultValues['discount_option_id'] : array();
if (CRM_Utils_Array::value('is_discount', $params) == 1) {
//.........这里部分代码省略.........