Exemplo n.º 1
0
 function __construct()
 {
     $yearsInPast = 10;
     $yearsInFuture = 1;
     $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
     $count = $date['maxYear'];
     while ($date['minYear'] <= $count) {
         $optionYear[$date['minYear']] = $date['minYear'];
         $date['minYear']++;
     }
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-field', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'last_name' => array('title' => ts('Last Name')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-field', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-field', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE)))) + $this->addAddressFields() + array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contact_id' => array('title' => ts('contactId'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'total_amount' => array('title' => ts('Total Amount'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'receive_date' => array('title' => ts('Year'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('yid' => array('name' => 'receive_date', 'title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => date('Y')), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1')))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group()))));
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
     }
     $this->_tagFilter = TRUE;
     parent::__construct();
 }
Exemplo n.º 2
0
 /**
  * Class constructor.
  */
 public function __construct()
 {
     // There could be multiple contacts. We not clear on which contact id to display.
     // Lets hide it for now.
     $this->_exposeContactID = FALSE;
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
         $this->engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
     }
     $this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'label', TRUE);
     asort($this->activityTypes);
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('contact_source' => array('name' => 'sort_name', 'title' => ts('Source Contact Name'), 'alias' => 'civicrm_contact_source', 'no_repeat' => TRUE), 'contact_assignee' => array('name' => 'sort_name', 'title' => ts('Assignee Contact Name'), 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.sort_name", 'default' => TRUE), 'contact_target' => array('name' => 'sort_name', 'title' => ts('Target Contact Name'), 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.sort_name", 'default' => TRUE), 'contact_source_id' => array('name' => 'id', 'alias' => 'civicrm_contact_source', 'dbAlias' => "civicrm_contact_source.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_assignee_id' => array('name' => 'id', 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_target_id' => array('name' => 'id', 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE)), 'filters' => array('contact_source' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_source', 'title' => ts('Source Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_assignee' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_assignee', 'title' => ts('Assignee Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_target' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_target', 'title' => ts('Target Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'current_user' => array('name' => 'current_user', 'title' => ts('Limit To Current User'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('contact_source_email' => array('name' => 'email', 'title' => ts('Source Contact Email'), 'alias' => 'civicrm_email_source'), 'contact_assignee_email' => array('name' => 'email', 'title' => ts('Assignee Contact Email'), 'alias' => 'civicrm_email_assignee'), 'contact_target_email' => array('name' => 'email', 'title' => ts('Target Contact Email'), 'alias' => 'civicrm_email_target')), 'order_bys' => array('source_contact_email' => array('name' => 'email', 'title' => ts('Source Contact Email'), 'dbAlias' => 'civicrm_email_contact_source_email'))), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('no_display' => TRUE, 'title' => ts('Activity ID'), 'required' => TRUE), 'source_record_id' => array('no_display' => TRUE, 'required' => TRUE), 'activity_type_id' => array('title' => ts('Activity Type'), 'required' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'activity_subject' => array('title' => ts('Subject'), 'default' => TRUE), 'activity_date_time' => array('title' => ts('Activity Date'), 'required' => TRUE), 'status_id' => array('title' => ts('Activity Status'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'duration' => array('title' => ts('Duration'), 'type' => CRM_Utils_Type::T_INT), 'details' => array('title' => ts('Activity Details'))), 'filters' => array('activity_date_time' => array('default' => 'this.month', 'operatorType' => CRM_Report_Form::OP_DATE), 'activity_subject' => array('title' => ts('Activity Subject')), 'activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityTypes), 'status_id' => array('title' => ts('Activity Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::activityStatus()), 'details' => array('title' => ts('Activity Details'), 'type' => CRM_Utils_Type::T_TEXT)), 'order_bys' => array('activity_date_time' => array('title' => ts('Activity Date'), 'default_weight' => '1', 'dbAlias' => 'civicrm_activity_activity_date_time'), 'activity_type_id' => array('title' => ts('Activity Type'), 'default_weight' => '2', 'dbAlias' => "option_value_civireport")), 'grouping' => 'activity-fields', 'alias' => 'activity'), 'civicrm_activity_contact' => array('dao' => 'CRM_Activity_DAO_ActivityContact', 'fields' => array()), 'civicrm_option_value' => array('dao' => 'CRM_Core_DAO_OptionValue', 'fields' => array(), 'status_id' => array('title' => ts('Activity Status'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'duration' => array('title' => ts('Duration'), 'type' => CRM_Utils_Type::T_INT), 'location' => array('title' => ts('Location'), 'type' => CRM_Utils_Type::T_STRING), 'details' => array('title' => ts('Activity Details'))), 'filters' => array('activity_date_time' => array('default' => 'this.month', 'operatorType' => CRM_Report_Form::OP_DATE), 'activity_subject' => array('title' => ts('Activity Subject')), 'location' => array('title' => ts('Location'), 'type' => CRM_Utils_Type::T_TEXT), 'activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityTypes), 'status_id' => array('title' => ts('Activity Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::activityStatus()), 'details' => array('title' => ts('Activity Details'), 'type' => CRM_Utils_Type::T_TEXT))) + $this->addressFields(TRUE);
     if ($campaignEnabled) {
         // Add display column and filter for Survey Results, Campaign and Engagement Index if CiviCampaign is enabled
         $this->_columns['civicrm_activity']['fields']['result'] = array('title' => 'Survey Result', 'default' => 'false');
         $this->_columns['civicrm_activity']['filters']['result'] = array('title' => ts('Survey Result'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING);
         if (!empty($this->activeCampaigns)) {
             $this->_columns['civicrm_activity']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
             $this->_columns['civicrm_activity']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         }
         if (!empty($this->engagementLevels)) {
             $this->_columns['civicrm_activity']['fields']['engagement_level'] = array('title' => 'Engagement Index', 'default' => 'false');
             $this->_columns['civicrm_activity']['filters']['engagement_level'] = array('title' => ts('Engagement Index'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->engagementLevels);
         }
     }
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     $this->_tagFilterTable = 'civicrm_activity';
     parent::__construct();
 }
Exemplo n.º 3
0
 /**
  */
 public function __construct()
 {
     $this->_autoIncludeIndexedFieldsAsOrderBys = 1;
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'middle_name' => array('title' => ts('Middle Name')), 'last_name' => array('title' => ts('Last Name')), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'gender_id' => array('title' => ts('Gender')), 'birth_date' => array('title' => ts('Birth Date')), 'age' => array('title' => ts('Age'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())'), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE, 'type' => CRM_Utils_Type::T_INT), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Donor Email'), 'default' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Donor Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'list_contri_id' => array('name' => 'id', 'title' => ts('Contribution ID')), 'financial_type_id' => array('title' => ts('Financial Type'), 'default' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'contribution_page_id' => array('title' => ts('Contribution Page')), 'source' => array('title' => ts('Source')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'check_number' => array('title' => ts('Check Number')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'receive_date' => array('default' => TRUE), 'receipt_date' => NULL, 'total_amount' => array('title' => ts('Amount'), 'required' => TRUE, 'statistics' => array('sum' => ts('Amount'))), 'fee_amount' => NULL, 'net_amount' => NULL, 'contribution_or_soft' => array('title' => ts('Contribution OR Soft Credit?'), 'dbAlias' => "'Contribution'"), 'soft_credits' => array('title' => ts('Soft Credits'), 'dbAlias' => "NULL"), 'soft_credit_for' => array('title' => ts('Soft Credit For'), 'dbAlias' => "NULL")), 'filters' => array('contribution_or_soft' => array('title' => ts('Contribution OR Soft Credit?'), 'clause' => "(1)", 'operatorType' => CRM_Report_Form::OP_SELECT, 'type' => CRM_Utils_Type::T_STRING, 'options' => array('both' => ts('Both'), 'contributions_only' => ts('Contributions Only'), 'soft_credits_only' => ts('Soft Credits Only'))), 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType(), 'type' => CRM_Utils_Type::T_INT), 'contribution_page_id' => array('title' => ts('Contribution Page'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionPage(), 'type' => CRM_Utils_Type::T_INT), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument(), 'type' => CRM_Utils_Type::T_INT), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Contribution Amount'))), 'order_bys' => array('financial_type_id' => array('title' => ts('Financial Type')), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Instrument')), 'receive_date' => array('title' => ts('Receive Date'))), 'grouping' => 'contri-fields'), 'civicrm_contribution_soft' => array('dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => array('soft_credit_type_id' => array('title' => ts('Soft Credit Type'))), 'filters' => array('soft_credit_type_id' => array('title' => 'Soft Credit Type', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING))), 'civicrm_contribution_ordinality' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'alias' => 'cordinality', 'filters' => array('ordinality' => array('title' => ts('Contribution Ordinality'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => array(0 => 'First by Contributor', 1 => 'Second or Later by Contributor'), 'type' => CRM_Utils_Type::T_INT))), 'civicrm_note' => array('dao' => 'CRM_Core_DAO_Note', 'fields' => array('contribution_note' => array('name' => 'note', 'title' => ts('Contribution Note'))), 'filters' => array('note' => array('name' => 'note', 'title' => ts('Contribution Note'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING)))) + $this->addAddressFields(FALSE);
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     // Don't show Batch display column and filter unless batches are being used
     $this->_allBatches = CRM_Batch_BAO_Batch::getBatches();
     if (!empty($this->_allBatches)) {
         $this->_columns['civicrm_batch']['dao'] = 'CRM_Batch_DAO_Batch';
         $this->_columns['civicrm_batch']['fields']['batch_id'] = array('name' => 'id', 'title' => ts('Batch Name'));
         $this->_columns['civicrm_batch']['filters']['bid'] = array('name' => 'id', 'title' => ts('Batch Name'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->_allBatches);
         $this->_columns['civicrm_entity_batch']['dao'] = 'CRM_Batch_DAO_EntityBatch';
         $this->_columns['civicrm_entity_batch']['fields']['entity_batch_id'] = array('name' => 'batch_id', 'default' => TRUE, 'no_display' => TRUE);
     }
     // If we have active campaigns add those elements to both the fields and filters
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_contribution']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
Exemplo n.º 4
0
 function __construct()
 {
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE, 'type' => CRM_Utils_Type::T_INT)), 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC')), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Donor Email'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Donor Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_contact_honor' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name_honor' => array('title' => ts('Honoree Name'), 'name' => 'sort_name', 'alias' => 'contacthonor', 'default' => FALSE, 'no_repeat' => TRUE), 'id_honor' => array('no_display' => TRUE, 'title' => ts('Honoree ID'), 'name' => 'id', 'alias' => 'contacthonor', 'required' => TRUE))), 'civicrm_email_honor' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email_honor' => array('title' => ts('Honoree Email'), 'name' => 'email', 'alias' => 'emailhonor', 'default' => FALSE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'default' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'trxn_id' => NULL, 'receive_date' => array('default' => TRUE), 'receipt_date' => NULL, 'honor_type_id' => array('title' => ts('Honor Type'), 'default' => FALSE), 'fee_amount' => NULL, 'net_amount' => NULL, 'total_amount' => array('title' => ts('Amount'), 'required' => TRUE, 'statistics' => array('sum' => ts('Amount')))), 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionType(), 'type' => CRM_Utils_Type::T_INT), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument(), 'type' => CRM_Utils_Type::T_INT), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Contribution Amount'))), 'order_bys' => array('contribution_type_id' => array('title' => ts('Contribution Type')), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Instrument'))), 'grouping' => 'contri-fields'), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group(), 'type' => CRM_Utils_Type::T_INT))), 'civicrm_contribution_ordinality' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'alias' => 'cordinality', 'filters' => array('ordinality' => array('title' => ts('Contribution Ordinality'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => array(0 => 'First by Contributor', 1 => 'Second or Later by Contributor'), 'type' => CRM_Utils_Type::T_INT))), 'civicrm_note' => array('dao' => 'CRM_Core_DAO_Note', 'fields' => array('contribution_note' => array('name' => 'note', 'title' => ts('Contribution Note'))), 'filters' => array('note' => array('name' => 'note', 'title' => ts('Contribution Note'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING)))) + $this->addAddressFields(FALSE);
     $this->_tagFilter = TRUE;
     // Don't show Batch display column and filter unless batches are being used
     $this->_closedBatches = CRM_Core_BAO_Batch::getBatches();
     if (!empty($this->_closedBatches)) {
         $this->_columns['civicrm_batch']['dao'] = 'CRM_Core_DAO_Batch';
         $this->_columns['civicrm_batch']['fields']['batch_id'] = array('name' => 'id', 'title' => ts('Batch Name'));
         $this->_columns['civicrm_batch']['filters']['bid'] = array('name' => 'id', 'title' => ts('Batch Name'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->_closedBatches);
         $this->_columns['civicrm_entity_batch']['dao'] = 'CRM_Core_DAO_EntityBatch';
         $this->_columns['civicrm_entity_batch']['fields']['entity_batch_id'] = array('name' => 'batch_id', 'default' => TRUE, 'no_display' => TRUE);
     }
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_contribution']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     parent::__construct();
 }
Exemplo n.º 5
0
 /**
  */
 public function __construct()
 {
     $this->_pledgeStatuses = CRM_Contribute_PseudoConstant::contributionStatus();
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Contact Name')), 'id' => array('no_display' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_pledge' => array('dao' => 'CRM_Pledge_DAO_Pledge', 'fields' => array('id' => array('no_display' => TRUE, 'required' => TRUE), 'contact_id' => array('no_display' => TRUE, 'required' => TRUE), 'financial_type_id' => array('title' => ts('Financial Type')), 'amount' => array('title' => ts('Pledge Amount'), 'required' => TRUE, 'type' => CRM_Utils_Type::T_MONEY), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'frequency_unit' => array('title' => ts('Frequency Unit')), 'installments' => array('title' => ts('Installments')), 'pledge_create_date' => array('title' => ts('Pledge Made Date')), 'start_date' => array('title' => ts('Pledge Start Date'), 'type' => CRM_Utils_Type::T_DATE), 'end_date' => array('title' => ts('Pledge End Date'), 'type' => CRM_Utils_Type::T_DATE), 'status_id' => array('title' => ts('Pledge Status'), 'required' => TRUE)), 'filters' => array('pledge_create_date' => array('title' => 'Pledge Made Date', 'operatorType' => CRM_Report_Form::OP_DATE), 'pledge_amount' => array('title' => ts('Pledged Amount'), 'operatorType' => CRM_Report_Form::OP_INT), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'sid' => array('name' => 'status_id', 'title' => ts('Pledge Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('contribution_status')), 'financial_type_id' => array('title' => ts('Financial Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()))), 'civicrm_pledge_payment' => array('dao' => 'CRM_Pledge_DAO_PledgePayment', 'fields' => array('total_paid' => array('title' => ts('Total Amount Paid'), 'type' => CRM_Utils_Type::T_MONEY), 'balance_due' => array('title' => ts('Balance Due'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_MONEY))));
     $this->_columns += $this->getAddressColumns(array('group_by' => FALSE)) + $this->getPhoneColumns();
     // If we have a campaign, build out the relevant elements
     $this->_tagFilter = TRUE;
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_pledge']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
         $this->_columns['civicrm_pledge']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_pledge']['group_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     $this->_currencyColumn = 'civicrm_pledge_currency';
     parent::__construct();
 }
Exemplo n.º 6
0
 /**
  */
 public function __construct()
 {
     $this->_rollup = 'WITH ROLLUP';
     $this->_autoIncludeIndexedFieldsAsOrderBys = 1;
     $yearsInPast = 10;
     $yearsInFuture = 1;
     $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
     $count = $date['maxYear'];
     while ($date['minYear'] <= $count) {
         $optionYear[$date['minYear']] = $date['minYear'];
         $date['minYear']++;
     }
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-field', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'middle_name' => array('title' => ts('Middle Name')), 'last_name' => array('title' => ts('Last Name')), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'gender_id' => array('title' => ts('Gender')), 'birth_date' => array('title' => ts('Birth Date')), 'age' => array('title' => ts('Age'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())'), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'age_at_event' => array('name' => 'age_at_event', 'title' => ts('Age at Event')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-field', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-field', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE))));
     $this->_columns += $this->addAddressFields();
     $this->_columns += array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contact_id' => array('title' => ts('contactId'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'total_amount' => array('title' => ts('Total Amount'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'receive_date' => array('title' => ts('Year'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('yid' => array('name' => 'receive_date', 'title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => date('Y'), 'type' => CRM_Utils_Type::T_INT), 'financial_type_id' => array('title' => ts('Financial Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1')))));
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns, 'type' => CRM_Utils_Type::T_INT);
     }
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     parent::__construct();
 }
