本文整理汇总了PHP中CRM_Core_BAO_OptionValue::ensureOptionValueExists方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_OptionValue::ensureOptionValueExists方法的具体用法?PHP CRM_Core_BAO_OptionValue::ensureOptionValueExists怎么用?PHP CRM_Core_BAO_OptionValue::ensureOptionValueExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_OptionValue
的用法示例。
在下文中一共展示了CRM_Core_BAO_OptionValue::ensureOptionValueExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testEnsureOptionValueExistsDisabled
/**
* Ensure only one option value copes with disabled.
*
* (Our expectation is no change - ie. currently we are respecting 'someone's
* decision to disable it & leaving it in that state.
*/
public function testEnsureOptionValueExistsDisabled()
{
CRM_Core_BAO_OptionValue::ensureOptionValueExists(array('name' => 'Crashed', 'option_group_id' => 'contribution_status', 'is_active' => 0));
$value = $this->callAPISuccessGetSingle('OptionValue', array('name' => 'Crashed', 'option_group_id' => 'contribution_status'));
$this->assertEquals(0, $value['is_active']);
CRM_Core_BAO_OptionValue::ensureOptionValueExists(array('name' => 'Crashed', 'option_group_id' => 'contribution_status'));
$value = $this->callAPISuccessGetSingle('OptionValue', array('name' => 'Crashed', 'option_group_id' => 'contribution_status'));
$this->assertEquals(0, $value['is_active']);
}
示例2: addRefundAndChargeBackAccountsIfNotExist
/**
* CRM-17951 Add accounts option values for refund and chargeback.
*
* Add Chargeback contribution status and Chargeback and Contra account relationships,
* checking first if one exists.
*/
public function addRefundAndChargeBackAccountsIfNotExist()
{
// First we enable and edit the record for Credit contra - this exists but is disabled for most sites.
// Using the ensure function (below) will not enabled a disabled option (by design).
CRM_Core_DAO::executeQuery("UPDATE civicrm_option_value v\n INNER JOIN civicrm_option_group g on v.option_group_id=g.id and g.name='account_relationship'\n SET v.is_active=1, v.label='Credit/Contra Revenue Account is', v.name='Credit/Contra Revenue Account is', v.description='Credit/Contra Revenue Account is'\n WHERE v.name = 'Credit/Contra Account is';");
CRM_Core_BAO_OptionValue::ensureOptionValueExists(array('option_group_id' => 'account_relationship', 'name' => 'Chargeback Account is', 'label' => ts('Chargeback Account is'), 'is_active' => TRUE, 'component_id' => 'CiviContribute'));
CRM_Core_BAO_OptionValue::ensureOptionValueExists(array('option_group_id' => 'contribution_status', 'name' => 'Chargeback', 'label' => ts('Chargeback'), 'is_active' => TRUE, 'component_id' => 'CiviContribute'));
return TRUE;
}
示例3: addDeletedByMergeActivityType
/**
* CRM-18124 Add index to civicrm_contribution.total_amount.
*
* Note that I made this a combined index with receive_date because the issue included
* both criteria and they seemed likely to be used in conjunction to me in other cases.
*
* @param \CRM_Queue_TaskContext $ctx
*
* @return bool
*/
public function addDeletedByMergeActivityType(CRM_Queue_TaskContext $ctx)
{
CRM_Core_BAO_OptionValue::ensureOptionValueExists(array('option_group_id' => 'activity_type', 'name' => 'Contact Deleted by Merge', 'label' => ts('Contact Deleted by Merge'), 'description' => ts('Contact was merged into another contact'), 'is_active' => TRUE, 'filter' => 1));
return TRUE;
}