Example #1
0
 /**
  *
  * @return void
  */
 public function buildQuickForm()
 {
     $slots = CRM_Core_OptionGroup::values('conference_slot');
     $this->add('select', 'slot_label_id', ts('Conference Slot'), array('' => ts('- select -')) + $slots, FALSE);
     $this->addEntityRef('parent_event_id', ts('Parent Event'), array('entity' => 'event', 'placeholder' => ts('- any -'), 'select' => array('minimumInputLength' => 0)));
     parent::buildQuickForm();
 }
 function __construct()
 {
     $this->fetchActivityTypes();
     $this->fetchCaseStatusses();
     $rels = CRM_Core_PseudoConstant::relationshipType();
     $coach_rel_type_id = false;
     foreach ($rels as $relid => $v) {
         $this->rel_types[$relid] = $v['label_b_a'];
         if ($v['label_b_a'] == 'Coach') {
             $coach_rel_type_id = $relid;
         }
     }
     $coaches = array();
     if ($coach_rel_type_id) {
         $coaches = $this->coaches($coach_rel_type_id);
     }
     $this->_groupFilter = FALSE;
     $this->_tagFilter = FALSE;
     $this->_columns = array('civicrm_activity`' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array(), 'filters' => array('activity_type_id' => array('title' => ts('Activity type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('activity_type'), 'pseudofield' => true, 'default' => $this->_activityTypes), 'case_status' => array('title' => ts('Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('case_status'), 'pseudofield' => true, 'default' => $this->_openedCaseStatusses), 'case_role' => array('title' => ts('Role on case'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->rel_types), 'coach' => array('title' => ts('Coach'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $coaches, 'pseudofield' => true), 'my_cases' => array('title' => ts('My cases'), 'type' => CRM_Utils_Type::T_BOOLEAN, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')), 'default' => '1', 'pseudofield' => TRUE))));
     parent::__construct();
     $this->fetchCaseType();
     $this->fetchChequenummer();
     $this->fetchStatusGroup();
     $this->fetchCoachIdentifier();
 }
Example #3
0
 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     $links =& self::links();
     $action = array_sum(array_keys($links));
     $caseStatus = CRM_Core_OptionGroup::values('case_status');
     $caseType = CRM_Core_OptionGroup::values('case_type');
     require_once 'CRM/Case/BAO/Case.php';
     $queryParams = array();
     $query = "SELECT civicrm_case.id, civicrm_case.case_type_id, civicrm_case.status_id,\n                         civicrm_case.start_date, civicrm_case.subject \n                  FROM civicrm_case\n                  LEFT JOIN civicrm_case_contact ON civicrm_case_contact.case_id = civicrm_case.id\n                  WHERE civicrm_case_contact.contact_id = {$this->_contactId}";
     $case = CRM_Core_DAO::executeQuery($query, $queryParams);
     $values = array();
     while ($case->fetch()) {
         $values[$case->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $case->id, 'cid' => $this->_contactId));
         $names = array();
         $caseTypeIds = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, $case->case_type_id);
         foreach ($caseTypeIds as $id => $val) {
             if ($val) {
                 $names[] = $caseType[$val];
             }
         }
         $values[$case->id]['case_type_id'] = implode(':::', $names);
         $values[$case->id]['status_id'] = $caseStatus[$case->status_id];
         $values[$case->id]['start_date'] = $case->start_date;
         $values[$case->id]['subject'] = $case->subject;
         $values[$case->id]['id'] = $case->id;
     }
     $this->assign('cases', $values);
 }
Example #4
0
 /**
  * Build the form object.
  *
  * It consists of
  *    - displaying the QILL (query in local language)
  *    - displaying elements for saving the search
  */
 public function buildQuickForm()
 {
     // @todo sync this more with CRM_Group_Form_Edit.
     $query = new CRM_Contact_BAO_Query($this->get('queryParams'));
     $this->assign('qill', $query->qill());
     // Values from the search form
     $formValues = $this->controller->exportValues();
     // the name and description are actually stored with the group and not the saved search
     $this->add('text', 'title', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), TRUE);
     $this->addElement('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
     $groupTypes = CRM_Core_OptionGroup::values('group_type', TRUE);
     unset($groupTypes['Access Control']);
     if (!CRM_Core_Permission::access('CiviMail')) {
         $isWorkFlowEnabled = CRM_Mailing_Info::workflowEnabled();
         if ($isWorkFlowEnabled && !CRM_Core_Permission::check('create mailings') && !CRM_Core_Permission::check('schedule mailings') && !CRM_Core_Permission::check('approve mailings')) {
             unset($groupTypes['Mailing List']);
         }
     }
     if (!empty($groupTypes)) {
         $this->addCheckBox('group_type', ts('Group Type'), $groupTypes, NULL, NULL, NULL, NULL, '   ');
     }
     //CRM-14190
     CRM_Group_Form_Edit::buildParentGroups($this);
     // get the group id for the saved search
     $groupID = NULL;
     if (isset($this->_id)) {
         $groupID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $this->_id, 'id', 'saved_search_id');
         $this->addDefaultButtons(ts('Update Smart Group'));
     } else {
         $this->addDefaultButtons(ts('Save Smart Group'));
         $this->assign('partiallySelected', $formValues['radio_ts'] != 'ts_all');
     }
     $this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Group', $groupID, 'title'));
 }
Example #5
0
/**
 * Implementation of hook_civicrm_install
 */
function hrvisa_civicrm_install()
{
    if (!CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name')) {
        // create activity_type 'Visa Expiration'
        $params = array('weight' => 1, 'label' => 'Visa Expiration', 'filter' => 0, 'is_active' => 1, 'is_default' => 0);
        $result = civicrm_api3('activity_type', 'create', $params);
        if (CRM_Utils_Array::value('is_error', $result, FALSE)) {
            CRM_Core_Error::debug_var("Failed to create activity type 'Visa  Expiration'", $result);
            throw new CRM_Core_Exception('Failed to create activity type \'Visa  Expiration\'');
        }
        $activityTypeId = $result['values'][$result['id']]['value'];
    } else {
        $activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name');
    }
    // set weekly reminder for Visa Expiration activities (not active)
    // will be active when extension is enabled
    if (!empty($activityTypeId)) {
        $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
        $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
        // schedule reminder for Visa Expiration Creation
        $result = civicrm_api3('action_schedule', 'get', array('name' => 'Visa Expiration Reminder'));
        if (empty($result['id'])) {
            $params = array('name' => 'Visa Expiration Reminder', 'title' => 'Visa Expiration Reminder', 'recipient' => $targetID, 'limit_to' => 1, 'entity_value' => $activityTypeId, 'entity_status' => CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name'), 'start_action_offset' => 1, 'start_action_unit' => 'week', 'start_action_condition' => 'before', 'start_action_date' => 'activity_date_time', 'is_repeat' => 0, 'is_active' => 0, 'body_html' => '<p>Your latest visa expiries on {activity.activity_date_time}</p>', 'subject' => 'Reminder for Visa Expiration', 'record_activity' => 1, 'mapping_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value'));
            $result = civicrm_api3('action_schedule', 'create', $params);
        }
    }
    return _hrvisa_civix_civicrm_install();
}
 public function run()
 {
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE, 0);
     $config = CRM_Chapters_AutomatchConfig::singelton();
     $sql = "SELECT id, `" . $config->getMatchTypeField('column_name') . "` AS `type`, `" . $config->getCountryField('column_name') . "` AS `country`, `" . $config->getZipCodeRangeFromField('column_name') . "` AS `zipcode_from`, `" . $config->getZipCodeRangeToField('column_name') . "` AS `zipcode_to` FROM `" . $config->getCustomGroup('table_name') . "` WHERE entity_id = %1";
     $params[1] = array($cid, 'Integer');
     $rows = array();
     $dao = CRM_Core_DAO::executeQuery($sql, $params);
     $types = CRM_Core_OptionGroup::values('chapter_match_type');
     $countries = CRM_Core_OptionGroup::values('chapter_match_country');
     while ($dao->fetch()) {
         $country = '';
         if (!empty($countries[$dao->country])) {
             $country = $countries[$dao->country];
         }
         $row = array();
         $row['type'] = $types[$dao->type];
         $row['type_value'] = $dao->type;
         $row['country'] = $country;
         $row['zipcode_from'] = $dao->zipcode_from;
         $row['zipcode_to'] = $dao->zipcode_to;
         $row['id'] = $dao->id;
         $rows[] = $row;
     }
     $this->assign('rows', $rows);
     $this->assign('cid', $cid);
     parent::run();
 }
Example #7
0
 function preProcess()
 {
     // Make sure case types have been configured for the component
     require_once 'CRM/Core/OptionGroup.php';
     $caseType = CRM_Core_OptionGroup::values('case_type');
     if (empty($caseType)) {
         $this->assign('notConfigured', 1);
         return;
     }
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse');
     if ($this->_contactId) {
         $this->assign('contactId', $this->_contactId);
         // check logged in url permission
         require_once 'CRM/Contact/Page/View.php';
         CRM_Contact_Page_View::checkUserPermission($this);
     } else {
         if ($this->_action & CRM_Core_Action::VIEW) {
             CRM_Core_Error::fatal('Contact Id is required for view action.');
         }
     }
     $activityTypes = CRM_Case_PseudoConstant::activityType();
     $this->assign('openCaseId', $activityTypes['Open Case']['id']);
     $this->assign('changeCaseTypeId', $activityTypes['Change Case Type']['id']);
     $this->assign('changeCaseStatusId', $activityTypes['Change Case Status']['id']);
     $this->assign('changeCaseStartDateId', $activityTypes['Change Case Start Date']['id']);
 }
 function testBatchAddMembership()
 {
     $this->webtestLogin();
     $itemCount = 5;
     $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE);
     $softCreditAmount = array(1 => 50, 2 => 60, 3 => 40, 4 => 70, 5 => 35);
     // create contact
     $contact = array();
     $batchTitle = 'Batch-' . substr(sha1(rand()), 0, 7);
     //Open Live Contribution Page
     $this->openCiviPage("batch", "reset=1");
     $this->click("xpath=//div[@class='crm-submit-buttons']/a");
     $this->waitForElementPresent("_qf_Batch_next");
     $this->click("title");
     $this->type("title", $batchTitle);
     $this->select("type_id", "Membership");
     $this->type("item_count", $itemCount);
     $this->type("total", 500);
     $this->click("_qf_Batch_next");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     // Add Contact Details
     $data = array();
     for ($i = 1; $i <= $itemCount; $i++) {
         $data[$i] = array('first_name' => 'Ma' . substr(sha1(rand()), 0, 7), 'last_name' => 'An' . substr(sha1(rand()), 0, 7), 'membership_type' => 'General', 'amount' => 100, 'financial_type' => 'Member Dues', 'soft_credit_first_name' => 'Ar' . substr(sha1(rand()), 0, 7), 'soft_credit_last_name' => 'Ki' . substr(sha1(rand()), 0, 7), 'soft_credit_amount' => $softCreditAmount[$i], 'soft_credit_type' => $softCreditTypes[$i]);
         $this->_fillData($data[$i], $i, "Membership");
     }
     $this->click("_qf_Entry_cancel");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->_verifyData($data, "Membership");
 }
 /**
  * This function sets the default values for the form.
  * default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues()
 {
     if (!$this->_defaults) {
         $this->_defaults = array();
         $formArray = array('Component', 'Localization');
         $formMode = FALSE;
         if (in_array($this->_name, $formArray)) {
             $formMode = TRUE;
         }
         CRM_Core_BAO_ConfigSetting::retrieve($this->_defaults);
         CRM_Core_Config_Defaults::setValues($this->_defaults, $formMode);
         $list = array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', FALSE, FALSE, TRUE, NULL, 'name'));
         $cRlist = array_flip(CRM_Core_OptionGroup::values('contact_reference_options', FALSE, FALSE, TRUE, NULL, 'name'));
         $listEnabled = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options');
         $cRlistEnabled = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_reference_options');
         $autoSearchFields = array();
         if (!empty($list) && !empty($listEnabled)) {
             $autoSearchFields = array_combine($list, $listEnabled);
         }
         $cRSearchFields = array();
         if (!empty($cRlist) && !empty($cRlistEnabled)) {
             $cRSearchFields = array_combine($cRlist, $cRlistEnabled);
         }
         //Set defaults for autocomplete and contact reference options
         $this->_defaults['autocompleteContactSearch'] = array('1' => 1) + $autoSearchFields;
         $this->_defaults['autocompleteContactReference'] = array('1' => 1) + $cRSearchFields;
         $this->_defaults['enableSSL'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL', NULL, 0);
         $this->_defaults['verifySSL'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL', NULL, 1);
         $sql = "\nSELECT time_format\nFROM   civicrm_preferences_date\nWHERE  time_format IS NOT NULL\nAND    time_format <> ''\nLIMIT  1\n";
         $this->_defaults['timeInputFormat'] = CRM_Core_DAO::singleValueQuery($sql);
     }
     return $this->_defaults;
 }
 /**
  *
  */
 function __construct()
 {
     $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), 'id' => array('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('title' => ts('Contact Name'), 'operator' => 'like'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE)), 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'))), 'grouping' => 'contact-fields'), 'civicrm_membership' => array('dao' => 'CRM_Member_DAO_Membership', 'fields' => array('id' => array('title' => ts('Membership #'), 'no_display' => TRUE, 'required' => TRUE))), 'civicrm_financial_account' => array('dao' => 'CRM_Financial_DAO_FinancialAccount', 'fields' => array('debit_accounting_code' => array('title' => ts('Financial Account Code - Debit'), 'name' => 'accounting_code', 'alias' => 'financial_account_civireport_debit', 'default' => TRUE), 'credit_accounting_code' => array('title' => ts('Financial Account Code - Credit'), 'name' => 'accounting_code', 'alias' => 'financial_account_civireport_credit', 'default' => TRUE), 'debit_name' => array('title' => ts('Financial Account Name - Debit'), 'name' => 'name', 'alias' => 'financial_account_civireport_debit', 'default' => TRUE), 'credit_name' => array('title' => ts('Financial Account Name - Credit'), 'name' => 'name', 'alias' => 'financial_account_civireport_credit', 'default' => TRUE)), 'filters' => array('debit_accounting_code' => array('title' => ts('Financial Account Code - Debit'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount(NULL, NULL, 'accounting_code', 'accounting_code'), 'name' => 'accounting_code', 'alias' => 'financial_account_civireport_debit'), 'credit_accounting_code' => array('title' => ts('Financial Account Code - Credit'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount(NULL, NULL, 'accounting_code', 'accounting_code')), 'debit_name' => array('title' => ts('Financial Account Name - Debit'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount(), 'name' => 'id', 'alias' => 'financial_account_civireport_debit'), 'credit_name' => array('title' => ts('Financial Account Name - Credit'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount()))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem', 'fields' => array('financial_type_id' => array('title' => ts('Financial Type'), 'default' => TRUE)), 'filters' => array('financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType())), 'order_bys' => array('financial_type_id' => array('title' => ts('Financial Type')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('receive_date' => array('default' => TRUE), 'invoice_id' => array('title' => ts('Invoice ID'), 'default' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'default' => TRUE), 'id' => array('title' => ts('Contribution #'), 'default' => TRUE)), '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))), 'order_bys' => array('contribution_id' => array('title' => ts('Contribution #')), 'contribution_status_id' => array('title' => ts('Contribution Status'))), 'grouping' => 'contri-fields'), 'civicrm_financial_trxn' => array('dao' => 'CRM_Financial_DAO_FinancialTrxn', 'fields' => array('check_number' => array('title' => ts('Cheque #'), 'default' => TRUE), 'payment_instrument_id' => array('title' => ts('Payment Instrument'), 'default' => TRUE), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_date' => array('title' => ts('Transaction Date'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_DATE), 'trxn_id' => array('title' => ts('Trans #'), 'default' => TRUE)), 'filters' => array('payment_instrument_id' => array('title' => ts('Payment Instrument'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument()), '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), 'trxn_date' => array('title' => ts('Transaction Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE)), 'order_bys' => array('payment_instrument_id' => array('title' => ts('Payment Instrument')))), 'civicrm_entity_financial_trxn' => array('dao' => 'CRM_Financial_DAO_EntityFinancialTrxn', 'fields' => array('amount' => array('title' => ts('Amount'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING)), 'filters' => array('amount' => array('title' => ts('Amount')))));
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     parent::__construct();
 }
Example #11
0
 function preProcess()
 {
     // Make sure case types have been configured for the component
     require_once 'CRM/Core/OptionGroup.php';
     $caseType = CRM_Core_OptionGroup::values('case_type');
     if (empty($caseType)) {
         $this->assign('notConfigured', 1);
         return;
     }
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     // contact id is not mandatory for case form. If not found, don't call
     // parent's pre-process and proceed further.
     if ($this->_contactId) {
         parent::preProcess();
     } else {
         // we would need action to proceed further.
         $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'add');
         if ($this->_action & CRM_Core_Action::VIEW) {
             CRM_Core_Error::fatal('Contact Id is required for view action.');
         }
         $this->assign('action', $this->_action);
     }
     $activityTypes = CRM_Case_PseudoConstant::activityType();
     $this->assign('openCaseId', $activityTypes['Open Case']['id']);
     $this->assign('changeCaseTypeId', $activityTypes['Change Case Type']['id']);
     $this->assign('changeCaseStatusId', $activityTypes['Change Case Status']['id']);
     $this->assign('changeCaseStartDateId', $activityTypes['Change Case Start Date']['id']);
 }
Example #12
0
 function browse()
 {
     require_once 'CRM/Core/Permission.php';
     $surveys = CRM_Campaign_BAO_Survey::getSurvey(true);
     if (!empty($surveys)) {
         require_once 'CRM/Campaign/BAO/Campaign.php';
         $surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType();
         $campaigns = CRM_Campaign_BAO_Campaign::getAllCampaign();
         $activityTypes = CRM_Core_OptionGroup::values('activity_type', false, false, false, false, 'name');
         foreach ($surveys as $sid => $survey) {
             $surveys[$sid]['campaign_id'] = $campaigns[$survey['campaign_id']];
             $surveys[$sid]['activity_type_id'] = $surveyType[$survey['activity_type_id']];
             $surveys[$sid]['release_frequency'] = $survey['release_frequency_interval'] . ' ' . $survey['release_frequency_unit'];
             $action = array_sum(array_keys($this->actionLinks()));
             if ($survey['is_active']) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             $surveys[$sid]['action'] = CRM_Core_Action::formLink($this->actionLinks(), $action, array('id' => $sid));
         }
     }
     $this->assign('surveys', $surveys);
     $this->assign('addSurveyUrl', CRM_Utils_System::url('civicrm/survey/add', 'reset=1&action=add'));
 }
Example #13
0
 /**
  * This function sets the default values for the form.
  * default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 function setDefaultValues()
 {
     if (!$this->_defaults) {
         $this->_defaults = array();
         $formArray = array('Component', 'Localization');
         $formMode = false;
         if (in_array($this->_name, $formArray)) {
             $formMode = true;
         }
         require_once "CRM/Core/BAO/Setting.php";
         CRM_Core_BAO_Setting::retrieve($this->_defaults);
         require_once "CRM/Core/Config/Defaults.php";
         CRM_Core_Config_Defaults::setValues($this->_defaults, $formMode);
         require_once "CRM/Core/OptionGroup.php";
         $list = array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', false, false, true, null, 'name'));
         require_once "CRM/Core/BAO/Preferences.php";
         $listEnabled = CRM_Core_BAO_Preferences::valueOptions('contact_autocomplete_options');
         $autoSearchFields = array();
         if (!empty($list) && !empty($listEnabled)) {
             $autoSearchFields = array_combine($list, $listEnabled);
         }
         //Set sort_name for default
         $this->_defaults['autocompleteContactSearch'] = array('1' => 1) + $autoSearchFields;
     }
     return $this->_defaults;
 }
 /**
  * Overridden parent method to build the form
  *
  * @access public
  */
 public function buildQuickForm()
 {
     $this->add('hidden', 'rule_action_id');
     $this->add('select', 'activity_type_id', ts('Activity type'), array('' => ts('-- please select --')) + CRM_Core_OptionGroup::values('activity_type'), true);
     $this->add('select', 'status_id', ts('Status'), array('' => ts('-- please select --')) + CRM_Core_OptionGroup::values('activity_status'), true);
     $this->add('text', 'subject', ts('Subject'));
     $this->assign('use_old_contact_ref_fields', $this->use_old_contact_ref_fields);
     if ($this->use_old_contact_ref_fields) {
         $data = unserialize($this->ruleAction->action_params);
         $assignees = array();
         if (!empty($data['assignee_contact_id'])) {
             if (is_array($data['assignee_contact_id'])) {
                 $assignees = $data['assignee_contact_id'];
             } else {
                 $assignees[] = $data['assignee_contact_id'];
             }
         }
         $this->assign('selectedContacts', implode(",", $assignees));
         CRM_Contact_Form_NewContact::buildQuickForm($this);
     } else {
         $attributes = array('multiple' => TRUE, 'create' => TRUE, 'api' => array('params' => array('is_deceased' => 0)));
         $this->addEntityRef('assignee_contact_id', ts('Assigned to'), $attributes, false);
     }
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
 /**
  * Class constructor.
  */
 public function __construct()
 {
     // don’t display the ‘Add these Contacts to Group’ button
     $this->_add2groupSupported = FALSE;
     $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
     $this->loggingDB = $dsn['database'];
     // used for redirect back to contact summary
     $this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
     $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
     $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
     $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
     $this->_logTables = array('log_civicrm_contact' => array('fk' => 'id'), 'log_civicrm_email' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_phone' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_address' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_note' => array('fk' => 'entity_id', 'entity_table' => TRUE, 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject')), 'log_civicrm_note_comment' => array('fk' => 'entity_id', 'table_name' => 'log_civicrm_note', 'joins' => array('table' => 'log_civicrm_note', 'join' => "entity_log_civireport.entity_id = fk_table.id AND entity_log_civireport.entity_table = 'civicrm_note'"), 'entity_table' => TRUE, 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject')), 'log_civicrm_group_contact' => array('fk' => 'contact_id', 'bracket_info' => array('entity_column' => 'group_id', 'table' => 'log_civicrm_group', 'column' => 'title'), 'action_column' => 'status', 'log_type' => 'Group'), 'log_civicrm_entity_tag' => array('fk' => 'entity_id', 'bracket_info' => array('entity_column' => 'tag_id', 'table' => 'log_civicrm_tag', 'column' => 'name'), 'entity_table' => TRUE), 'log_civicrm_relationship' => array('fk' => 'contact_id_a', 'bracket_info' => array('entity_column' => 'relationship_type_id', 'table' => 'log_civicrm_relationship_type', 'column' => 'label_a_b')), 'log_civicrm_activity_for_target' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "(entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$targetID})"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_activity_for_assignee' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$assigneeID}"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_activity_for_source' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$sourceID}"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_case' => array('fk' => 'contact_id', 'joins' => array('table' => 'log_civicrm_case_contact', 'join' => 'entity_log_civireport.id = fk_table.case_id'), 'bracket_info' => array('entity_column' => 'case_type_id', 'options' => CRM_Case_PseudoConstant::caseType('title', FALSE))));
     $logging = new CRM_Logging_Schema();
     // build _logTables for contact custom tables
     $customTables = $logging->entityCustomDataLogTables('Contact');
     foreach ($customTables as $table) {
         $this->_logTables[$table] = array('fk' => 'entity_id', 'log_type' => 'Contact');
     }
     // build _logTables for address custom tables
     $customTables = $logging->entityCustomDataLogTables('Address');
     foreach ($customTables as $table) {
         $this->_logTables[$table] = array('fk' => 'contact_id', 'joins' => array('table' => 'log_civicrm_address', 'join' => 'entity_log_civireport.entity_id = fk_table.id'), 'log_type' => 'Contact');
     }
     // Allow log tables to be extended via report hooks.
     CRM_Report_BAO_Hook::singleton()->alterLogTables($this, $this->_logTables);
     parent::__construct();
 }
Example #16
0
 function __construct()
 {
     $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('no_repeat' => TRUE, 'title' => ts('email'))), 'grouping' => 'contact-fields'), 'civicrm_pledge' => array('dao' => 'CRM_Pledge_DAO_Pledge', 'fields' => array('id' => array('no_display' => TRUE, 'required' => FALSE), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'amount' => array('title' => ts('Pledge Amount'), 'required' => TRUE, 'type' => CRM_Utils_Type::T_MONEY, 'statistics' => array('sum' => ts('Aggregate Amount Pledged'), 'count' => ts('Pledges'), 'avg' => ts('Average'))), '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'))), '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'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('contribution_status'))), 'group_bys' => array('pledge_create_date' => array('frequency' => TRUE, 'default' => TRUE, 'chart' => TRUE), 'frequency_unit' => array('title' => ts('Frequency Unit')), 'status_id' => array('title' => ts('Pledge Status')))), 'civicrm_pledge_payment' => array('dao' => 'CRM_Pledge_DAO_PledgePayment', 'fields' => array('total_paid' => array('title' => ts('Total Amount Paid'), 'type' => CRM_Utils_Type::T_STRING, 'dbAlias' => 'sum(pledge_payment_civireport.actual_amount)'))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_Group', '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())))) + $this->addAddressFields();
     $this->_tagFilter = TRUE;
     $this->_currencyColumn = 'civicrm_pledge_currency';
     parent::__construct();
 }
 /**
  * Set defaults for the form.
  *
  * @return array
  */
 public function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if (!empty($defaults['preferred_language'])) {
         $languages = CRM_Contact_BAO_Contact::buildOptions('preferred_language');
         $defaults['preferred_language'] = CRM_Utils_Array::key($defaults['preferred_language'], $languages);
     }
     // CRM-7119: set preferred_language to default if unset
     if (empty($defaults['preferred_language'])) {
         $config = CRM_Core_Config::singleton();
         $defaults['preferred_language'] = $config->lcMessages;
     }
     // CRM-19135: where CRM_Core_BAO_Contact::getValues() set label as a default value instead of reserved 'value',
     // the code is to ensure we always set default to value instead of label
     if (!empty($defaults['preferred_mail_format'])) {
         $defaults['preferred_mail_format'] = array_search($defaults['preferred_mail_format'], CRM_Core_SelectValues::pmf());
     }
     if (empty($defaults['communication_style_id'])) {
         $defaults['communication_style_id'] = array_pop(CRM_Core_OptionGroup::values('communication_style', TRUE, NULL, NULL, 'AND is_default = 1'));
     }
     foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
         $name = "{$greeting}_display";
         $this->assign($name, CRM_Utils_Array::value($name, $defaults));
     }
     return $defaults;
 }