Exemplo n.º 7
0
 /**
  *
  */
 function __construct()
 {
     // UI for selecting columns to appear in the report list
     // Array containing the columns, group_bys and filters build and provided to Form
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_membership' => array('dao' => 'CRM_Member_DAO_MembershipType', 'grouping' => 'member-fields', 'fields' => array('membership_type_id' => array('title' => 'Membership Type', 'required' => TRUE)), 'filters' => array('join_date' => array('title' => ts('Member Since'), 'type' => CRM_Utils_Type::T_DATE, 'operatorType' => CRM_Report_Form::OP_DATE), 'membership_start_date' => array('name' => 'start_date', 'title' => ts('Membership Start Date'), 'type' => CRM_Utils_Type::T_DATE, 'operatorType' => CRM_Report_Form::OP_DATE), 'membership_end_date' => array('name' => 'end_date', 'title' => ts('Membership End Date'), 'type' => CRM_Utils_Type::T_DATE, 'operatorType' => CRM_Report_Form::OP_DATE), 'owner_membership_id' => array('title' => ts('Membership Owner ID'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_INT), 'membership_type_id' => array('title' => ts('Membership Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipType()), 'status_id' => array('title' => ts('Membership Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'))), 'group_bys' => array('join_date' => array('title' => ts('Member Since'), 'default' => TRUE, 'frequency' => TRUE, 'chart' => TRUE, 'type' => 12), 'membership_type_id' => array('title' => 'Membership Type', 'default' => TRUE, 'chart' => TRUE))), 'civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('contact_id' => array('no_display' => TRUE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('currency' => array('required' => TRUE, 'no_display' => TRUE), 'total_amount' => array('title' => ts('Amount Statistics'), 'required' => TRUE, 'statistics' => array('sum' => ts('Total Payments Made'), 'count' => ts('Contribution Count'), 'avg' => ts('Average')))), 'filters' => array('currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus())), 'grouping' => 'member-fields'));
     $this->_tagFilter = TRUE;
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_membership']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
         $this->_columns['civicrm_membership']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_membership']['grouping']['campaign_id'] = 'contri-fields';
         $this->_columns['civicrm_membership']['group_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_groupFilter = TRUE;
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
Exemplo n.º 8
0
 /**
  */
 public function __construct()
 {
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array('CiviCampaign', $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'first_name' => array('title' => ts('First Name'), 'no_repeat' => TRUE), 'last_name' => array('title' => ts('Last Name'), 'no_repeat' => TRUE), 'contact_type' => array('title' => ts('Contact Type'), 'no_repeat' => TRUE), 'contact_sub_type' => array('title' => ts('Contact Subtype'), 'no_repeat' => TRUE), 'do_not_email' => array('title' => ts('Do Not Email'), 'no_repeat' => TRUE), 'is_opt_out' => array('title' => ts('No Bulk Email(Is Opt Out)'), 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contact ID'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Donor Email'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Donor Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'first_donation' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('first_donation_date' => array('title' => ts('First Contribution Date'), 'base_field' => 'receive_date', 'no_repeat' => TRUE), 'first_donation_amount' => array('title' => ts('First Contribution Amount'), 'base_field' => 'total_amount', 'no_repeat' => TRUE))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contribution ID')), 'financial_type_id' => array('title' => ts('Financial Type'), 'default' => TRUE), 'contribution_recur_id' => array('title' => ts('Recurring Contribution Id'), 'name' => 'contribution_recur_id', 'required' => TRUE, 'no_display' => TRUE, 'csv_display' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'contribution_source' => array('name' => 'source', 'title' => ts('Contribution Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'receive_date' => array('default' => TRUE), 'receipt_date' => NULL, 'fee_amount' => NULL, 'net_amount' => NULL, 'total_amount' => array('title' => ts('Amount'), 'required' => TRUE)), 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1)), 'total_amount' => array('title' => ts('Contribution Amount'))), 'grouping' => 'contri-fields'), 'civicrm_product' => array('dao' => 'CRM_Contribute_DAO_Product', 'fields' => array('product_name' => array('name' => 'name', 'title' => ts('Premium')))), 'civicrm_contribution_product' => array('dao' => 'CRM_Contribute_DAO_ContributionProduct', 'fields' => array('product_id' => array('no_display' => TRUE), 'product_option' => array('title' => ts('Premium Option')), 'fulfilled_date' => array('title' => ts('Premium Fulfilled Date')), 'contribution_id' => array('no_display' => TRUE))), 'civicrm_contribution_ordinality' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'alias' => 'cordinality', 'filters' => array('ordinality' => array('title' => ts('Contribution Ordinality'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => array(0 => 'First by Contributor', 1 => 'Second or Later by Contributor')))), 'civicrm_membership' => array('dao' => 'CRM_Member_DAO_Membership', 'fields' => array('membership_type_id' => array('title' => ts('Membership Type'), 'required' => TRUE, 'no_repeat' => TRUE), 'membership_start_date' => array('title' => ts('Start Date'), 'default' => TRUE), 'membership_end_date' => array('title' => ts('End Date'), 'default' => TRUE), 'join_date' => array('title' => ts('Join Date'), 'default' => TRUE), 'source' => array('title' => ts('Membership Source'))), 'filters' => array('join_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'membership_start_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'membership_end_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'owner_membership_id' => array('title' => ts('Membership Owner ID'), 'operatorType' => CRM_Report_Form::OP_INT), 'tid' => array('name' => 'membership_type_id', 'title' => ts('Membership Types'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipType())), 'grouping' => 'member-fields'), 'civicrm_membership_status' => array('dao' => 'CRM_Member_DAO_MembershipStatus', 'alias' => 'mem_status', 'fields' => array('membership_status_name' => array('name' => 'name', 'title' => ts('Membership Status'), 'default' => TRUE)), 'filters' => array('sid' => array('name' => 'id', 'title' => ts('Membership Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'))), 'grouping' => 'member-fields'), 'civicrm_note' => array('dao' => 'CRM_Core_DAO_Note', 'fields' => array('contribution_note' => array('name' => 'note', 'title' => ts('Contribution Note'))), 'filters' => array('note' => array('name' => 'note', 'title' => ts('Contribution Note'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING)))) + $this->addAddressFields(FALSE);
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     // Don't show Batch display column and filter unless batches are being used
     $this->_allBatches = CRM_Batch_BAO_Batch::getBatches();
     if (!empty($this->_allBatches)) {
         $this->_columns['civicrm_batch']['dao'] = 'CRM_Batch_DAO_Batch';
         $this->_columns['civicrm_batch']['fields']['batch_id'] = array('name' => 'id', 'title' => ts('Batch Name'));
         $this->_columns['civicrm_batch']['filters']['bid'] = array('name' => 'id', 'title' => ts('Batch Name'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->_allBatches);
         $this->_columns['civicrm_entity_batch']['dao'] = 'CRM_Batch_DAO_EntityBatch';
         $this->_columns['civicrm_entity_batch']['fields']['entity_batch_id'] = array('name' => 'batch_id', 'default' => TRUE, 'no_display' => TRUE);
     }
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_contribution']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
 /**
  */
 public function __construct()
 {
     $this->_autoIncludeIndexedFieldsAsOrderBys = 1;
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array_merge(array('sort_name_linked' => array('title' => ts('Participant Name'), 'required' => TRUE, 'no_repeat' => TRUE, 'dbAlias' => 'contact_civireport.sort_name')), $this->getBasicContactFields(), array('age_at_event' => array('title' => ts('Age at Event'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, event_civireport.start_date)'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'age_at_event' => array('name' => 'age_at_event', 'title' => ts('Age at Event')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Participant Name'), 'operator' => 'like'), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields', 'filters' => array('email' => array('title' => ts('Participant E-mail'), 'operator' => 'like'))), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'supplemental_address_1' => NULL, 'supplemental_address_2' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'))), 'grouping' => 'contact-fields'), 'civicrm_participant' => array('dao' => 'CRM_Event_DAO_Participant', 'fields' => array('participant_id' => array('title' => 'Participant ID'), 'participant_record' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'event_id' => array('default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'status_id' => array('title' => ts('Status'), 'default' => TRUE), 'role_id' => array('title' => ts('Role'), 'default' => TRUE), 'fee_currency' => array('required' => TRUE, 'no_display' => TRUE), 'registered_by_id' => array('title' => ts('Registered by Participant ID')), 'participant_fee_level' => NULL, 'participant_fee_amount' => array('title' => ts('Participant Fee')), 'participant_register_date' => array('title' => ts('Registration Date')), 'total_paid' => array('title' => ts('Total Paid'), 'dbAlias' => 'SUM(ft.total_amount)', 'type' => 1024), 'balance' => array('title' => ts('Balance'), 'dbAlias' => 'participant_civireport.fee_amount - SUM(ft.total_amount)', 'type' => 1024)), 'grouping' => 'event-fields', 'filters' => array('event_id' => array('name' => 'event_id', 'title' => ts('Event'), 'operatorType' => CRM_Report_Form::OP_ENTITYREF, 'type' => CRM_Utils_Type::T_INT, 'attributes' => array('entity' => 'event', 'select' => array('minimumInputLength' => 0))), 'sid' => array('name' => 'status_id', 'title' => ts('Participant Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label')), 'rid' => array('name' => 'role_id', 'title' => ts('Participant Role'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantRole()), 'participant_register_date' => array('title' => 'Registration Date', 'operatorType' => CRM_Report_Form::OP_DATE), 'fee_currency' => array('title' => ts('Fee Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'registered_by_id' => array('title' => ts('Registered by Participant ID'), 'type' => CRM_Utils_Type::T_STRING, 'operator' => 'like')), 'order_bys' => array('participant_register_date' => array('title' => ts('Registration Date'), 'default_weight' => '1', 'default_order' => 'ASC'), 'event_id' => array('title' => ts('Event'), 'default_weight' => '1', 'default_order' => 'ASC'))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_event' => array('dao' => 'CRM_Event_DAO_Event', 'fields' => array('event_type_id' => array('title' => ts('Event Type')), 'event_start_date' => array('title' => ts('Event Start Date'))), 'grouping' => 'event-fields', 'filters' => array('eid' => array('name' => 'event_type_id', 'title' => ts('Event Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('event_type')), 'event_start_date' => array('title' => ts('Event Start Date'), 'operatorType' => CRM_Report_Form::OP_DATE)), 'order_bys' => array('event_type_id' => array('title' => ts('Event Type'), 'default_weight' => '2', 'default_order' => 'ASC'), 'event_start_date' => array('title' => ts('Event Start Date')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contribution ID')), 'financial_type_id' => array('title' => ts('Financial Type')), 'receive_date' => array('title' => ts('Payment Date')), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'contribution_source' => array('name' => 'source', 'title' => ts('Contribution Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'fee_amount' => array('title' => ts('Transaction Fee')), 'net_amount' => NULL), 'grouping' => 'contrib-fields', 'filters' => array('receive_date' => array('title' => 'Payment Date', 'operatorType' => CRM_Report_Form::OP_DATE), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'currency' => array('title' => ts('Contribution Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => NULL))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem', 'grouping' => 'priceset-fields', 'filters' => array('price_field_value_id' => array('name' => 'price_field_value_id', 'title' => ts('Fee Level'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->getPriceLevels()))));
     $this->_options = array('blank_column_begin' => array('title' => ts('Blank column at the Begining'), 'type' => 'checkbox'), 'blank_column_end' => array('title' => ts('Blank column at the End'), 'type' => 'select', 'options' => array('' => '-select-', 1 => ts('One'), 2 => ts('Two'), 3 => ts('Three'))));
     // CRM-17115 avoid duplication of sort_name - would be better to standardise name
     // & behaviour across reports but trying for no change at this point.
     $this->_columns['civicrm_contact']['fields']['sort_name']['no_display'] = TRUE;
     // If we have active campaigns add those elements to both the fields and filters
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_participant']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_participant']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_participant']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_currencyColumn = 'civicrm_participant_fee_currency';
     parent::__construct();
 }
Exemplo n.º 10
0
 /**
  * Class constructor.
  */
 public function __construct()
 {
     // There could be multiple contacts. We not clear on which contact id to display.
     // Lets hide it for now.
     $this->_exposeContactID = FALSE;
     // if navigated from count link of activity summary reports.
     $this->_resetDateFilter = CRM_Utils_Request::retrieve('resetDateFilter', 'Boolean', CRM_Core_DAO::$_nullObject);
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     $caseEnabled = in_array("CiviCase", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
         $this->engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
     }
     $components = CRM_Core_Component::getEnabledComponents();
     foreach ($components as $componentName => $componentInfo) {
         // CRM-19201: Add support for reporting CiviCampaign activities
         // For CiviCase, "access all cases and activities" is required here
         // rather than "access my cases and activities" to prevent those with
         // only the later permission from seeing a list of all cases which might
         // present a privacy issue.
         if (CRM_Core_Permission::access($componentName, TRUE, TRUE)) {
             $accessAllowed[] = $componentInfo->componentID;
         }
     }
     $include = '';
     if (!empty($accessAllowed)) {
         $include = 'OR v.component_id IN (' . implode(', ', $accessAllowed) . ')';
     }
     $condition = " AND ( v.component_id IS NULL {$include} )";
     $this->activityTypes = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, $condition);
     asort($this->activityTypes);
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('contact_source' => array('name' => 'sort_name', 'title' => ts('Source Name'), 'alias' => 'civicrm_contact_source', 'no_repeat' => TRUE), 'contact_assignee' => array('name' => 'sort_name', 'title' => ts('Assignee Name'), 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.sort_name", 'default' => TRUE), 'contact_target' => array('name' => 'sort_name', 'title' => ts('Target Name'), 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.sort_name", 'default' => TRUE), 'contact_source_id' => array('name' => 'id', 'alias' => 'civicrm_contact_source', 'dbAlias' => "civicrm_contact_source.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_assignee_id' => array('name' => 'id', 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_target_id' => array('name' => 'id', 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE)), 'filters' => array('contact_source' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_source', 'title' => ts('Source Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_assignee' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_assignee', 'title' => ts('Assignee Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_target' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_target', 'title' => ts('Target Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'current_user' => array('name' => 'current_user', 'title' => ts('Limit To Current User'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('contact_source_email' => array('name' => 'email', 'title' => ts('Source Email'), 'alias' => 'civicrm_email_source'), 'contact_assignee_email' => array('name' => 'email', 'title' => ts('Assignee Email'), 'alias' => 'civicrm_email_assignee'), 'contact_target_email' => array('name' => 'email', 'title' => ts('Target Email'), 'alias' => 'civicrm_email_target')), 'order_bys' => array('source_contact_email' => array('name' => 'email', 'title' => ts('Source Email'), 'dbAlias' => 'civicrm_email_contact_source_email'))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('contact_source_phone' => array('name' => 'phone', 'title' => ts('Source Phone'), 'alias' => 'civicrm_phone_source'), 'contact_assignee_phone' => array('name' => 'phone', 'title' => ts('Assignee Phone'), 'alias' => 'civicrm_phone_assignee'), 'contact_target_phone' => array('name' => 'phone', 'title' => ts('Target Phone'), 'alias' => 'civicrm_phone_target'))), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('no_display' => TRUE, 'title' => ts('Activity ID'), 'required' => TRUE), 'source_record_id' => array('no_display' => TRUE, 'required' => TRUE), 'activity_type_id' => array('title' => ts('Activity Type'), 'required' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'activity_subject' => array('title' => ts('Subject'), 'default' => TRUE), 'activity_date_time' => array('title' => ts('Activity Date'), 'required' => TRUE), 'status_id' => array('title' => ts('Activity Status'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'duration' => array('title' => ts('Duration'), 'type' => CRM_Utils_Type::T_INT), 'details' => array('title' => ts('Activity Details'))), 'filters' => array('activity_date_time' => array('default' => 'this.month', 'operatorType' => CRM_Report_Form::OP_DATE), 'activity_subject' => array('title' => ts('Activity Subject')), 'activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityTypes), 'status_id' => array('title' => ts('Activity Status'), 'type' => CRM_Utils_Type::T_STRING, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::activityStatus()), 'details' => array('title' => ts('Activity Details'), 'type' => CRM_Utils_Type::T_TEXT)), 'order_bys' => array('activity_date_time' => array('title' => ts('Activity Date'), 'default_weight' => '1', 'dbAlias' => 'civicrm_activity_activity_date_time'), 'activity_type_id' => array('title' => ts('Activity Type'), 'default_weight' => '2', 'dbAlias' => 'field(civicrm_activity_activity_type_id, ' . implode(', ', array_keys($this->activityTypes)) . ')')), 'grouping' => 'activity-fields', 'alias' => 'activity'), 'civicrm_activity_contact' => array('dao' => 'CRM_Activity_DAO_ActivityContact', 'fields' => array())) + $this->addressFields(TRUE);
     if ($caseEnabled && CRM_Core_Permission::check('access all cases and activities')) {
         $this->_columns['civicrm_activity']['filters']['include_case_activities'] = array('name' => 'include_case_activities', 'title' => ts('Include Case Activities'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')));
     }
     if ($campaignEnabled) {
         // Add display column and filter for Survey Results, Campaign and Engagement Index if CiviCampaign is enabled
         $this->_columns['civicrm_activity']['fields']['result'] = array('title' => ts('Survey Result'), 'default' => 'false');
         $this->_columns['civicrm_activity']['filters']['result'] = array('title' => ts('Survey Result'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING);
         if (!empty($this->activeCampaigns)) {
             $this->_columns['civicrm_activity']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
             $this->_columns['civicrm_activity']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         }
         if (!empty($this->engagementLevels)) {
             $this->_columns['civicrm_activity']['fields']['engagement_level'] = array('title' => ts('Engagement Index'), 'default' => 'false');
             $this->_columns['civicrm_activity']['filters']['engagement_level'] = array('title' => ts('Engagement Index'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->engagementLevels);
         }
     }
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     $this->_tagFilterTable = 'civicrm_activity';
     parent::__construct();
 }
 function __construct()
 {
     self::validRelationships();
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact_household' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('household_name' => array('title' => ts('Household Name'), 'required' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'filters' => array('household_name' => array('title' => ts('Household Name'))), 'grouping' => 'household-fields'), 'civicrm_relationship' => array('dao' => 'CRM_Contact_DAO_Relationship', 'fields' => array('relationship_type_id' => array('title' => ts('Relationship Type'))), 'filters' => array('relationship_type_id' => array('title' => ts('Relationship Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $this->relationTypes, 'default' => array(1))), 'grouping' => 'household-fields'), 'civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'required' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('total_amount' => array('title' => ts('Amount'), 'required' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'contribution_status_id' => array('title' => 'Contribution Status', 'default' => TRUE), 'trxn_id' => NULL, 'receive_date' => array('default' => TRUE), 'receipt_date' => NULL), 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'total_amount' => array('title' => ts('Amount Between')), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1))), 'grouping' => 'contri-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => NULL), 'grouping' => 'contact-fields'));
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
     }
     parent::__construct();
 }
 /**
  */
 public function __construct()
 {
     self::validRelationships();
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array('CiviCampaign', $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact_organization' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('organization_name' => array('title' => ts('Organization Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('organization_name' => array('title' => ts('Organization Name'))), 'grouping' => 'organization-fields'), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem'), 'civicrm_relationship' => array('dao' => 'CRM_Contact_DAO_Relationship', 'fields' => array('relationship_type_id' => array('title' => ts('Relationship Type'))), 'filters' => array('relationship_type_id' => array('title' => ts('Relationship Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $this->relationTypes, 'default' => key($this->relationTypes))), 'grouping' => 'organization-fields'), 'civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'required' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('total_amount' => array('title' => ts('Amount'), 'required' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'contribution_status_id' => array('title' => 'Contribution Status', 'default' => TRUE), 'check_number' => array('title' => ts('Check Number')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'receive_date' => array('default' => TRUE), 'receipt_date' => NULL), 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'total_amount' => array('title' => ts('Amount Between')), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1))), 'grouping' => 'contri-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => NULL), 'grouping' => 'contact-fields'));
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
     }
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
Exemplo n.º 13
0
 function __construct()
 {
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'no_repeat' => TRUE), 'postal_greeting_display' => array('title' => ts('Postal Greeting')), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'grouping' => 'contact-fields', 'group_bys' => array('id' => array('title' => ts('Contact ID')), 'sort_name' => array('title' => ts('Contact Name')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_contribution_type' => array('dao' => 'CRM_Contribute_DAO_ContributionType', 'fields' => array('contribution_type' => NULL), 'grouping' => 'contri-fields', 'group_bys' => array('contribution_type' => NULL)), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_source' => NULL, 'total_amount' => array('title' => ts('Amount Statistics'), 'default' => TRUE, 'required' => TRUE, 'statistics' => array('sum' => ts('Aggregate Amount'), 'count' => ts('Donations'), 'avg' => ts('Average')))), 'grouping' => 'contri-fields', 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'contribution_status_id' => array('title' => ts('Donation Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT), 'contribution_type_id' => array('title' => ts('Contribution Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionType(), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Donation Amount')), 'total_sum' => array('title' => ts('Aggregate Amount'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_sum', 'having' => TRUE), 'total_count' => array('title' => ts('Donation Count'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_count', 'having' => TRUE), 'total_avg' => array('title' => ts('Average'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_avg', 'having' => TRUE)), 'group_bys' => array('receive_date' => array('frequency' => TRUE, 'default' => TRUE, 'chart' => TRUE), 'contribution_source' => NULL)), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group(), 'type' => CRM_Utils_Type::T_INT)))) + $this->addAddressFields();
     $this->_tagFilter = TRUE;
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_contribution']['grouping']['campaign_id'] = 'contri-fields';
         $this->_columns['civicrm_contribution']['group_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     parent::__construct();
 }
