<commit_before><?php

/**
 * Form controller class
 *
 * @see https://wiki.civicrm.org/confluence/display/CRMDOC/QuickForm+Reference
 */
class CRM_Fieldconditions_Form_FieldFilterValue extends CRM_Core_Form {
  public function buildQuickForm() {

    $map_id = CRM_Utils_Array::value('map_id', $_REQUEST);

    $dao = CRM_Core_DAO::executeQuery('SELECT map.*,
        fsrc.option_group_id as source_option_group_id,
        fdst.option_group_id as dest_option_group_id
      FROM civicrm_fieldcondition_map map
      LEFT JOIN civicrm_custom_field fsrc ON (fsrc.id = map.source_field_id)
      LEFT JOIN civicrm_custom_field fdst ON (fdst.id = map.dest_field_id)
      WHERE map.id = %1', [
      1 => [$map_id, 'Positive'],
    ]);
<commit_msg>CRM/Fieldconditions/Form/FieldFilterValue: add support to pass a source value, to make it easier to add a value in a specific category.<commit_after><?php

/**
 * Form controller class
 *
 * @see https://wiki.civicrm.org/confluence/display/CRMDOC/QuickForm+Reference
 */
class CRM_Fieldconditions_Form_FieldFilterValue extends CRM_Core_Form {

  public function setDefaultValues() {
    $defaults = [];

    $source_value = CRM_Utils_Array::value('source_value', $_REQUEST);

    if ($source_value) {
      $defaults['source_option'] = intval($source_value);
    }

    return $defaults;
  }

  public function buildQuickForm() {
    $map_id = CRM_Utils_Array::value('map_id', $_REQUEST);

    $dao = CRM_Core_DAO::executeQuery('SELECT map.*,
        fsrc.option_group_id as source_option_group_id,
        fdst.option_group_id as dest_option_group_id
      FROM civicrm_fieldcondition_map map
      LEFT JOIN civicrm_custom_field fsrc ON (fsrc.id = map.source_field_id)
      LEFT JOIN civicrm_custom_field fdst ON (fdst.id = map.dest_field_id)
      WHERE map.id = %1', [
      1 => [$map_id, 'Positive'],
    ]);

{'fraction_non_alphanumeric': 0.10800644814615798, 'fraction_numerical': 0.0021493820526598604, 'mean_word_length': 3.965333333333333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6072305', 'n_tokens_mistral': 638, 'n_tokens_neox': 602, 'n_words': 128}