Example #18
0
 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Settings - Search Preferences'));
     // @todo remove the following adds in favour of setting via the settings array (above).
     $this->addYesNo('includeWildCardInName', ts('Automatic Wildcard'));
     $this->addYesNo('includeEmailInName', ts('Include Email'));
     $this->addYesNo('includeNickNameInName', ts('Include Nickname'));
     $this->addYesNo('includeAlphabeticalPager', ts('Include Alphabetical Pager'));
     $this->addYesNo('includeOrderByClause', ts('Include Order By Clause'));
     $this->addElement('text', 'smartGroupCacheTimeout', ts('Smart group cache timeout'), array('size' => 3, 'maxlength' => 5));
     $types = array('Contact', 'Individual', 'Organization', 'Household');
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
     $this->add('select', 'defaultSearchProfileID', ts('Default Contact Search Profile'), array('' => ts('- none -')) + $profiles, FALSE, array('class' => 'crm-select2 huge'));
     // Autocomplete for Contact Search (quick search etc.)
     $options = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', FALSE, FALSE, TRUE));
     $this->addCheckBox('autocompleteContactSearch', ts('Autocomplete Contact Search'), $options, NULL, NULL, NULL, NULL, array('&nbsp;&nbsp;'));
     $element = $this->getElement('autocompleteContactSearch');
     $element->_elements[0]->_flagFrozen = TRUE;
     // Autocomplete for Contact Reference (custom fields)
     $optionsCR = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_reference_options', FALSE, FALSE, TRUE));
     $this->addCheckBox('autocompleteContactReference', ts('Contact Reference Options'), $optionsCR, NULL, NULL, NULL, NULL, array('&nbsp;&nbsp;'));
     $element = $this->getElement('autocompleteContactReference');
     $element->_elements[0]->_flagFrozen = TRUE;
     parent::buildQuickForm();
 }