Exemplo n.º 14
0
 function __construct()
 {
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name_creditor' => array('title' => ts('Soft Credit Name'), 'name' => 'sort_name', 'alias' => 'contact_civireport', 'required' => TRUE, 'no_repeat' => TRUE), 'id_creditor' => array('title' => ts('Soft Credit Id'), 'name' => 'id', 'alias' => 'contact_civireport', 'no_display' => TRUE, 'required' => TRUE), 'display_name_constituent' => array('title' => ts('Contributor Name'), 'name' => 'sort_name', 'alias' => 'constituentname', 'required' => TRUE), 'id_constituent' => array('title' => ts('Const Id'), 'name' => 'id', 'alias' => 'constituentname', 'no_display' => TRUE, 'required' => TRUE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType'))), 'filters' => array('sort_name' => array('name' => 'sort_name', 'title' => ts('Soft Credit Name'))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email_creditor' => array('title' => ts('Soft Credit Email'), 'name' => 'email', 'alias' => 'emailcredit', 'default' => TRUE, 'no_repeat' => TRUE), 'email_constituent' => array('title' => ts('Contributor\'s Email'), 'name' => 'email', 'alias' => 'emailconst')), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone_creditor' => array('title' => ts('Soft Credit Phone'), 'name' => 'phone', 'alias' => 'pcredit', 'default' => TRUE), 'phone_constituent' => array('title' => ts('Contributor\'s Phone'), 'name' => 'phone', 'alias' => 'pconst', 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_financial_type' => array('dao' => 'CRM_Financial_DAO_FinancialType', 'fields' => array('financial_type' => null), 'filters' => array('id' => array('name' => 'id', 'title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType())), 'grouping' => 'softcredit-fields'), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_source' => NULL, 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'total_amount' => array('title' => ts('Amount Statistics'), 'default' => TRUE, 'statistics' => array('sum' => ts('Aggregate Amount'), 'count' => ts('Donations'), 'avg' => ts('Average')))), 'grouping' => 'softcredit-fields', 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'contribution_status_id' => array('title' => ts('Donation Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1)), 'total_amount' => array('title' => ts('Donation Amount')))), 'civicrm_contribution_soft' => array('dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => array('contribution_id' => array('title' => ts('Contribution ID'), 'no_display' => TRUE, 'default' => TRUE), 'id' => array('default' => TRUE, 'no_display' => TRUE), 'soft_credit_type_id' => array('title' => ts('Soft Credit Type'))), 'filters' => array('soft_credit_type_id' => array('title' => 'Soft Credit Type', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING)), 'grouping' => 'softcredit-fields'), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Soft Credit Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group()))));
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
     }
     $this->_tagFilter = TRUE;
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
Exemplo n.º 15
0
 /**
  * Class constructor.
  */
 public function __construct()
 {
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Constituent Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_pledge' => array('dao' => 'CRM_Pledge_DAO_Pledge', 'fields' => array('pledge_create_date' => array('title' => ts('Pledge Made'), 'required' => TRUE), 'financial_type_id' => array('title' => ts('Financial Type'), 'required' => TRUE), 'frequency_unit' => array('title' => ts('Frequency Unit')), 'installments' => array('title' => ts('Installments')), 'amount' => array('title' => ts('Amount'), 'required' => TRUE, 'type' => CRM_Utils_Type::T_MONEY), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'status_id' => array('title' => ts('Status'))), 'filters' => array('pledge_create_date' => array('title' => ts('Pledge Made'), 'operatorType' => CRM_Report_Form::OP_DATE), 'pledge_amount' => array('title' => ts('Pledged Amount'), 'operatorType' => CRM_Report_Form::OP_INT), 'currency' => array('title' => ts('Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'financial_type_id' => array('title' => ts('Financial Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'pledge_status_id' => array('name' => 'status_id', 'title' => ts('Pledge Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('contribution_status')), 'installments' => array('title' => ts('Installments'), 'type' => CRM_Utils_Type::T_INT)), 'grouping' => 'pledge-fields'), 'civicrm_pledge_payment' => array('dao' => 'CRM_Pledge_DAO_PledgePayment', 'fields' => array('scheduled_date' => array('title' => ts('Next Payment Due'), 'type' => CRM_Utils_Type::T_DATE, 'required' => TRUE), 'scheduled_amount' => array('type' => CRM_Utils_Type::T_MONEY, 'title' => ts('Next Payment Amount'))), 'filters' => array('scheduled_date' => array('title' => ts('Next Payment Due'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE)), 'grouping' => 'pledge-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'), 'default' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => NULL), 'grouping' => 'contact-fields'), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_Group', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'type' => CRM_Utils_Type::T_INT, 'group' => TRUE, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::staticGroup()))));
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_pledge']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_pledge']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns, 'type' => CRM_Utils_Type::T_INT);
     }
     $this->_tagFilter = TRUE;
     $this->_currencyColumn = 'civicrm_pledge_currency';
     parent::__construct();
 }
