Exemplo n.º 1
0
 /**
  * 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']);
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * 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;
 }