Example #19
0
 /** 
  * Heart of the viewing process. The runner gets all the meta data for 
  * the contact and calls the appropriate type of page to view. 
  * 
  * @return void 
  * @access public 
  * 
  */
 function preProcess()
 {
     // Make sure case types have been configured for the component
     require_once 'CRM/Core/OptionGroup.php';
     $caseType = CRM_Core_OptionGroup::values('case_type');
     if (empty($caseType)) {
         $this->assign('notConfigured', 1);
         return;
     }
     $session =& CRM_Core_Session::singleton();
     $allCases = CRM_Utils_Request::retrieve('all', 'Positive', $session);
     CRM_Utils_System::setTitle(ts('CiviCase Dashboard'));
     $userID = $session->get('userID');
     if (!$allCases) {
         $this->assign('myCases', true);
     } else {
         $this->assign('myCases', false);
     }
     $this->assign('newClient', false);
     if (CRM_Core_Permission::check('add contacts')) {
         $this->assign('newClient', true);
     }
     require_once 'CRM/Case/BAO/Case.php';
     $summary = CRM_Case_BAO_Case::getCasesSummary($allCases, $userID);
     $upcoming = CRM_Case_BAO_Case::getCases($allCases, $userID, 'upcoming');
     $recent = CRM_Case_BAO_Case::getCases($allCases, $userID, 'recent');
     $this->assign('casesSummary', $summary);
     if (!empty($upcoming)) {
         $this->assign('upcomingCases', $upcoming);
     }
     if (!empty($recent)) {
         $this->assign('recentCases', $recent);
     }
 }