Exemplo n.º 16
0
 function __construct()
 {
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     // UI for selecting columns to appear in the report list
     // array conatining the columns, group_bys and filters build and provided to Form
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Member Name'), 'no_repeat' => TRUE, 'required' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'first_name' => array('title' => ts('First Name'), 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'last_name' => array('title' => ts('Last Name'), 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType'))), 'grouping' => 'contact-fields'), 'civicrm_membership_type' => array('dao' => 'CRM_Member_DAO_MembershipType', 'grouping' => 'member-fields', 'filters' => array('tid' => array('name' => 'id', 'title' => ts('Membership Types'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipType()))), 'civicrm_membership' => array('dao' => 'CRM_Member_DAO_Membership', 'grouping' => 'member-fields', 'fields' => array('membership_type_id' => array('title' => 'Membership Type', 'required' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'membership_start_date' => array('title' => ts('Current Cycle Start Date')), 'membership_end_date' => array('title' => ts('Membership Lapse Date'), 'required' => TRUE)), 'filters' => array('membership_end_date' => array('title' => 'Lapsed Memberships', 'operatorType' => CRM_Report_Form::OP_DATE))), 'civicrm_membership_status' => array('dao' => 'CRM_Member_DAO_MembershipStatus', 'alias' => 'mem_status', 'fields' => array('name' => array('title' => ts('Current Status'), 'required' => TRUE)), 'grouping' => 'member-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'), 'default' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'alias' => 'phone', 'fields' => array('phone' => NULL), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => NULL), 'grouping' => 'contact-fields'), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group()))));
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_membership']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
         $this->_columns['civicrm_membership']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
     }
     $this->_tagFilter = TRUE;
     parent::__construct();
 }