Example #20
0
 /**
  * Set default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  *
  *
  * @return array
  */
 public function setDefaultValues()
 {
     $defaults = array();
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         if (!empty($this->_BAOName)) {
             $baoName = $this->_BAOName;
             $baoName::retrieve($params, $defaults);
         }
     }
     if ($this->_action == CRM_Core_Action::DELETE && !empty($defaults['name'])) {
         $this->assign('delName', $defaults['name']);
     } elseif ($this->_action == CRM_Core_Action::ADD) {
         $condition = " AND is_default = 1";
         $values = CRM_Core_OptionGroup::values('financial_account_type', FALSE, FALSE, FALSE, $condition);
         $defaults['financial_account_type_id'] = array_keys($values);
         $defaults['is_active'] = 1;
     } elseif ($this->_action & CRM_Core_Action::UPDATE) {
         if (!empty($defaults['contact_id']) || !empty($defaults['created_id'])) {
             $contactID = !empty($defaults['created_id']) ? $defaults['created_id'] : $defaults['contact_id'];
             $this->assign('created_id', $contactID);
             $this->assign('organisationId', $contactID);
         }
         if ($parentId = CRM_Utils_Array::value('parent_id', $defaults)) {
             $this->assign('parentId', $parentId);
         }
     }
     return $defaults;
 }
 /**
  */
 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();
 }
Example #22
0
 /**
  * @param CRM_Core_Form $form
  */
 public function buildForm(&$form)
 {
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Find Totals for Events');
     /**
      * Define the search form fields here
      */
     $form->addElement('checkbox', 'paid_online', ts('Only show Credit Card Payments'));
     $form->addElement('checkbox', 'show_payees', ts('Show payees'));
     $event_type = CRM_Core_OptionGroup::values('event_type', FALSE);
     foreach ($event_type as $eventId => $eventName) {
         $form->addElement('checkbox', "event_type_id[{$eventId}]", 'Event Type', $eventName);
     }
     $events = CRM_Event_BAO_Event::getEvents(1);
     $form->add('select', 'event_id', ts('Event Name'), array('' => ts('- select -')) + $events);
     $form->addDate('start_date', ts('Payments Date From'), FALSE, array('formatType' => 'custom'));
     $form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
     /**
      * If you are using the sample template, this array tells the template fields to render
      * for the search form.
      */
     $form->assign('elements', array('paid_online', 'start_date', 'end_date', 'show_payees', 'event_type_id', 'event_id'));
 }
Example #23
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();
 }
Example #24
0
 /**
  * Class constructor.
  */
 public function __construct()
 {
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'order_bys' => array('sort_name' => array('title' => ts("Last name, First name"))), 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'no_repeat' => TRUE, 'default' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE))), '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' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('id' => array('no_display' => TRUE, 'required' => TRUE), 'total_amount' => array('title' => ts('Amount Contributed to Date'), 'statistics' => array('sum' => ts("Total Amount Contributed"))))), 'civicrm_contribution_recur' => array('dao' => 'CRM_Contribute_DAO_ContributionRecur', 'fields' => array('id' => array('no_display' => TRUE, 'required' => TRUE), 'currency' => array('title' => ts("Currency"), 'required' => TRUE, 'no_display' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'frequency_interval' => array('title' => ts('Frequency interval'), 'default' => TRUE), 'frequency_unit' => array('title' => ts('Frequency unit'), 'default' => TRUE), 'amount' => array('title' => ts('Installment Amount'), 'default' => TRUE), 'installments' => array('title' => ts('Installments'), 'default' => TRUE), 'start_date' => array('title' => ts('Start Date')), 'create_date' => array('title' => ts('Create Date')), 'modified_date' => array('title' => ts('Modified Date')), 'cancel_date' => array('title' => ts('Cancel Date')), 'end_date' => array('title' => ts('End Date')), 'next_sched_contribution_date' => array('title' => ts('Next Scheduled Contribution Date')), 'failure_count' => array('title' => ts('Failure Count')), 'failure_retry_date' => array('title' => ts('Failure Retry Date'))), 'filters' => array('contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(5), '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), 'frequency_unit' => array('title' => ts('Frequency Unit'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('recur_frequency_units'), 'type' => CRM_Utils_Type::T_INT), 'frequency_interval' => array('title' => ts('Frequency Interval'), 'type' => CRM_Utils_Type::T_INT), 'amount' => array('title' => ts('Installment Amount'), 'type' => CRM_Utils_Type::T_MONEY), 'installments' => array('title' => ts('Installments'), 'type' => CRM_Utils_Type::T_INT), 'start_date' => array('title' => ts('Start Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_TIME), 'next_sched_contribution_date' => array('title' => ts('Next Scheduled Contribution Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_TIME), 'end_date' => array('title' => ts('End Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_TIME), 'contribution_processed_date' => array('title' => ts('Last Contribution Processed'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_TIME), 'calculated_end_date' => array('title' => ts('Calculated end date (either end date or date all installments will be made)'), 'description' => "does this work?", 'operatorType' => CRM_Report_Form::OP_DATE, 'pseudofield' => TRUE))));
     $this->_currencyColumn = 'civicrm_contribution_recur_currency';
     $this->_groupFilter = TRUE;
     parent::__construct();
 }
Example #25
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();
 }
 function __construct()
 {
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('id' => array('no_display' => TRUE, 'required' => TRUE), 'display_name' => array('title' => ts('Contact Name'), 'required' => TRUE, 'no_repeat' => 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'))))) + $this->getAddressColumns() + array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('total_amount' => array('title' => ts('Amount Statistics'), 'required' => TRUE, 'statistics' => array('sum' => ts('Aggregate Amount'), 'count' => ts('Donations'), 'avg' => ts('Average'))), 'currency' => array('required' => TRUE, 'no_display' => TRUE)), 'filters' => array('receive_date' => array('default' => 'this.year', '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), 'total_range' => array('title' => ts('Show no. of Top Donors'), 'type' => CRM_Utils_Type::T_INT, 'default_op' => 'eq'), 'financial_type_id' => array('name' => 'financial_type_id', 'title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'contribution_status_id' => array('title' => ts('Donation Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array(1)))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'email-fields'), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'phone-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::nestedGroup()))));
     $this->_tagFilter = TRUE;
     $this->_currencyColumn = 'civicrm_contribution_currency';
     parent::__construct();
 }
Example #27
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();
 }
Example #28
0
 /**
  * Function used to build form element for soft credit block.
  *
  * @param CRM_Core_Form $form
  *
  * @return \CRM_Core_Form
  */
 public static function buildQuickForm(&$form)
 {
     if (!empty($form->_honor_block_is_active)) {
         $ufJoinDAO = new CRM_Core_DAO_UFJoin();
         $ufJoinDAO->module = 'soft_credit';
         $ufJoinDAO->entity_id = $form->_id;
         if ($ufJoinDAO->find(TRUE)) {
             $jsonData = CRM_Contribute_BAO_ContributionPage::formatModuleData($ufJoinDAO->module_data, TRUE, 'soft_credit');
             if ($jsonData) {
                 foreach (array('honor_block_title', 'honor_block_text') as $name) {
                     $form->assign($name, $jsonData[$name]);
                 }
                 $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE);
                 // radio button for Honor Type
                 foreach ($jsonData['soft_credit_types'] as $value) {
                     $honorTypes[$value] = $form->createElement('radio', NULL, NULL, $softCreditTypes[$value], $value);
                 }
                 $form->addGroup($honorTypes, 'soft_credit_type_id', NULL)->setAttribute('allowClear', TRUE);
             }
         }
         return $form;
     }
     // by default generate 10 blocks
     $item_count = 11;
     $showSoftCreditRow = 2;
     if ($form->getAction() & CRM_Core_Action::UPDATE) {
         $form->_softCreditInfo = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($form->_id, TRUE);
     } elseif (!empty($form->_pledgeID)) {
         //Check and select most recent completed contrubtion and use it to retrieve
         //soft-credit information to use as default for current pledge payment, CRM-13981
         $pledgePayments = CRM_Pledge_BAO_PledgePayment::getPledgePayments($form->_pledgeID);
         foreach ($pledgePayments as $id => $record) {
             if ($record['contribution_id']) {
                 $softCredits = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($record['contribution_id'], TRUE);
                 if ($record['status'] == 'Completed' && count($softCredits) > 0) {
                     $form->_softCreditInfo = $softCredits;
                 }
             }
         }
     }
     if (property_exists($form, "_softCreditInfo")) {
         if (!empty($form->_softCreditInfo['soft_credit'])) {
             $showSoftCreditRow = count($form->_softCreditInfo['soft_credit']);
             $showSoftCreditRow++;
         }
     }
     for ($rowNumber = 1; $rowNumber <= $item_count; $rowNumber++) {
         $form->addEntityRef("soft_credit_contact_id[{$rowNumber}]", ts('Contact'), array('create' => TRUE));
         $form->addMoney("soft_credit_amount[{$rowNumber}]", ts('Amount'), FALSE, NULL, FALSE);
         $form->addSelect("soft_credit_type[{$rowNumber}]", array('entity' => 'contribution_soft', 'field' => 'soft_credit_type_id', 'label' => ts('Type')));
         if (!empty($form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id'])) {
             $form->add('hidden', "soft_credit_id[{$rowNumber}]", $form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id']);
         }
     }
     self::addPCPFields($form);
     $form->assign('showSoftCreditRow', $showSoftCreditRow);
     $form->assign('rowCount', $item_count);
     $form->addElement('hidden', 'sct_default_id', CRM_Core_OptionGroup::getDefaultValue("soft_credit_type"), array('id' => 'sct_default_id'));
 }
 /**
  * Function to build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     $slots = CRM_Core_OptionGroup::values('conference_slot');
     $this->add('select', 'slot_label_id', ts('Conference Slot'), array('' => ts('- select -')) + $slots, FALSE);
     $this->addElement('text', 'parent_event_name', ts('Parent Event'));
     $this->addElement('hidden', 'parent_event_id');
     parent::buildQuickForm();
 }
Example #30
0
 /**
  */
 public function __construct()
 {
     $this->_autoIncludeIndexedFieldsAsOrderBys = 1;
     $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), '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')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Contact 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_membership' => array('dao' => 'CRM_Member_DAO_Membership', 'fields' => array('id' => array('title' => ts('Membership #'), 'no_display' => TRUE, 'required' => TRUE))), 'civicrm_financial_account' => array('dao' => 'CRM_Financial_DAO_FinancialAccount', 'fields' => array('debit_accounting_code' => array('title' => ts('Financial Account Code - Debit'), 'name' => 'accounting_code', 'alias' => 'financial_account_civireport_debit', 'default' => TRUE), 'credit_accounting_code' => array('title' => ts('Financial Account Code - Credit'), 'name' => 'accounting_code', 'alias' => 'financial_account_civireport_credit', 'default' => TRUE), 'debit_name' => array('title' => ts('Financial Account Name - Debit'), 'name' => 'name', 'alias' => 'financial_account_civireport_debit', 'default' => TRUE), 'credit_name' => array('title' => ts('Financial Account Name - Credit'), 'name' => 'name', 'alias' => 'financial_account_civireport_credit', 'default' => TRUE)), 'filters' => array('debit_accounting_code' => array('title' => ts('Financial Account Code - Debit'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount(NULL, NULL, 'accounting_code', 'accounting_code'), 'name' => 'accounting_code', 'alias' => 'financial_account_civireport_debit'), 'credit_accounting_code' => array('title' => ts('Financial Account Code - Credit'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount(NULL, NULL, 'accounting_code', 'accounting_code')), 'debit_name' => array('title' => ts('Financial Account Name - Debit'), 'type' => CRM_Utils_Type::T_STRING, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount(), 'name' => 'id', 'alias' => 'financial_account_civireport_debit'), 'credit_name' => array('title' => ts('Financial Account Name - Credit'), 'type' => CRM_Utils_Type::T_STRING, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialAccount()))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem', 'fields' => array('financial_type_id' => array('title' => ts('Financial Type'), 'default' => TRUE)), 'filters' => array('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())), 'order_bys' => array('financial_type_id' => array('title' => ts('Financial Type')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('receive_date' => array('default' => TRUE), 'invoice_id' => array('title' => ts('Invoice ID'), 'default' => TRUE), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'default' => TRUE), 'id' => array('title' => ts('Contribution #'), 'default' => TRUE)), '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))), 'order_bys' => array('contribution_id' => array('title' => ts('Contribution #')), 'contribution_status_id' => array('title' => ts('Contribution Status'))), 'grouping' => 'contri-fields'), 'civicrm_financial_trxn' => array('dao' => 'CRM_Financial_DAO_FinancialTrxn', 'fields' => array('check_number' => array('title' => ts('Cheque #'), 'default' => TRUE), 'payment_instrument_id' => array('title' => ts('Payment Method'), 'default' => TRUE), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_date' => array('title' => ts('Transaction Date'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_DATE), 'trxn_id' => array('title' => ts('Trans #'), 'default' => TRUE)), 'filters' => array('payment_instrument_id' => array('title' => ts('Payment Method'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument()), '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), 'trxn_date' => array('title' => ts('Transaction Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE)), 'order_bys' => array('payment_instrument_id' => array('title' => ts('Payment Method')))), 'civicrm_entity_financial_trxn' => array('dao' => 'CRM_Financial_DAO_EntityFinancialTrxn', 'fields' => array('amount' => array('title' => ts('Amount'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING)), 'filters' => array('amount' => array('title' => ts('Amount')))));
     $this->_groupFilter = TRUE;
     $this->_tagFilter = TRUE;
     parent::__construct();
 }