Exemplo n.º 17
0
 /**
  */
 public function __construct()
 {
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name_creditor' => array('title' => ts('Soft Credit Name'), 'name' => 'sort_name', 'alias' => 'contact_civireport', 'required' => TRUE, 'no_repeat' => TRUE), 'id_creditor' => array('title' => ts('Soft Credit Id'), 'name' => 'id', 'alias' => 'contact_civireport', 'no_display' => TRUE, 'required' => TRUE), 'display_name_constituent' => array('title' => ts('Contributor Name'), 'name' => 'sort_name', 'alias' => 'constituentname', 'required' => TRUE), 'id_constituent' => array('title' => ts('Const Id'), 'name' => 'id', 'alias' => 'constituentname', 'no_display' => TRUE, 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'middle_name' => array('title' => ts('Middle Name')), 'last_name' => array('title' => ts('Last Name')), 'gender_id' => array('title' => ts('Gender')), 'birth_date' => array('title' => ts('Birth Date')), 'age' => array('title' => ts('Age'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())'), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'age_at_event' => array('name' => 'age_at_event', 'title' => ts('Age at Event')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('name' => 'sort_name', 'title' => ts('Soft Credit Name')), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email_creditor' => array('title' => ts('Soft Credit Email'), 'name' => 'email', 'alias' => 'emailcredit', 'default' => TRUE, 'no_repeat' => TRUE), 'email_constituent' => array('title' => ts('Contributor\'s Email'), 'name' => 'email', 'alias' => 'emailconst')), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone_creditor' => array('title' => ts('Soft Credit Phone'), 'name' => 'phone', 'alias' => 'pcredit', 'default' => TRUE), 'phone_constituent' => array('title' => ts('Contributor\'s Phone'), 'name' => 'phone', 'alias' => 'pconst', 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_financial_type' => array('dao' => 'CRM_Financial_DAO_FinancialType', 'fields' => array('financial_type' => NULL), 'filters' => array('id' => array('name' => 'id', 'title' => ts('Financial Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes())), 'grouping' => 'softcredit-fields'), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_source' => NULL, 'currency' => array('required' => TRUE, 'no_display' => TRUE)), 'grouping' => 'softcredit-fields', 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1)))), 'civicrm_contribution_soft' => array('dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => array('contribution_id' => array('title' => ts('Contribution ID'), 'no_display' => TRUE, 'default' => TRUE), 'amount' => array('title' => ts('Amount Statistics'), 'default' => TRUE, 'statistics' => array('sum' => ts('Aggregate Amount'), 'count' => ts('Contributions'), 'avg' => ts('Average'))), 'id' => array('default' => TRUE, 'no_display' => TRUE), 'soft_credit_type_id' => array('title' => ts('Soft Credit Type'))), 'filters' => array('soft_credit_type_id' => array('title' => 'Soft Credit Type', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'amount' => array('title' => ts('Soft Credit Amount'))), 'grouping' => 'softcredit-fields'));
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
     }
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
Exemplo n.º 18
0
 /**
  * Class constructor.
  */
 public function __construct()
 {
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array_merge($this->getBasicContactFields(), array('sort_name' => array('title' => ts('Contact Name'), 'no_repeat' => TRUE))), 'grouping' => 'contact-fields', 'group_bys' => array('id' => array('title' => ts('Contact ID')), 'sort_name' => array('title' => ts('Contact Name')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_financial_type' => array('dao' => 'CRM_Financial_DAO_FinancialType', 'fields' => array('financial_type' => NULL), 'grouping' => 'contri-fields', 'group_bys' => array('financial_type' => array('title' => ts('Financial Type')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_status_id' => array('title' => ts('Contribution Status')), 'contribution_source' => array('title' => ts('Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'total_amount' => array('title' => ts('Contribution Amount Stats'), 'default' => TRUE, 'statistics' => array('count' => ts('Contributions'), 'sum' => ts('Contribution Aggregate'), 'avg' => ts('Contribution Avg')))), 'grouping' => 'contri-fields', 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT), 'currency' => array('title' => ts('Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(), 'type' => CRM_Utils_Type::T_INT), 'contribution_page_id' => array('title' => ts('Contribution Page'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionPage(), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Contribution Amount')), 'total_sum' => array('title' => ts('Contribution Aggregate'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_sum', 'having' => TRUE), 'total_count' => array('title' => ts('Contribution Count'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_count', 'having' => TRUE), 'total_avg' => array('title' => ts('Contribution Avg'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_avg', 'having' => TRUE)), 'group_bys' => array('receive_date' => array('frequency' => TRUE, 'default' => TRUE, 'chart' => TRUE), 'contribution_source' => NULL, 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT))), 'civicrm_batch' => array('dao' => 'CRM_Batch_DAO_EntityBatch', 'grouping' => 'contri-fields', 'filters' => array('batch_id' => array('title' => ts('Batch Title'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Batch_BAO_Batch::getBatches(), 'type' => CRM_Utils_Type::T_INT))), 'civicrm_contribution_soft' => array('dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => array('soft_amount' => array('title' => ts('Soft Credit Amount Stats'), 'name' => 'amount', 'statistics' => array('count' => ts('Soft Credits'), 'sum' => ts('Soft Credit Aggregate'), 'avg' => ts('Soft Credit Avg')))), 'grouping' => 'contri-fields', 'filters' => array('amount' => array('title' => ts('Soft Credit Amount')), 'soft_credit_type_id' => array('title' => ts('Soft Credit Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('soft_credit_type'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'soft_sum' => array('title' => ts('Soft Credit Aggregate'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_sum', 'having' => TRUE), 'soft_count' => array('title' => ts('Soft Credits Count'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_count', 'having' => TRUE), 'soft_avg' => array('title' => ts('Soft Credit Avg'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_avg', 'having' => TRUE)))) + $this->addAddressFields();
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_contribution']['group_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_tagFilter = TRUE;
     $this->_groupFilter = TRUE;
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
Exemplo n.º 19
0
 /**
  * Class constructor.
  */
 public function __construct()
 {
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => $this->getBasicContactFields(), 'filters' => array('sort_name' => array('title' => ts('Contact Name'), 'operator' => 'like'), 'id' => array('no_display' => TRUE)), 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC')), 'grouping' => 'contact-fields'), 'civicrm_membership' => array('dao' => 'CRM_Member_DAO_Membership', 'fields' => array('membership_type_id' => array('title' => 'Membership Type', 'required' => TRUE, 'no_repeat' => TRUE), 'membership_start_date' => array('title' => ts('Start Date'), 'default' => TRUE), 'membership_end_date' => array('title' => ts('End Date'), 'default' => TRUE), 'join_date' => array('title' => ts('Join Date'), 'default' => TRUE), 'source' => array('title' => 'Source')), 'filters' => array('join_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'membership_start_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'membership_end_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'owner_membership_id' => array('title' => ts('Membership Owner ID'), 'operatorType' => CRM_Report_Form::OP_INT), 'tid' => array('name' => 'membership_type_id', 'title' => ts('Membership Types'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipType())), 'order_bys' => array('membership_type_id' => array('title' => ts('Membership Type'), 'default' => '0', 'default_weight' => '1', 'default_order' => 'ASC')), 'grouping' => 'member-fields', 'group_bys' => array('id' => array('title' => ts('Membership'), 'default' => TRUE))), 'civicrm_membership_status' => array('dao' => 'CRM_Member_DAO_MembershipStatus', 'alias' => 'mem_status', 'fields' => array('name' => array('title' => ts('Status'), 'default' => TRUE)), 'filters' => array('sid' => array('name' => 'id', 'title' => ts('Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'))), 'grouping' => 'member-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => NULL), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => NULL), 'grouping' => 'contact-fields'), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'financial_type_id' => array('title' => ts('Financial Type')), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'receive_date' => NULL, 'receipt_date' => NULL, 'fee_amount' => NULL, 'net_amount' => NULL, 'total_amount' => array('title' => ts('Payment Amount (most recent)'), 'statistics' => array('sum' => ts('Amount')))), 'filters' => array('receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType(), 'type' => CRM_Utils_Type::T_INT), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument(), 'type' => CRM_Utils_Type::T_INT), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Contribution Amount'))), 'order_bys' => array('receive_date' => array('title' => ts('Date Received'), 'default_weight' => '2', 'default_order' => 'DESC')), 'grouping' => 'contri-fields')) + $this->getAddressColumns(array('order_by' => FALSE, 'group_by' => FALSE));
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     // If we have active campaigns add those elements to both the fields and filters
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_membership']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_membership']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns, 'type' => CRM_Utils_Type::T_INT);
         $this->_columns['civicrm_membership']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
 function __construct()
 {
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('teamsinger_retention_report_type' => array('filters' => array('teamsinger_retention_report_type' => array('pseudofield' => 'true', 'name' => 'teamsinger_retention_report_type', 'title' => ts('Report Type'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('not_yet_renewed' => 'Have Not Yet Renewed', 'have_renewed' => 'Have Renewed')))), 'civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'required' => TRUE, 'default' => TRUE, 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'first_name' => array('title' => ts('First Name'), 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'last_name' => array('title' => ts('Last Name'), 'no_repeat' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType'))), 'grouping' => 'contact-fields'), 'civicrm_membership' => array('dao' => 'CRM_Member_DAO_Membership', 'fields' => array('membership_type_id' => array('title' => 'Membership Type', 'required' => TRUE, 'no_repeat' => TRUE), 'membership_start_date' => array('title' => ts('Start Date'), 'default' => TRUE), 'membership_end_date' => array('title' => ts('End Date'), 'default' => TRUE), 'join_date' => array('title' => ts('Join Date'), 'default' => TRUE), 'source' => array('title' => 'Source')), 'filters' => array('membership_end_date' => array('title' => 'Membership Renewal Due', 'operatorType' => CRM_Report_Form::OP_DATE), 'tid' => array('name' => 'membership_type_id', 'title' => ts('Membership Types'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipType()), 'status_id' => array('title' => ts('Membership Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'))), 'grouping' => 'member-fields'), 'civicrm_membership_status' => array('dao' => 'CRM_Member_DAO_MembershipStatus', 'alias' => 'mem_status', 'fields' => array('name' => array('title' => ts('Status'), 'default' => TRUE)), 'filters' => array('sid' => array('name' => 'id', 'title' => ts('Status'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'))), 'grouping' => 'member-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => NULL), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => NULL), 'grouping' => 'contact-fields'), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'financial_type_id' => array('title' => ts('Financial Type')), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'receive_date' => NULL, 'receipt_date' => NULL, 'fee_amount' => NULL, 'net_amount' => NULL, 'total_amount' => array('title' => ts('Payment Amount (most recent)'), 'statistics' => array('sum' => ts('Amount')))), 'filters' => array('contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'type' => CRM_Utils_Type::T_INT)), 'grouping' => 'contri-fields'));
     //    $this->_groupFilter = TRUE;
     //    $this->_tagFilter = TRUE;
     // If we have active campaigns add those elements to both the fields and filters
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_membership']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_membership']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_membership']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
 function __construct()
 {
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'no_repeat' => TRUE, 'default' => TRUE), 'first_name' => array('title' => ts('First Name'), 'default' => TRUE), 'middle_name' => array('title' => ts('Middle Name'), 'default' => TRUE), 'last_name' => array('title' => ts('Last Name'), 'default' => TRUE), 'postal_greeting_display' => array('title' => ts('Postal Greeting')), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType'))), 'grouping' => 'contact-fields', 'group_bys' => array('id' => array('title' => ts('Contact ID'), 'default' => TRUE), 'sort_name' => array('title' => ts('Contact Name')))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE, 'default' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_repeat' => TRUE, 'default' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_financial_type' => array('dao' => 'CRM_Financial_DAO_FinancialType', 'fields' => array('financial_type' => null), 'grouping' => 'contri-fields', 'group_bys' => array('financial_type' => array('title' => ts('Financial Type')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_source' => array('title' => ts('Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'total_amount' => array('title' => ts('Contribution Amount Stats'), 'default' => TRUE, 'statistics' => array('sum' => ts('Contributions Aggregate'), 'count' => ts('Contributions'), 'avg' => ts('Contributions Avg')))), 'grouping' => 'contri-fields', 'filters' => array('receive_date' => array('title' => ts('Receive Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'default' => '0'), 'contribution_status_id' => array('title' => ts('Donation Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1), 'type' => CRM_Utils_Type::T_INT), 'currency' => array('title' => 'Currency', 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType(), 'type' => CRM_Utils_Type::T_INT), 'contribution_page_id' => array('title' => ts('Contribution Page'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionPage(), 'type' => CRM_Utils_Type::T_INT), 'total_amount' => array('title' => ts('Contribution Amount')), 'total_sum' => array('title' => ts('Contributions Aggregate'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_sum', 'having' => TRUE), 'total_count' => array('title' => ts('Contributions Count'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_count', 'having' => TRUE), 'total_avg' => array('title' => ts('Contributions Avg'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_total_amount_avg', 'having' => TRUE)), 'group_bys' => array('receive_date' => array('frequency' => TRUE, 'default' => TRUE, 'chart' => TRUE), 'contribution_source' => NULL)), 'civicrm_contribution_soft' => array('dao' => 'CRM_Contribute_DAO_ContributionSoft', 'fields' => array('soft_amount' => array('title' => ts('Soft Credit Amount Stats'), 'name' => 'amount', 'statistics' => array('sum' => ts('Soft Credit Aggregate'), 'count' => ts('Soft Credits'), 'avg' => ts('Soft Credit Avg')))), 'grouping' => 'contri-fields', 'filters' => array('amount' => array('title' => ts('Soft Credit Amount')), 'soft_sum' => array('title' => ts('Soft Credit Aggregate'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_sum', 'having' => TRUE), 'soft_count' => array('title' => ts('Soft Credits Count'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_count', 'having' => TRUE), 'soft_avg' => array('title' => ts('Soft Credit Avg'), 'type' => CRM_Report_Form::OP_INT, 'dbAlias' => 'civicrm_contribution_soft_soft_amount_avg', 'having' => TRUE))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group(), 'type' => CRM_Utils_Type::T_INT)))) + $this->addAddressFields();
     // If we have a campaign, build out the relevant elements
     $this->_tagFilter = TRUE;
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         $this->_columns['civicrm_contribution']['group_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     /*
      * BOSW1508247 vnv.nl - exporteren data clubcollect
      * Hack uncheck land field
      */
     $this->_columns['civicrm_address']['fields']['street_address']['default'] = TRUE;
     $this->_columns['civicrm_address']['fields']['supplemental_address_1']['default'] = TRUE;
     $this->_columns['civicrm_address']['fields']['supplemental_address_2']['default'] = TRUE;
     $this->_columns['civicrm_address']['fields']['postal_code']['default'] = TRUE;
     $this->_columns['civicrm_address']['fields']['city']['default'] = TRUE;
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
     /*
      * BOSW1508247 vnv.nl - exporteren data clubcollect
      * Add country name or the country id will show in the Preview Excel 
      */
     // hide country_id field
     $this->_columns['civicrm_address']['fields']['country_id'] = array('no_display' => TRUE, 'required' => TRUE);
     // add country field
     $this->_columns['civicrm_country'] = array('dao' => 'CRM_Core_DAO_County', 'grouping' => 'location-fields', 'fields' => array('civicrm_country_name' => array('title' => ts('Country'), 'default' => TRUE, 'dbAlias' => 'country_civireport.name')));
     /*
      * BOSW1508247 vnv.nl - exporteren data clubcollect
      * Membership
      */
     // add membership for lidmaatschap
     $this->_columns['civicrm_membership'] = array('dao' => 'CRM_Member_DAO_Membership', 'grouping' => 'civicrm_membership', 'group_title' => ts('Membership'), 'fields' => array('id' => array('no_display' => TRUE, 'title' => ts('Membership Id'), 'required' => TRUE, 'no_repeat' => TRUE), 'membership_type_id' => array('no_display' => TRUE, 'title' => ts('Membership Type'), 'default' => TRUE, 'required' => TRUE), 'membership_start_date' => array('title' => ts('Start Date')), 'membership_end_date' => array('title' => ts('End Date')), 'join_date' => array('title' => ts('Join Date')), 'source' => array('title' => 'Source')));
     $this->_columns['civicrm_membership_type'] = array('dao' => 'CRM_Member_DAO_MembershipType', 'grouping' => 'civicrm_membership', 'group_title' => ts('Membership'), 'fields' => array('name' => array('title' => ts('Membership Type'), 'default' => TRUE)));
     /*
      * BOSW1508247 vnv.nl - exporteren data clubcollect
      * Lidmaatschap - Maatschappij
      */
     $lidmaatschapbijdrage_config = CRM_Lidmaatschapbijdragerapport_Config::singleton();
     $lidmaatschap_custom_group = $lidmaatschapbijdrage_config->get_lidmaatschap_custom_group();
     // add the Lidmaatschap - Maatschappij
     $this->_columns[$lidmaatschap_custom_group['table_name']] = array('dao' => 'CRM_Contact_DAO_Contact', 'extends' => 'Membership', 'grouping' => $lidmaatschap_custom_group['table_name'], 'group_title' => $lidmaatschap_custom_group['title'], 'fields' => array());
     // add the Lidmaatschap - Maatschappij fields
     foreach ($lidmaatschapbijdrage_config->get_lidmaatschap_custom_fields() as $custom_field_id => $custom_field) {
         $this->_columns[$lidmaatschap_custom_group['table_name']]['fields']['custom_' . $custom_field_id] = array('name' => strtolower($custom_field['name']) . '_' . $custom_field_id, 'title' => $custom_field['label']);
         // check only lidnr and
         if ('lidnr' == $custom_field['name']) {
             $this->_columns[$lidmaatschap_custom_group['table_name']]['fields']['custom_' . $custom_field_id]['default'] = TRUE;
         }
     }
 }
 function __construct()
 {
     // There could be multiple contacts. We not clear on which contact id to display.
     // Lets hide it for now.
     $this->_exposeContactID = FALSE;
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
         $this->engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
     }
     $this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'label', TRUE);
     asort($this->activityTypes);
     /*
      * BOS1502448 vnv.nl - lidmaatschap historie
      */
     $lidmaatschap_config = CRM_Lidmaatschaphistorie_Config::singleton();
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('contact_source' => array('name' => 'sort_name', 'title' => ts('Source Contact Name'), 'alias' => 'civicrm_contact_source', 'no_repeat' => TRUE, 'default' => FALSE, 'no_display' => TRUE), 'contact_assignee' => array('name' => 'sort_name', 'title' => ts('Assignee Contact Name'), 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.sort_name", 'default' => FALSE, 'no_display' => TRUE), 'contact_target' => array('name' => 'sort_name', 'title' => ts('Target Contact Name'), 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.sort_name", 'default' => TRUE), 'contact_source_id' => array('name' => 'id', 'alias' => 'civicrm_contact_source', 'dbAlias' => "civicrm_contact_source.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_assignee_id' => array('name' => 'id', 'alias' => 'civicrm_contact_assignee', 'dbAlias' => "civicrm_contact_assignee.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE), 'contact_target_id' => array('name' => 'id', 'alias' => 'civicrm_contact_target', 'dbAlias' => "civicrm_contact_target.id", 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE)), 'filters' => array('contact_source' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_source', 'title' => ts('Source Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_assignee' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_assignee', 'title' => ts('Assignee Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'contact_target' => array('name' => 'sort_name', 'alias' => 'civicrm_contact_target', 'title' => ts('Target Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING), 'current_user' => array('name' => 'current_user', 'title' => ts('Limit To Current User'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')))), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('contact_source_email' => array('name' => 'email', 'title' => ts('Source Contact Email'), 'alias' => 'civicrm_email_source'), 'contact_assignee_email' => array('name' => 'email', 'title' => ts('Assignee Contact Email'), 'alias' => 'civicrm_email_assignee'), 'contact_target_email' => array('name' => 'email', 'title' => ts('Target Contact Email'), 'alias' => 'civicrm_email_target')), 'order_bys' => array('source_contact_email' => array('name' => 'email', 'title' => ts('Source Contact Email'), 'dbAlias' => 'civicrm_email_contact_source_email'))), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('title' => ts('Activity ID'), 'required' => TRUE), 'source_record_id' => array('no_display' => TRUE, 'title' => ts('Activity Contact Id'), 'required' => TRUE), 'activity_type_id' => array('title' => ts('Activity Type'), 'no_display' => TRUE, 'required' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'activity_subject' => array('title' => ts('Subject')), 'activity_date_time' => array('title' => ts('Activity Date'), 'no_display' => TRUE, 'required' => TRUE), 'status_id' => array('title' => ts('Activity Status'), 'type' => CRM_Utils_Type::T_STRING), 'duration' => array('title' => ts('Duration'), 'type' => CRM_Utils_Type::T_INT), 'details' => array('title' => ts('Activity Details'))), 'filters' => array('activity_date_time' => array('default' => '0', 'operatorType' => CRM_Report_Form::OP_DATE), 'activity_subject' => array('title' => ts('Activity Subject')), 'activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityTypes, 'default' => $lidmaatschap_config->get_lidmaatschap_historie_activity_id()), 'status_id' => array('title' => ts('Activity Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::activityStatus()), 'details' => array('title' => ts('Activity Details'), 'type' => CRM_Utils_Type::T_TEXT)), 'order_bys' => array('activity_date_time' => array('title' => ts('Activity Date'), 'default_weight' => '1', 'dbAlias' => 'civicrm_activity_activity_date_time'), 'activity_type_id' => array('title' => ts('Activity Type'), 'default_weight' => '2', 'dbAlias' => 'civicrm_activity_activity_type_id')), 'grouping' => 'activity-fields', 'alias' => 'activity'), 'civicrm_activity_contact' => array('dao' => 'CRM_Activity_DAO_ActivityContact', 'fields' => array('id' => array('no_display' => TRUE, 'title' => ts('Activity Contact ID'), 'required' => TRUE), 'contact_id' => array('title' => ts('Contact ID'), 'required' => TRUE)))) + $this->addAddressFields(FALSE, TRUE);
     if ($campaignEnabled) {
         // Add display column and filter for Survey Results, Campaign and Engagement Index if CiviCampaign is enabled
         $this->_columns['civicrm_activity']['fields']['result'] = array('title' => 'Survey Result', 'default' => 'false');
         $this->_columns['civicrm_activity']['filters']['result'] = array('title' => ts('Survey Result'), 'operator' => 'like', 'type' => CRM_Utils_Type::T_STRING);
         if (!empty($this->activeCampaigns)) {
             $this->_columns['civicrm_activity']['fields']['campaign_id'] = array('title' => 'Campaign', 'default' => 'false');
             $this->_columns['civicrm_activity']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
         }
         if (!empty($this->engagementLevels)) {
             $this->_columns['civicrm_activity']['fields']['engagement_level'] = array('title' => 'Engagement Index', 'default' => 'false');
             $this->_columns['civicrm_activity']['filters']['engagement_level'] = array('title' => ts('Engagement Index'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->engagementLevels);
         }
     }
     /*
      * Hack uncheck land field
      */
     $this->_columns['civicrm_address']['fields']['country_id']['default'] = false;
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     parent::__construct();
     /*
      * $this->_lidmaatschap_historie_custom_group_id
      * Set custom fields default values and if check or not
      */
     $lidmaatschap_historie_custom_group = $lidmaatschap_config->get_lidmaatschap_historie_custom_group();
     $lidmaatschap_custom_group = $lidmaatschap_config->get_lidmaatschap_custom_group();
     if (isset($this->_columns[$lidmaatschap_historie_custom_group['table_name']]) and !empty($this->_columns[$lidmaatschap_historie_custom_group['table_name']])) {
         // add membership for lidmaatschap
         $this->_columns['civicrm_membership'] = array('dao' => 'CRM_Member_DAO_Membership', 'fields' => array('id' => array('no_display' => TRUE, 'title' => ts('Membership Id'), 'required' => TRUE, 'no_repeat' => TRUE)));
         // add the lidmaatschap
         $this->_columns[$lidmaatschap_custom_group['table_name']] = array('dao' => 'CRM_Contact_DAO_Contact', 'extends' => 'Membership', 'grouping' => $lidmaatschap_custom_group['table_name'], 'group_title' => $lidmaatschap_custom_group['title'], 'fields' => array());
         // add the lidmaatschap fields
         foreach ($lidmaatschap_config->get_lidmaatschap_custom_fields() as $custom_field_id => $custom_field) {
             $this->_columns[$lidmaatschap_custom_group['table_name']]['fields']['custom_' . $custom_field_id] = array('name' => strtolower($custom_field['name']) . '_' . $custom_field_id, 'title' => $custom_field['label']);
         }
         // check every custom field of lidmaatschap historie
         if (isset($this->_columns[$lidmaatschap_historie_custom_group['table_name']]['fields']) and !empty($this->_columns[$lidmaatschap_historie_custom_group['table_name']]['fields'])) {
             foreach ($lidmaatschap_config->get_lidmaatschap_historie_custom_fields() as $custom_field_id => $custom_field) {
                 if (isset($this->_columns[$lidmaatschap_historie_custom_group['table_name']]['fields']['custom_' . $custom_field_id]) and !empty($this->_columns[$lidmaatschap_historie_custom_group['table_name']]['fields']['custom_' . $custom_field_id])) {
                     $this->_columns[$lidmaatschap_historie_custom_group['table_name']]['fields']['custom_' . $custom_field_id]['default'] = TRUE;
                 }
             }
         }
     }
 }
Exemplo n.º 23
0
  /**
   * Class constructor.
   */
  public function __construct() {
    $this->_autoIncludeIndexedFieldsAsOrderBys = 1;

    // Check if CiviCampaign is a) enabled and b) has active campaigns
    $config = CRM_Core_Config::singleton();
    $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
    if ($campaignEnabled) {
      $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
      $this->activeCampaigns = $getCampaigns['campaigns'];
      asort($this->activeCampaigns);
    }

    $this->_columns = array(
      'civicrm_contact' => array_merge($this->getColumns('Contact'), array(
        'dao' => 'CRM_Contact_DAO_Contact',
        'fields' => array(
          'sort_name' => array(
            'title' => ts('Participant Name'),
            'required' => TRUE,
            'no_repeat' => TRUE,
            'dbAlias' => 'contact_civireport.sort_name',
          ),
          'first_name' => array(
            'title' => ts('First Name'),
          ),
          'last_name' => array(
            'title' => ts('Last Name'),
          ),
          'id' => array(
            'no_display' => TRUE,
            'required' => TRUE,
          ),
          'gender_id' => array(
            'title' => ts('Gender'),
          ),
          'birth_date' => array(
            'title' => ts('Birth Date'),
          ),
          'age' => array(
            'title' => ts('Age'),
            'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())',
          ),
          'age_at_event' => array(
            'title' => ts('Age at Event'),
            'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, event_civireport.start_date)',
          ),
          'employer_id' => array(
            'title' => ts('Organization'),
          ),
        ),
        'grouping' => 'contact-fields',
        'order_bys' => array(
          'sort_name' => array(
            'title' => ts('Last Name, First Name'),
            'default' => '1',
            'default_weight' => '0',
            'default_order' => 'ASC',
          ),
          'gender_id' => array(
            'name' => 'gender_id',
            'title' => ts('Gender'),
          ),
          'birth_date' => array(
            'name' => 'birth_date',
            'title' => ts('Birth Date'),
          ),
          'age_at_event' => array(
            'name' => 'age_at_event',
            'title' => ts('Age at Event'),
          ),
        ),
        'filters' => array(
          'sort_name' => array(
            'title' => ts('Participant Name'),
            'operator' => 'like',
          ),
          'gender_id' => array(
            'title' => ts('Gender'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
          ),
          'birth_date' => array(
            'title' => 'Birth Date',
            'operatorType' => CRM_Report_Form::OP_DATE,
            'type' => CRM_Utils_Type::T_DATE,
          ),
        ),
      )),
      'civicrm_email' => array(
        'dao' => 'CRM_Core_DAO_Email',
        'fields' => array(
          'email' => array(
            'title' => ts('Email'),
            'no_repeat' => TRUE,
          ),
        ),
        'grouping' => 'contact-fields',
        'filters' => array(
          'email' => array(
            'title' => ts('Participant E-mail'),
            'operator' => 'like',
          ),
        ),
      ),
      'civicrm_address' => array(
        'dao' => 'CRM_Core_DAO_Address',
        'fields' => array(
          'street_address' => NULL,
          'city' => NULL,
          'postal_code' => NULL,
          'state_province_id' => array(
            'title' => ts('State/Province'),
          ),
          'country_id' => array(
            'title' => ts('Country'),
          ),
        ),
        'grouping' => 'contact-fields',
      ),
      'civicrm_participant' => array(
        'dao' => 'CRM_Event_DAO_Participant',
        'fields' => array(
          'participant_id' => array('title' => 'Participant ID'),
          'participant_record' => array(
            'name' => 'id',
            'no_display' => TRUE,
            'required' => TRUE,
          ),
          'event_id' => array(
            'default' => TRUE,
            'type' => CRM_Utils_Type::T_STRING,
          ),
          'status_id' => array(
            'title' => ts('Status'),
            'default' => TRUE,
          ),
          'role_id' => array(
            'title' => ts('Role'),
            'default' => TRUE,
          ),
          'fee_currency' => array(
            'required' => TRUE,
            'no_display' => TRUE,
          ),
          'participant_fee_level' => NULL,
          'participant_fee_amount' => NULL,
          'participant_register_date' => array('title' => ts('Registration Date')),
        ),
        'grouping' => 'event-fields',
        'filters' => array(
          'event_id' => array(
            'name' => 'event_id',
            'title' => ts('Event'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => $this->getEventFilterOptions(),
          ),
          'sid' => array(
            'name' => 'status_id',
            'title' => ts('Participant Status'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'),
          ),
          'rid' => array(
            'name' => 'role_id',
            'title' => ts('Participant Role'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => CRM_Event_PseudoConstant::participantRole(),
          ),
          'participant_register_date' => array(
            'title' => 'Registration Date',
            'operatorType' => CRM_Report_Form::OP_DATE,
          ),
          'fee_currency' => array(
            'title' => ts('Fee Currency'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
            'default' => NULL,
            'type' => CRM_Utils_Type::T_STRING,
          ),

        ),
        'order_bys' => array(
          'event_id' => array(
            'title' => ts('Event'),
            'default_weight' => '1',
            'default_order' => 'ASC',
          ),
        ),
      ),
    ) +
    $this->getColumns('Phone') + array(
      'civicrm_event' => array(
        'dao' => 'CRM_Event_DAO_Event',
        'fields' => array(
          'event_type_id' => array('title' => ts('Event Type')),
          'event_start_date' => array('title' => ts('Event Start Date')),
        ),
        'grouping' => 'event-fields',
        'filters' => array(
          'eid' => array(
            'name' => 'event_type_id',
            'title' => ts('Event Type'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => CRM_Core_OptionGroup::values('event_type'),
          ),
          'event_start_date' => array(
            'title' => ts('Event Start Date'),
            'operatorType' => CRM_Report_Form::OP_DATE,
          ),
        ),
        'order_bys' => array(
          'event_type_id' => array(
            'title' => ts('Event Type'),
            'default_weight' => '2',
            'default_order' => 'ASC',
          ),
        ),
      ),
      'civicrm_contribution' => array(
        'dao' => 'CRM_Contribute_DAO_Contribution',
        'fields' => array(
          'contribution_id' => array(
            'name' => 'id',
            'no_display' => TRUE,
            'required' => TRUE,
            'csv_display' => TRUE,
            'title' => ts('Contribution ID'),
          ),
          'financial_type_id' => array('title' => ts('Financial Type')),
          'receive_date' => array('title' => ts('Payment Date')),
          'contribution_status_id' => array('title' => ts('Contribution Status')),
          'payment_instrument_id' => array('title' => ts('Payment Type')),
          'contribution_source' => array(
            'name' => 'source',
            'title' => ts('Contribution Source'),
          ),
          'currency' => array(
            'required' => TRUE,
            'no_display' => TRUE,
          ),
          'trxn_id' => NULL,
          'honor_type_id' => array('title' => ts('Honor Type')),
          'fee_amount' => array('title' => ts('Transaction Fee')),
          'net_amount' => NULL,
        ),
        'grouping' => 'contrib-fields',
        'filters' => array(
          'receive_date' => array(
            'title' => 'Payment Date',
            'operatorType' => CRM_Report_Form::OP_DATE,
          ),
          'financial_type_id' => array(
            'title' => ts('Financial Type'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => CRM_Contribute_PseudoConstant::financialType(),
          ),
          'currency' => array(
            'title' => ts('Contribution Currency'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
            'default' => NULL,
            'type' => CRM_Utils_Type::T_STRING,
          ),
          'payment_instrument_id' => array(
            'title' => ts('Payment Type'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => CRM_Contribute_PseudoConstant::paymentInstrument(),
          ),
          'contribution_status_id' => array(
            'title' => ts('Contribution Status'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
            'default' => NULL,
          ),
        ),
      ),
      'civicrm_line_item' => array(
        'dao' => 'CRM_Price_DAO_LineItem',
        'grouping' => 'priceset-fields',
        'filters' => array(
          'price_field_value_id' => array(
            'name' => 'price_field_value_id',
            'title' => ts('Fee Level'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'options' => $this->getPriceLevels(),
          ),
        ),
      ),
    )
    + $this->getColumns('Relationship', array(
        'fields' => FALSE,
        'filters' => FALSE,
        'join_filters' => TRUE,
        'group_by' => FALSE,
    )) +
    $this->getColumns('Contact', array(
        'fields' => TRUE,
        'join_fields' => TRUE,
        'filters' => FALSE,
        'prefix' => 'related_',
        'prefix_label' => 'Related Contact ',
    )) +
    $this->getColumns('Email', array(
      'prefix' => 'related_',
      'prefix_label' => 'Related Contact ',
    )) +
    $this->getColumns('Phone', array(
      'fields' => TRUE,
      'join_fields' => TRUE,
      'filters' => FALSE,
      'prefix' => 'related_',
      'prefix_label' => 'Related Contact ',
    ));

    $this->_options = array(
      'blank_column_begin' => array(
        'title' => ts('Blank column at the Beginning'),
        'type' => 'checkbox',
      ),
      'blank_column_end' => array(
        'title' => ts('Blank column at the End'),
        'type' => 'select',
        'options' => array(
          '' => '-select-',
          1 => ts('One'),
          2 => ts('Two'),
          3 => ts('Three'),
        ),
      ),
    );

    // If we have active campaigns add those elements to both the fields and filters
    if ($campaignEnabled && !empty($this->activeCampaigns)) {
      $this->_columns['civicrm_participant']['fields']['campaign_id'] = array(
        'title' => ts('Campaign'),
        'default' => 'false',
      );
      $this->_columns['civicrm_participant']['filters']['campaign_id'] = array(
        'title' => ts('Campaign'),
        'operatorType' => CRM_Report_Form::OP_MULTISELECT,
        'options' => $this->activeCampaigns,
      );
      $this->_columns['civicrm_participant']['order_bys']['campaign_id'] = array(
        'title' => ts('Campaign'),
      );
    }

    $this->_currencyColumn = 'civicrm_participant_fee_currency';
    parent::__construct();
  }