Reports have always been all over the place on this leading to PRs often going stale
'location' => array(
'type' => 'text',
'label' => ts('Location'),
- 'attributes' =>
- CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity',
- 'location'
- ),
+ 'attributes' => CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'location'),
'required' => FALSE
),
'details' => array(
}
$this->setDefaults(array(
- 'onDuplicate' =>
- CRM_Import_Parser::DUPLICATE_SKIP,
+ 'onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP,
));
//build date formats
'' => '- select -') + CRM_Core_SelectValues::addressProvider();
$this->_varNames = array(
- CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
'address_options' => array(
'html_type' => 'checkboxes',
'title' => ts('Address Fields'),
'weight' => 3,
),
),
- CRM_Core_BAO_Setting::ADDRESS_STANDARDIZATION_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::ADDRESS_STANDARDIZATION_PREFERENCES_NAME => array(
'address_standardization_provider' => array(
'html_type' => 'select',
'title' => ts('Provider'),
function preProcess() {
CRM_Utils_System::setTitle(ts('CiviCampaign Component Settings'));
$this->_varNames = array(
- CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME => array(
'tag_unconfirmed' => array(
'html_type' => 'text',
'title' => ts('Tag for Unconfirmed Petition Signers'),
$config = CRM_Core_Config::singleton();
CRM_Utils_System::setTitle(ts('CiviContribute Component Settings'));
$this->_varNames = array(
- CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME =>
- array(
- 'invoice_prefix' =>
- array(
- 'html_type' => 'text',
- 'title' => ts('Invoice Prefix'),
- 'weight' => 1,
- 'description' => ts('Enter prefix to be display on PDF for invoice'),
- ),
- 'credit_notes_prefix' =>
- array(
- 'html_type' => 'text',
- 'title' => ts('Credit Notes Prefix'),
- 'weight' => 2,
- 'description' => ts('Enter prefix to be display on PDF for credit notes.'),
- ),
- 'due_date' =>
- array(
- 'html_type' => 'text',
- 'title' => ts('Due Date'),
- 'weight' => 3,
- ),
- 'due_date_period' =>
- array(
- 'html_type' => 'select',
- 'title' => ts('For transmission'),
- 'weight' => 4,
- 'description' => ts('Select the interval for due date.'),
- 'option_values' =>
- array(
- 'select' => ts('- select -'),
- 'days' => ts('Days'),
- 'months' => ts('Months'),
- 'years' => ts('Years'),
+ CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME => array(
+ 'invoice_prefix' => array(
+ 'html_type' => 'text',
+ 'title' => ts('Invoice Prefix'),
+ 'weight' => 1,
+ 'description' => ts('Enter prefix to be display on PDF for invoice'),
),
- ),
- 'notes' =>
- array(
- 'html_type' => 'wysiwyg',
- 'title' => ts('Notes or Standard Terms'),
- 'weight' => 5,
- 'description' => ts('Enter note or message to be displayed on PDF invoice or credit notes '),
- 'attributes' => array('rows' => 2, 'cols' => 40),
- ),
- 'is_email_pdf' =>
- array(
- 'html_type' => 'checkbox',
- 'title' => ts('Automatically email invoice when user purchases online'),
- 'weight' => 6,
- ),
- 'tax_term' =>
- array(
- 'html_type' => 'text',
- 'title' => ts('Tax Term'),
- 'weight' => 7,
- ),
- 'tax_display_settings'=>
- array(
- 'html_type' => 'select',
- 'title' => ts('Tax Display Settings'),
- 'weight' => 8,
- 'option_values' =>
- array(
- 'Do_not_show' => ts('Do not show breakdown, only show total -i.e '.$config->defaultCurrencySymbol.'120.00'),
- 'Inclusive' => ts('Show [tax term] inclusive price - i.e. '.$config->defaultCurrencySymbol.'120.00 (includes [tax term] of '.$config->defaultCurrencySymbol.'20.00)'),
- 'Exclusive' => ts('Show [tax term] exclusive price - i.e. '.$config->defaultCurrencySymbol.'100.00 + '.$config->defaultCurrencySymbol.'20.00 [tax term]'),
+ 'credit_notes_prefix' => array(
+ 'html_type' => 'text',
+ 'title' => ts('Credit Notes Prefix'),
+ 'weight' => 2,
+ 'description' => ts('Enter prefix to be display on PDF for credit notes.'),
+ ),
+ 'due_date' => array(
+ 'html_type' => 'text',
+ 'title' => ts('Due Date'),
+ 'weight' => 3,
+ ),
+ 'due_date_period' => array(
+ 'html_type' => 'select',
+ 'title' => ts('For transmission'),
+ 'weight' => 4,
+ 'description' => ts('Select the interval for due date.'),
+ 'option_values' => array(
+ 'select' => ts('- select -'),
+ 'days' => ts('Days'),
+ 'months' => ts('Months'),
+ 'years' => ts('Years'),
+ ),
+ ),
+ 'notes' => array(
+ 'html_type' => 'wysiwyg',
+ 'title' => ts('Notes or Standard Terms'),
+ 'weight' => 5,
+ 'description' => ts('Enter note or message to be displayed on PDF invoice or credit notes '),
+ 'attributes' => array('rows' => 2, 'cols' => 40),
+ ),
+ 'is_email_pdf' => array(
+ 'html_type' => 'checkbox',
+ 'title' => ts('Automatically email invoice when user purchases online'),
+ 'weight' => 6,
+ ),
+ 'tax_term' => array(
+ 'html_type' => 'text',
+ 'title' => ts('Tax Term'),
+ 'weight' => 7,
+ ),
+ 'tax_display_settings' => array(
+ 'html_type' => 'select',
+ 'title' => ts('Tax Display Settings'),
+ 'weight' => 8,
+ 'option_values' => array(
+ 'Do_not_show' => ts('Do not show breakdown, only show total -i.e ' .
+ $config->defaultCurrencySymbol . '120.00'),
+ 'Inclusive' => ts('Show [tax term] inclusive price - i.e. ' .
+ $config->defaultCurrencySymbol .
+ '120.00 (includes [tax term] of ' .
+ $config->defaultCurrencySymbol . '20.00)'),
+ 'Exclusive' => ts('Show [tax term] exclusive price - i.e. ' .
+ $config->defaultCurrencySymbol . '100.00 + ' .
+ $config->defaultCurrencySymbol . '20.00 [tax term]'),
+ ),
),
),
- ),
);
parent::preProcess();
}
* @return void
*/
function setDefaultValues() {
- $defaults = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings');
+ $defaults = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
return $defaults;
}
if (isset($params['invoicing'])) {
$value = array($setKey => $optionValues[$setKey]);
- $setInvoice = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($value)) . CRM_Core_DAO::VALUE_SEPARATOR;
- CRM_Core_BAO_Setting::setItem($values['user_dashboard_options'] . $setInvoice, 'CiviCRM Preferences', 'user_dashboard_options');
+ $setInvoice = CRM_Core_DAO::VALUE_SEPARATOR .
+ implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($value)) .
+ CRM_Core_DAO::VALUE_SEPARATOR;
+ CRM_Core_BAO_Setting::setItem($values['user_dashboard_options'] .
+ $setInvoice, 'CiviCRM Preferences', 'user_dashboard_options');
}
else {
$setting = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($values['user_dashboard_options'], 1, -1));
- $invoiceKey = array_search ($setKey, $setting);
+ $invoiceKey = array_search($setKey, $setting);
unset($setting[$invoiceKey]);
- $settingName = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_values($setting)) . CRM_Core_DAO::VALUE_SEPARATOR;
+ $settingName = CRM_Core_DAO::VALUE_SEPARATOR .
+ implode(CRM_Core_DAO::VALUE_SEPARATOR, array_values($setting)) .
+ CRM_Core_DAO::VALUE_SEPARATOR;
CRM_Core_BAO_Setting::setItem($settingName, 'CiviCRM Preferences', 'user_dashboard_options');
}
}
CRM_Utils_System::setTitle(ts('Settings - Display Preferences'));
$this->_varNames = array(
- CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
'contact_view_options' => array(
'html_type' => 'checkboxes',
'title' => ts('Viewing Contacts'),
$optionValues[$i] = $i;
}
$this->_varNames = array(
- CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME => array(
'enable_cart' => array(
'html_type' => 'checkbox',
'title' => ts('Use Shopping Cart Style Event Registration'),
function preProcess() {
CRM_Utils_System::setTitle(ts('CiviMail Component Settings'));
$this->_varNames = array(
- CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME =>
- array(
- 'profile_double_optin' =>
- array(
+ CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME => array(
+ 'profile_double_optin' => array(
'html_type' => 'checkbox',
'title' => ts('Enable Double Opt-in for Profile Group(s) field'),
'weight' => 1,
'description' => ts('When CiviMail is enabled, users who "subscribe" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.'),
),
- 'profile_add_to_group_double_optin' =>
- array(
+ 'profile_add_to_group_double_optin' => array(
'html_type' => 'checkbox',
'title' => ts('Enable Double Opt-in for Profiles which use the "Add to Group" setting'),
'weight' => 2,
'description' => ts('When CiviMail is enabled and a profile uses the "Add to Group" setting, users who complete the profile form will receive a confirmation email. They must respond (opt-in) before they are added to the group.'),
),
- 'track_civimail_replies' =>
- array(
+ 'track_civimail_replies' => array(
'html_type' => 'checkbox',
'title' => ts('Track replies using VERP in Reply-To header'),
'weight' => 3,
'description' => ts('If checked, mailings will default to tracking replies using VERP-ed Reply-To.'),
),
- 'civimail_workflow' =>
- array(
+ 'civimail_workflow' => array(
'html_type' => 'checkbox',
'title' => ts('Enable workflow support for CiviMail'),
'weight' => 4,
'description' => ts('Drupal-only. Rules module must be enabled (beta feature - use with caution).'),
),
- 'civimail_multiple_bulk_emails' =>
- array(
+ 'civimail_multiple_bulk_emails' => array(
'html_type' => 'checkbox',
'title' => ts('Enable multiple bulk email address for a contact.'),
'weight' => 5,
'description' => ts('CiviMail will deliver a copy of the email to each bulk email listed for the contact.'),
),
- 'civimail_server_wide_lock' =>
- array(
+ 'civimail_server_wide_lock' => array(
'html_type' => 'checkbox',
'title' => ts('Enable global server wide lock for CiviMail'),
'weight' => 6,
'description' => NULL,
),
- 'include_message_id' =>
- array(
+ 'include_message_id' => array(
'html_type' => 'checkbox',
'title' => ts('Enable CiviMail to generate Message-ID header'),
'weight' => 7,
'description' => NULL,
),
- 'write_activity_record' =>
- array(
+ 'write_activity_record' => array(
'html_type' => 'checkbox',
'title' => ts('Enable CiviMail to create activities on delivery'),
'weight' => 8,
'description' => NULL,
),
- 'disable_mandatory_tokens_check' =>
- array(
+ 'disable_mandatory_tokens_check' => array(
'html_type' => 'checkbox',
'title' => ts('Disable check for mandatory tokens'),
'weight' => 9,
'description' => ts('Don\'t check for presence of mandatory tokens (domain address; unsubscribe/opt-out) before sending mailings. WARNING: Mandatory tokens are a safe-guard which facilitate compliance with the US CAN-SPAM Act. They should only be disabled if your organization adopts other mechanisms for compliance or if your organization is not subject to CAN-SPAM.'),
),
- 'dedupe_email_default' =>
- array(
+ 'dedupe_email_default' => array(
'html_type' => 'checkbox',
'title' => ts('CiviMail dedupes e-mail addresses by default'),
'weight' => 10,
'description' => NULL,
),
- 'hash_mailing_url' =>
- array(
+ 'hash_mailing_url' => array(
'html_type' => 'checkbox',
'title' => ts('Hashed Mailing URL\'s'),
'weight' => 11,
parent::postProcess();
}
-}
\ No newline at end of file
+}
function preProcess() {
CRM_Utils_System::setTitle(ts('CiviMember Component Settings'));
$this->_varNames = array(
- CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME => array(
'default_renewal_contribution_page' => array(
'html_type' => 'select',
'title' => ts('Default online membership renewal page'),
$msDoc = CRM_Utils_System::docURL2('Multi Site Installation', NULL, NULL, NULL, NULL, "wiki");
CRM_Utils_System::setTitle(ts('Multi Site Settings'));
$this->_varNames = array(
- CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME => array(
'is_enabled' => array(
'html_type' => 'checkbox',
'title' => ts('Enable Multi Site Configuration'),
);
if (!CRM_Utils_System::checkURL($url, TRUE)) {
$errors = array(
- 'enableSSL' =>
- ts('You need to set up a secure server before you can use the Force Secure URLs option'),
+ 'enableSSL' => ts('You need to set up a secure server before you can use the Force Secure URLs option'),
);
return $errors;
}
function &links() {
if (!(self::$_links)) {
self::$_links = array(
- CRM_Core_Action::UPDATE =>
- array(
+ CRM_Core_Action::UPDATE => array(
'name' => ts('Edit'),
'url' => 'civicrm/admin/options/subtype',
'qs' => 'action=update&id=%%id%%&reset=1',
'title' => ts('Edit Contact Type'),
),
- CRM_Core_Action::DISABLE =>
- array(
+ CRM_Core_Action::DISABLE => array(
'name' => ts('Disable'),
'ref' => 'crm-enable-disable',
'title' => ts('Disable Contact Type'),
),
- CRM_Core_Action::ENABLE =>
- array(
+ CRM_Core_Action::ENABLE => array(
'name' => ts('Enable'),
'ref' => 'crm-enable-disable',
'title' => ts('Enable Contact Type'),
),
- CRM_Core_Action::DELETE =>
- array(
+ CRM_Core_Action::DELETE => array(
'name' => ts('Delete'),
'url' => 'civicrm/admin/options/subtype',
'qs' => 'action=delete&id=%%id%%',
$this->set('values', $this->_values);
}
- $query = "SELECT MAX(id) as id, title FROM civicrm_report_instance WHERE name = %1";
- $params = array( 1 => array("survey_{$this->_surveyId}",'String') );
+ $query = "SELECT MAX(id) as id, title FROM civicrm_report_instance WHERE name = %1";
+ $params = array(1 => array("survey_{$this->_surveyId}", 'String'));
$result = CRM_Core_DAO::executeQuery($query, $params);
- if ( $result->fetch() ) {
+ if ($result->fetch()) {
$this->_reportId = $result->id;
$this->_reportTitle = $result->title;
}
$optionTypes = array('1' => ts('Create new result set'));
}
else {
- $optionTypes = array('1' => ts('Create new result set'),
+ $optionTypes = array(
+ '1' => ts('Create new result set'),
'2' => ts('Use existing result set'),
);
$this->add('select',
'option_group_id',
ts('Select Result Set'),
array(
- '' => ts('- select -')) + $optionGroups, FALSE,
+ '' => ts('- select -')
+ ) + $optionGroups, FALSE,
array('onChange' => 'loadOptionGroup( )')
);
}
ts('Survey Responses'),
$optionTypes,
array(
- 'onclick' => "showOptionSelect();"), '<br/>', TRUE
+ 'onclick' => "showOptionSelect();"
+ ), '<br/>', TRUE
);
if (empty($optionGroups) || empty($this->_values['result_id'])) {
elseif (!empty($this->_values['result_id'])) {
$this->setdefaults(array(
'option_type' => 2,
- 'option_group_id' => $this->_values['result_id'],
- ));
+ 'option_group_id' => $this->_values['result_id'],
+ ));
}
// form fields of Custom Option rows
$optionAttributes['weight']
);
- $this->add('text', 'option_interval[' . $i . ']', ts('Recontact Interval'),
+ $this->add('text', 'option_interval[' . $i .
+ ']', ts('Recontact Interval'),
CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'release_frequency')
);
$this->addElement('checkbox', 'create_report', ts('Create Report'));
$this->addElement('text', 'report_title', ts('Report Title'));
- if( $this->_reportId){
+ if ($this->_reportId) {
$this->freeze('create_report');
$this->freeze('report_title');
}
- $this->addFormRule(array('CRM_Campaign_Form_Survey_Results', 'formRule'), $this);
+ $this->addFormRule(array(
+ 'CRM_Campaign_Form_Survey_Results',
+ 'formRule'
+ ), $this);
parent::buildQuickForm();
}
}
if (
- $fields['option_type'] == 2 && empty($fields['option_group_id'])) {
+ $fields['option_type'] == 2 && empty($fields['option_group_id'])
+ ) {
$errors['option_group_id'] = ts("Please select a Survey Result Set.");
return $errors;
}
$nextIndex = $start + 1;
while ($nextIndex <= self::NUM_OPTION) {
- if ($fields['option_value'][$start] == $fields['option_value'][$nextIndex] &&
+ if ($fields['option_value'][$start] ==
+ $fields['option_value'][$nextIndex] &&
!empty($fields['option_value'][$nextIndex])
) {
- $errors['option_value[' . $start . ']'] = ts('Duplicate Option values');
- $errors['option_value[' . $nextIndex . ']'] = ts('Duplicate Option values');
+ $errors['option_value[' . $start .
+ ']'] = ts('Duplicate Option values');
+ $errors['option_value[' . $nextIndex .
+ ']'] = ts('Duplicate Option values');
$_flagOption = 1;
}
$nextIndex++;
$nextIndex = $start + 1;
while ($nextIndex <= self::NUM_OPTION) {
- if ($fields['option_label'][$start] == $fields['option_label'][$nextIndex] && !empty($fields['option_label'][$nextIndex])) {
- $errors['option_label[' . $start . ']'] = ts('Duplicate Option label');
- $errors['option_label[' . $nextIndex . ']'] = ts('Duplicate Option label');
+ if ($fields['option_label'][$start] ==
+ $fields['option_label'][$nextIndex] &&
+ !empty($fields['option_label'][$nextIndex])
+ ) {
+ $errors['option_label[' . $start .
+ ']'] = ts('Duplicate Option label');
+ $errors['option_label[' . $nextIndex .
+ ']'] = ts('Duplicate Option label');
$_flagOption = 1;
}
$nextIndex++;
for ($i = 1; $i <= self::NUM_OPTION; $i++) {
if (!$fields['option_label'][$i]) {
if ($fields['option_value'][$i]) {
- $errors['option_label[' . $i . ']'] = ts('Option label cannot be empty');
+ $errors['option_label[' . $i .
+ ']'] = ts('Option label cannot be empty');
$_flagOption = 1;
}
else {
}
elseif (!strlen(trim($fields['option_value'][$i]))) {
if (!$fields['option_value'][$i]) {
- $errors['option_value[' . $i . ']'] = ts('Option value cannot be empty');
+ $errors['option_value[' . $i .
+ ']'] = ts('Option value cannot be empty');
$_flagOption = 1;
}
}
- if (!empty($fields['option_interval'][$i]) && !CRM_Utils_Rule::integer($fields['option_interval'][$i])) {
+ if (!empty($fields['option_interval'][$i]) &&
+ !CRM_Utils_Rule::integer($fields['option_interval'][$i])
+ ) {
$_flagOption = 1;
- $errors['option_interval[' . $i . ']'] = ts('Please enter a valid integer.');
+ $errors['option_interval[' . $i .
+ ']'] = ts('Please enter a valid integer.');
}
$showBlocks = 'optionField_' . $i;
$updateResultSet = FALSE;
$resultSetOptGrpId = NULL;
- if ((CRM_Utils_Array::value('option_type', $params) == 2) && !empty($params['option_group_id'])) {
+ if ((CRM_Utils_Array::value('option_type', $params) == 2) &&
+ !empty($params['option_group_id'])
+ ) {
$updateResultSet = TRUE;
$resultSetOptGrpId = $params['option_group_id'];
}
$optionValue->save();
// using is_numeric since 0 is a valid value for option_interval
- if ( is_numeric($params['option_interval'][$k])) {
+ if (is_numeric($params['option_interval'][$k])) {
$recontactInterval[$optionValue->label] = $params['option_interval'][$k];
}
}
$survey = CRM_Campaign_BAO_Survey::create($params);
// create report if required.
- if ( !$this->_reportId && $survey->id && !empty($params['create_report'])) {
+ if (!$this->_reportId && $survey->id && !empty($params['create_report'])) {
$activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
$activityStatus = array_flip($activityStatus);
$this->_params =
- array( 'name' => "survey_{$survey->id}",
- 'title' => $params['report_title'] ? $params['report_title'] : $this->_values['title'],
- 'status_id_op' => 'eq',
- 'status_id_value' => $activityStatus['Scheduled'], // reserved status
- 'survey_id_value' => array($survey->id),
- 'description' => ts('Detailed report for canvassing, phone-banking, walk lists or other surveys.'),
- );
+ array(
+ 'name' => "survey_{$survey->id}",
+ 'title' => $params['report_title'] ? $params['report_title'] : $this->_values['title'],
+ 'status_id_op' => 'eq',
+ 'status_id_value' => $activityStatus['Scheduled'], // reserved status
+ 'survey_id_value' => array($survey->id),
+ 'description' => ts('Detailed report for canvassing, phone-banking, walk lists or other surveys.'),
+ );
//Default value of order by
$this->_params['order_bys'] =
array(
- 1 =>
- array(
- 'column' => 'sort_name',
- 'order' => 'ASC'
- ),
- );
+ 1 => array(
+ 'column' => 'sort_name',
+ 'order' => 'ASC'
+ ),
+ );
// for WalkList or default
- $displayFields = array('id', 'sort_name', 'result', 'street_number','street_name','street_unit','survey_response');
- if ( CRM_Core_OptionGroup::getValue('activity_type','WalkList') == $this->_values['activity_type_id'] ) {
+ $displayFields = array(
+ 'id',
+ 'sort_name',
+ 'result',
+ 'street_number',
+ 'street_name',
+ 'street_unit',
+ 'survey_response'
+ );
+ if (CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') ==
+ $this->_values['activity_type_id']
+ ) {
$this->_params['order_bys'] =
array(
- 1 =>
- array(
- 'column' => 'street_name',
- 'order' => 'ASC'
- ),
- 2 =>
- array(
- 'column' => 'street_number_odd_even',
- 'order' => 'ASC'
- ),
- 3 =>
- array(
- 'column' => 'street_number',
- 'order' => 'ASC'
- ),
- 4 =>
- array(
- 'column' => 'sort_name',
- 'order' => 'ASC'
- ),
- );
+ 1 => array(
+ 'column' => 'street_name',
+ 'order' => 'ASC'
+ ),
+ 2 => array(
+ 'column' => 'street_number_odd_even',
+ 'order' => 'ASC'
+ ),
+ 3 => array(
+ 'column' => 'street_number',
+ 'order' => 'ASC'
+ ),
+ 4 => array(
+ 'column' => 'sort_name',
+ 'order' => 'ASC'
+ ),
+ );
}
- elseif ( CRM_Core_OptionGroup::getValue('activity_type','PhoneBank') == $this->_values['activity_type_id'] ) {
+ elseif (CRM_Core_OptionGroup::getValue('activity_type', 'PhoneBank') ==
+ $this->_values['activity_type_id']
+ ) {
array_push($displayFields, 'phone');
}
- elseif ((CRM_Core_OptionGroup::getValue('activity_type','Survey') == $this->_values['activity_type_id']) ||
- (CRM_Core_OptionGroup::getValue('activity_type','Canvass') == $this->_values['activity_type_id']) ) {
- array_push($displayFields, 'phone','city','state_province_id','postal_code','email');
+ elseif ((CRM_Core_OptionGroup::getValue('activity_type', 'Survey') ==
+ $this->_values['activity_type_id']) ||
+ (CRM_Core_OptionGroup::getValue('activity_type', 'Canvass') ==
+ $this->_values['activity_type_id'])
+ ) {
+ array_push($displayFields, 'phone', 'city', 'state_province_id', 'postal_code', 'email');
}
- foreach($displayFields as $key){
+ foreach ($displayFields as $key) {
$this->_params['fields'][$key] = 1;
}
$this->_createNew = TRUE;
CRM_Report_Form_Instance::postProcess($this, FALSE);
$query = "SELECT MAX(id) FROM civicrm_report_instance WHERE name = %1";
- $reportID = CRM_Core_DAO::singleValueQuery($query, array(1 => array("survey_{$survey->id}",'String')));
+ $reportID = CRM_Core_DAO::singleValueQuery($query, array(
+ 1 => array(
+ "survey_{$survey->id}",
+ 'String'
+ )
+ ));
if ($reportID) {
- $url = CRM_Utils_System::url("civicrm/report/instance/{$reportID}",'reset=1');
+ $url = CRM_Utils_System::url("civicrm/report/instance/{$reportID}", 'reset=1');
$status = ts("A Survey Detail Report <a href='%1'>%2</a> has been created.",
- array(1 => $url, 2 => $this->_params['title']));
+ array(1 => $url, 2 => $this->_params['title']));
}
}
elseif ( CRM_Core_OptionGroup::getValue('activity_type','WalkList') == $this->_surveyDetails['activity_type_id'] ) {
$orderByParams =
array(
- 1 =>
- array(
+ 1 => array(
'column' => 'civicrm_address.street_name',
'order' => 'ASC',
),
- 2 =>
- array(
+ 2 => array(
'column' => 'civicrm_address.street_number%2',
'order' => 'ASC',
),
- 3 =>
- array(
+ 3 => array(
'column' => 'civicrm_address.street_number',
'order' => 'ASC',
),
- 4 =>
- array(
+ 4 => array(
'column' => 'contact_a.sort_name',
'order' => 'ASC',
),
if ( CRM_Core_OptionGroup::getValue('activity_type','WalkList') == $this->_surveyDetails['activity_type_id'] ) {
$defaults['order_bys'] =
array(
- 1 =>
- array(
+ 1 => array(
'column' => 'civicrm_address.street_name',
'order' => 'ASC',
),
- 2 =>
- array(
+ 2 => array(
'column' => 'civicrm_address.street_number%2',
'order' => 'ASC',
),
- 3 =>
- array(
+ 3 => array(
'column' => 'civicrm_address.street_number',
'order' => 'ASC',
),
- 4 =>
- array(
+ 4 => array(
'column' => 'contact_a.sort_name',
'order' => 'ASC',
),
);
$contributionRecurId = array(
- 'contribution_recur_id' =>
- array(
+ 'contribution_recur_id' => array(
'title' => ts('Recurring Contributions ID'),
'name' => 'contribution_recur_id',
'where' => 'civicrm_contribution.contribution_recur_id',
$group->title = $params['title'];
if (in_array($params['extends'][0],
- array(
- 'ParticipantRole',
- 'ParticipantEventName',
- 'ParticipantEventType',
- )
- )) {
+ array(
+ 'ParticipantRole',
+ 'ParticipantEventName',
+ 'ParticipantEventType',
+ )
+ )) {
$group->extends = 'Participant';
}
else {
if (!CRM_Utils_System::isNull($extendsChildType)) {
$extendsChildType = implode(CRM_Core_DAO::VALUE_SEPARATOR, $extendsChildType);
if (CRM_Utils_Array::value(0, $params['extends']) == 'Relationship') {
- $extendsChildType = str_replace(array('_a_b', '_b_a'), array('', ''), $extendsChildType);
+ $extendsChildType = str_replace(array('_a_b', '_b_a'), array(
+ '',
+ ''
+ ), $extendsChildType);
}
if (substr($extendsChildType, 0, 1) != CRM_Core_DAO::VALUE_SEPARATOR) {
- $extendsChildType = CRM_Core_DAO::VALUE_SEPARATOR . $extendsChildType . CRM_Core_DAO::VALUE_SEPARATOR;
+ $extendsChildType = CRM_Core_DAO::VALUE_SEPARATOR . $extendsChildType .
+ CRM_Core_DAO::VALUE_SEPARATOR;
}
}
else {
$oldWeight = 0;
}
$group->weight = CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_CustomGroup', $oldWeight, CRM_Utils_Array::value('weight', $params, FALSE));
- $fields = array('style', 'collapse_display', 'collapse_adv_display', 'help_pre', 'help_post', 'is_active', 'is_multiple');
+ $fields = array(
+ 'style',
+ 'collapse_display',
+ 'collapse_adv_display',
+ 'help_pre',
+ 'help_post',
+ 'is_active',
+ 'is_multiple'
+ );
foreach ($fields as $field) {
$group->$field = CRM_Utils_Array::value($field, $params, FALSE);
}
/**
* Fetch object based on array of properties
*
- * @param array $params (reference ) an assoc array of name/value pairs
+ * @param array $params (reference ) an assoc array of name/value pairs
* @param array $defaults (reference ) an assoc array to hold the flattened values
*
* @return CRM_Core_DAO_CustomGroup object
/**
* Update the is_active flag in the db
*
- * @param int $id id of the database record
- * @param boolean $is_active value we want to set the is_active field
+ * @param int $id id of the database record
+ * @param boolean $is_active value we want to set the is_active field
*
* @return Object DAO object on sucess, null otherwise
* @static
*/
public static function hasCustomGroup($extends, $columnId, $columnValue) {
$dao = new CRM_Core_DAO_CustomGroup();
- $dao->extends = $extends;
+ $dao->extends = $extends;
$dao->extends_entity_column_id = $columnId;
- $escapedValue = CRM_Core_DAO::VALUE_SEPARATOR . CRM_Core_DAO::escapeString($columnValue) . CRM_Core_DAO::VALUE_SEPARATOR;
+ $escapedValue =
+ CRM_Core_DAO::VALUE_SEPARATOR . CRM_Core_DAO::escapeString($columnValue) .
+ CRM_Core_DAO::VALUE_SEPARATOR;
$dao->whereAdd("extends_entity_column_value LIKE \"%$escapedValue%\"");
//$dao->extends_entity_column_value = $columnValue;
return $dao->find() ? TRUE : FALSE;
* If none found, create one.
*
* @param int $activityTypeId
+ *
* @return bool TRUE if a group is found or created; FALSE on error
*/
public static function autoCreateByActivityType($activityTypeId) {
'is_active' => 1,
);
$result = civicrm_api('CustomGroup', 'create', $params);
- return ! $result['is_error'];
+ return !$result['is_error'];
}
/**
$entityType,
&$form,
$entityID = NULL,
- $groupID = NULL,
- $subType = NULL,
- $subName = NULL,
+ $groupID = NULL,
+ $subType = NULL,
+ $subName = NULL,
$fromCache = TRUE,
$onlySubType = NULL
) {
// using tableData to build the queryString
$tableData = array(
- 'civicrm_custom_field' =>
- array(
+ 'civicrm_custom_field' => array(
'id',
'label',
'column_name',
'option_group_id',
'in_selector'
),
- 'civicrm_custom_group' =>
- array(
+ 'civicrm_custom_group' => array(
'id',
'name',
'table_name',
";
// if entity is either individual, organization or household pls get custom groups for 'contact' too.
- if ($entityType == "Individual" || $entityType == 'Organization' || $entityType == 'Household') {
+ if ($entityType == "Individual" || $entityType == 'Organization' ||
+ $entityType == 'Household'
+ ) {
$in = "'$entityType', 'Contact'";
}
elseif (strpos($entityType, "'") !== FALSE) {
$subTypeParts = explode(',', $subType);
$subTypeClauses = array();
foreach ($subTypeParts as $subTypePart) {
- $subTypePart = CRM_Core_DAO::VALUE_SEPARATOR . trim($subTypePart, CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR;
+ $subTypePart = CRM_Core_DAO::VALUE_SEPARATOR .
+ trim($subTypePart, CRM_Core_DAO::VALUE_SEPARATOR) .
+ CRM_Core_DAO::VALUE_SEPARATOR;
$subTypeClauses[] = "civicrm_custom_group.extends_entity_column_value LIKE '%$subTypePart%'";
}
$subTypeClause = '(' . implode(' OR ', $subTypeClauses) . ')';
}
else {
- $subTypeClause = '(' . implode(' OR ', $subTypeClauses) . " OR civicrm_custom_group.extends_entity_column_value IS NULL )";
+ $subTypeClause = '(' . implode(' OR ', $subTypeClauses) .
+ " OR civicrm_custom_group.extends_entity_column_value IS NULL )";
}
}
else {
- $subType = CRM_Core_DAO::VALUE_SEPARATOR . trim($subType, CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR;
+ $subType = CRM_Core_DAO::VALUE_SEPARATOR .
+ trim($subType, CRM_Core_DAO::VALUE_SEPARATOR) .
+ CRM_Core_DAO::VALUE_SEPARATOR;
if ($onlySubType) {
$subTypeClause = "( civicrm_custom_group.extends_entity_column_value LIKE '%$subType%' )";
}
// ensure that the user has access to these custom groups
- $strWhere .= " AND " . CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW,
- 'civicrm_custom_group.'
- );
+ $strWhere .= " AND " .
+ CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW,
+ 'civicrm_custom_group.'
+ );
$orderBy = "
ORDER BY civicrm_custom_group.weight,
// lets see if we can retrieve the groupTree from cache
$cacheString = $queryString;
- if ( $groupID > 0 ) {
+ if ($groupID > 0) {
$cacheString .= "_{$groupID}";
- } else {
+ }
+ else {
$cacheString .= "_Inline";
}
$cacheKey = "CRM_Core_DAO_CustomGroup_Query " . md5($cacheString);
- $multipleFieldGroupCacheKey = "CRM_Core_DAO_CustomGroup_QueryMultipleFields " . md5($cacheString);
+ $multipleFieldGroupCacheKey =
+ "CRM_Core_DAO_CustomGroup_QueryMultipleFields " . md5($cacheString);
$cache = CRM_Utils_Cache::singleton();
$tablesWithEntityData = array();
if ($fromCache) {
}
if (empty($groupTree)) {
- $groupTree = $multipleFieldGroups =array();
+ $groupTree = $multipleFieldGroups = array();
$crmDAO = CRM_Core_DAO::executeQuery($queryString, $params);
$customValueTables = array();
// get the id's
$groupID = $crmDAO->civicrm_custom_group_id;
$fieldId = $crmDAO->civicrm_custom_field_id;
- if($crmDAO->civicrm_custom_group_is_multiple){
+ if ($crmDAO->civicrm_custom_group_is_multiple) {
$multipleFieldGroups[$groupID] = $crmDAO->civicrm_custom_group_table_name;
}
// create an array for groups if it does not exist
// since we need to know the table and field names
// add info to groupTree
- if (isset($groupTree['info']) && !empty($groupTree['info']) && !empty($groupTree['info']['tables'])) {
+ if (isset($groupTree['info']) && !empty($groupTree['info']) &&
+ !empty($groupTree['info']['tables'])
+ ) {
$select = $from = $where = array();
$groupTree['info']['where'] = NULL;
foreach ($groupTree['info']['tables'] as $table => $fields) {
- $groupTree['info']['from'][] = $table;
- $select = array("{$table}.id as {$table}_id",
- "{$table}.entity_id as {$table}_entity_id");
+ $groupTree['info']['from'][] = $table;
+ $select = array(
+ "{$table}.id as {$table}_id",
+ "{$table}.entity_id as {$table}_entity_id"
+ );
foreach ($fields as $column => $dontCare) {
$select[] = "{$table}.{$column} as {$table}_{$column}";
}
$groupTree['info']['select'] = array_merge($groupTree['info']['select'], $select);
if ($entityID) {
$groupTree['info']['where'][] = "{$table}.entity_id = $entityID";
- if(in_array($table, $multipleFieldGroups) && self::customGroupDataExistsForEntity($entityID, $table)){
+ if (in_array($table, $multipleFieldGroups) &&
+ self::customGroupDataExistsForEntity($entityID, $table)
+ ) {
$entityMultipleSelectClauses[$table] = $select;
}
- else{
+ else {
$singleFieldTables[] = $table;
$entitySingleSelectClauses = array_merge($entitySingleSelectClauses, $select);
}
self::buildEntityTreeSingleFields($groupTree, $entityID, $entitySingleSelectClauses, $singleFieldTables);
}
$multipleFieldTablesWithEntityData = array_keys($entityMultipleSelectClauses);
- if(!empty($multipleFieldTablesWithEntityData)){
+ if (!empty($multipleFieldTablesWithEntityData)) {
self::buildEntityTreeMultipleFields($groupTree, $entityID, $entityMultipleSelectClauses, $multipleFieldTablesWithEntityData);
}
- }
+ }
return $groupTree;
}
*
* @return boolean does this entity have data in this custom table
*/
- static public function customGroupDataExistsForEntity($entityID, $table, $getCount = FALSE){
+ static public function customGroupDataExistsForEntity($entityID, $table, $getCount = FALSE) {
$query = "
SELECT count(id)
FROM $table
return $recordExists ? TRUE : FALSE;
}
-/**
- * Build the group tree for Custom fields which are not 'is_multiple'
- *
- * The combination of all these fields in one query with a 'using' join was not working for
- * multiple fields. These now have a new behaviour (one at a time) but the single fields still use this
- * mechanism as it seemed to be acceptable in this context
- *
- * @param array $groupTree (reference) group tree array which is being built
- * @param integer $entityID id of entity for whom the tree is being build up.
- * @param array $entitySingleSelectClauses array of select clauses relevant to the entity
- * @param array $singleFieldTablesWithEntityData array of tables in which this entity has data
- */
- static public function buildEntityTreeSingleFields(&$groupTree, $entityID, $entitySingleSelectClauses, $singleFieldTablesWithEntityData){
+ /**
+ * Build the group tree for Custom fields which are not 'is_multiple'
+ *
+ * The combination of all these fields in one query with a 'using' join was not working for
+ * multiple fields. These now have a new behaviour (one at a time) but the single fields still use this
+ * mechanism as it seemed to be acceptable in this context
+ *
+ * @param array $groupTree (reference) group tree array which is being built
+ * @param integer $entityID id of entity for whom the tree is being build up.
+ * @param array $entitySingleSelectClauses array of select clauses relevant to the entity
+ * @param array $singleFieldTablesWithEntityData array of tables in which this entity has data
+ */
+ static public function buildEntityTreeSingleFields(&$groupTree, $entityID, $entitySingleSelectClauses, $singleFieldTablesWithEntityData) {
$select = implode(', ', $entitySingleSelectClauses);
$fromSQL = " (SELECT $entityID as entity_id ) as first ";
foreach ($singleFieldTablesWithEntityData as $table) {
}
/**
- * Build the group tree for Custom fields which are 'is_multiple'
- *
- * This is done one table at a time to avoid Cross-Joins resulting in too many rows being returned
- *
- * @param array $groupTree (reference) group tree array which is being built
- * @param integer $entityID id of entity for whom the tree is being build up.
- * @param array $entityMultipleSelectClauses array of select clauses relevant to the entity
- * @param array $multipleFieldTablesWithEntityData array of tables in which this entity has data
- */
- static public function buildEntityTreeMultipleFields(&$groupTree, $entityID, $entityMultipleSelectClauses, $multipleFieldTablesWithEntityData){
+ * Build the group tree for Custom fields which are 'is_multiple'
+ *
+ * This is done one table at a time to avoid Cross-Joins resulting in too many rows being returned
+ *
+ * @param array $groupTree (reference) group tree array which is being built
+ * @param integer $entityID id of entity for whom the tree is being build up.
+ * @param array $entityMultipleSelectClauses array of select clauses relevant to the entity
+ * @param array $multipleFieldTablesWithEntityData array of tables in which this entity has data
+ */
+ static public function buildEntityTreeMultipleFields(&$groupTree, $entityID, $entityMultipleSelectClauses, $multipleFieldTablesWithEntityData) {
foreach ($entityMultipleSelectClauses as $table => $selectClauses) {
$select = implode(',', $selectClauses);
$query = "
* @param array $includedTables tables to include - required because the function (for historical reasons)
* iterates through the group tree
*/
- static public function buildTreeEntityDataFromQuery(&$groupTree, $query, $includedTables){
+ static public function buildTreeEntityDataFromQuery(&$groupTree, $query, $includedTables) {
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
foreach ($groupTree as $groupID => $group) {
//working from the groupTree instead of the table list means we have to iterate & exclude.
// this could possibly be re-written as other parts of the function have been refactored
// for now we just check if the given table is to be included in this function
- if( !in_array($table, $includedTables)){
+ if (!in_array($table, $includedTables)) {
continue;
}
foreach ($group['fields'] as $fieldID => $dontCare) {
* @param unknown_type $groupID custom group ID
* @param unknown_type $fieldID custom field ID
*/
- static public function buildCustomFieldData($dao, &$groupTree, $table, $groupID, $fieldID){
- $column = $groupTree[$groupID]['fields'][$fieldID]['column_name'];
- $idName = "{$table}_id";
+ static public function buildCustomFieldData($dao, &$groupTree, $table, $groupID, $fieldID) {
+ $column = $groupTree[$groupID]['fields'][$fieldID]['column_name'];
+ $idName = "{$table}_id";
$fieldName = "{$table}_{$column}";
$dataType = $groupTree[$groupID]['fields'][$fieldID]['data_type'];
if ($dataType == 'File') {
if (isset($dao->$fieldName)) {
- $config = CRM_Core_Config::singleton();
- $fileDAO = new CRM_Core_DAO_File();
+ $config = CRM_Core_Config::singleton();
+ $fileDAO = new CRM_Core_DAO_File();
$fileDAO->id = $dao->$fieldName;
if ($fileDAO->find(TRUE)) {
$customValue['displayURL'] = NULL;
$deleteExtra = ts('Are you sure you want to delete attached file.');
$deleteURL = array(
- CRM_Core_Action::DELETE =>
- array(
+ CRM_Core_Action::DELETE => array(
'name' => ts('Delete Attached File'),
'url' => 'civicrm/file',
'qs' => 'reset=1&id=%%id%%&eid=%%eid%%&fid=%%fid%%&action=delete',
- 'extra' =>
- 'onclick = "if (confirm( \'' . $deleteExtra . '\' ) ) this.href+=\'&confirmed=1\'; else return false;"',
+ 'extra' => 'onclick = "if (confirm( \'' . $deleteExtra .
+ '\' ) ) this.href+=\'&confirmed=1\'; else return false;"',
),
);
$customValue['deleteURL'] = CRM_Core_Action::formLink($deleteURL,
'entity_id',
'file_id'
);
- $customValue['imageURL'] = str_replace('persist/contribute', 'custom', $config->imageUploadURL) . $fileDAO->uri;
+ $customValue['imageURL'] =
+ str_replace('persist/contribute', 'custom', $config->imageUploadURL) .
+ $fileDAO->uri;
list($path) = CRM_Core_BAO_File::path($fileDAO->id, $entityId,
NULL, NULL
);
// using tableData to build the queryString
$tableData = array(
- 'civicrm_custom_field' =>
- array(
+ 'civicrm_custom_field' => array(
'id',
'label',
'data_type',
'option_group_id',
'in_selector',
),
- 'civicrm_custom_group' =>
- array(
+ 'civicrm_custom_group' => array(
'id',
'name',
'title',
}
// ensure that the user has access to these custom groups
- $where .= " AND " . CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW,
- 'civicrm_custom_group.'
- );
+ $where .= " AND " .
+ CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW,
+ 'civicrm_custom_group.'
+ );
$orderBy = " ORDER BY civicrm_custom_group.weight, civicrm_custom_field.weight";
// process each group with menu tab
while ($customGroupDAO->fetch()) {
- $group = array();
- $group['id'] = $customGroupDAO->id;
- $group['path'] = $path;
- $group['title'] = "$customGroupDAO->title";
- $group['query'] = "reset=1&gid={$customGroupDAO->id}&cid={$cidToken}";
- $group['extra'] = array('gid' => $customGroupDAO->id);
+ $group = array();
+ $group['id'] = $customGroupDAO->id;
+ $group['path'] = $path;
+ $group['title'] = "$customGroupDAO->title";
+ $group['query'] = "reset=1&gid={$customGroupDAO->id}&cid={$cidToken}";
+ $group['extra'] = array('gid' => $customGroupDAO->id);
$group['table_name'] = $customGroupDAO->table_name;
$group['is_multiple'] = $customGroupDAO->is_multiple;
- $groups[] = $group;
+ $groups[] = $group;
}
return $groups;
* currently if entity type is 'Contact', 'Individual', 'Household', 'Organization'
* tableName is 'civicrm_contact'
*
- * @param string $entityType what entity are we extending here ?
+ * @param string $entityType what entity are we extending here ?
*
* @return string $tableName
*
* those WILL be included.
*
* @param $entityType string
+ *
* @return CRM_Core_DAO_CustomGroup
*/
static function getAllCustomGroupsByBaseEntity($entityType) {
if (!empty($csType)) {
$subtypeClause = array();
foreach ($csType as $subtype) {
- $subtype = CRM_Core_DAO::VALUE_SEPARATOR . $subtype . CRM_Core_DAO::VALUE_SEPARATOR;
+ $subtype = CRM_Core_DAO::VALUE_SEPARATOR . $subtype .
+ CRM_Core_DAO::VALUE_SEPARATOR;
$subtypeClause[] = "extends_entity_column_value LIKE '%{$subtype}%'";
}
$subtypeClause[] = "extends_entity_column_value IS NULL";
- $customGroupDAO->whereAdd("( " . implode(' OR ', $subtypeClause) . " )");
+ $customGroupDAO->whereAdd("( " . implode(' OR ', $subtypeClause) .
+ " )");
}
else {
$customGroupDAO->whereAdd("extends_entity_column_value IS NULL");
default:
if ($field['data_type'] == "Float") {
- $defaults[$elementName] = (float)$value;
+ $defaults[$elementName] = (float) $value;
}
elseif ($field['data_type'] == 'Money' &&
$field['html_type'] == 'Text'
$fieldId = $field['id'];
//added Multi-Select option in the below if-statement
- if ($field['html_type'] == 'CheckBox' || $field['html_type'] == 'Radio' ||
- $field['html_type'] == 'AdvMulti-Select' || $field['html_type'] == 'Multi-Select'
+ if ($field['html_type'] == 'CheckBox' ||
+ $field['html_type'] == 'Radio' ||
+ $field['html_type'] == 'AdvMulti-Select' ||
+ $field['html_type'] == 'Multi-Select'
) {
$groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = 'NULL';
}
case 'CheckBox':
if (!empty($v)) {
$customValue = array_keys($v);
- $groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue) . CRM_Core_DAO::VALUE_SEPARATOR;
+ $groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] =
+ CRM_Core_DAO::VALUE_SEPARATOR .
+ implode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue) .
+ CRM_Core_DAO::VALUE_SEPARATOR;
}
else {
$groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = NULL;
//added for Multi-Select
case 'Multi-Select':
if (!empty($v)) {
- $groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $v) . CRM_Core_DAO::VALUE_SEPARATOR;
+ $groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] =
+ CRM_Core_DAO::VALUE_SEPARATOR .
+ implode(CRM_Core_DAO::VALUE_SEPARATOR, $v) .
+ CRM_Core_DAO::VALUE_SEPARATOR;
}
else {
$groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = NULL;
/**
* Generic function to build all the form elements for a specific group tree
*
- * @param CRM_Core_Form $form the form object
+ * @param CRM_Core_Form $form the form object
* @param array $groupTree the group tree object
* @param boolean $inactiveNeeded return inactive custom groups
* @param string $prefix prefix for custom grouptree assigned to template
* @access public
* @static
*/
- static function buildQuickForm(&$form, &$groupTree, $inactiveNeeded = FALSE, $prefix = '' ) {
+ static function buildQuickForm(&$form, &$groupTree, $inactiveNeeded = FALSE, $prefix = '') {
$form->assign_by_ref("{$prefix}groupTree", $groupTree);
// this is fix for date field
* and store it in session
*
* @param CRM_Core_Form $form the form object
- * @param string $type the type of custom group we are using
+ * @param string $type the type of custom group we are using
*
* @return array
* @access public
return array();
}
- $groupTree = CRM_Core_BAO_CustomGroup::getTree($type, $form);
+ $groupTree = CRM_Core_BAO_CustomGroup::getTree($type, $form);
$customValue = array();
- $htmlType = array('CheckBox', 'Multi-Select', 'AdvMulti-Select', 'Select', 'Radio');
+ $htmlType = array(
+ 'CheckBox',
+ 'Multi-Select',
+ 'AdvMulti-Select',
+ 'Select',
+ 'Radio'
+ );
foreach ($groupTree as $group) {
if (!isset($group['fields'])) {
$field['html_type'] == 'AdvMulti-Select' ||
$field['html_type'] == 'Multi-Select'
) {
- $value = str_replace("|", ",", $value);
- $mulValues = explode(',', $value);
+ $value = str_replace("|", ",", $value);
+ $mulValues = explode(',', $value);
$customOption = CRM_Core_BAO_CustomOption::getCustomOption($key, TRUE);
- $val = array();
+ $val = array();
foreach ($mulValues as $v1) {
foreach ($customOption as $coID => $coValue) {
- if (strtolower(trim($coValue['label'])) == strtolower(trim($v1))) {
+ if (strtolower(trim($coValue['label'])) ==
+ strtolower(trim($v1))
+ ) {
$val[$coValue['value']] = 1;
}
}
) {
$customOption = CRM_Core_BAO_CustomOption::getCustomOption($key, TRUE);
foreach ($customOption as $customID => $coValue) {
- if (strtolower(trim($coValue['label'])) == strtolower(trim($value))) {
+ if (strtolower(trim($coValue['label'])) ==
+ strtolower(trim($value))
+ ) {
$value = $coValue['value'];
$valid = TRUE;
}
if (!empty($value)) {
$time = NULL;
if (!empty($field['time_format'])) {
- $time = CRM_Utils_Request::retrieve($fieldName . '_time', 'String', $form, FALSE, NULL, 'GET');
+ $time = CRM_Utils_Request::retrieve($fieldName .
+ '_time', 'String', $form, FALSE, NULL, 'GET');
}
- list($value, $time) = CRM_Utils_Date::setDateDefaults($value . ' ' . $time);
+ list($value, $time) = CRM_Utils_Date::setDateDefaults($value .
+ ' ' . $time);
if (!empty($field['time_format'])) {
$customValue[$fieldName . '_time'] = $time;
}
* Check the type of custom field type (eg: Used for Individual, Contribution, etc)
* this function is used to get the custom fields of a type (eg: Used for Individual, Contribution, etc )
*
- * @param int $customFieldId custom field id
- * @param array $removeCustomFieldTypes remove custom fields of a type eg: array("Individual") ;
+ * @param int $customFieldId custom field id
+ * @param array $removeCustomFieldTypes remove custom fields of a type eg: array("Individual") ;
*
*
* @return boolean false if it matches else true
$query = "SELECT cg.extends as extends
FROM civicrm_custom_group as cg, civicrm_custom_field as cf
WHERE cg.id = cf.custom_group_id
- AND cf.id =" . CRM_Utils_Type::escape($customFieldId, 'Integer');
+ AND cf.id =" .
+ CRM_Utils_Type::escape($customFieldId, 'Integer');
$extends = CRM_Core_DAO::singleValueQuery($query);
/**
* Function returns formatted groupTree, sothat form can be easily build in template
*
- * @param array $groupTree associated array
- * @param int $groupCount group count by default 1, but can varry for multiple value custom data
+ * @param array $groupTree associated array
+ * @param int $groupCount group count by default 1, but can varry for multiple value custom data
* @param object form object
*
* @return array $formattedGroupTree
// add field information
foreach ($value['fields'] as $k => $properties) {
$properties['element_name'] = "custom_{$k}_-{$groupCount}";
- if (isset($properties['customValue']) && !CRM_Utils_System::isNull($properties['customValue'])) {
+ if (isset($properties['customValue']) &&
+ !CRM_Utils_System::isNull($properties['customValue'])
+ ) {
if (isset($properties['customValue'][$groupCount])) {
$properties['element_name'] = "custom_{$k}_{$properties['customValue'][$groupCount]['id']}";
$formattedGroupTree[$key]['table_id'] = $properties['customValue'][$groupCount]['id'];
$details[$groupID][$values['id']]['help_post'] = CRM_Utils_Array::value('help_post', $group);
$details[$groupID][$values['id']]['collapse_display'] = CRM_Utils_Array::value('collapse_display', $group);
$details[$groupID][$values['id']]['collapse_adv_display'] = CRM_Utils_Array::value('collapse_adv_display', $group);
- $details[$groupID][$values['id']]['fields'][$k] = array('field_title' => CRM_Utils_Array::value('label', $properties),
+ $details[$groupID][$values['id']]['fields'][$k] = array(
+ 'field_title' => CRM_Utils_Array::value('label', $properties),
'field_type' => CRM_Utils_Array::value('html_type',
$properties
),
),
);
// also return contact reference contact id if user has view all or edit all contacts perm
- if ((CRM_Core_Permission::check('view all contacts') || CRM_Core_Permission::check('edit all contacts'))
- && $details[$groupID][$values['id']]['fields'][$k]['field_data_type'] == 'ContactReference'
+ if ((CRM_Core_Permission::check('view all contacts') ||
+ CRM_Core_Permission::check('edit all contacts'))
+ &&
+ $details[$groupID][$values['id']]['fields'][$k]['field_data_type'] ==
+ 'ContactReference'
) {
$details[$groupID][$values['id']]['fields'][$k]['contact_ref_id'] = CRM_Utils_Array::value('data', $values);
}
if ($returnCount) {
//return a single value count if group id is passed to function
//else return a groupId and count mapped array
- if (!empty($gID)){
+ if (!empty($gID)) {
return count($details[$gID]);
}
else {
$countValue = array();
- foreach( $details as $key => $value ) {
+ foreach ($details as $key => $value) {
$countValue[$key] = count($details[$key]);
}
return $countValue;
return;
}
- $htmlType = CRM_Utils_Array::value('html_type', $field);
- $dataType = CRM_Utils_Array::value('data_type', $field);
+ $htmlType = CRM_Utils_Array::value('html_type', $field);
+ $dataType = CRM_Utils_Array::value('data_type', $field);
$option_group_id = CRM_Utils_Array::value('option_group_id', $field);
- $timeFormat = CRM_Utils_Array::value('time_format', $field);
- $optionPerLine = CRM_Utils_Array::value('options_per_line', $field);
+ $timeFormat = CRM_Utils_Array::value('time_format', $field);
+ $optionPerLine = CRM_Utils_Array::value('options_per_line', $field);
$freezeString = "";
$freezeStringChecked = "";
'dd-mm' => "%E%f %B $customTimeFormat",
'yy' => "%Y $customTimeFormat",
'M yy' => "%b %Y $customTimeFormat",
- 'yy-mm' => "%Y-%m $customTimeFormat"
+ 'yy-mm' => "%Y-%m $customTimeFormat"
);
if ($format = CRM_Utils_Array::value('date_format', $field)) {
case 'Float':
if ($htmlType == 'Text') {
- $retValue = (float)$value;
+ $retValue = (float) $value;
break;
}
case 'Money':
$retValue = $value;
break;
}
- // note that if its not text / textarea, the code falls thru and executes
- // the below case also
+ // note that if its not text / textarea, the code falls thru and executes
+ // the below case also
case 'StateProvince':
case 'Country':
$options = array();
case 'Select Country':
$customData = $value;
if (!is_array($value)) {
- $customData = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
- }
- $query = "
+ $customData = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
+ }
+ $query = "
SELECT id as value, name as label
FROM civicrm_country";
- $coDAO = CRM_Core_DAO::executeQuery($query);
- break;
-
- case 'Select State/Province':
- case 'Multi-Select State/Province':
- $customData = $value;
- if (!is_array($value)) {
- $customData = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
- }
+ $coDAO = CRM_Core_DAO::executeQuery($query);
+ break;
- $query = "
+ case 'Select State/Province':
+ case 'Multi-Select State/Province':
+ $customData = $value;
+ if (!is_array($value)) {
+ $customData = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
+ }
+
+ $query = "
SELECT id as value, name as label
FROM civicrm_state_province";
- $coDAO = CRM_Core_DAO::executeQuery($query);
- break;
+ $coDAO = CRM_Core_DAO::executeQuery($query);
+ break;
- case 'Select':
- $customData = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
- if ($option_group_id) {
- $options = CRM_Core_BAO_OptionValue::getOptionValuesAssocArray($option_group_id);
- }
- break;
-
- case 'CheckBox':
- case 'AdvMulti-Select':
- case 'Multi-Select':
- $customData = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
- default:
- if ($option_group_id) {
- $options = CRM_Core_BAO_OptionValue::getOptionValuesAssocArray($option_group_id);
- }
- }
+ case 'Select':
+ $customData = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
+ if ($option_group_id) {
+ $options = CRM_Core_BAO_OptionValue::getOptionValuesAssocArray($option_group_id);
+ }
+ break;
- if (is_object($coDAO)) {
- while ($coDAO->fetch()) {
- if ($dataType == 'Country') {
- // NB: using ts() on a variable here is OK, since the value is pre-determined, not variable
- // and already extracted to .pot files.
- $options[$coDAO->value] = ts($coDAO->label, array('context' => 'country'));
- }
- elseif ($dataType == 'StateProvince') {
- $options[$coDAO->value] = ts($coDAO->label, array('context' => 'province'));
- }
- else {
- $options[$coDAO->value] = $coDAO->label;
- }
- }
- }
+ case 'CheckBox':
+ case 'AdvMulti-Select':
+ case 'Multi-Select':
+ $customData = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
+ default:
+ if ($option_group_id) {
+ $options = CRM_Core_BAO_OptionValue::getOptionValuesAssocArray($option_group_id);
+ }
+ }
- CRM_Utils_Hook::customFieldOptions($field['id'], $options, FALSE);
+ if (is_object($coDAO)) {
+ while ($coDAO->fetch()) {
+ if ($dataType == 'Country') {
+ // NB: using ts() on a variable here is OK, since the value is pre-determined, not variable
+ // and already extracted to .pot files.
+ $options[$coDAO->value] = ts($coDAO->label, array('context' => 'country'));
+ }
+ elseif ($dataType == 'StateProvince') {
+ $options[$coDAO->value] = ts($coDAO->label, array('context' => 'province'));
+ }
+ else {
+ $options[$coDAO->value] = $coDAO->label;
+ }
+ }
+ }
- $retValue = NULL;
- foreach ($options as $optionValue => $optionLabel) {
- if ($dataType == 'Money') {
- foreach ($customData as $k => $v) {
- $customData[] = CRM_Utils_Money::format($v, NULL, '%a');
- }
- }
+ CRM_Utils_Hook::customFieldOptions($field['id'], $options, FALSE);
- //to show only values that are checked
- if (in_array((string) $optionValue, $customData)) {
- $checked = in_array($optionValue, $customData) ? $freezeStringChecked : $freezeString;
- if (!$optionPerLine || $dncOptionPerLine) {
- if ($retValue) {
+ $retValue = NULL;
+ foreach ($options as $optionValue => $optionLabel) {
+ if ($dataType == 'Money') {
+ foreach ($customData as $k => $v) {
+ $customData[] = CRM_Utils_Money::format($v, NULL, '%a');
+ }
+ }
+
+ //to show only values that are checked
+ if (in_array((string) $optionValue, $customData)) {
+ $checked = in_array($optionValue, $customData) ? $freezeStringChecked : $freezeString;
+ if (!$optionPerLine || $dncOptionPerLine) {
+ if ($retValue) {
$retValue .= ", ";
- }
- $retValue .= $checked . $optionLabel;
- }
- else {
- $retValue[] = $checked . $optionLabel;
- }
- }
- }
- break;
+ }
+ $retValue .= $checked . $optionLabel;
}
+ else {
+ $retValue[] = $checked . $optionLabel;
+ }
+ }
+ }
+ break;
+ }
- //special case for option per line formatting
- if ($optionPerLine > 1 && is_array($retValue)) {
- $rowCounter = 0;
- $fieldCounter = 0;
- $displayValues = array();
+ //special case for option per line formatting
+ if ($optionPerLine > 1 && is_array($retValue)) {
+ $rowCounter = 0;
+ $fieldCounter = 0;
+ $displayValues = array();
$displayString = '';
- foreach ($retValue as $val) {
- if ($displayString) {
+ foreach ($retValue as $val) {
+ if ($displayString) {
$displayString .= ", ";
- }
+ }
- $displayString .= $val;
- $rowCounter++;
- $fieldCounter++;
+ $displayString .= $val;
+ $rowCounter++;
+ $fieldCounter++;
- if (($rowCounter == $optionPerLine) || ($fieldCounter == count($retValue))) {
- $displayValues[] = $displayString;
- $displayString = '';
- $rowCounter = 0;
- }
- }
- $retValue = $displayValues;
- }
+ if (($rowCounter == $optionPerLine) ||
+ ($fieldCounter == count($retValue))
+ ) {
+ $displayValues[] = $displayString;
+ $displayString = '';
+ $rowCounter = 0;
+ }
+ }
+ $retValue = $displayValues;
+ }
- $retValue = isset($retValue) ? $retValue : NULL;
- return $retValue;
- }
+ $retValue = isset($retValue) ? $retValue : NULL;
+ return $retValue;
+ }
/**
* Get the custom group titles by custom field ids.
*
- * @param array $fieldIds - array of custom field ids.
+ * @param array $fieldIds - array of custom field ids.
*
* @return array $groupLabels - array consisting of groups and fields labels with ids.
* @access public
'fieldLabel' => $dao->fieldLabel,
'groupID' => $dao->groupID,
'groupTitle' => $dao->groupTitle,
- );
+ );
}
return $groupLabels;
/**
* Check whether custom group is empty or not.
*
- * @param int $gID - custom group id.
+ * @param int $gID - custom group id.
*
* @return boolean true if empty otherwise false.
* @access public
}
$tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup',
- $gID,
- 'table_name'
- );
+ $gID,
+ 'table_name'
+ );
$query = "SELECT count(id) FROM {$tableName} WHERE id IS NOT NULL LIMIT 1";
$value = CRM_Core_DAO::singleValueQuery($query);
* @return array of types.
* @access public
*/
- static function getExtendedObjectTypes(&$types = array( )) {
+ static function getExtendedObjectTypes(&$types = array()) {
static $flag = FALSE, $objTypes = array();
if (!$flag) {
}
list($className) = explode('::', $callback);
- require_once (str_replace('_',DIRECTORY_SEPARATOR, $className) . '.php');
+ require_once(str_replace('_', DIRECTORY_SEPARATOR, $className) .
+ '.php');
$objTypes[$ovValues['value']] = call_user_func_array($callback, $args);
}
$isMultiple = ($isMultiple) ? TRUE : FALSE;
$hasReachedMax = FALSE;
if ($isMultiple &&
- ($maxMultiple = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'max_multiple'))) {
+ ($maxMultiple = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'max_multiple'))
+ ) {
if (!$maxMultiple) {
$hasReachedMax = FALSE;
- } else {
+ }
+ else {
$tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'table_name');
//count the number of entries for a entity
$sql = "SELECT COUNT(id) FROM {$tableName} WHERE entity_id = %1";
static function getMultipleFieldGroup() {
$multipleGroup = array();
$dao = new CRM_Core_DAO_CustomGroup();
- $dao->is_multiple = 1 ;
+ $dao->is_multiple = 1;
$dao->find();
- while($dao->fetch()) {
+ while ($dao->fetch()) {
$multipleGroup[$dao->id] = $dao->title;
}
return $multipleGroup;
}
- }
+}
);
$this->setDefaults(array(
- 'contactType' =>
- CRM_Import_Parser::CONTACT_INDIVIDUAL,
+ 'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL,
));
//build date formats
$this->addGroup($contactOptions, 'contactType', ts('Contact Type'));
$this->setDefaults(array(
- 'contactType' =>
- CRM_Import_Parser::CONTACT_INDIVIDUAL,
+ 'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL,
)
);
$this->_logTables =
array(
- 'log_civicrm_contact' =>
- array(
+ 'log_civicrm_contact' => array(
'fk' => 'id',
),
- 'log_civicrm_email' =>
- array(
+ 'log_civicrm_email' => array(
'fk' => 'contact_id',
'log_type' => 'Contact',
),
- 'log_civicrm_phone' =>
- array(
+ 'log_civicrm_phone' => array(
'fk' => 'contact_id',
'log_type' => 'Contact',
),
- 'log_civicrm_address' =>
- array(
+ 'log_civicrm_address' => array(
'fk' => 'contact_id',
'log_type' => 'Contact',
),
- 'log_civicrm_note' =>
- array(
+ 'log_civicrm_note' => array(
'fk' => 'entity_id',
'entity_table' => TRUE,
- 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject'),
+ 'bracket_info' => array(
+ 'table' => 'log_civicrm_note',
+ 'column' => 'subject'
+ ),
),
- 'log_civicrm_note_comment' =>
- array(
+ 'log_civicrm_note_comment' => array(
'fk' => 'entity_id',
'table_name' => 'log_civicrm_note',
'joins' => array(
'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'),
+ 'bracket_info' => array(
+ 'table' => 'log_civicrm_note',
+ 'column' => 'subject'
+ ),
),
- 'log_civicrm_group_contact' =>
- array(
+ 'log_civicrm_group_contact' => array(
'fk' => 'contact_id',
- 'bracket_info' => array('entity_column' => 'group_id', 'table' => 'log_civicrm_group', 'column' => 'title'),
+ 'bracket_info' => array(
+ 'entity_column' => 'group_id',
+ 'table' => 'log_civicrm_group',
+ 'column' => 'title'
+ ),
'action_column' => 'status',
'log_type' => 'Group',
),
- 'log_civicrm_entity_tag' =>
- array(
+ 'log_civicrm_entity_tag' => array(
'fk' => 'entity_id',
- 'bracket_info' => array('entity_column' => 'tag_id', 'table' => 'log_civicrm_tag', 'column' => 'name'),
+ 'bracket_info' => array(
+ 'entity_column' => 'tag_id',
+ 'table' => 'log_civicrm_tag',
+ 'column' => 'name'
+ ),
'entity_table' => TRUE
),
- 'log_civicrm_relationship' =>
- array(
+ 'log_civicrm_relationship' => array(
'fk' => 'contact_id_a',
'bracket_info' => array(
'entity_column' => 'relationship_type_id',
'column' => 'label_a_b'
),
),
- 'log_civicrm_activity_for_target' =>
- array(
+ 'log_civicrm_activity_for_target' => array(
'fk' => 'contact_id',
'table_name' => 'log_civicrm_activity',
'joins' => array(
),
'log_type' => 'Activity',
),
- 'log_civicrm_activity_for_assignee' =>
- array(
+ 'log_civicrm_activity_for_assignee' => array(
'fk' => 'contact_id',
'table_name' => 'log_civicrm_activity',
'joins' => array(
),
'log_type' => 'Activity',
),
- 'log_civicrm_activity_for_source' =>
- array(
+ 'log_civicrm_activity_for_source' => array(
'fk' => 'contact_id',
'table_name' => 'log_civicrm_activity',
'joins' => array(
),
'log_type' => 'Activity',
),
- 'log_civicrm_case' =>
- array(
+ 'log_civicrm_case' => array(
'fk' => 'contact_id',
'joins' => array(
'table' => 'log_civicrm_case_contact',
// build _logTables for contact custom tables
$customTables = $logging->entityCustomDataLogTables('Contact');
foreach ($customTables as $table) {
- $this->_logTables[$table] = array('fk' => 'entity_id', 'log_type' => 'Contact');
+ $this->_logTables[$table] = array(
+ 'fk' => 'entity_id',
+ 'log_type' => 'Contact'
+ );
}
// build _logTables for address custom tables
'fk' => 'contact_id',// for join of fk_table with contact table
'joins' => array(
'table' => 'log_civicrm_address', // fk_table
- 'join' => 'entity_log_civireport.entity_id = fk_table.id'
+ 'join' => 'entity_log_civireport.entity_id = fk_table.id'
),
'log_type' => 'Contact'
);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('required', $field) or CRM_Utils_Array::value($fieldName, $this->_params['fields'])) {
+ if (CRM_Utils_Array::value('required', $field) or
+ CRM_Utils_Array::value($fieldName, $this->_params['fields'])
+ ) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
$this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
}
- if ($entityID && $logDate && array_key_exists('table', $this->_logTables[$entity]['bracket_info'])) {
+ if ($entityID && $logDate &&
+ array_key_exists('table', $this->_logTables[$entity]['bracket_info'])
+ ) {
$sql = "
SELECT {$this->_logTables[$entity]['bracket_info']['column']}
FROM `{$this->loggingDB}`.{$this->_logTables[$entity]['bracket_info']['table']}
));
}
else {
- if (array_key_exists('options', $this->_logTables[$entity]['bracket_info']) && $entityID) {
+ if (array_key_exists('options', $this->_logTables[$entity]['bracket_info']) &&
+ $entityID
+ ) {
return CRM_Utils_Array::value($entityID, $this->_logTables[$entity]['bracket_info']['options']);
}
}
'delivered' => CRM_Mailing_Event_BAO_Delivered::getTableName(),
'opened' => CRM_Mailing_Event_BAO_Opened::getTableName(),
'reply' => CRM_Mailing_Event_BAO_Reply::getTableName(),
- 'unsubscribe' =>
- CRM_Mailing_Event_BAO_Unsubscribe::getTableName(),
+ 'unsubscribe' => CRM_Mailing_Event_BAO_Unsubscribe::getTableName(),
'bounce' => CRM_Mailing_Event_BAO_Bounce::getTableName(),
'forward' => CRM_Mailing_Event_BAO_Forward::getTableName(),
'url' => CRM_Mailing_BAO_TrackableURL::getTableName(),
$params['start_date_time']
)) < CRM_Utils_Date::format(date('YmdHi00'))) {
return array(
- 'start_date' =>
- ts('Start date cannot be earlier than the current time.'),
+ 'start_date' => ts('Start date cannot be earlier than the current time.'),
);
}
return TRUE;
ts('Import mode')
);
$this->setDefaults(array(
- 'onDuplicate' =>
- CRM_Import_Parser::DUPLICATE_SKIP,
+ 'onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP,
));
//get the saved mapping details
);
$this->setDefaults(array(
- 'contactType' =>
- CRM_Import_Parser::CONTACT_INDIVIDUAL,
+ 'contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL,
));
//build date formats
* Operator types - used for displaying filter elements
*/
CONST
- OP_INT = 1,
+ OP_INT = 1,
OP_STRING = 2,
- OP_DATE = 4,
+ OP_DATE = 4,
OP_DATETIME = 5,
- OP_FLOAT = 8,
+ OP_FLOAT = 8,
OP_SELECT = 64,
OP_MULTISELECT = 65,
OP_MULTISELECT_SEPARATOR = 66,
protected $_customGroupExtendsJoin = array();
protected $_customGroupFilters = TRUE;
protected $_customGroupGroupBy = FALSE;
- protected $_customGroupJoin = 'LEFT JOIN';
+ protected $_customGroupJoin = 'LEFT JOIN';
/**
* Build tags filter
* @var array
*/
protected $_fourColumnAttribute = array(
- '</td><td width="25%">', '</td><td width="25%">',
- '</td><td width="25%">', '</tr><tr><td>',
+ '</td><td width="25%">',
+ '</td><td width="25%">',
+ '</td><td width="25%">',
+ '</tr><tr><td>',
);
protected $_force = 1;
public $_columnHeaders = array();
public $_orderBy = NULL;
public $_orderByFields = array();
- public $_orderByArray = array();
+ public $_orderByArray = array();
public $_groupBy = NULL;
public $_whereClauses = array();
public $_havingClauses = array();
CRM_Core_Region::instance('page-header')->add(array(
'markup' => sprintf('<!-- Report class: [%s] -->', htmlentities(get_class($this))),
));
- if(!$this->noController) {
+ if (!$this->noController) {
$this->setID($this->get('instanceId'));
if (!$this->_id) {
$this->setID(CRM_Report_Utils_Report::getInstanceID());
if (!$this->_id) {
- $this->setID( CRM_Report_Utils_Report::getInstanceIDForPath());
+ $this->setID(CRM_Report_Utils_Report::getInstanceIDForPath());
}
}
// Do not display Report Settings section if administer Reports permission is absent OR
// if report instance is reserved and administer reserved reports absent
if (!CRM_Core_Permission::check('administer Reports') ||
- ($this->_instanceValues['is_reserved'] && !CRM_Core_Permission::check('administer reserved reports'))) {
+ ($this->_instanceValues['is_reserved'] &&
+ !CRM_Core_Permission::check('administer reserved reports'))
+ ) {
$this->_instanceForm = FALSE;
}
$this->assign('criteriaForm', FALSE);
// Display Report Criteria section if user has access Report Criteria OR administer Reports AND report instance is not reserved
- if (CRM_Core_Permission::check('administer Reports') || CRM_Core_Permission::check('access Report Criteria')) {
- if (!$this->_instanceValues['is_reserved'] || CRM_Core_Permission::check('administer reserved reports')) {
+ if (CRM_Core_Permission::check('administer Reports') ||
+ CRM_Core_Permission::check('access Report Criteria')
+ ) {
+ if (!$this->_instanceValues['is_reserved'] ||
+ CRM_Core_Permission::check('administer reserved reports')
+ ) {
$this->assign('criteriaForm', TRUE);
$this->_criteriaForm = TRUE;
}
foreach ($this->_columns as $tableName => $table) {
// set alias
if (!isset($table['alias'])) {
- $this->_columns[$tableName]['alias'] = substr($tableName, 8) . '_civireport';
+ $this->_columns[$tableName]['alias'] = substr($tableName, 8) .
+ '_civireport';
}
else {
$this->_columns[$tableName]['alias'] = $table['alias'] . '_civireport';
// higher preference to bao object
if (array_key_exists('bao', $table)) {
$daoOrBaoName = $table['bao'];
- $expFields = $daoOrBaoName::exportableFields( );
+ $expFields = $daoOrBaoName::exportableFields();
}
- elseif (array_key_exists('dao', $table)){
+ elseif (array_key_exists('dao', $table)) {
$daoOrBaoName = $table['dao'];
- $expFields = $daoOrBaoName::export( );
+ $expFields = $daoOrBaoName::export();
}
- else{
+ else {
$expFields = array();
}
// set alias = table-name, unless already set
$alias = isset($field['alias']) ? $field['alias'] : (isset($this->_columns[$tableName]['alias']) ?
- $this->_columns[$tableName]['alias'] : $tableName
+ $this->_columns[$tableName]['alias'] : $tableName
);
$this->_columns[$tableName][$fieldGrp][$fieldName]['alias'] = $alias;
// set dbAlias = alias.name, unless already set
if (!isset($this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias'])) {
- $this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias'] = $alias . '.' . $this->_columns[$tableName][$fieldGrp][$fieldName]['name'];
+ $this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias'] =
+ $alias . '.' .
+ $this->_columns[$tableName][$fieldGrp][$fieldName]['name'];
}
// a few auto fills for filters
$this->_columns[$tableName][$fieldGrp][$fieldName]['operatorType'] = CRM_Report_Form::OP_SELECT;
if (!array_key_exists('options', $this->_columns[$tableName][$fieldGrp][$fieldName])) {
$this->_columns[$tableName][$fieldGrp][$fieldName]['options'] =
- array('' => ts('Any'), '0' => ts('No'), '1' => ts('Yes'));
+ array(
+ '' => ts('Any'),
+ '0' => ts('No'),
+ '1' => ts('Yes')
+ );
}
break;
default:
if ($daoOrBaoName &&
- array_key_exists('pseudoconstant', $this->_columns[$tableName][$fieldGrp][$fieldName])) {
+ array_key_exists('pseudoconstant', $this->_columns[$tableName][$fieldGrp][$fieldName])
+ ) {
// with multiple options operator-type is generally multi-select
$this->_columns[$tableName][$fieldGrp][$fieldName]['operatorType'] = CRM_Report_Form::OP_MULTISELECT;
if (!array_key_exists('options', $this->_columns[$tableName][$fieldGrp][$fieldName])) {
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
if (isset($field['default'])) {
- if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- if(is_array($field['default'])){
+ if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE
+ ) {
+ if (is_array($field['default'])) {
$this->_defaults["{$fieldName}_from"] = CRM_Utils_Array::value('from', $field['default']);
$this->_defaults["{$fieldName}_to"] = CRM_Utils_Array::value('to', $field['default']);
$this->_defaults["{$fieldName}_relative"] = 0;
}
- else{
+ else {
$this->_defaults["{$fieldName}_relative"] = $field['default'];
}
}
}
//assign default value as "in" for multiselect
//operator, To freeze the select element
- if (CRM_Utils_Array::value('operatorType', $field) == CRM_Report_Form::OP_MULTISELECT) {
+ if (CRM_Utils_Array::value('operatorType', $field) ==
+ CRM_Report_Form::OP_MULTISELECT
+ ) {
$this->_defaults["{$fieldName}_op"] = 'in';
}
- if (CRM_Utils_Array::value('operatorType', $field) == CRM_Report_Form::OP_ENTITYREF) {
+ if (CRM_Utils_Array::value('operatorType', $field) ==
+ CRM_Report_Form::OP_ENTITYREF
+ ) {
$this->_defaults["{$fieldName}_op"] = 'in';
}
- elseif (CRM_Utils_Array::value('operatorType', $field) == CRM_Report_Form::OP_MULTISELECT_SEPARATOR) {
+ elseif (CRM_Utils_Array::value('operatorType', $field) ==
+ CRM_Report_Form::OP_MULTISELECT_SEPARATOR
+ ) {
$this->_defaults["{$fieldName}_op"] = 'mhas';
}
elseif ($op = CRM_Utils_Array::value('default_op', $field)) {
}
foreach ($table['order_bys'] as $fieldName => $field) {
if (!empty($field['default']) || !empty($field['default_order']) ||
- CRM_Utils_Array::value('default_is_section', $field) || !empty($field['default_weight'])) {
+ CRM_Utils_Array::value('default_is_section', $field) ||
+ !empty($field['default_weight'])
+ ) {
$order_by = array(
'column' => $fieldName,
'order' => CRM_Utils_Array::value('default_order', $field, 'ASC'),
/**
* Setter for $_params
+ *
* @param array $params
*/
function setParams($params) {
/**
* Setter for $_force
- * @param bool $isForce
-*/
+ *
+ * @param $isForce
+ */
function setForce($isForce) {
$this->_force = $isForce;
}
/**
* Setter for $_limitValue
+ *
* @param number $_limitValue
*/
function setLimitValue($_limitValue) {
/**
* Setter for $_offsetValue
+ *
* @param number $_offsetValue
*/
function setOffsetValue($_offsetValue) {
foreach ($table['fields'] as $fieldName => $field) {
$groupTitle = '';
if (empty($field['no_display'])) {
- foreach ( array('table', 'field') as $var) {
+ foreach (array('table', 'field') as $var) {
if (!empty(${$var}['grouping'])) {
if (!is_array(${$var}['grouping'])) {
$tableName = ${$var}['grouping'];
- } else {
+ }
+ else {
$tableName = array_keys(${$var}['grouping']);
$tableName = $tableName[0];
$groupTitle = array_values(${$var}['grouping']);
switch (CRM_Utils_Array::value('operatorType', $field)) {
case CRM_Report_Form::OP_MONTH:
- if (!array_key_exists('options', $field) || !is_array($field['options']) || empty($field['options'])) {
+ if (!array_key_exists('options', $field) ||
+ !is_array($field['options']) || empty($field['options'])
+ ) {
// If there's no option list for this filter, define one.
$field['options'] = array(
1 => ts('January'),
case CRM_Report_Form::OP_MULTISELECT:
case CRM_Report_Form::OP_MULTISELECT_SEPARATOR:
// assume a multi-select field
- if (!empty($field['options']) || $fieldName == 'state_province_id' || $fieldName == 'county_id') {
+ if (!empty($field['options']) ||
+ $fieldName == 'state_province_id' || $fieldName == 'county_id'
+ ) {
$element = $this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations);
if (count($operations) <= 1) {
$element->freeze();
}
- if ($fieldName == 'state_province_id' || $fieldName == 'county_id') {
- $this->addChainSelect($fieldName . '_value', array('multiple' => TRUE, 'label' => NULL, 'class' => 'huge'));
+ if ($fieldName == 'state_province_id' ||
+ $fieldName == 'county_id'
+ ) {
+ $this->addChainSelect($fieldName . '_value', array(
+ 'multiple' => TRUE,
+ 'label' => NULL,
+ 'class' => 'huge'
+ ));
}
else {
$this->addElement('select', "{$fieldName}_value", NULL, $field['options'], array(
case CRM_Report_Form::OP_SELECT:
// assume a select field
$this->addElement('select', "{$fieldName}_op", ts('Operator:'), $operations);
- if (!empty($field['options']))
+ if (!empty($field['options'])) {
$this->addElement('select', "{$fieldName}_value", NULL, $field['options']);
+ }
break;
case CRM_Report_Form::OP_ENTITYREF:
case CRM_Report_Form::OP_DATE:
// build datetime fields
- CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count, '_from','_to', 'From:', FALSE, $operations);
+ CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count, '_from', '_to', 'From:', FALSE, $operations);
$count++;
break;
case CRM_Report_Form::OP_DATETIME:
// build datetime fields
- CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count, '_from', '_to', 'From:', FALSE, $operations, 'searchDate', true);
+ CRM_Core_Form_Date::buildDateRange($this, $fieldName, $count, '_from', '_to', 'From:', FALSE, $operations, 'searchDate', TRUE);
$count++;
break;
*/
- if ($this->_autoIncludeIndexedFieldsAsOrderBys && array_key_exists('extends', $table) && !empty($table['extends'])) {
+ if ($this->_autoIncludeIndexedFieldsAsOrderBys &&
+ array_key_exists('extends', $table) && !empty($table['extends'])
+ ) {
foreach ($table['fields'] as $fieldName => $field) {
if (empty($field['no_display'])) {
$options[$fieldName] = $field['title'];
if (!empty($options)) {
$options = array(
- '-' => ' - none - ') + $options;
+ '-' => ' - none - '
+ ) + $options;
for ($i = 1; $i <= 5; $i++) {
$this->addElement('select', "order_bys[{$i}][column]", ts('Order by Column'), $options);
- $this->addElement('select', "order_bys[{$i}][order]", ts('Order by Order'), array('ASC' => 'Ascending', 'DESC' => 'Descending'));
+ $this->addElement('select', "order_bys[{$i}][order]", ts('Order by Order'), array(
+ 'ASC' => 'Ascending',
+ 'DESC' => 'Descending'
+ ));
$this->addElement('checkbox', "order_bys[{$i}][section]", ts('Order by Section'), FALSE, array('id' => "order_by_section_$i"));
$this->addElement('checkbox', "order_bys[{$i}][pageBreak]", ts('Page Break'), FALSE, array('id' => "order_by_pagebreak_$i"));
}
$this->addElement('submit', $this->_pdfButtonName, ts('PDF'));
if ($this->_id) {
- $this->addElement('submit', $this->_createNewButtonName, ts('Save a Copy') . '...');
+ $this->addElement('submit', $this->_createNewButtonName,
+ ts('Save a Copy') . '...');
}
if ($this->_instanceForm) {
$this->assign('instanceForm', TRUE);
$this->addElement('submit', $this->_csvButtonName, $label);
}
- if (CRM_Core_Permission::check('administer Reports') && $this->_add2groupSupported) {
+ if (CRM_Core_Permission::check('administer Reports') &&
+ $this->_add2groupSupported
+ ) {
$this->addElement('select', 'groups', ts('Group'),
- array('' => ts('Add Contacts to Group')) + CRM_Core_PseudoConstant::nestedGroup(),
+ array('' => ts('Add Contacts to Group')) +
+ CRM_Core_PseudoConstant::nestedGroup(),
array('class' => 'crm-select2 crm-action-menu action-icon-plus huge')
);
$this->assign('group', TRUE);
//add form rule for report
if (is_callable(array(
- $this, 'formRule'))) {
+ $this,
+ 'formRule'
+ ))) {
$this->addFormRule(array(get_class($this), 'formRule'), $this);
}
}
*
* @return array
*/
- function customDataFormRule($fields, $ignoreFields = array( )) {
+ function customDataFormRule($fields, $ignoreFields = array()) {
$errors = array();
- if (!empty($this->_customGroupExtends) && $this->_customGroupGroupBy && !empty($fields['group_bys'])) {
+ if (!empty($this->_customGroupExtends) && $this->_customGroupGroupBy &&
+ !empty($fields['group_bys'])
+ ) {
foreach ($this->_columns as $tableName => $table) {
- if ((substr($tableName, 0, 13) == 'civicrm_value' || substr($tableName, 0, 12) == 'custom_value') && !empty($this->_columns[$tableName]['fields'])) {
+ if ((substr($tableName, 0, 13) == 'civicrm_value' ||
+ substr($tableName, 0, 12) == 'custom_value') &&
+ !empty($this->_columns[$tableName]['fields'])
+ ) {
foreach ($this->_columns[$tableName]['fields'] as $fieldName => $field) {
if (array_key_exists($fieldName, $fields['group_bys']) &&
!array_key_exists($fieldName, $fields['fields'])
}
elseif (array_key_exists($fieldName, $fields['group_bys'])) {
foreach ($fields['fields'] as $fld => $val) {
- if (!array_key_exists($fld, $fields['group_bys']) && !in_array($fld, $ignoreFields)) {
+ if (!array_key_exists($fld, $fields['group_bys']) &&
+ !in_array($fld, $ignoreFields)
+ ) {
$errors['fields'] = "Please ensure that fields selected in 'Display Columns' are also selected in 'Group by Columns' section.";
}
}
if (!empty($contactTags)) {
$this->_columns['civicrm_tag'] = array(
'dao' => 'CRM_Core_DAO_Tag',
- 'filters' =>
- array(
- 'tagid' =>
- array(
+ 'filters' => array(
+ 'tagid' => array(
'name' => 'tag_id',
'title' => ts('Tag'),
'tag' => TRUE,
*/
function buildGroupFilter() {
$this->_columns['civicrm_group']['filters'] = array(
- 'gid' =>
- array(
+ 'gid' => array(
'name' => 'group_id',
'title' => ts('Group'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
* @return null|string
*/
function whereClause(&$field, $op,
- $value, $min, $max
+ $value, $min, $max
) {
$type = CRM_Utils_Type::typeToString(CRM_Utils_Array::value('type', $field));
if (($min !== NULL && strlen($min) > 0) ||
($max !== NULL && strlen($max) > 0)
) {
- $min = CRM_Utils_Type::escape($min, $type);
- $max = CRM_Utils_Type::escape($max, $type);
+ $min = CRM_Utils_Type::escape($min, $type);
+ $max = CRM_Utils_Type::escape($max, $type);
$clauses = array();
if ($min) {
if ($op == 'bw') {
}
if ($value !== NULL && is_array($value) && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
- if (CRM_Utils_Array::value('type', $field) == CRM_Utils_Type::T_STRING) {
+ if (CRM_Utils_Array::value('type', $field) ==
+ CRM_Utils_Type::T_STRING
+ ) {
//cycle through selections and esacape values
foreach ($value as $key => $selection) {
$value[$key] = CRM_Utils_Type::escape($selection, $type);
}
- $clause = "( {$field['dbAlias']} $sqlOP ( '" . implode("' , '", $value) . "') )";
+ $clause =
+ "( {$field['dbAlias']} $sqlOP ( '" . implode("' , '", $value) .
+ "') )";
}
else {
// for numerical values
- $clause = "{$field['dbAlias']} $sqlOP (" . implode(', ', $value) . ")";
+ $clause = "{$field['dbAlias']} $sqlOP (" . implode(', ', $value) .
+ ")";
}
if ($op == 'notin') {
$clause = "( " . $clause . " OR {$field['dbAlias']} IS NULL )";
// mhas == multiple has
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
- $clause = "{$field['dbAlias']} REGEXP '[[:<:]]" . implode('|', $value) . "[[:>:]]'";
+ $clause =
+ "{$field['dbAlias']} REGEXP '[[:<:]]" . implode('|', $value) .
+ "[[:>:]]'";
}
break;
// mnot == multiple is not one of
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
- $clause = "( {$field['dbAlias']} NOT REGEXP '[[:<:]]" . implode('|', $value) . "[[:>:]]' OR {$field['dbAlias']} IS NULL )";
+ $clause =
+ "( {$field['dbAlias']} NOT REGEXP '[[:<:]]" . implode('|', $value) .
+ "[[:>:]]' OR {$field['dbAlias']} IS NULL )";
}
break;
* @return null|string
*/
function dateClause($fieldName,
- $relative, $from, $to, $type = NULL, $fromTime = NULL, $toTime = NULL
+ $relative, $from, $to, $type = NULL, $fromTime = NULL, $toTime = NULL
) {
$clauses = array();
if (in_array($relative, array_keys($this->getOperationPair(CRM_Report_Form::OP_DATE)))) {
return NULL;
}
- /**
- * @todo - could not find any instances where this is called
- * @param unknown_type $relative
- * @param String $from
- * @param String_type $to
- * @return string|NULL
- */
+
+ /**
+ * @todo - could not find any instances where this is called
+ *
+ * @param unknown_type $relative
+ * @param String $from
+ * @param String_type $to
+ *
+ * @return string|NULL
+ */
function dateDisplay($relative, $from, $to) {
list($from, $to) = $this->getFromTo($relative, $from, $to);
}
$customFields = $fieldValueMap = array();
- $customFieldCols = array('column_name', 'data_type', 'html_type', 'option_group_id', 'id');
+ $customFieldCols = array(
+ 'column_name',
+ 'data_type',
+ 'html_type',
+ 'option_group_id',
+ 'id'
+ );
// skip for type date and ContactReference since date format is already handled
$query = "
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
foreach ($customFieldCols as $key) {
- $customFields[$dao->table_name . '_custom_' . $dao->id][$key] = $dao->$key;
+ $customFields[$dao->table_name . '_custom_' .
+ $dao->id][$key] = $dao->$key;
}
if ($dao->option_group_id) {
$fieldValueMap[$dao->option_group_id][$dao->value] = $dao->label;
case 'Float':
if ($htmlType == 'Text') {
- $retValue = (float)$value;
+ $retValue = (float) $value;
break;
}
case 'Money':
if ($htmlType == 'Text') {
-
-
-
-
-
-
-
$retValue = CRM_Utils_Money::format($value, NULL, '%a');
break;
}
case 'String':
case 'Int':
if (in_array($htmlType, array(
- 'Text', 'TextArea'))) {
+ 'Text',
+ 'TextArea'
+ ))) {
$retValue = $value;
break;
}
foreach ($rows as $key => $list) {
foreach ($list as $colName => $colVal) {
if (array_key_exists($colName, $checkList) &&
- $checkList[$colName] == $colVal) {
+ $checkList[$colName] == $colVal
+ ) {
$rows[$key][$colName] = "";
}
if (in_array($colName, $this->_noRepeats)) {
if (!empty($this->_params['charts']) && !empty($rows)) {
$this->buildChart($rows);
$this->assign('chartEnabled', TRUE);
- $this->_chartId = "{$this->_params['charts']}_" . ($this->_id ? $this->_id : substr(get_class($this), 16)) . '_' . session_id();
+ $this->_chartId = "{$this->_params['charts']}_" .
+ ($this->_id ? $this->_id : substr(get_class($this), 16)) . '_' .
+ session_id();
$this->assign('chartId', $this->_chartId);
}
$this->_phoneField = TRUE;
}
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
// 1. In many cases we want select clause to be built in slightly different way
// for a particular field of a particular type.
continue;
}
- if (!empty($this->_params['group_bys']) && !empty($this->_params['group_bys'][$fieldName]) && !empty($this->_params['group_bys_freq'])) {
+ if (!empty($this->_params['group_bys']) &&
+ !empty($this->_params['group_bys'][$fieldName]) &&
+ !empty($this->_params['group_bys_freq'])
+ ) {
switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
case 'YEARWEEK':
- $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
- $select[] = "YEARWEEK({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "WEEKOFYEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
+ $select[] = "YEARWEEK({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "WEEKOFYEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Week';
break;
case 'YEAR':
- $select[] = "MAKEDATE(YEAR({$field['dbAlias']}), 1) AS {$tableName}_{$fieldName}_start";
- $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "MAKEDATE(YEAR({$field['dbAlias']}), 1) AS {$tableName}_{$fieldName}_start";
+ $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Year';
break;
case 'MONTH':
- $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL (DAYOFMONTH({$field['dbAlias']})-1) DAY) as {$tableName}_{$fieldName}_start";
- $select[] = "MONTH({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "MONTHNAME({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL (DAYOFMONTH({$field['dbAlias']})-1) DAY) as {$tableName}_{$fieldName}_start";
+ $select[] = "MONTH({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "MONTHNAME({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Month';
break;
case 'QUARTER':
- $select[] = "STR_TO_DATE(CONCAT( 3 * QUARTER( {$field['dbAlias']} ) -2 , '/', '1', '/', YEAR( {$field['dbAlias']} ) ), '%m/%d/%Y') AS {$tableName}_{$fieldName}_start";
- $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "STR_TO_DATE(CONCAT( 3 * QUARTER( {$field['dbAlias']} ) -2 , '/', '1', '/', YEAR( {$field['dbAlias']} ) ), '%m/%d/%Y') AS {$tableName}_{$fieldName}_start";
+ $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Quarter';
break;
}
// for graphs and charts -
if (!empty($this->_params['group_bys_freq'][$fieldName])) {
$this->_interval = $field['title'];
- $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning';
+ $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] =
+ $field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['group_by'] = $this->_params['group_bys_freq'][$fieldName];
* temp table that may not be part of the final where clause or added
* in other functions
*/
- function storeWhereHavingClauseArray(){
+ function storeWhereHavingClauseArray() {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
// respect pseudofield to filter spec so fields can be marked as
// not to be handled here
- if(!empty($field['pseudofield'])){
+ if (!empty($field['pseudofield'])) {
continue;
}
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- if (CRM_Utils_Array::value('operatorType', $field) == CRM_Report_Form::OP_MONTH) {
+ if (CRM_Utils_Array::value('operatorType', $field) ==
+ CRM_Report_Form::OP_MONTH
+ ) {
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
$value = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
if (is_array($value) && !empty($value)) {
- $clause = "(month({$field['dbAlias']}) $op (" . implode(', ', $value) . '))';
+ $clause =
+ "(month({$field['dbAlias']}) $op (" . implode(', ', $value) .
+ '))';
}
}
else {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$fromTime = CRM_Utils_Array::value("{$fieldName}_from_time", $this->_params);
- $toTime = CRM_Utils_Array::value("{$fieldName}_to_time", $this->_params);
- $clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type'], $fromTime, $toTime);
+ $toTime = CRM_Utils_Array::value("{$fieldName}_to_time", $this->_params);
+ $clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type'], $fromTime, $toTime);
}
}
else {
}
}
+
function processReportMode() {
$buttonName = $this->controller->getButtonName();
$printOnly = FALSE;
$this->assign('printOnly', FALSE);
- if ($this->_printButtonName == $buttonName || $output == 'print' || ($this->_sendmail && !$output)) {
+ if ($this->_printButtonName == $buttonName || $output == 'print' ||
+ ($this->_sendmail && !$output)
+ ) {
$this->assign('printOnly', TRUE);
$printOnly = TRUE;
$this->assign('outputMode', 'print');
$this->_outputMode = 'print';
if ($this->_sendmail) {
$this->_absoluteUrl = TRUE;
- }
+ }
}
elseif ($this->_pdfButtonName == $buttonName || $output == 'pdf') {
$this->assign('printOnly', TRUE);
$this->_formValues = $this->_params;
if (CRM_Core_Permission::check('administer Reports') &&
isset($this->_id) &&
- ($this->_instanceButtonName == $this->controller->getButtonName() . '_save' ||
+ ($this->_instanceButtonName ==
+ $this->controller->getButtonName() . '_save' ||
$this->_chartButtonName == $this->controller->getButtonName()
)
) {
}
function orderBy() {
- $this->_orderBy = "";
+ $this->_orderBy = "";
$this->_sections = array();
$this->storeOrderByArray();
- if(!empty($this->_orderByArray) && !$this->_rollup == 'WITH ROLLUP'){
+ if (!empty($this->_orderByArray) && !$this->_rollup == 'WITH ROLLUP') {
$this->_orderBy = "ORDER BY " . implode(', ', $this->_orderByArray);
}
$this->assign('sections', $this->_sections);
* the order by clause
*/
function storeOrderByArray() {
- $orderBys = array();
+ $orderBys = array();
if (!empty($this->_params['order_bys']) &&
is_array($this->_params['order_bys']) &&
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
$selectColumns["{$tableName}_{$fieldName}"] = 1;
}
*/
- $query = "select " . implode(", ", $ifnulls) . ", count(*) as ct from ($sql) as subquery group by " . implode(", ", $sectionAliases);
+ $query = "select " . implode(", ", $ifnulls) .
+ ", count(*) as ct from ($sql) as subquery group by " .
+ implode(", ", $sectionAliases);
// initialize array of total counts
$totals = array();
$row = $rows[0];
// add totals for all permutations of section values
- $values = array();
- $i = 1;
+ $values = array();
+ $i = 1;
$aliasCount = count($sectionAliases);
foreach ($sectionAliases as $alias) {
$values[] = $row[$alias];
* @param $count
*/
function countStat(&$statistics, $count) {
- $statistics['counts']['rowCount'] = array('title' => ts('Row(s) Listed'),
- 'value' => $count,
+ $statistics['counts']['rowCount'] = array(
+ 'title' => ts('Row(s) Listed'),
+ 'value' => $count,
);
if ($this->_rowsFound && ($this->_rowsFound > $count)) {
- $statistics['counts']['rowsFound'] = array('title' => ts('Total Row(s)'),
- 'value' => $this->_rowsFound,
+ $statistics['counts']['rowsFound'] = array(
+ 'title' => ts('Total Row(s)'),
+ 'value' => $this->_rowsFound,
);
}
}
}
}
}
- $statistics['groups'][] = array('title' => ts('Grouping(s)'),
- 'value' => implode(' & ', $combinations),
+ $statistics['groups'][] = array(
+ 'title' => ts('Grouping(s)'),
+ 'value' => implode(' & ', $combinations),
);
}
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE && CRM_Utils_Array::value('operatorType', $field) != CRM_Report_Form::OP_MONTH) {
+ if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE &&
+ CRM_Utils_Array::value('operatorType', $field) !=
+ CRM_Report_Form::OP_MONTH
+ ) {
list($from, $to) =
$this->getFromTo(
CRM_Utils_Array::value("{$fieldName}_relative", $this->_params),
CRM_Utils_Array::value("{$fieldName}_to_time", $this->_params)
);
$from_time_format = !empty($this->_params["{$fieldName}_from_time"]) ? 'h' : 'd';
- $from = CRM_Utils_Date::customFormat($from, null, array($from_time_format));
+ $from = CRM_Utils_Date::customFormat($from, NULL, array($from_time_format));
$to_time_format = !empty($this->_params["{$fieldName}_to_time"]) ? 'h' : 'd';
- $to = CRM_Utils_Date::customFormat($to, null, array($to_time_format));
+ $to = CRM_Utils_Date::customFormat($to, NULL, array($to_time_format));
if ($from || $to) {
$statistics['filters'][] = array(
);
}
elseif (in_array($rel = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params),
- array_keys($this->getOperationPair(CRM_Report_Form::OP_DATE))
- )) {
+ array_keys($this->getOperationPair(CRM_Report_Form::OP_DATE))
+ )) {
$pair = $this->getOperationPair(CRM_Report_Form::OP_DATE);
$statistics['filters'][] = array(
'title' => $field['title'],
if (in_array($op, array('bw', 'nbw')) && ($min || $max)) {
$value = "{$pair[$op]} $min " . ts('and') . " $max";
}
- elseif ($val && CRM_Utils_Array::value('operatorType', $field) & self::OP_ENTITYREF) {
+ elseif ($val && CRM_Utils_Array::value('operatorType', $field) &
+ self::OP_ENTITYREF
+ ) {
$this->setEntityRefDefaults($field, $tableName);
- $result = civicrm_api3($field['attributes']['entity'], 'getlist', array('id' => $val) + CRM_Utils_Array::value('api', $field['attributes'], array()));
+ $result = civicrm_api3($field['attributes']['entity'], 'getlist',
+ array('id' => $val) +
+ CRM_Utils_Array::value('api', $field['attributes'], array()));
$values = array();
foreach ($result['values'] as $v) {
$values[] = $v['label'];
$val[$key] = $options[$valIds];
}
}
- $pair[$op] = (count($val) == 1) ? (($op == 'notin' || $op == 'mnot') ? ts('Is Not') : ts('Is')) : CRM_Utils_Array::value($op, $pair);
- $val = implode(', ', $val);
- $value = "{$pair[$op]} " . $val;
+ $pair[$op] = (count($val) == 1) ? (($op == 'notin' || $op ==
+ 'mnot') ? ts('Is Not') : ts('Is')) : CRM_Utils_Array::value($op, $pair);
+ $val = implode(', ', $val);
+ $value = "{$pair[$op]} " . $val;
}
- elseif (!is_array($val) && (!empty($val) || $val == '0') && isset($field['options']) &&
+ elseif (!is_array($val) && (!empty($val) || $val == '0') &&
+ isset($field['options']) &&
is_array($field['options']) && !empty($field['options'])
) {
- $value = CRM_Utils_Array::value($op, $pair) . " " . CRM_Utils_Array::value($val, $field['options'], $val);
+ $value = CRM_Utils_Array::value($op, $pair) . " " .
+ CRM_Utils_Array::value($val, $field['options'], $val);
}
elseif ($val) {
$value = CRM_Utils_Array::value($op, $pair) . " " . $val;
}
}
if ($value) {
- $statistics['filters'][] = array('title' => CRM_Utils_Array::value('title', $field),
- 'value' => $value,
+ $statistics['filters'][] = array(
+ 'title' => CRM_Utils_Array::value('title', $field),
+ 'value' => $value,
);
}
}
* @param null $rows
*/
function endPostProcess(&$rows = NULL) {
- if ( $this->_storeResultSet ) {
+ if ($this->_storeResultSet) {
$this->_resultSet = $rows;
}
$content = $this->compileContent();
$url = CRM_Utils_System::url("civicrm/report/instance/{$this->_id}",
- "reset=1", TRUE
+ "reset=1", TRUE
);
if ($this->_sendmail) {
$attachments = array();
if ($this->_outputMode == 'csv') {
- $content = $this->_formValues['report_header'] . '<p>' . ts('Report URL') . ": {$url}</p>" . '<p>' . ts('The report is attached as a CSV file.') . '</p>' . $this->_formValues['report_footer'];
-
- $csvFullFilename = $config->templateCompileDir . CRM_Utils_File::makeFileName('CiviReport.csv');
+ $content =
+ $this->_formValues['report_header'] . '<p>' . ts('Report URL') .
+ ": {$url}</p>" . '<p>' .
+ ts('The report is attached as a CSV file.') . '</p>' .
+ $this->_formValues['report_footer'];
+
+ $csvFullFilename = $config->templateCompileDir .
+ CRM_Utils_File::makeFileName('CiviReport.csv');
$csvContent = CRM_Report_Utils_Report::makeCsv($this, $rows);
file_put_contents($csvFullFilename, $csvContent);
$attachments[] = array(
}
if ($this->_outputMode == 'pdf') {
// generate PDF content
- $pdfFullFilename = $config->templateCompileDir . CRM_Utils_File::makeFileName('CiviReport.pdf');
+ $pdfFullFilename = $config->templateCompileDir .
+ CRM_Utils_File::makeFileName('CiviReport.pdf');
file_put_contents($pdfFullFilename,
CRM_Utils_PDF_Utils::html2pdf($content, "CiviReport.pdf",
TRUE, array('orientation' => 'landscape')
)
);
// generate Email Content
- $content = $this->_formValues['report_header'] . '<p>' . ts('Report URL') . ": {$url}</p>" . '<p>' . ts('The report is attached as a PDF file.') . '</p>' . $this->_formValues['report_footer'];
+ $content =
+ $this->_formValues['report_header'] . '<p>' . ts('Report URL') .
+ ": {$url}</p>" . '<p>' .
+ ts('The report is attached as a PDF file.') . '</p>' .
+ $this->_formValues['report_footer'];
$attachments[] = array(
'fullPath' => $pdfFullFilename,
}
if (CRM_Report_Utils_Report::mailReport($content, $this->_id,
- $this->_outputMode, $attachments
- )) {
+ $this->_outputMode, $attachments
+ )
+ ) {
CRM_Core_Session::setStatus(ts("Report mail has been sent."), ts('Sent'), 'success');
}
else {
//get chart image name
$chartImg = $this->_chartId . '.png';
//get image url path
- $uploadUrl = str_replace('/persist/contribute/', '/persist/', $config->imageUploadURL) . 'openFlashChart/';
+ $uploadUrl =
+ str_replace('/persist/contribute/', '/persist/', $config->imageUploadURL) .
+ 'openFlashChart/';
$uploadUrl .= $chartImg;
//get image doc path to overwrite
- $uploadImg = str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) . 'openFlashChart/' . $chartImg;
+ $uploadImg =
+ str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) .
+ 'openFlashChart/' . $chartImg;
//Load the image
$chart = imagecreatefrompng($uploadUrl);
//convert it into formattd png
CRM_Report_Form_Instance::postProcess($this);
}
elseif ($this->_createNewButtonName == $this->controller->getButtonName() ||
- $this->_outputMode == 'create_report' ) {
+ $this->_outputMode == 'create_report'
+ ) {
$this->_createNew = TRUE;
CRM_Report_Form_Instance::postProcess($this);
}
/**
* @return string
*/
- function getTemplateFileName(){
+ function getTemplateFileName() {
$defaultTpl = parent::getTemplateFileName();
- $template = CRM_Core_Smarty::singleton();
+ $template = CRM_Core_Smarty::singleton();
if (!$template->template_exists($defaultTpl)) {
$defaultTpl = 'CRM/Report/Form.tpl';
}
/**
* @return string
*/
- function compileContent(){
+ function compileContent() {
$templateFile = $this->getHookedTemplateFileName();
- return $this->_formValues['report_header'] . CRM_Core_Form::$_template->fetch($templateFile) . $this->_formValues['report_footer'];
+ return $this->_formValues['report_header'] .
+ CRM_Core_Form::$_template->fetch($templateFile) .
+ $this->_formValues['report_footer'];
}
if (!$pageId && !empty($_POST)) {
if (isset($_POST['PagerBottomButton']) && isset($_POST['crmPID_B'])) {
- $pageId = max((int)@$_POST['crmPID_B'], 1);
+ $pageId = max((int) @$_POST['crmPID_B'], 1);
}
elseif (isset($_POST['PagerTopButton']) && isset($_POST['crmPID'])) {
- $pageId = max((int)@$_POST['crmPID'], 1);
+ $pageId = max((int) @$_POST['crmPID'], 1);
}
unset($_POST['crmPID_B'], $_POST['crmPID']);
}
$this->_limit = " LIMIT $offset, $rowCount";
return array($offset, $rowCount);
}
- if($this->_limitValue) {
- if($this->_offsetValue) {
+ if ($this->_limitValue) {
+ if ($this->_offsetValue) {
$this->_limit = " LIMIT {$this->_offsetValue}, {$this->_limitValue} ";
}
else {
}
if ($this->_limit && ($this->_limit != '')) {
- $sql = "SELECT FOUND_ROWS();";
+ $sql = "SELECT FOUND_ROWS();";
$this->_rowsFound = CRM_Core_DAO::singleValueQuery($sql);
- $params = array(
+ $params = array(
'total' => $this->_rowsFound,
'rowCount' => $rowCount,
'status' => ts('Records') . ' %%StatusMessage%%',
$group->find();
$smartGroups = array();
while ($group->fetch()) {
- if (in_array($group->id, $this->_params['gid_value']) && $group->saved_search_id) {
+ if (in_array($group->id, $this->_params['gid_value']) &&
+ $group->saved_search_id
+ ) {
$smartGroups[] = $group->id;
}
}
FROM civicrm_membership mem
LEFT JOIN civicrm_membership_status mem_status ON mem.status_id = mem_status.id
LEFT JOIN civicrm_membership_type mt ON mem.membership_type_id = mt.id
- WHERE mt.member_of_contact_id IN (".$tmp_membership_org_sql_list.")
+ WHERE mt.member_of_contact_id IN (" .
+ $tmp_membership_org_sql_list . ")
AND mt.is_active = '1'
AND mem_status.is_current_member = '1'
AND mem_status.is_active = '1' ) ";
- }
+ }
function whereMembershipTypeClause($field, $value, $op) {
$sqlOp = $this->getSQLOperator($op);
$value = array($value);
}
- $tmp_membership_sql_list = implode(', ', $value);
+ $tmp_membership_sql_list = implode(', ', $value);
return " {$this->_aliases['civicrm_contact']}.id {$sqlOp} (
SELECT DISTINCT mem.contact_id
FROM civicrm_membership mem
LEFT JOIN civicrm_membership_status mem_status ON mem.status_id = mem_status.id
LEFT JOIN civicrm_membership_type mt ON mem.membership_type_id = mt.id
- WHERE mem.membership_type_id IN (".$tmp_membership_sql_list.")
+ WHERE mem.membership_type_id IN (" .
+ $tmp_membership_sql_list . ")
AND mt.is_active = '1'
AND mem_status.is_current_member = '1'
AND mem_status.is_active = '1' ) ";
}
$customGroupWhere = '';
if (!empty($permCustomGroupIds)) {
- $customGroupWhere = "cg.id IN (".implode(',' , $permCustomGroupIds).") AND";
+ $customGroupWhere = "cg.id IN (" . implode(',', $permCustomGroupIds) .
+ ") AND";
}
$sql = "
SELECT cg.table_name, cg.title, cg.extends, cf.id as cf_id, cf.label,
$this->_columns[$curTable]['group_title'] = $customDAO->title;
foreach (array(
- 'fields', 'filters', 'group_bys') as $colKey) {
+ 'fields',
+ 'filters',
+ 'group_bys'
+ ) as $colKey) {
if (!array_key_exists($colKey, $this->_columns[$curTable])) {
$this->_columns[$curTable][$colKey] = array();
}
case 'Boolean':
$curFilters[$fieldName]['operatorType'] = CRM_Report_Form::OP_SELECT;
- $curFilters[$fieldName]['options'] = array('' => ts('- select -'),
- 1 => ts('Yes'),
- 0 => ts('No'),
+ $curFilters[$fieldName]['options'] = array(
+ '' => ts('- select -'),
+ 1 => ts('Yes'),
+ 0 => ts('No'),
);
$curFilters[$fieldName]['type'] = CRM_Utils_Type::T_INT;
break;
if (!empty($customDAO->option_group_id)) {
if (in_array($customDAO->html_type, array(
- 'Multi-Select', 'AdvMulti-Select', 'CheckBox'))) {
+ 'Multi-Select',
+ 'AdvMulti-Select',
+ 'CheckBox'
+ ))) {
$curFilters[$fieldName]['operatorType'] = CRM_Report_Form::OP_MULTISELECT_SEPARATOR;
}
else {
}
if ($this->_customGroupFilters) {
$curFilters[$fieldName]['options'] = array();
- $ogDAO = CRM_Core_DAO::executeQuery("SELECT ov.value, ov.label FROM civicrm_option_value ov WHERE ov.option_group_id = %1 ORDER BY ov.weight", array(1 => array($customDAO->option_group_id, 'Integer')));
+ $ogDAO = CRM_Core_DAO::executeQuery("SELECT ov.value, ov.label FROM civicrm_option_value ov WHERE ov.option_group_id = %1 ORDER BY ov.weight", array(
+ 1 => array(
+ $customDAO->option_group_id,
+ 'Integer'
+ )
+ ));
while ($ogDAO->fetch()) {
$curFilters[$fieldName]['options'][$ogDAO->value] = $ogDAO->label;
}
case 'StateProvince':
if (in_array($customDAO->html_type, array(
- 'Multi-Select State/Province'))) {
+ 'Multi-Select State/Province'
+ ))) {
$curFilters[$fieldName]['operatorType'] = CRM_Report_Form::OP_MULTISELECT_SEPARATOR;
}
else {
case 'Country':
if (in_array($customDAO->html_type, array(
- 'Multi-Select Country'))) {
+ 'Multi-Select Country'
+ ))) {
$curFilters[$fieldName]['operatorType'] = CRM_Report_Form::OP_MULTISELECT_SEPARATOR;
}
else {
$mapper = CRM_Core_BAO_CustomQuery::$extendsMap;
foreach ($this->_columns as $table => $prop) {
- if (substr($table, 0, 13) == 'civicrm_value' || substr($table, 0, 12) == 'custom_value') {
+ if (substr($table, 0, 13) == 'civicrm_value' ||
+ substr($table, 0, 12) == 'custom_value'
+ ) {
$extendsTable = $mapper[$prop['extends']];
// check field is in params
}
$baseJoin = CRM_Utils_Array::value($prop['extends'], $this->_customGroupExtendsJoin, "{$this->_aliases[$extendsTable]}.id");
- $customJoin = is_array($this->_customGroupJoin) ? $this->_customGroupJoin[$table] : $this->_customGroupJoin;
+ $customJoin = is_array($this->_customGroupJoin) ? $this->_customGroupJoin[$table] : $this->_customGroupJoin;
$this->_from .= "
{$customJoin} {$table} {$this->_aliases[$table]} ON {$this->_aliases[$table]}.entity_id = {$baseJoin}";
// handle for ContactReference
if (array_key_exists('fields', $prop)) {
foreach ($prop['fields'] as $fieldName => $field) {
- if (CRM_Utils_Array::value('dataType', $field) == 'ContactReference') {
+ if (CRM_Utils_Array::value('dataType', $field) ==
+ 'ContactReference'
+ ) {
$columnName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', CRM_Core_BAO_CustomField::getKeyID($fieldName), 'column_name');
$this->_from .= "
LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_aliases[$table]}.{$columnName} ";
}
//might be survey response field.
- if (!empty($this->_params['fields']['survey_response']) && !empty($prop['fields'][$fieldAlias]['isSurveyResponseField'])) {
+ if (!empty($this->_params['fields']['survey_response']) &&
+ !empty($prop['fields'][$fieldAlias]['isSurveyResponseField'])
+ ) {
return TRUE;
}
}
if (!empty($this->_params['group_bys']) && $this->_customGroupGroupBy) {
foreach (array_keys($prop['group_bys']) as $fieldAlias) {
- if (array_key_exists($fieldAlias, $this->_params['group_bys']) && CRM_Core_BAO_CustomField::getKeyID($fieldAlias)) {
+ if (array_key_exists($fieldAlias, $this->_params['group_bys']) &&
+ CRM_Core_BAO_CustomField::getKeyID($fieldAlias)
+ ) {
return TRUE;
}
}
if (!empty($this->_params['order_bys'])) {
foreach (array_keys($prop['fields']) as $fieldAlias) {
foreach ($this->_params['order_bys'] as $orderBy) {
- if ($fieldAlias == $orderBy['column'] && CRM_Core_BAO_CustomField::getKeyID($fieldAlias)) {
+ if ($fieldAlias == $orderBy['column'] &&
+ CRM_Core_BAO_CustomField::getKeyID($fieldAlias)
+ ) {
return TRUE;
}
}
if (!empty($prop['filters']) && $this->_customGroupFilters) {
foreach ($prop['filters'] as $fieldAlias => $val) {
foreach (array(
- 'value', 'min', 'max', 'relative', 'from', 'to') as $attach) {
+ 'value',
+ 'min',
+ 'max',
+ 'relative',
+ 'from',
+ 'to'
+ ) as $attach) {
if (isset($this->_params[$fieldAlias . '_' . $attach]) &&
(!empty($this->_params[$fieldAlias . '_' . $attach])
- || ($attach != 'relative' && $this->_params[$fieldAlias . '_' . $attach] == '0')
+ || ($attach != 'relative' &&
+ $this->_params[$fieldAlias . '_' . $attach] == '0')
)
- ){
+ ) {
return TRUE;
}
}
/**
* Does table name have columns in SELECT clause?
*
- * @param string $tableName Name of table (index of $this->_columns array)
+ * @param string $tableName Name of table (index of $this->_columns array)
*
* @return bool
*/
function selectedTables() {
if (!$this->_selectedTables) {
$orderByColumns = array();
- if (array_key_exists('order_bys', $this->_params) && is_array($this->_params['order_bys'])) {
+ if (array_key_exists('order_bys', $this->_params) &&
+ is_array($this->_params['order_bys'])
+ ) {
foreach ($this->_params['order_bys'] as $orderBy) {
$orderByColumns[] = $orderBy['column'];
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
$this->_selectedTables[] = $tableName;
break;
}
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $filterName => $filter) {
if (!empty($this->_params["{$filterName}_value"]) ||
- CRM_Utils_Array::value("{$filterName}_op", $this->_params) == 'nll' ||
- CRM_Utils_Array::value("{$filterName}_op", $this->_params) == 'nnll'
+ CRM_Utils_Array::value("{$filterName}_op", $this->_params) ==
+ 'nll' ||
+ CRM_Utils_Array::value("{$filterName}_op", $this->_params) ==
+ 'nnll'
) {
$this->_selectedTables[] = $tableName;
break;
*/
function addAddressFields($groupBy = TRUE, $orderBy = FALSE, $filters = TRUE, $defaults = array('country_id' => TRUE)) {
$addressFields = array(
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'fields' =>
- array(
- 'name' =>
- array('title' => ts('Address Name'),
+ 'fields' => array(
+ 'name' => array(
+ 'title' => ts('Address Name'),
'default' => CRM_Utils_Array::value('name', $defaults, FALSE),
),
- 'street_address' =>
- array('title' => ts('Street Address'),
+ 'street_address' => array(
+ 'title' => ts('Street Address'),
'default' => CRM_Utils_Array::value('street_address', $defaults, FALSE),
),
- 'supplemental_address_1' =>
- array('title' => ts('Supplementary Address Field 1'),
+ 'supplemental_address_1' => array(
+ 'title' => ts('Supplementary Address Field 1'),
'default' => CRM_Utils_Array::value('supplemental_address_1', $defaults, FALSE),
),
- 'supplemental_address_2' =>
- array('title' => ts('Supplementary Address Field 2'),
+ 'supplemental_address_2' => array(
+ 'title' => ts('Supplementary Address Field 2'),
'default' => CRM_Utils_Array::value('supplemental_address_2', $defaults, FALSE),
),
- 'street_number' =>
- array(
+ 'street_number' => array(
'name' => 'street_number',
'title' => ts('Street Number'),
'type' => 1,
'default' => CRM_Utils_Array::value('street_number', $defaults, FALSE),
),
- 'street_name' =>
- array(
+ 'street_name' => array(
'name' => 'street_name',
'title' => ts('Street Name'),
'type' => 1,
'default' => CRM_Utils_Array::value('street_name', $defaults, FALSE),
),
- 'street_unit' =>
- array(
+ 'street_unit' => array(
'name' => 'street_unit',
'title' => ts('Street Unit'),
'type' => 1,
'default' => CRM_Utils_Array::value('street_unit', $defaults, FALSE),
),
- 'city' =>
- array('title' => ts('City'),
+ 'city' => array(
+ 'title' => ts('City'),
'default' => CRM_Utils_Array::value('city', $defaults, FALSE),
),
- 'postal_code' =>
- array('title' => ts('Postal Code'),
+ 'postal_code' => array(
+ 'title' => ts('Postal Code'),
'default' => CRM_Utils_Array::value('postal_code', $defaults, FALSE),
),
- 'postal_code_suffix' =>
- array('title' => ts('Postal Code Suffix'),
+ 'postal_code_suffix' => array(
+ 'title' => ts('Postal Code Suffix'),
'default' => CRM_Utils_Array::value('postal_code_suffix', $defaults, FALSE),
),
- 'country_id' =>
- array('title' => ts('Country'),
- 'default' => CRM_Utils_Array::value('country_id', $defaults, FALSE),
- ),
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'country_id' => array(
+ 'title' => ts('Country'),
+ 'default' => CRM_Utils_Array::value('country_id', $defaults, FALSE),
+ ),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
'default' => CRM_Utils_Array::value('state_province_id', $defaults, FALSE),
),
- 'county_id' =>
- array('title' => ts('County'),
- 'default' => CRM_Utils_Array::value('county_id', $defaults, FALSE),
- ),
+ 'county_id' => array(
+ 'title' => ts('County'),
+ 'default' => CRM_Utils_Array::value('county_id', $defaults, FALSE),
+ ),
),
'grouping' => 'location-fields',
),
if ($filters) {
$addressFields['civicrm_address']['filters'] = array(
- 'street_number' => array('title' => ts('Street Number'),
- 'type' => 1,
- 'name' => 'street_number',
+ 'street_number' => array(
+ 'title' => ts('Street Number'),
+ 'type' => 1,
+ 'name' => 'street_number',
),
- 'street_name' => array('title' => ts('Street Name'),
- 'name' => 'street_name',
- 'operator' => 'like',
+ 'street_name' => array(
+ 'title' => ts('Street Name'),
+ 'name' => 'street_name',
+ 'operator' => 'like',
),
- 'postal_code' => array('title' => ts('Postal Code'),
- 'type' => 1,
- 'name' => 'postal_code',
+ 'postal_code' => array(
+ 'title' => ts('Postal Code'),
+ 'type' => 1,
+ 'name' => 'postal_code',
),
- 'city' => array('title' => ts('City'),
- 'operator' => 'like',
- 'name' => 'city',
+ 'city' => array(
+ 'title' => ts('City'),
+ 'operator' => 'like',
+ 'name' => 'city',
),
'country_id' => array(
'name' => 'country_id',
'title' => ts('Country'),
'type' => CRM_Utils_Type::T_INT,
- 'operatorType' =>
- CRM_Report_Form::OP_MULTISELECT,
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::country(),
),
'state_province_id' => array(
}
if ($orderBy) {
- $addressFields['civicrm_address']['order_bys'] = array('street_name' => array('title' => ts('Street Name')),
- 'street_number' => array('title' => 'Odd / Even Street Number'),
- 'street_address' => NULL,
- 'city' => NULL,
- 'postal_code' => NULL,
+ $addressFields['civicrm_address']['order_bys'] = array(
+ 'street_name' => array('title' => ts('Street Name')),
+ 'street_number' => array('title' => 'Odd / Even Street Number'),
+ 'street_address' => NULL,
+ 'city' => NULL,
+ 'postal_code' => NULL,
);
}
'street_address' => NULL,
'city' => NULL,
'postal_code' => NULL,
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
- 'country_id' =>
- array('title' => ts('Country'),
+ 'country_id' => array(
+ 'title' => ts('Country'),
),
- 'county_id' =>
- array('title' => ts('County'),
+ 'county_id' => array(
+ 'title' => ts('County'),
),
);
}
if ($value = $row['civicrm_address_country_id']) {
$rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value, FALSE);
$url = CRM_Report_Utils_Report::getNextUrl($baseUrl,
- "reset=1&force=1&{$criteriaQueryParams}&" .
- "country_id_op=in&country_id_value={$value}",
- $this->_absoluteUrl, $this->_id
+ "reset=1&force=1&{$criteriaQueryParams}&" .
+ "country_id_op=in&country_id_value={$value}",
+ $this->_absoluteUrl, $this->_id
);
$rows[$rowNum]['civicrm_address_country_id_link'] = $url;
$rows[$rowNum]['civicrm_address_country_id_hover'] = ts("%1 for this country.",
- array(1 => $urltxt)
+ array(1 => $urltxt)
);
}
if ($value = $row['civicrm_address_county_id']) {
$rows[$rowNum]['civicrm_address_county_id'] = CRM_Core_PseudoConstant::county($value, FALSE);
$url = CRM_Report_Utils_Report::getNextUrl($baseUrl,
- "reset=1&force=1&{$criteriaQueryParams}&" .
- "county_id_op=in&county_id_value={$value}",
- $this->_absoluteUrl, $this->_id
+ "reset=1&force=1&{$criteriaQueryParams}&" .
+ "county_id_op=in&county_id_value={$value}",
+ $this->_absoluteUrl, $this->_id
);
$rows[$rowNum]['civicrm_address_county_id_link'] = $url;
$rows[$rowNum]['civicrm_address_county_id_hover'] = ts("%1 for this county.",
- array(1 => $urltxt)
+ array(1 => $urltxt)
);
}
$entryFound = TRUE;
$rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvince($value, FALSE);
$url = CRM_Report_Utils_Report::getNextUrl($baseUrl,
- "reset=1&force=1&{$criteriaQueryParams}&state_province_id_op=in&state_province_id_value={$value}",
- $this->_absoluteUrl, $this->_id
+ "reset=1&force=1&{$criteriaQueryParams}&state_province_id_op=in&state_province_id_value={$value}",
+ $this->_absoluteUrl, $this->_id
);
$rows[$rowNum]['civicrm_address_state_province_id_link'] = $url;
$rows[$rowNum]['civicrm_address_state_province_id_hover'] = ts("%1 for this state.",
- array(1 => $urltxt)
+ array(1 => $urltxt)
);
}
$entryFound = TRUE;
function fiscalYearOffset($fieldName) {
$config = CRM_Core_Config::singleton();
$fy = $config->fiscalYearStart;
- if (CRM_Utils_Array::value('yid_op', $this->_params) == 'calendar' || ($fy['d'] == 1 && $fy['M'] == 1)) {
+ if (CRM_Utils_Array::value('yid_op', $this->_params) == 'calendar' ||
+ ($fy['d'] == 1 && $fy['M'] == 1)
+ ) {
return "YEAR( $fieldName )";
}
- return "YEAR( $fieldName - INTERVAL " . ($fy['M'] - 1) . " MONTH" . ($fy['d'] > 1 ? (" - INTERVAL " . ($fy['d'] - 1) . " DAY") : '') . " )";
+ return "YEAR( $fieldName - INTERVAL " . ($fy['M'] - 1) . " MONTH" .
+ ($fy['d'] > 1 ? (" - INTERVAL " . ($fy['d'] - 1) . " DAY") : '') . " )";
}
/*
/**
* Get phone columns to add to array
+ *
* @param array $options
* - prefix Prefix to add to table (in case of more than one instance of the table)
* - prefix_label Label to give columns from this phone table instance
+ *
* @return array phone columns definition
*/
- function getPhoneColumns($options = array()){
+ function getPhoneColumns($options = array()) {
$defaultOptions = array(
'prefix' => '',
'prefix_label' => '',
);
- $options = array_merge($defaultOptions,$options);
+ $options = array_merge($defaultOptions, $options);
$fields = array(
$options['prefix'] . 'civicrm_phone' => array(
- 'dao' => 'CRM_Core_DAO_Phone',
+ 'dao' => 'CRM_Core_DAO_Phone',
'fields' => array(
$options['prefix'] . 'phone' => array(
'title' => ts($options['prefix_label'] . 'Phone'),
- 'name' => 'phone'
+ 'name' => 'phone'
),
),
),
/**
* Get address columns to add to array
+ *
* @param array $options
* - prefix Prefix to add to table (in case of more than one instance of the table)
* - prefix_label Label to give columns from this address table instance
+ *
* @return array address columns definition
*/
function getAddressColumns($options = array()) {
}
}
- if ( !empty($contact_ids) ) {
+ if (!empty($contact_ids)) {
CRM_Contact_BAO_GroupContact::addContactsToGroup($contact_ids, $groupID);
CRM_Core_Session::setStatus(ts("Listed contact(s) have been added to the selected group."), ts('Contacts Added'), 'success');
}
// prepare the directory
$config = CRM_Core_Config::singleton();
- $defaultPath = str_replace('/persist/contribute/' , '/persist/', $config->imageUploadDir) . '/openFlashChart/';
+ $defaultPath =
+ str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) .
+ '/openFlashChart/';
if (!file_exists($defaultPath)) {
mkdir($defaultPath, 0777, TRUE);
}
/**
* Apply common settings to entityRef fields
+ *
* @param array $field
* @param string $table
*/
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,
+ '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,
+ ),
),
- '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',
),
- '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,
+ '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',
+ ),
),
- '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')),
+ 'order_bys' => array(
+ 'source_contact_email' => array(
+ 'name' => 'email',
+ 'title' => ts('Source Contact Email'),
+ 'dbAlias' => 'civicrm_email_contact_source_email',
+ ),
),
),
- '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,
+ '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'),
+ )
),
- 'status_id' =>
- array('title' => ts('Activity Status'),
- 'default' => TRUE,
- 'type' => CRM_Utils_Type::T_STRING,
+ '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,
+ )
),
- 'duration' =>
- array('title' => ts('Duration'),
- 'type' => CRM_Utils_Type::T_INT,
+ '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'
+ ),
),
- 'details' => array(
- 'title' => ts('Activity Details'),
- )
+ 'grouping' => 'activity-fields',
+ 'alias' => 'activity',
),
- '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(),
+ 'civicrm_activity_contact' => array(
+ 'dao' => 'CRM_Activity_DAO_ActivityContact',
+ 'fields' => array(// so we have $this->_alias populated
),
- '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(
- // so we have $this->_alias populated
- ),
- ),
- ) + $this->addAddressFields(FALSE, TRUE);
+ ) + $this->addAddressFields(FALSE, TRUE);
if ($campaignEnabled) {
// Add display column and filter for Survey Results, Campaign and Engagement Index if CiviCampaign is enabled
'title' => 'Survey Result',
'default' => 'false',
);
- $this->_columns['civicrm_activity']['filters']['result'] = array('title' => ts('Survey Result'),
+ $this->_columns['civicrm_activity']['filters']['result'] = array(
+ 'title' => ts('Survey Result'),
'operator' => 'like',
'type' => CRM_Utils_Type::T_STRING,
);
'title' => 'Campaign',
'default' => 'false',
);
- $this->_columns['civicrm_activity']['filters']['campaign_id'] = array('title' => ts('Campaign'),
+ $this->_columns['civicrm_activity']['filters']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activeCampaigns,
);
'title' => 'Engagement Index',
'default' => 'false',
);
- $this->_columns['civicrm_activity']['filters']['engagement_level'] = array('title' => ts('Engagement Index'),
+ $this->_columns['civicrm_activity']['filters']['engagement_level'] = array(
+ 'title' => ts('Engagement Index'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->engagementLevels,
);
* @param null $recordType
*/
function select($recordType = NULL) {
- if (!array_key_exists("contact_{$recordType}", $this->_params['fields']) && $recordType != 'final') {
+ if (!array_key_exists("contact_{$recordType}", $this->_params['fields']) &&
+ $recordType != 'final'
+ ) {
$this->_nonDisplayFields[] = "civicrm_contact_contact_{$recordType}";
}
parent::select();
unset($this->_selectClauses[$key]);
}
}
- } else if ($recordType == 'assignee') {
+ }
+ else if ($recordType == 'assignee') {
foreach ($this->_selectClauses as $key => $clause) {
if (strstr($clause, 'civicrm_contact_target.') ||
strstr($clause, 'civicrm_contact_source.') ||
unset($this->_selectClauses[$key]);
}
}
- } else if ($recordType == 'source') {
+ }
+ else if ($recordType == 'source') {
foreach ($this->_selectClauses as $key => $clause) {
if (strstr($clause, 'civicrm_contact_target.') ||
strstr($clause, 'civicrm_contact_assignee.') ||
unset($this->_selectClauses[$key]);
}
}
- } else if ($recordType == 'final') {
+ }
+ else if ($recordType == 'final') {
$this->_selectClauses = $this->_selectAliasesTotal;
foreach ($this->_selectClauses as $key => $clause) {
if (strstr($clause, 'civicrm_contact_contact_target') ||
strstr($clause, 'civicrm_contact_contact_assignee') ||
- strstr($clause, 'civicrm_contact_contact_source') ) {
+ strstr($clause, 'civicrm_contact_contact_source')
+ ) {
$this->_selectClauses[$key] = "GROUP_CONCAT($clause SEPARATOR ';') as $clause";
}
}
function from($recordType) {
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
- $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
- $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
+ $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
+ $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
if ($recordType == 'target') {
$this->_from = "
}
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
CRM_Utils_Array::value("{$fieldName}_min", $this->_params),
CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
);
- if ($fieldName == 'activity_type_id' && empty($this->_params['activity_type_id_value'])) {
+ if ($fieldName == 'activity_type_id' &&
+ empty($this->_params['activity_type_id_value'])
+ ) {
$actTypes = array_flip(CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'label', TRUE));
- $clause = "( {$this->_aliases['civicrm_activity']}.activity_type_id IN (".implode(',',$actTypes).") )";
+ $clause =
+ "( {$this->_aliases['civicrm_activity']}.activity_type_id IN (" .
+ implode(',', $actTypes) . ") )";
}
}
}
if ($field['name'] == 'current_user') {
- if (CRM_Utils_Array::value("{$fieldName}_value", $this->_params) == 1) {
+ if (CRM_Utils_Array::value("{$fieldName}_value", $this->_params) ==
+ 1
+ ) {
// get current user
$session = CRM_Core_Session::singleton();
if ($contactID = $session->get('userID')) {
}
}
- if ( !empty($contactIDs) ) {
+ if (!empty($contactIDs)) {
CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIDs, $groupID);
CRM_Core_Session::setStatus(ts("Listed contact(s) have been added to the selected group."), ts('Contacts Added'), 'success');
}
//Assign those recordtype to array which have filter operator as 'Is not empty' or 'Is empty'
$nullFilters = array();
foreach (array('target', 'source', 'assignee') as $type) {
- if (CRM_Utils_Array::value("contact_{$type}_op", $this->_params) == 'nnll' || !empty($this->_params["contact_{$type}_value"])) {
+ if (CRM_Utils_Array::value("contact_{$type}_op", $this->_params) ==
+ 'nnll' || !empty($this->_params["contact_{$type}_value"])
+ ) {
$nullFilters[] = " civicrm_contact_contact_{$type}_id IS NOT NULL ";
}
- else if (CRM_Utils_Array::value("contact_{$type}_op", $this->_params) == 'nll') {
+ else if (CRM_Utils_Array::value("contact_{$type}_op", $this->_params) ==
+ 'nll'
+ ) {
$nullFilters[] = " civicrm_contact_contact_{$type}_id IS NULL ";
}
}
- // 1. fill temp table with target results
+ // 1. fill temp table with target results
$this->buildACLClause(array('civicrm_contact_target'));
$this->select('target');
$this->from('target');
$this->customDataFrom();
$this->where('target');
$insertCols = implode(',', $this->_selectAliases);
- $tempQuery = "CREATE TEMPORARY TABLE civireport_activity_temp_target CHARACTER SET utf8 COLLATE utf8_unicode_ci AS
+ $tempQuery = "CREATE TEMPORARY TABLE civireport_activity_temp_target CHARACTER SET utf8 COLLATE utf8_unicode_ci AS
{$this->_select} {$this->_from} {$this->_where} ";
CRM_Core_DAO::executeQuery($tempQuery);
$this->customDataFrom();
$this->where('assignee');
$insertCols = implode(',', $this->_selectAliases);
- $tempQuery = "INSERT INTO civireport_activity_temp_target ({$insertCols})
+ $tempQuery = "INSERT INTO civireport_activity_temp_target ({$insertCols})
{$this->_select}
{$this->_from} {$this->_where}";
CRM_Core_DAO::executeQuery($tempQuery);
$this->customDataFrom();
$this->where('source');
$insertCols = implode(',', $this->_selectAliases);
- $tempQuery = "INSERT INTO civireport_activity_temp_target ({$insertCols})
+ $tempQuery = "INSERT INTO civireport_activity_temp_target ({$insertCols})
{$this->_select}
{$this->_from} {$this->_where}";
CRM_Core_DAO::executeQuery($tempQuery);
function alterDisplay(&$rows) {
// custom code to alter rows
- $entryFound = FALSE;
- $activityType = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
+ $entryFound = FALSE;
+ $activityType = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
$activityStatus = CRM_Core_PseudoConstant::activityStatus();
- $viewLinks = FALSE;
- $seperator = CRM_Core_DAO::VALUE_SEPARATOR;
- $context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'report');
- $actUrl = '';
+ $viewLinks = FALSE;
+ $seperator = CRM_Core_DAO::VALUE_SEPARATOR;
+ $context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'report');
+ $actUrl = '';
if (CRM_Core_Permission::check('access CiviCRM')) {
- $viewLinks = TRUE;
- $onHover = ts('View Contact Summary for this Contact');
+ $viewLinks = TRUE;
+ $onHover = ts('View Contact Summary for this Contact');
$onHoverAct = ts('View Activity Record');
}
foreach ($rows as $rowNum => $row) {
// if we have an activity type, format the View Activity link for use in various columns
- if ($viewLinks && array_key_exists('civicrm_activity_activity_type_id', $row)) {
+ if ($viewLinks &&
+ array_key_exists('civicrm_activity_activity_type_id', $row)
+ ) {
// Check for target contact id(s) and use the first contact id in that list for view activity link if found,
// else use source contact id
if (!empty($rows[$rowNum]['civicrm_contact_contact_target_id'])) {
'reset=1&cid=' . $value,
$this->_absoluteUrl
);
- $link[] = "<a title='" . $onHover . "' href='" . $url . "'>{$assigneeNames[$id]}</a>";
+ $link[] = "<a title='" . $onHover . "' href='" . $url .
+ "'>{$assigneeNames[$id]}</a>";
}
}
$rows[$rowNum]['civicrm_contact_contact_assignee'] = implode('; ', $link);
'reset=1&cid=' . $value,
$this->_absoluteUrl
);
- $link[] = "<a title='" . $onHover . "' href='" . $url . "'>{$targetNames[$id]}</a>";
+ $link[] = "<a title='" . $onHover . "' href='" . $url .
+ "'>{$targetNames[$id]}</a>";
}
}
$rows[$rowNum]['civicrm_contact_contact_target'] = implode('; ', $link);
}
}
- if (array_key_exists('civicrm_activity_activity_date_time', $row) && array_key_exists('civicrm_activity_status_id', $row)) {
+ if (array_key_exists('civicrm_activity_activity_date_time', $row) &&
+ array_key_exists('civicrm_activity_status_id', $row)
+ ) {
if (CRM_Utils_Date::overdue($rows[$rowNum]['civicrm_activity_activity_date_time']) &&
$activityStatus[$row['civicrm_activity_status_id']] != 'Completed'
) {
),
),
'group_bys' => array(
- 'activity_date_time' =>
- array(
+ 'activity_date_time' => array(
'title' => ts('Activity Date'),
'frequency' => TRUE,
),
protected $_summary = NULL;
protected $_customGroupGroupBy = FALSE;
- protected $_customGroupExtends = array('Contact', 'Individual', 'Household', 'Organization', 'Activity');
+ protected $_customGroupExtends = array(
+ 'Contact',
+ 'Individual',
+ 'Household',
+ 'Organization',
+ 'Activity'
+ );
public $_drilldownReport = array('contact/detail' => 'Link to Detail Report');
private static $_surveyRespondentStatus;
self::$_surveyRespondentStatus[$statusId] = 'Interviewed';
}
- $optionGroups = CRM_Campaign_BAO_Survey::getResultSets( 'name' );
+ $optionGroups = CRM_Campaign_BAO_Survey::getResultSets('name');
$resultOptions = array();
- foreach ( $optionGroups as $gid => $name ) {
- if ( $name ) {
+ foreach ($optionGroups as $gid => $name) {
+ if ($name) {
$value = array();
$value = CRM_Core_OptionGroup::values($name);
- if (!empty($value))
+ if (!empty($value)) {
$value = array_combine($value, $value);
- $resultOptions = $resultOptions + $value;
+ }
+ $resultOptions = $resultOptions + $value;
}
}
asort($resultOptions);
$allSurveyInterviewers = CRM_Campaign_BAO_Survey::getInterviewers();
$this->_columns = array(
- 'civicrm_activity_contact' =>
- array(
+ 'civicrm_activity_contact' => array(
'dao' => 'CRM_Activity_DAO_ActivityContact',
'fields' => array('contact_id' => array('title' => ts('Interviewer Name'))),
'filters' => array(
- 'contact_id' => array('name' => 'contact_id',
+ 'contact_id' => array(
+ 'name' => 'contact_id',
'title' => ts('Interviewer Name'),
'type' => CRM_Utils_Type::T_INT,
- 'operatorType' =>
- CRM_Report_Form::OP_SELECT,
+ 'operatorType' => CRM_Report_Form::OP_SELECT,
'options' => array(
- '' => ts('- any interviewer -')) + $allSurveyInterviewers,
- )),
+ '' => ts('- any interviewer -')
+ ) + $allSurveyInterviewers,
+ )
+ ),
'grouping' => 'survey-interviewer-fields',
),
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' => array('id' => array('title' => ts('Contact ID'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Contact ID'),
'no_display' => TRUE,
'required' => TRUE,
),
- 'sort_name' => array('title' => ts('Respondent Name'),
+ 'sort_name' => array(
+ 'title' => ts('Respondent Name'),
'required' => TRUE,
'no_repeat' => TRUE,
),
),
- 'filters' => array('sort_name' => array('title' => ts('Respondent Name'),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Respondent Name'),
'operator' => 'like',
- )),
+ )
+ ),
'grouping' => 'contact-fields',
- 'order_bys' => array('sort_name' => array('title' => ts('Respondent Name'),
+ 'order_bys' => array(
+ 'sort_name' => array(
+ 'title' => ts('Respondent Name'),
'required' => TRUE,
- )),
+ )
+ ),
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
'fields' => array(
- 'phone' => array('name' => 'phone',
+ 'phone' => array(
+ 'name' => 'phone',
'title' => ts('Phone'),
- )),
+ )
+ ),
'grouping' => 'location-fields',
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
'fields' => array(
- 'street_number' => array('name' => 'street_number',
+ 'street_number' => array(
+ 'name' => 'street_number',
'title' => ts('Street Number'),
'type' => 1,
),
'title' => ts('Country'),
),
),
- 'filters' => array('street_number' => array('title' => ts('Street Number'),
+ 'filters' => array(
+ 'street_number' => array(
+ 'title' => ts('Street Number'),
'type' => 1,
'name' => 'street_number',
),
- 'street_name' => array('title' => ts('Street Name'),
+ 'street_name' => array(
+ 'title' => ts('Street Name'),
'name' => 'street_name',
'operator' => 'like',
),
- 'postal_code' => array('title' => ts('Postal Code'),
+ 'postal_code' => array(
+ 'title' => ts('Postal Code'),
'type' => 1,
'name' => 'postal_code',
),
- 'city' => array('title' => ts('City'),
+ 'city' => array(
+ 'title' => ts('City'),
'operator' => 'like',
'name' => 'city',
),
'state_province_id' => array(
'name' => 'state_province_id',
'title' => ts('State/Province'),
- 'operatorType' =>
- CRM_Report_Form::OP_MULTISELECT,
- 'options' =>
- CRM_Core_PseudoConstant::stateProvince(),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Core_PseudoConstant::stateProvince(),
),
'country_id' => array(
'name' => 'country_id',
'title' => ts('Country'),
- 'operatorType' =>
- CRM_Report_Form::OP_MULTISELECT,
- 'options' =>
- CRM_Core_PseudoConstant::country(),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Core_PseudoConstant::country(),
),
),
- 'order_bys' =>
- array('street_name' => array('title' => ts('Street Name')),
- 'street_number_odd_even' =>
- array('title' => ts('Odd / Even Street Number'),
- 'name' =>'street_number',
- 'dbAlias' => 'address_civireport.street_number%2',
- ),
- 'street_number' => array('title' => 'Street Number'),
- ),
+ 'order_bys' => array(
+ 'street_name' => array('title' => ts('Street Name')),
+ 'street_number_odd_even' => array(
+ 'title' => ts('Odd / Even Street Number'),
+ 'name' => 'street_number',
+ 'dbAlias' => 'address_civireport.street_number%2',
+ ),
+ 'street_number' => array('title' => 'Street Number'),
+ ),
'grouping' => 'location-fields',
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
'fields' => array(
- 'email' => array('name' => 'email',
+ 'email' => array(
+ 'name' => 'email',
'title' => ts('Email'),
- )),
+ )
+ ),
'grouping' => 'location-fields',
),
- 'civicrm_activity' =>
- array(
+ 'civicrm_activity' => array(
'dao' => 'CRM_Activity_DAO_Activity',
'alias' => 'survey_activity',
'fields' => array(
- 'survey_id' => array('name' => 'source_record_id',
+ 'survey_id' => array(
+ 'name' => 'source_record_id',
'title' => ts('Survey'),
'type' => CRM_Utils_Type::T_INT,
- 'operatorType' =>
- CRM_Report_Form::OP_MULTISELECT,
- 'options' =>
- CRM_Campaign_BAO_Survey::getSurveys(),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Campaign_BAO_Survey::getSurveys(),
),
'survey_response' => array(
'name' => 'survey_response',
),
),
'filters' => array(
- 'survey_id' => array('name' => 'source_record_id',
+ 'survey_id' => array(
+ 'name' => 'source_record_id',
'title' => ts('Survey'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' =>
- CRM_Campaign_BAO_Survey::getSurveys(),
+ 'options' => CRM_Campaign_BAO_Survey::getSurveys(),
),
'status_id' => array(
'name' => 'status_id',
'operatorType' => CRM_Report_Form::OP_SELECT,
'options' => $responseStatus,
),
- 'result' =>
- array(
- 'title' => ts('Survey Result'),
- 'type' => CRM_Utils_Type::T_STRING,
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => $resultOptions,
- ),
+ 'result' => array(
+ 'title' => ts('Survey Result'),
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => $resultOptions,
+ ),
),
'grouping' => 'survey-activity-fields',
),
continue;
}
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName]) || CRM_Utils_Array::value('is_required', $field)
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName]) ||
+ CRM_Utils_Array::value('is_required', $field)
) {
$fieldsName = CRM_Utils_Array::value(1, explode('_', $tableName));
{$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND {$this->_aliases['civicrm_phone']}.is_primary = 1\n";
}
- if($this->_locationBasedPhoneField){
- foreach($this->_surveyResponseFields as $key => $value){
- if(substr($key,0,5) == 'phone' && !empty($value['location_type_id'])){
- $fName = str_replace('-','_',$key);
- $this->_from .= "LEFT JOIN civicrm_phone ".$this->_aliases["civicrm_phone_{$fName}"]." ON {$this->_aliases['civicrm_contact']}.id = ".$this->_aliases["civicrm_phone_{$fName}"].".contact_id AND ".$this->_aliases["civicrm_phone_{$fName}"].".location_type_id = {$value['location_type_id']} AND ".$this->_aliases["civicrm_phone_{$fName}"].".phone_type_id = {$value['phone_type_id']}\n";
+ if ($this->_locationBasedPhoneField) {
+ foreach ($this->_surveyResponseFields as $key => $value) {
+ if (substr($key, 0, 5) == 'phone' && !empty($value['location_type_id'])
+ ) {
+ $fName = str_replace('-', '_', $key);
+ $this->_from .= "LEFT JOIN civicrm_phone " .
+ $this->_aliases["civicrm_phone_{$fName}"] .
+ " ON {$this->_aliases['civicrm_contact']}.id = " .
+ $this->_aliases["civicrm_phone_{$fName}"] . ".contact_id AND " .
+ $this->_aliases["civicrm_phone_{$fName}"] .
+ ".location_type_id = {$value['location_type_id']} AND " .
+ $this->_aliases["civicrm_phone_{$fName}"] .
+ ".phone_type_id = {$value['phone_type_id']}\n";
}
}
}
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
//apply survey activity types filter.
$surveyActivityTypes = CRM_Campaign_BAO_Survey::getSurveyActivityType();
if (!empty($surveyActivityTypes)) {
- $clauses[] = "( {$this->_aliases['civicrm_activity']}.activity_type_id IN ( " . implode(' , ', array_keys($surveyActivityTypes)) . ' ) )';
+ $clauses[] =
+ "( {$this->_aliases['civicrm_activity']}.activity_type_id IN ( " .
+ implode(' , ', array_keys($surveyActivityTypes)) . ' ) )';
}
// always filter out deleted activities (so contacts that have been released
//we do need special formatted o/p only when we do have grouping
$orderBys = CRM_Utils_Array::value('order_bys', $this->_params, array());
if (in_array($this->_outputMode, array(
- 'print', 'pdf'))) {
+ 'print',
+ 'pdf'
+ ))) {
$outPut = array();
$templateFile = parent::getTemplateFileName();
if (array_key_exists('street_name', $orderBys) ||
- array_key_exists('street_number', $orderBys)
- ) {
+ array_key_exists('street_number', $orderBys)
+ ) {
$orderByStreetName = CRM_Utils_Array::value('street_name', $orderBys);
$orderByStreetNum = CRM_Utils_Array::value('street_number', $orderBys);
- $pageCnt = 0;
- $dataPerPage = array();
+ $pageCnt = 0;
+ $dataPerPage = array();
$lastStreetName = $lastStreetNum = NULL;
foreach ($rows as $row) {
//do we need to take new page.
if ($orderByStreetName &&
- ($lastStreetName != CRM_Utils_Array::value('civicrm_address_street_name', $row))
- ) {
+ ($lastStreetName !=
+ CRM_Utils_Array::value('civicrm_address_street_name', $row))
+ ) {
$pageCnt++;
}
elseif ($orderByStreetNum &&
- ($lastStreetNum !=
- CRM_Utils_Array::value('civicrm_address_street_number', $row) % 2
- )
- ) {
+ ($lastStreetNum !=
+ CRM_Utils_Array::value('civicrm_address_street_number', $row) % 2
+ )
+ ) {
$pageCnt++;
}
//get the data per page.
$dataPerPage[$pageCnt][] = $row;
$lastStreetName = CRM_Utils_Array::value('civicrm_address_street_name', $row);
- $lastStreetNum = CRM_Utils_Array::value('civicrm_address_street_number', $row) % 2;
+ $lastStreetNum =
+ CRM_Utils_Array::value('civicrm_address_street_number', $row) % 2;
}
foreach ($dataPerPage as $page) {
$coverSheet = $this->_surveyCoverSheet();
$footerImage = preg_replace('/<\/html>|<\/body>|<\/div>/i', '', $footer);
- $outPut = $header . $coverSheet . "<div style=\"page-break-after: always\"></div>" . implode($footerImage .
- "<div style=\"page-break-after: always\"></div>",
- $outPut
- ) . $footer;
+ $outPut = $header . $coverSheet .
+ "<div style=\"page-break-after: always\"></div>" .
+ implode($footerImage .
+ "<div style=\"page-break-after: always\"></div>",
+ $outPut
+ ) . $footer;
if ($this->_outputMode == 'print') {
echo $outPut;
*/
private function _formatSurveyResult(&$rows) {
$surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
- if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['result']) ||
+ if (CRM_Utils_System::isNull($surveyIds) ||
+ empty($this->_params['fields']['result']) ||
!in_array($this->_outputMode, array('print', 'pdf'))
) {
return;
*/
private function _formatSurveyResponseData(&$rows) {
$surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
- if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['survey_response'])) {
+ if (CRM_Utils_System::isNull($surveyIds) ||
+ empty($this->_params['fields']['survey_response'])
+ ) {
return;
}
Order By ov.weight';
$responseFields = array();
- $fieldValueMap = array();
- $properties = array(
+ $fieldValueMap = array();
+ $properties = array(
'id',
'data_type',
'html_type',
$responseField = CRM_Core_DAO::executeQuery($query);
while ($responseField->fetch()) {
- $reponseFldName = $responseField->table_name . '_custom_' . $responseField->id;
+ $reponseFldName = $responseField->table_name . '_custom_' .
+ $responseField->id;
foreach ($properties as $prop) {
$responseFields[$reponseFldName][$prop] = $responseField->$prop;
}
//show value for print and pdf.
$value = $responseField->label;
if (in_array($this->_outputMode, array(
- 'print', 'pdf'))) {
+ 'print',
+ 'pdf'
+ ))) {
$value = $responseField->value;
}
$fieldValueMap[$responseField->option_group_id][$responseField->value] = $value;
in_array($this->_outputMode, array('print', 'pdf'))
) {
$optGrpId = CRM_Utils_Array::value('option_group_id', $responseFields[$name]);
- $options = CRM_Utils_Array::value($optGrpId, $fieldValueMap, array());
- $value = implode(' | ', array_keys($options));
+ $options = CRM_Utils_Array::value($optGrpId, $fieldValueMap, array());
+ $value = implode(' | ', array_keys($options));
}
else {
$value = $this->formatCustomValues($value,
}
}
- if (!$hasData)
- break;
+ if (!$hasData) {
+ break;
+ }
}
}
private function _addSurveyResponseColumns() {
$surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
- if (CRM_Utils_System::isNull($surveyIds) || empty($this->_params['fields']['survey_response'])) {
+ if (CRM_Utils_System::isNull($surveyIds) ||
+ empty($this->_params['fields']['survey_response'])
+ ) {
return;
}
$responseFields += CRM_Campaign_BAO_Survey::getSurveyResponseFields($surveyId);
$this->_surveyResponseFields = $responseFields;
}
- foreach($responseFields as $key => $value){
- if(substr($key,0,5) == 'phone' && !empty($value['location_type_id'])){
- $fName = str_replace('-','_',$key);
+ foreach ($responseFields as $key => $value) {
+ if (substr($key, 0, 5) == 'phone' && !empty($value['location_type_id'])) {
+ $fName = str_replace('-', '_', $key);
$this->_columns["civicrm_{$fName}"] =
- array( 'dao' => 'CRM_Core_DAO_Phone',
- 'alias' => "phone_civireport_{$fName}",
- 'fields' =>
- array( $fName => array_merge($value, array( 'is_required' => '1', 'alias' => "phone_civireport_{$fName}",
- 'dbAlias' => "phone_civireport_{$fName}.phone",
- 'no_display' => TRUE,
- )
- ),
- ),
- );
+ array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'alias' => "phone_civireport_{$fName}",
+ 'fields' => array(
+ $fName => array_merge($value, array(
+ 'is_required' => '1',
+ 'alias' => "phone_civireport_{$fName}",
+ 'dbAlias' => "phone_civireport_{$fName}.phone",
+ 'no_display' => TRUE,
+ )
+ ),
+ ),
+ );
$this->_aliases["civicrm_phone_{$fName}"] = $this->_columns["civicrm_{$fName}"]['alias'];
$this->_locationBasedPhoneField = TRUE;
}
cf.option_group_id
FROM civicrm_custom_group cg
INNER JOIN civicrm_custom_field cf ON ( cg.id = cf.custom_group_id )
- WHERE cf.id IN ( ' . implode(' , ', $responseFieldIds) . ' ) ORDER BY cf.weight';
+ WHERE cf.id IN ( ' . implode(' , ', $responseFieldIds) .
+ ' ) ORDER BY cf.weight';
$response = CRM_Core_DAO::executeQuery($query);
$fildCnt = 1;
while ($response->fetch()) {
$title = $responseFields[$fieldName]['title'];
if (in_array($this->_outputMode, array(
- 'print', 'pdf'))) {
+ 'print',
+ 'pdf'
+ ))) {
$title = 'Q' . $fildCnt++;
}
'dataType' => $response->data_type,
'htmlType' => $response->html_type,
'required' => TRUE,
- 'alias' => ($response->data_type == 'ContactReference') ? $this->_columns[$resTable]['alias'] . '_contact' : $this->_columns[$resTable]['alias'],
- 'dbAlias' => $this->_columns[$resTable]['alias'] . '.' . $response->column_name,
+ 'alias' => ($response->data_type == 'ContactReference') ?
+ $this->_columns[$resTable]['alias'] .
+ '_contact' : $this->_columns[$resTable]['alias'],
+ 'dbAlias' => $this->_columns[$resTable]['alias'] . '.' .
+ $response->column_name,
'no_display' => TRUE,
'isSurveyResponseField' => TRUE,
);
*/
function __construct() {
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'required' => TRUE,
'no_repeat' => TRUE,
),
- 'gender_id' =>
- array('title' => ts('Gender'),
+ 'gender_id' => array(
+ 'title' => ts('Gender'),
'default' => TRUE,
),
- 'birth_date' =>
- array('title' => ts('Birthdate'),
+ 'birth_date' => array(
+ 'title' => ts('Birthdate'),
'default' => FALSE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
- 'filters' =>
- array(
+ 'filters' => array(
'sort_name' => array(
'title' => ts('Contact Name'),
'operatorType' => CRM_Report_Form::OP_STRING,
),
- 'contact_type' =>
- array('title' => ts('Contact Type'),
+ 'contact_type' => array(
+ 'title' => ts('Contact Type'),
'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => array('' => ts('-select-'),
+ 'options' => array(
+ '' => ts('-select-'),
'Individual' => ts('Individual'),
'Organization' => ts('Organization'),
'Household' => ts('Household'),
),
'default' => 'Individual',
),
- 'id' =>
- array('title' => ts('Contact ID'),
+ 'id' => array(
+ 'title' => ts('Contact ID'),
'no_display' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email' =>
- array('title' => ts('Email'),
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
'grouping' => 'contact-fields',
- 'fields' =>
- array(
- 'street_address' =>
- array('default' => FALSE),
- 'city' =>
- array('default' => TRUE),
+ 'fields' => array(
+ 'street_address' => array('default' => FALSE),
+ 'city' => array('default' => TRUE),
'postal_code' => NULL,
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
- 'country_id' =>
- array('title' => ts('Country'),
+ 'country_id' => array(
+ 'title' => ts('Country'),
'default' => FALSE,
),
),
/*
- 'filters' =>
- array(
- 'country_id' =>
- array( 'title' => ts( 'Country' ),
+ 'filters' => array(
+ 'country_id' => array( 'title' => ts( 'Country' ),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::country( ),
),
- 'state_province_id' =>
- array( 'title' => ts( 'State/Province' ),
+ 'state_province_id' => array( 'title' => ts( 'State/Province' ),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::stateProvince( ), ),
),
*/
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array('phone' => NULL),
+ 'fields' => array('phone' => NULL),
'grouping' => 'contact-fields',
),
- 'civicrm_activity' =>
- array(
+ 'civicrm_activity' => array(
'dao' => 'CRM_Activity_DAO_Activity',
- 'fields' =>
- array('id' => array('title' => ts('Activity ID'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Activity ID'),
'no_display' => TRUE,
'required' => TRUE,
),
),
),
- 'civicrm_case' =>
- array(
+ 'civicrm_case' => array(
'dao' => 'CRM_Case_DAO_Case',
- 'fields' =>
- array('id' => array('title' => ts('Case ID'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Case ID'),
'required' => TRUE,
),
- 'start_date' => array('title' => ts('Case Start'),
+ 'start_date' => array(
+ 'title' => ts('Case Start'),
'required' => TRUE,
),
- 'end_date' => array('title' => ts('Case End'),
+ 'end_date' => array(
+ 'title' => ts('Case End'),
'required' => TRUE,
),
),
- 'filters' =>
- array(
- 'case_id_filter' => array('name' => 'id',
+ 'filters' => array(
+ 'case_id_filter' => array(
+ 'name' => 'id',
'title' => ts('Cases?'),
'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => array(1 => ts('Exclude non-case'), 2 => ts('Exclude cases'), 3 => ts('Include Both')),
+ 'options' => array(
+ 1 => ts('Exclude non-case'),
+ 2 => ts('Exclude cases'),
+ 3 => ts('Include Both')
+ ),
'default' => 3,
),
- 'start_date' => array('title' => ts('Case Start'),
+ 'start_date' => array(
+ 'title' => ts('Case Start'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
- 'end_date' => array('title' => ts('Case End'),
+ 'end_date' => array(
+ 'title' => ts('Case End'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
),
$open_case_val = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name');
$crmDAO = &CRM_Core_DAO::executeQuery("SELECT cg.table_name, cg.extends AS ext, cf.label, cf.column_name FROM civicrm_custom_group cg INNER JOIN civicrm_custom_field cf ON cg.id = cf.custom_group_id
where (cg.extends='Contact' OR cg.extends='Individual' OR cg.extends_entity_column_value='$open_case_val') AND cg.is_active=1 AND cf.is_active=1 ORDER BY cg.table_name");
- $curTable = '';
- $curExt = '';
+ $curTable = '';
+ $curExt = '';
$curFields = array();
while ($crmDAO->fetch()) {
if ($curTable == '') {
'fields' => $curFields,
'ext' => $curExt,
);
- $curTable = $crmDAO->table_name;
- $curExt = $crmDAO->ext;
+ $curTable = $crmDAO->table_name;
+ $curExt = $crmDAO->ext;
$curFields = array();
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_email') {
$this->_emailField = TRUE;
}
";
foreach ($this->_columns as $t => $c) {
- if (substr($t, 0, 13) == 'civicrm_value' || substr($t, 0, 12) == 'custom_value') {
+ if (substr($t, 0, 13) == 'civicrm_value' ||
+ substr($t, 0, 12) == 'custom_value'
+ ) {
$this->_from .= " LEFT JOIN $t {$this->_aliases[$t]} ON {$this->_aliases[$t]}.entity_id = ";
- $this->_from .= ($c['ext'] == 'Activity') ? "{$this->_aliases['civicrm_activity']}.id" : "{$this->_aliases['civicrm_contact']}.id";
+ $this->_from .= ($c['ext'] ==
+ 'Activity') ? "{$this->_aliases['civicrm_activity']}.id" : "{$this->_aliases['civicrm_contact']}.id";
}
}
$clause = NULL;
if ($field['operatorType'] & CRM_Report_Form::OP_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, CRM_Utils_Type::T_DATE);
}
// handle custom fields
foreach ($row as $k => $r) {
- if (substr($k, 0, 13) == 'civicrm_value' || substr($k, 0, 12) == 'custom_value') {
+ if (substr($k, 0, 13) == 'civicrm_value' ||
+ substr($k, 0, 12) == 'custom_value'
+ ) {
if ($r || $r == '0') {
if ($newval = $this->getCustomFieldLabel($k, $r)) {
$rows[$rowNum][$k] = $newval;
INNER JOIN civicrm_option_group g ON cf.option_group_id = g.id
INNER JOIN civicrm_option_value v ON g.id = v.option_group_id
WHERE CONCAT(cg.table_name, '_', cf.column_name) = %1 AND v.value = %2";
- $params = array(1 => array($fname, 'String'),
+ $params = array(
+ 1 => array($fname, 'String'),
2 => array($val, 'String'),
);
return CRM_Core_DAO::singleValueQuery($query, $params);
protected $_includeCaseDetailExtra = FALSE;
- protected $_caseDetailExtra = array(
- );
+ protected $_caseDetailExtra = array();
/**
*
*/
function __construct() {
$this->case_statuses = CRM_Core_OptionGroup::values('case_status');
- $this->case_types = CRM_Case_PseudoConstant::caseType();
- $rels = CRM_Core_PseudoConstant::relationshipType();
+ $this->case_types = CRM_Case_PseudoConstant::caseType();
+ $rels = CRM_Core_PseudoConstant::relationshipType();
foreach ($rels as $relid => $v) {
$this->rel_types[$relid] = $v['label_b_a'];
}
- $this->deleted_labels = array('' => ts('- select -'), 0 => ts('No'), 1 => ts('Yes'));
+ $this->deleted_labels = array(
+ '' => ts('- select -'),
+ 0 => ts('No'),
+ 1 => ts('Yes')
+ );
$this->caseActivityTypes = array();
foreach (CRM_Case_PseudoConstant::caseActivityType() as $typeDetail) {
}
$this->_columns = array(
- 'civicrm_case' =>
- array(
+ 'civicrm_case' => array(
'dao' => 'CRM_Case_DAO_Case',
- 'fields' =>
- array(
- 'id' => array('title' => ts('Case ID'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Case ID'),
'no_display' => TRUE,
'required' => TRUE,
),
- 'subject' => array('title' => ts('Subject'),
+ 'subject' => array(
+ 'title' => ts('Subject'),
'required' => TRUE,
),
- 'start_date' => array('title' => ts('Start Date'),
+ 'start_date' => array(
+ 'title' => ts('Start Date'),
'type' => CRM_Utils_Type::T_DATE,
),
- 'end_date' => array('title' => ts('End Date'),
+ 'end_date' => array(
+ 'title' => ts('End Date'),
'type' => CRM_Utils_Type::T_DATE,
),
'status_id' => array('title' => ts('Case Status')),
'case_type_id' => array('title' => ts('Case Type')),
- 'is_deleted' => array('title' => ts('Deleted?'),
+ 'is_deleted' => array(
+ 'title' => ts('Deleted?'),
'default' => FALSE,
'type' => CRM_Utils_Type::T_INT,
),
),
- 'filters' =>
- array(
- 'start_date' => array('title' => ts('Start Date'),
+ 'filters' => array(
+ 'start_date' => array(
+ 'title' => ts('Start Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
- 'end_date' => array('title' => ts('End Date'),
+ 'end_date' => array(
+ 'title' => ts('End Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
- 'status_id' => array('title' => ts('Case Status'),
+ 'status_id' => array(
+ 'title' => ts('Case Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->case_statuses,
),
- 'case_type_id' => array('title' => ts('Case Type'),
+ 'case_type_id' => array(
+ 'title' => ts('Case Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->case_types,
),
- 'is_deleted' => array('title' => ts('Deleted?'),
+ 'is_deleted' => array(
+ 'title' => ts('Deleted?'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_SELECT,
'options' => $this->deleted_labels,
),
),
),
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
+ 'fields' => array(
'client_sort_name' => array(
'name' => 'sort_name',
'title' => ts('Client Name'),
'required' => TRUE,
),
),
- 'filters' =>
- array(
+ 'filters' => array(
'sort_name' => array('title' => ts('Client Name')),
),
),
- 'civicrm_relationship' =>
- array(
+ 'civicrm_relationship' => array(
'dao' => 'CRM_Contact_DAO_Relationship',
- 'fields' =>
- array(
- 'case_role' => array('name' => 'relationship_type_id',
+ 'fields' => array(
+ 'case_role' => array(
+ 'name' => 'relationship_type_id',
'title' => ts('Case Role(s)'),
),
),
- 'filters' =>
- array(
- 'case_role' =>
- array(
+ 'filters' => array(
+ 'case_role' => array(
'name' => 'relationship_type_id',
'title' => ts('Case Role(s)'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
),
),
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array('email' => array('title' => ts('Email'),
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone' =>
- array('title' => ts('Phone'),
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone'),
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'fields' =>
- array(
+ 'fields' => array(
'street_address' => NULL,
- 'state_province_id' => array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
'country_id' => array('title' => ts('Country')),
),
'grouping' => 'contact-fields',
- 'filters' =>
- array(
- 'country_id' =>
- array('title' => ts('Country'),
+ 'filters' => array(
+ 'country_id' => array(
+ 'title' => ts('Country'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::country(),
),
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::stateProvince(),
),
),
),
- 'civicrm_worldregion' =>
- array(
+ 'civicrm_worldregion' => array(
'dao' => 'CRM_Core_DAO_Worldregion',
- 'filters' =>
- array(
+ 'filters' => array(
'worldregion_id' => array(
'name' => 'id',
'title' => ts('World Region'),
),
),
),
- 'civicrm_country' =>
- array(
+ 'civicrm_country' => array(
'dao' => 'CRM_Core_DAO_Country',
),
- 'civicrm_activity_last' =>
- array(
+ 'civicrm_activity_last' => array(
'dao' => 'CRM_Activity_DAO_Activity',
- 'filters' =>
- array(
- 'last_activity_date_time' =>
- array(
+ 'filters' => array(
+ 'last_activity_date_time' => array(
'name' => 'activity_date_time',
'title' => ts('Last Action Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
'alias' => 'civireport_activity_last',
),
- 'civicrm_activity_last_completed' =>
- array(
+ 'civicrm_activity_last_completed' => array(
'dao' => 'CRM_Activity_DAO_Activity',
- 'fields' =>
- array(
- 'last_completed_activity_subject' =>
- array(
+ 'fields' => array(
+ 'last_completed_activity_subject' => array(
'name' => 'subject',
'title' => ts('Subject of the last completed activity in the case'),
),
- 'last_completed_activity_type' =>
- array(
+ 'last_completed_activity_type' => array(
'name' => 'activity_type_id',
'title' => ts('Activity type of the last completed activity'),
),
);
$this->_options = array(
- 'my_cases' =>
- array('title' => ts('My Cases'),
+ 'my_cases' => array(
+ 'title' => ts('My Cases'),
'type' => 'checkbox',
),
);
$elements = array();
$elements[] = &$this->createElement('select', 'case_activity_all_dates', NULL,
array(
- '' => ts('- select -')) + $this->caseActivityTypes
+ '' => ts('- select -')
+ ) + $this->caseActivityTypes
);
$this->addGroup($elements, 'case_detail_extra');
- $this->_caseDetailExtra = array('case_activity_all_dates' => array('title' => ts('List of all dates of activities of Type'),
+ $this->_caseDetailExtra = array(
+ 'case_activity_all_dates' => array(
+ 'title' => ts('List of all dates of activities of Type'),
'name' => 'activity_date_time',
),
);
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
}
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_email') {
$this->_emailField = TRUE;
}
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type']);
}
else {
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
- if ($fieldName == 'case_type_id' && !empty($this->_params['case_type_id_value'])) {
+ if ($fieldName == 'case_type_id' &&
+ !empty($this->_params['case_type_id_value'])
+ ) {
foreach ($this->_params['case_type_id_value'] as $key => $value) {
if (strpos($value, CRM_Core_DAO::VALUE_SEPARATOR) === FALSE) {
- $value = CRM_Core_DAO::VALUE_SEPARATOR . $value . CRM_Core_DAO::VALUE_SEPARATOR;
+ $value = CRM_Core_DAO::VALUE_SEPARATOR . $value .
+ CRM_Core_DAO::VALUE_SEPARATOR;
$this->_params['case_type_id_value'][$key] = "'{$value}'";
}
}
if (isset($this->_params['options']['my_cases'])) {
- $session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $session = CRM_Core_Session::singleton();
+ $userID = $session->get('userID');
$clauses[] = "{$this->_aliases['civicrm_contact']}.id = {$userID}";
}
function statistics(&$rows) {
$statistics = parent::statistics($rows);
- $select = "select COUNT( DISTINCT( {$this->_aliases['civicrm_address']}.country_id))";
- $sql = "{$select} {$this->_from} {$this->_where}";
+ $select = "select COUNT( DISTINCT( {$this->_aliases['civicrm_address']}.country_id))";
+ $sql = "{$select} {$this->_from} {$this->_where}";
$countryCount = CRM_Core_DAO::singleValueQuery($sql);
//CaseType statistics
if (array_key_exists('filters', $statistics)) {
foreach ($statistics['filters'] as $id => $value) {
if ($value['title'] == 'Case Type') {
- $statistics['filters'][$id]['value'] = 'Is ' . $this->case_types[substr($statistics['filters'][$id]
- ['value'], -3, -2
- )];
+ $statistics['filters'][$id]['value'] = 'Is ' .
+ $this->case_types[substr($statistics['filters'][$id]
+ ['value'], -3, -2
+ )];
}
}
}
LEFT JOIN civicrm_activity civireport_activity_all_{$activityType} ON ( civireport_activity_all_{$activityType}.id = civireport_case_activity_all_{$activityType}.activity_id AND civireport_activity_all_{$activityType}.activity_type_id = {$activityType})";
$this->_columnHeaders['case_activity_all_dates'] = array(
- 'title' => $this->_caseDetailExtra['case_activity_all_dates']['title'] . ": {$this->caseActivityTypes[$activityType]}",
+ 'title' => $this->_caseDetailExtra['case_activity_all_dates']['title'] .
+ ": {$this->caseActivityTypes[$activityType]}",
'type' => CRM_Utils_Array::value('type', $this->_caseDetailExtra['case_activity_all_dates']),
);
}
}
function checkEnabledFields() {
- if (isset($this->_params['worldregion_id_value']) && !empty($this->_params['worldregion_id_value'])) {
+ if (isset($this->_params['worldregion_id_value']) &&
+ !empty($this->_params['worldregion_id_value'])
+ ) {
$this->_addressField = TRUE;
$this->_worldRegionField = TRUE;
}
$this->_relField = TRUE;
}
- if (!empty($this->_params['activity_date_time_relative']) || !empty($this->_params['activity_date_time_from']) ||
+ if (!empty($this->_params['activity_date_time_relative']) ||
+ !empty($this->_params['activity_date_time_from']) ||
CRM_Utils_Array::value('activity_date_time_to', $this->_params)
) {
$this->_activityLast = TRUE;
}
$entryFound = TRUE;
}
- if (array_key_exists('civicrm_activity_last_completed_last_completed_activity_subject', $row) && empty($row['civicrm_activity_last_completed_last_completed_activity_subject'])) {
+ if (array_key_exists('civicrm_activity_last_completed_last_completed_activity_subject', $row) &&
+ empty($row['civicrm_activity_last_completed_last_completed_activity_subject'])
+ ) {
$rows[$rowNum]['civicrm_activity_last_completed_last_completed_activity_subject'] = ts('(no subject)');
$entryFound = TRUE;
}
*
*/
function __construct() {
- $this->case_types = CRM_Case_PseudoConstant::caseType();
+ $this->case_types = CRM_Case_PseudoConstant::caseType();
$this->case_statuses = CRM_Core_OptionGroup::values('case_status');
- $rels = CRM_Core_PseudoConstant::relationshipType();
+ $rels = CRM_Core_PseudoConstant::relationshipType();
foreach ($rels as $relid => $v) {
$this->rel_types[$relid] = $v['label_b_a'];
}
- $this->deleted_labels = array('' => ts('- select -'), 0 => ts('No'), 1 => ts('Yes'));
+ $this->deleted_labels = array(
+ '' => ts('- select -'),
+ 0 => ts('No'),
+ 1 => ts('Yes')
+ );
$this->_columns = array(
- 'civicrm_c2' =>
- array(
+ 'civicrm_c2' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'client_name' =>
- array(
+ 'fields' => array(
+ 'client_name' => array(
'name' => 'sort_name',
'title' => ts('Client'),
'required' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
),
- 'civicrm_case' =>
- array(
+ 'civicrm_case' => array(
'dao' => 'CRM_Case_DAO_Case',
- 'fields' =>
- array(
- 'id' =>
- array('title' => ts('Case ID'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Case ID'),
'required' => TRUE,
),
'subject' => array(
- 'title' => ts('Case Subject'), 'default' => TRUE,
+ 'title' => ts('Case Subject'),
+ 'default' => TRUE,
),
'status_id' => array(
- 'title' => ts('Status'), 'default' => TRUE,
+ 'title' => ts('Status'),
+ 'default' => TRUE,
),
'case_type_id' => array(
- 'title' => ts('Case Type'), 'default' => TRUE,
+ 'title' => ts('Case Type'),
+ 'default' => TRUE,
),
'start_date' => array(
- 'title' => ts('Start Date'), 'default' => TRUE,
+ 'title' => ts('Start Date'),
+ 'default' => TRUE,
'type' => CRM_Utils_Type::T_DATE,
),
'end_date' => array(
- 'title' => ts('End Date'), 'default' => TRUE,
+ 'title' => ts('End Date'),
+ 'default' => TRUE,
'type' => CRM_Utils_Type::T_DATE,
),
'duration' => array(
- 'title' => ts('Duration (Days)'), 'default' => FALSE,
+ 'title' => ts('Duration (Days)'),
+ 'default' => FALSE,
),
'is_deleted' => array(
- 'title' => ts('Deleted?'), 'default' => FALSE, 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Deleted?'),
+ 'default' => FALSE,
+ 'type' => CRM_Utils_Type::T_INT,
),
),
- 'filters' =>
- array('start_date' => array('title' => ts('Start Date'),
+ 'filters' => array(
+ 'start_date' => array(
+ 'title' => ts('Start Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
- 'end_date' => array('title' => ts('End Date'),
+ 'end_date' => array(
+ 'title' => ts('End Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
- 'case_type_id' => array('title' => ts('Case Type'),
+ 'case_type_id' => array(
+ 'title' => ts('Case Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->case_types,
),
- 'status_id' => array('title' => ts('Status'),
+ 'status_id' => array(
+ 'title' => ts('Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->case_statuses,
),
- 'is_deleted' => array('title' => ts('Deleted?'),
+ 'is_deleted' => array(
+ 'title' => ts('Deleted?'),
'type' => CRM_Report_Form::OP_INT,
'operatorType' => CRM_Report_Form::OP_SELECT,
'options' => $this->deleted_labels,
),
),
),
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Staff Member'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Staff Member'),
'default' => TRUE,
),
),
- 'filters' =>
- array('sort_name' => array('title' => ts('Staff Member'),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Staff Member'),
),
),
),
- 'civicrm_relationship' =>
- array(
+ 'civicrm_relationship' => array(
'dao' => 'CRM_Contact_DAO_Relationship',
- 'filters' =>
- array('relationship_type_id' => array('title' => ts('Staff Relationship'),
+ 'filters' => array(
+ 'relationship_type_id' => array(
+ 'title' => ts('Staff Relationship'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->rel_types,
),
),
),
- 'civicrm_relationship_type' =>
- array(
+ 'civicrm_relationship_type' => array(
'dao' => 'CRM_Contact_DAO_RelationshipType',
- 'fields' =>
- array(
- 'label_b_a' =>
- array(
- 'title' => ts('Relationship'), 'default' => TRUE,
+ 'fields' => array(
+ 'label_b_a' => array(
+ 'title' => ts('Relationship'),
+ 'default' => TRUE,
),
),
),
- 'civicrm_case_contact' =>
- array(
+ 'civicrm_case_contact' => array(
'dao' => 'CRM_Case_DAO_CaseContact',
),
);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_relationship_type') {
$this->_relField = TRUE;
*/
static function formRule($fields, $files, $self) {
$errors = $grouping = array();
- if (empty($fields['relationship_type_id_value']) && (array_key_exists('sort_name', $fields['fields']) || array_key_exists('label_b_a', $fields['fields']))) {
+ if (empty($fields['relationship_type_id_value']) &&
+ (array_key_exists('sort_name', $fields['fields']) ||
+ array_key_exists('label_b_a', $fields['fields']))
+ ) {
$errors['fields'] = ts('Either filter on at least one relationship type, or de-select Staff Member and Relationship from the list of fields.');
}
- if ((!empty($fields['relationship_type_id_value']) || !empty($fields['sort_name_value'])) && (!array_key_exists('sort_name', $fields['fields']) || !array_key_exists('label_b_a', $fields['fields']))) {
+ if ((!empty($fields['relationship_type_id_value']) ||
+ !empty($fields['sort_name_value'])) &&
+ (!array_key_exists('sort_name', $fields['fields']) ||
+ !array_key_exists('label_b_a', $fields['fields']))
+ ) {
$errors['fields'] = ts('To filter on Staff Member or Relationship, please also select Staff Member and Relationship from the list of fields.');
}
return $errors;
function from() {
- $cc = $this->_aliases['civicrm_case'];
- $c = $this->_aliases['civicrm_contact'];
- $c2 = $this->_aliases['civicrm_c2'];
- $cr = $this->_aliases['civicrm_relationship'];
+ $cc = $this->_aliases['civicrm_case'];
+ $c = $this->_aliases['civicrm_contact'];
+ $c2 = $this->_aliases['civicrm_c2'];
+ $cr = $this->_aliases['civicrm_relationship'];
$crt = $this->_aliases['civicrm_relationship_type'];
$ccc = $this->_aliases['civicrm_case_contact'];
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
- if (CRM_Utils_Array::value("operatorType", $field) & CRM_Report_Form::OP_DATE) {
+ if (CRM_Utils_Array::value("operatorType", $field) &
+ CRM_Report_Form::OP_DATE
+ ) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to,
CRM_Utils_Array::value('type', $field)
if ($fieldName == 'case_type_id') {
$value = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
if (!empty($value)) {
- $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" . implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
+ $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" .
+ implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
}
$op = NULL;
}
}
}
- if (array_key_exists('civicrm_case_case_type_id', $row) && !empty($rows[$rowNum]['civicrm_case_case_type_id'])) {
- $value = $row['civicrm_case_case_type_id'];
+ if (array_key_exists('civicrm_case_case_type_id', $row) &&
+ !empty($rows[$rowNum]['civicrm_case_case_type_id'])
+ ) {
+ $value = $row['civicrm_case_case_type_id'];
$typeIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
- $value = array();
+ $value = array();
foreach ($typeIds as $typeId) {
if ($typeId) {
$value[$typeId] = $this->case_types[$typeId];
}
// convert Case ID and Subject to links to Manage Case
- if (array_key_exists('civicrm_case_id', $row) && !empty($rows[$rowNum]['civicrm_c2_id'])) {
+ if (array_key_exists('civicrm_case_id', $row) &&
+ !empty($rows[$rowNum]['civicrm_c2_id'])
+ ) {
$url = CRM_Utils_System::url("civicrm/contact/view/case",
- 'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' . $row['civicrm_case_id'],
+ 'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' .
+ $row['civicrm_case_id'],
$this->_absoluteUrl
);
$rows[$rowNum]['civicrm_case_id_link'] = $url;
$rows[$rowNum]['civicrm_case_id_hover'] = ts("Manage Case");
$entryFound = TRUE;
}
- if (array_key_exists('civicrm_case_subject', $row) && !empty($rows[$rowNum]['civicrm_c2_id'])) {
+ if (array_key_exists('civicrm_case_subject', $row) &&
+ !empty($rows[$rowNum]['civicrm_c2_id'])
+ ) {
$url = CRM_Utils_System::url("civicrm/contact/view/case",
- 'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' . $row['civicrm_case_id'],
+ 'reset=1&action=view&cid=' . $row['civicrm_c2_id'] . '&id=' .
+ $row['civicrm_case_id'],
$this->_absoluteUrl
);
$rows[$rowNum]['civicrm_case_subject_link'] = $url;
$this->activityStatuses = CRM_Core_PseudoConstant::activityStatus();
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'id' =>
- array('title' => ts('Contact ID'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Contact ID'),
'no_display' => TRUE,
'required' => TRUE,
),
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'required' => TRUE,
'no_repeat' => TRUE,
),
),
- 'filters' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'operator' => 'like',
'type' => CRM_Report_Form::OP_STRING,
),
),
),
- 'civicrm_activity' =>
- array(
+ 'civicrm_activity' => array(
'dao' => 'CRM_Activity_DAO_Activity',
- 'fields' =>
- array(
- 'activity_type_id' =>
- array('title' => ts('Activity Type'),
+ 'fields' => array(
+ 'activity_type_id' => array(
+ 'title' => ts('Activity Type'),
'default' => TRUE,
'type' => CRM_Utils_Type::T_STRING,
),
- 'activity_date_time' =>
- array('title' => ts('Activity Date'),
+ 'activity_date_time' => array(
+ 'title' => ts('Activity Date'),
'default' => TRUE,
),
- 'status_id' =>
- array('title' => ts('Activity Status'),
+ 'status_id' => array(
+ 'title' => ts('Activity Status'),
'default' => FALSE,
'type' => CRM_Utils_Type::T_STRING,
),
- 'id' =>
- array('title' => ts('Activity ID'),
+ 'id' => array(
+ 'title' => ts('Activity ID'),
'default' => TRUE,
),
- 'duration' =>
- array('title' => ts('Duration'),
+ 'duration' => array(
+ 'title' => ts('Duration'),
'default' => TRUE,
'type' => CRM_Utils_Type::T_INT,
),
- 'subject' =>
- array('title' => ts('Activity Subject'),
+ 'subject' => array(
+ 'title' => ts('Activity Subject'),
'default' => FALSE,
),
),
- 'filters' =>
- array(
- 'activity_date_time' =>
- //'default' => 'this.month',
- array(
- 'operatorType' => CRM_Report_Form::OP_DATE,
- ),
- 'subject' =>
- array('title' => ts('Activity Subject'),
+ 'filters' => array(
+ 'activity_date_time' => //'default' => 'this.month',
+ array(
+ 'operatorType' => CRM_Report_Form::OP_DATE,
+ ),
+ 'subject' => array(
+ 'title' => ts('Activity Subject'),
'operator' => 'like',
),
- 'activity_type_id' =>
- array('title' => ts('Activity Type'),
+ 'activity_type_id' => array(
+ 'title' => ts('Activity Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activityTypes,
),
- 'status_id' =>
- array('title' => ts('Activity Status'),
+ 'status_id' => array(
+ 'title' => ts('Activity Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activityStatuses,
),
),
),
- 'civicrm_activity_source' =>
- array(
- 'dao' => 'CRM_Activity_DAO_ActivityContact',
- 'fields' =>
- array(
- 'contact_id' =>
- array(
- 'title' => ts('Contact ID'),
- 'default' => TRUE,
- 'no_display' => TRUE,
- ),
+ 'civicrm_activity_source' => array(
+ 'dao' => 'CRM_Activity_DAO_ActivityContact',
+ 'fields' => array(
+ 'contact_id' => array(
+ 'title' => ts('Contact ID'),
+ 'default' => TRUE,
+ 'no_display' => TRUE,
),
- 'group_bys' =>
- array(
- 'contact_id' =>
- array('title' => ts('Totals Only'),
- 'default' => TRUE,
- ),
+ ),
+ 'group_bys' => array(
+ 'contact_id' => array(
+ 'title' => ts('Totals Only'),
+ 'default' => TRUE,
),
+ ),
'grouping' => 'activity-fields',
),
- 'civicrm_case_activity' =>
- array(
+ 'civicrm_case_activity' => array(
'dao' => 'CRM_Case_DAO_CaseActivity',
- 'fields' =>
- array(
- 'case_id' =>
- array('title' => ts('Case ID'),
+ 'fields' => array(
+ 'case_id' => array(
+ 'title' => ts('Case ID'),
'default' => FALSE,
),
),
- 'filters' =>
- array(
- 'case_id_filter' =>
- array(
+ 'filters' => array(
+ 'case_id_filter' => array(
'name' => 'case_id',
'title' => ts('Cases?'),
'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => array(1 => ts('Exclude non-case'), 2 => ts('Exclude cases'), 3 => ts('Include Both')),
+ 'options' => array(
+ 1 => ts('Exclude non-case'),
+ 2 => ts('Exclude cases'),
+ 3 => ts('Include Both')
+ ),
'default' => 3,
),
),
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
if (!empty($field['required']) ||
- (!empty($this->_params['fields'][$fieldName]) && ((!$this->has_grouping) || !in_array($fieldName, array('case_id', 'subject', 'status_id')))
+ (!empty($this->_params['fields'][$fieldName]) &&
+ ((!$this->has_grouping) ||
+ !in_array($fieldName, array('case_id', 'subject', 'status_id')))
)
) {
$select[] = "EXTRACT(YEAR_MONTH FROM {$field['dbAlias']}) AS {$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = ts('Month/Year');
}
- elseif ($tableName == 'civicrm_activity' && $fieldName == 'id' && $this->has_grouping) {
+ elseif ($tableName == 'civicrm_activity' && $fieldName == 'id' &&
+ $this->has_grouping
+ ) {
$select[] = "COUNT({$field['dbAlias']}) AS {$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = ts('# Activities');
}
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to);
}
static function formRule($fields, $files, $self) {
$errors = array();
if (!empty($fields['group_bys']) &&
- (!array_key_exists('id', $fields['fields']) || !array_key_exists('activity_date_time', $fields['fields']) || !array_key_exists('duration', $fields['fields']))
+ (!array_key_exists('id', $fields['fields']) ||
+ !array_key_exists('activity_date_time', $fields['fields']) ||
+ !array_key_exists('duration', $fields['fields']))
) {
$errors['fields'] = ts('To view totals please select all of activity id, date and duration.');
}
protected $_summary = NULL;
protected $_customGroupExtends = array(
- 'Contact', 'Individual');
+ 'Contact',
+ 'Individual'
+ );
public $_drilldownReport = array('contact/detail' => 'Link to Detail Report');
function __construct() {
$this->_columns = array(
- 'civicrm_employer' =>
- array(
+ 'civicrm_employer' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'organization_name' =>
- array('title' => ts('Employer Name'),
+ 'fields' => array(
+ 'organization_name' => array(
+ 'title' => ts('Employer Name'),
'required' => TRUE,
'no_repeat' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
- 'filters' =>
- array(
- 'organization_name' =>
- array('title' => ts('Employer Name'),
+ 'filters' => array(
+ 'organization_name' => array(
+ 'title' => ts('Employer Name'),
'operatorType' => CRM_Report_Form::OP_STRING,
),
),
),
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Employee Name'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Employee Name'),
'required' => TRUE,
),
- 'first_name' => array('title' => ts('First Name'),
+ 'first_name' => array(
+ 'title' => ts('First Name'),
),
- 'last_name' => array('title' => ts('Last Name'),
+ 'last_name' => array(
+ 'title' => ts('Last Name'),
),
- 'job_title' =>
- array('title' => ts('Job Title'),
+ 'job_title' => array(
+ 'title' => ts('Job Title'),
'default' => TRUE,
),
- 'gender_id' =>
- array('title' => ts('Gender'),
+ 'gender_id' => array(
+ 'title' => ts('Gender'),
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'contact_type' =>
- array(
+ 'contact_type' => array(
'title' => ts('Contact Type'),
),
- 'contact_sub_type' =>
- array(
+ 'contact_sub_type' => array(
'title' => ts('Contact Subtype'),
),
),
- 'filters' =>
- array(
- 'sort_name' =>
- array('title' => ts('Employee Name')),
- 'id' =>
- array('no_display' => TRUE),
+ 'filters' => array(
+ 'sort_name' => array('title' => ts('Employee Name')),
+ 'id' => array('no_display' => TRUE),
),
'grouping' => 'contact-fields',
),
- 'civicrm_relationship' =>
- array(
+ 'civicrm_relationship' => array(
'dao' => 'CRM_Contact_DAO_Relationship',
- 'fields' =>
- array(
- 'start_date' =>
- array('title' => ts('Employee Since'),
+ 'fields' => array(
+ 'start_date' => array(
+ 'title' => ts('Employee Since'),
'default' => TRUE,
),
),
- 'filters' =>
- array(
- 'start_date' =>
- array('title' => ts('Employee Since'),
+ 'filters' => array(
+ 'start_date' => array(
+ 'title' => ts('Employee Since'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
),
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
'grouping' => 'contact-fields',
- 'fields' =>
- array(
- 'phone' =>
- array('title' => ts('Phone'),
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone'),
'default' => TRUE,
),
),
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
'grouping' => 'contact-fields',
- 'fields' =>
- array(
- 'email' =>
- array('title' => ts('Email'),
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
'default' => TRUE,
),
),
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
'grouping' => 'contact-fields',
- 'fields' =>
- array(
+ 'fields' => array(
'street_address' => NULL,
'city' => NULL,
'postal_code' => NULL,
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
- 'country_id' =>
- array('title' => ts('Country'),
+ 'country_id' => array(
+ 'title' => ts('Country'),
),
),
- 'filters' =>
- array(
- 'country_id' =>
- array('title' => ts('Country'),
+ 'filters' => array(
+ 'country_id' => array(
+ 'title' => ts('Country'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::country(NULL, FALSE),
),
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::stateProvince(),
),
),
),
- 'civicrm_group' =>
- array(
+ 'civicrm_group' => array(
'dao' => 'CRM_Contact_DAO_Group',
'alias' => 'cgroup',
- 'filters' =>
- array(
- 'gid' =>
- array(
+ 'filters' => array(
+ 'gid' => array(
'name' => 'group_id',
'title' => ts('Group'),
'group' => TRUE,
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
- if (CRM_Utils_Array::value('operatorType', $field) & CRM_Report_Form::OP_DATE) {
+ if (CRM_Utils_Array::value('operatorType', $field) &
+ CRM_Report_Form::OP_DATE
+ ) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
$this->_where = "WHERE {$this->_aliases['civicrm_contact']}.employer_id!='null' ";
}
else {
- $this->_where = "WHERE ({$this->_aliases['civicrm_contact']}.employer_id!='null') AND " . implode(' AND ', $clauses);
+ $this->_where =
+ "WHERE ({$this->_aliases['civicrm_contact']}.employer_id!='null') AND " .
+ implode(' AND ', $clauses);
}
if ($this->_aclWhere) {
function postProcess() {
// get the acl clauses built before we assemble the query
- $this->buildACLClause(array($this->_aliases['civicrm_contact'], $this->_aliases['civicrm_employer']));
+ $this->buildACLClause(array(
+ $this->_aliases['civicrm_contact'],
+ $this->_aliases['civicrm_employer']
+ ));
parent::postProcess();
}
protected $_summary = NULL;
protected $_customGroupExtends = array(
- 'Contact', 'Individual', 'Household', 'Organization');
+ 'Contact',
+ 'Individual',
+ 'Household',
+ 'Organization'
+ );
/**
*
function __construct() {
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'required' => TRUE,
'no_repeat' => TRUE,
),
'last_name' => array(
'title' => ts('Last Name'),
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'contact_type' =>
- array(
+ 'contact_type' => array(
'title' => ts('Contact Type'),
),
- 'contact_sub_type' =>
- array(
+ 'contact_sub_type' => array(
'title' => ts('Contact Subtype'),
),
- 'birth_date' =>
- array(
+ 'birth_date' => array(
'title' => ts('Birth Date'),
),
),
- 'filters' =>
- array(
- 'id' =>
- array('title' => ts('Contact ID'),
+ 'filters' => array(
+ 'id' => array(
+ 'title' => ts('Contact ID'),
'no_display' => TRUE,
),
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
),
- 'birth_date' =>
- array(
+ 'birth_date' => array(
'title' => ts('Birth Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
),
'grouping' => 'contact-fields',
- 'order_bys' =>
- array(
- 'sort_name' =>
- array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'),
+ 'order_bys' => array(
+ 'sort_name' => array(
+ 'title' => ts('Last Name, First Name'),
+ 'default' => '1',
+ 'default_weight' => '0',
+ 'default_order' => 'ASC'
+ ),
),
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
'grouping' => 'contact-fields',
- 'fields' =>
- array(
+ 'fields' => array(
'street_address' => NULL,
'city' => NULL,
'postal_code' => NULL,
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
),
- 'order_bys' =>
- array('state_province_id' => array('title' => 'State/Province'),
+ 'order_bys' => array(
+ 'state_province_id' => array('title' => 'State/Province'),
'city' => array('title' => 'City'),
'postal_code' => array('title' => 'Postal Code'),
),
),
- 'civicrm_country' =>
- array(
+ 'civicrm_country' => array(
'dao' => 'CRM_Core_DAO_Country',
- 'fields' =>
- array(
- 'name' =>
- array('title' => 'Country', 'default' => TRUE),
+ 'fields' => array(
+ 'name' => array('title' => 'Country', 'default' => TRUE),
),
- 'order_bys' =>
- array(
- 'name' =>
- array('title' => 'Country'),
+ 'order_bys' => array(
+ 'name' => array('title' => 'Country'),
),
'grouping' => 'contact-fields',
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email' =>
- array('title' => ts('Email'),
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
- 'order_bys' =>
- array(
- 'email' =>
- array('title' => ts('Email'),
+ 'order_bys' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
),
),
),
- 'civicrm_contribution' =>
- array(
+ 'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' =>
- array(
- 'contact_id' =>
- array(
+ 'fields' => array(
+ 'contact_id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'contribution_id' =>
- array('title' => ts('Contribution'),
+ 'contribution_id' => array(
+ 'title' => ts('Contribution'),
'no_repeat' => TRUE,
'default' => TRUE,
),
'total_amount' => array('default' => TRUE),
- 'financial_type_id' => array('title' => ts('Financial Type'),
+ 'financial_type_id' => array(
+ 'title' => ts('Financial Type'),
'default' => TRUE,
),
'trxn_id' => NULL,
'receive_date' => array('default' => TRUE),
'receipt_date' => NULL,
- 'contribution_status_id' => array('title' => ts('Contribution Status'),
+ 'contribution_status_id' => array(
+ 'title' => ts('Contribution Status'),
'default' => TRUE,
),
'contribution_source' => NULL,
),
),
- 'civicrm_membership' =>
- array(
+ 'civicrm_membership' => array(
'dao' => 'CRM_Member_DAO_Membership',
- 'fields' =>
- array(
- 'contact_id' =>
- array(
+ 'fields' => array(
+ 'contact_id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'membership_id' =>
- array('title' => ts('Membership'),
+ 'membership_id' => array(
+ 'title' => ts('Membership'),
'no_repeat' => TRUE,
'default' => TRUE,
),
- 'membership_type_id' => array('title' => ts('Membership Type'),
+ 'membership_type_id' => array(
+ 'title' => ts('Membership Type'),
'default' => TRUE,
),
'join_date' => NULL,
- 'membership_start_date' => array('title' => ts('Start Date'),
+ 'membership_start_date' => array(
+ 'title' => ts('Start Date'),
'default' => TRUE,
),
- 'membership_end_date' => array('title' => ts('End Date'),
+ 'membership_end_date' => array(
+ 'title' => ts('End Date'),
'default' => TRUE,
),
'membership_status_id' => array(
'source' => array('title' => 'Membership Source'),
),
),
- 'civicrm_participant' =>
- array(
+ 'civicrm_participant' => array(
'dao' => 'CRM_Event_DAO_Participant',
- 'fields' =>
- array(
- 'contact_id' =>
- array(
+ 'fields' => array(
+ 'contact_id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'participant_id' =>
- array('title' => ts('Participant'),
+ 'participant_id' => array(
+ 'title' => ts('Participant'),
'no_repeat' => TRUE,
'default' => TRUE,
),
'title' => ts('Participant Status'),
'default' => TRUE,
),
- 'role_id' => array('title' => ts('Role'),
+ 'role_id' => array(
+ 'title' => ts('Role'),
'default' => TRUE,
),
- 'participant_register_date' => array('title' => ts('Register Date'),
+ 'participant_register_date' => array(
+ 'title' => ts('Register Date'),
'default' => TRUE,
),
- 'fee_level' => array('title' => ts('Fee Level'),
+ 'fee_level' => array(
+ 'title' => ts('Fee Level'),
'default' => TRUE,
),
- 'fee_amount' => array('title' => ts('Fee Amount'),
+ 'fee_amount' => array(
+ 'title' => ts('Fee Amount'),
'default' => TRUE,
),
),
),
- 'civicrm_relationship' =>
- array(
+ 'civicrm_relationship' => array(
'dao' => 'CRM_Contact_DAO_Relationship',
- 'fields' =>
- array(
- 'relationship_id' =>
- array(
+ 'fields' => array(
+ 'relationship_id' => array(
'name' => 'id',
'title' => ts('Relationship'),
'no_repeat' => TRUE,
'default' => TRUE,
),
- 'relationship_type_id' =>
- array('title' => ts('Relationship Type'),
+ 'relationship_type_id' => array(
+ 'title' => ts('Relationship Type'),
'default' => TRUE,
),
- 'contact_id_b' =>
- array('title' => ts('Relationship With'),
+ 'contact_id_b' => array(
+ 'title' => ts('Relationship With'),
'default' => TRUE,
),
- 'start_date' =>
- array(
+ 'start_date' => array(
'title' => 'Start Date ',
'type' => CRM_Report_Form::OP_DATE,
),
- 'end_date' =>
- array(
+ 'end_date' => array(
'title' => 'End Date ',
'type' => CRM_Report_Form::OP_DATE,
),
),
),
- 'civicrm_activity' =>
- array(
+ 'civicrm_activity' => array(
'dao' => 'CRM_Activity_DAO_Activity',
- 'fields' =>
- array(
- 'id' =>
- array('title' => ts('Activity'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Activity'),
'no_repeat' => TRUE,
'default' => TRUE,
),
- 'activity_type_id' =>
- array('title' => ts('Activity Type'),
+ 'activity_type_id' => array(
+ 'title' => ts('Activity Type'),
'default' => TRUE,
),
- 'subject' =>
- array('title' => ts('Subject'),
+ 'subject' => array(
+ 'title' => ts('Subject'),
'default' => TRUE,
),
- 'activity_date_time' =>
- array('title' => ts('Activity Date'),
+ 'activity_date_time' => array(
+ 'title' => ts('Activity Date'),
'default' => TRUE,
),
- 'activity_status_id' =>
- array(
+ 'activity_status_id' => array(
'name' => 'status_id',
'title' => ts('Activity Status'),
'default' => TRUE,
),
'grouping' => 'activity-fields',
),
- 'civicrm_activity_target' =>
- array(
+ 'civicrm_activity_target' => array(
'dao' => 'CRM_Activity_DAO_ActivityContact',
- 'fields' =>
- array(
- 'target_contact_id' =>
- array('title' => ts('With Contact'),
+ 'fields' => array(
+ 'target_contact_id' => array(
+ 'title' => ts('With Contact'),
'name' => 'contact_id',
'default' => TRUE,
),
),
'grouping' => 'activity-fields',
),
- 'civicrm_activity_assignment' =>
- array(
+ 'civicrm_activity_assignment' => array(
'dao' => 'CRM_Activity_DAO_ActivityContact',
- 'fields' =>
- array(
- 'assignee_contact_id' =>
- array('title' => ts('Assigned to'),
+ 'fields' => array(
+ 'assignee_contact_id' => array(
+ 'title' => ts('Assigned to'),
'name' => 'contact_id',
'default' => TRUE,
),
),
'grouping' => 'activity-fields',
),
- 'civicrm_activity_source' =>
- array(
- 'dao' => 'CRM_Activity_DAO_ActivityContact',
- 'fields' =>
- array(
- 'source_contact_id' =>
- array(
- 'title' => ts('Added By'),
- 'name' => 'contact_id',
- 'default' => TRUE,
- ),
+ 'civicrm_activity_source' => array(
+ 'dao' => 'CRM_Activity_DAO_ActivityContact',
+ 'fields' => array(
+ 'source_contact_id' => array(
+ 'title' => ts('Added By'),
+ 'name' => 'contact_id',
+ 'default' => TRUE,
),
+ ),
'grouping' => 'activity-fields',
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
+ 'fields' => array(
'phone' => NULL,
- 'phone_ext' =>
- array(
+ 'phone_ext' => array(
'title' => ts('Phone Extension')
)
),
function select() {
$select = array();
$this->_columnHeaders = array();
- $this->_component = array('contribution_civireport', 'membership_civireport', 'participant_civireport', 'relationship_civireport', 'activity_civireport');
+ $this->_component = array(
+ 'contribution_civireport',
+ 'membership_civireport',
+ 'participant_civireport',
+ 'relationship_civireport',
+ 'activity_civireport'
+ );
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
//isolate the select clause compoenent wise
if (in_array($table['alias'], $this->_component)) {
$select[$table['alias']][] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
$this->_columnHeadersComponent[$table['alias']]["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
$this->_columnHeadersComponent[$table['alias']]["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
}
- elseif ($table['alias'] == $this->_aliases['civicrm_activity_target'] ||
- $table['alias'] == $this->_aliases['civicrm_activity_assignment'] ||
+ elseif ($table['alias'] ==
+ $this->_aliases['civicrm_activity_target'] ||
+ $table['alias'] ==
+ $this->_aliases['civicrm_activity_assignment'] ||
$table['alias'] == $this->_aliases['civicrm_activity_source']
) {
- if ($table['alias'] == $this->_aliases['civicrm_activity_target']) {
+ if ($table['alias'] == $this->_aliases['civicrm_activity_target']
+ ) {
$addContactId = 'civicrm_activity_target.contact_id as target_contact_id';
}
- elseif ($table['alias'] == $this->_aliases['civicrm_activity_source']) {
+ elseif ($table['alias'] ==
+ $this->_aliases['civicrm_activity_source']
+ ) {
$addContactId = 'civicrm_activity_source.contact_id';
}
else {
foreach ($this->_component as $val) {
if (!empty($select[$val])) {
- $this->_selectComponent[$val] = "SELECT " . implode(', ', $select[$val]) . " ";
+ $this->_selectComponent[$val] =
+ "SELECT " . implode(', ', $select[$val]) . " ";
unset($select[$val]);
}
}
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']} {$this->_aclFrom}";
- if ($this->isTableSelected('civicrm_country') || $this->isTableSelected('civicrm_address')) {
+ if ($this->isTableSelected('civicrm_country') ||
+ $this->isTableSelected('civicrm_address')
+ ) {
$this->_from .= "
LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
- if (CRM_Utils_Array::value('operatorType', $field) & CRM_Report_Form::OP_DATE) {
+ if (CRM_Utils_Array::value('operatorType', $field) &
+ CRM_Report_Form::OP_DATE
+ ) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to);
}
*/
function clauseComponent() {
$selectedContacts = implode(',', $this->_contactSelected);
- $contribution = $membership = $participant = NULL;
- $eligibleResult = $rows = $tempArray = array();
+ $contribution = $membership = $participant = NULL;
+ $eligibleResult = $rows = $tempArray = array();
foreach ($this->_component as $val) {
- if (!empty($this->_selectComponent[$val]) && ($val != 'activity_civireport' && $val != 'relationship_civireport')) {
+ if (!empty($this->_selectComponent[$val]) &&
+ ($val != 'activity_civireport' && $val != 'relationship_civireport')
+ ) {
$sql = "{$this->_selectComponent[$val]} {$this->_formComponent[$val]}
WHERE {$this->_aliases['civicrm_contact']}.id IN ( $selectedContacts )
GROUP BY {$this->_aliases['civicrm_contact']}.id,{$val}.id ";
$row[$key] = $dao->$key;
}
- $relTitle = "" . $dao->civicrm_relationship_relationship_type_id . '_a_b';
+ $relTitle = "" . $dao->civicrm_relationship_relationship_type_id .
+ '_a_b';
$row['civicrm_relationship_relationship_type_id'] = $relTypes[$relTitle];
$rows[$dao->contact_a_id][$val][] = $row;
$row['civicrm_relationship_contact_id_b'] = $dao->contact_a_name;
- $relTitle = "" . $dao->civicrm_relationship_relationship_type_id . '_b_a';
+ $relTitle = "" . $dao->civicrm_relationship_relationship_type_id .
+ '_b_a';
if (isset($relTypes[$relTitle])) {
$row['civicrm_relationship_relationship_type_id'] = $relTypes[$relTitle];
}
if (!empty($this->_selectComponent['activity_civireport'])) {
$componentClause = "civicrm_option_value.component_id IS NULL";
- $componentsIn = NULL;
- $compInfo = CRM_Core_Component::getEnabledComponents();
+ $componentsIn = NULL;
+ $compInfo = CRM_Core_Component::getEnabledComponents();
foreach ($compInfo as $compObj) {
if ($compObj->info['showActivitiesInCore']) {
- $componentsIn = $componentsIn ? ($componentsIn . ', ' . $compObj->componentID) : $compObj->componentID;
+ $componentsIn = $componentsIn ? ($componentsIn . ', ' .
+ $compObj->componentID) : $compObj->componentID;
}
}
if ($componentsIn) {
//unset Conmponent id and contact id from display
foreach ($this->_columnHeadersComponent as $componentTitle => $headers) {
- $id_header = 'civicrm_' . substr_replace($componentTitle, '', -11, 11) . '_' . substr_replace($componentTitle, '', -11, 11) . '_id';
- $contact_header = 'civicrm_' . substr_replace($componentTitle, '', -11, 11) . '_contact_id';
+ $id_header =
+ 'civicrm_' . substr_replace($componentTitle, '', -11, 11) . '_' .
+ substr_replace($componentTitle, '', -11, 11) . '_id';
+ $contact_header =
+ 'civicrm_' . substr_replace($componentTitle, '', -11, 11) .
+ '_contact_id';
if ($componentTitle == 'activity_civireport') {
- $id_header = 'civicrm_' . substr_replace($componentTitle, '', -11, 11) . '_id';
+ $id_header =
+ 'civicrm_' . substr_replace($componentTitle, '', -11, 11) . '_id';
}
unset($this->_columnHeadersComponent[$componentTitle][$id_header]);
if ($component == 'contribution_civireport') {
if ($val = CRM_Utils_Array::value('civicrm_contribution_financial_type_id', $row)) {
$componentRows[$contactID][$component][$rowNum]['civicrm_contribution_financial_type_id'] =
- CRM_Contribute_PseudoConstant::financialType($val, false);
+ CRM_Contribute_PseudoConstant::financialType($val, FALSE);
}
if ($val = CRM_Utils_Array::value('civicrm_contribution_contribution_status_id', $row)) {
asort($this->activityTypes);
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Modified By'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Modified By'),
'required' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
- 'filters' =>
- array(
- 'sort_name' =>
- array('title' => ts('Modified By'),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Modified By'),
'type' => CRM_Utils_Type::T_STRING,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_contact_touched' =>
- array(
+ 'civicrm_contact_touched' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name_touched' =>
- array('title' => ts('Touched Contact'),
+ 'fields' => array(
+ 'sort_name_touched' => array(
+ 'title' => ts('Touched Contact'),
'name' => 'sort_name',
'required' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
- 'filters' =>
- array(
- 'sort_name_touched' =>
- array('title' => ts('Touched Contact'),
+ 'filters' => array(
+ 'sort_name_touched' => array(
+ 'title' => ts('Touched Contact'),
'name' => 'sort_name',
'type' => CRM_Utils_Type::T_STRING,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_activity' =>
- array(
+ 'civicrm_activity' => array(
'dao' => 'CRM_Activity_DAO_Activity',
- 'fields' =>
- array('id' => array('title' => ts('Activity ID'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Activity ID'),
'no_display' => TRUE,
'required' => TRUE,
),
- 'subject' => array('title' => ts('Touched Activity'),
+ 'subject' => array(
+ 'title' => ts('Touched Activity'),
'required' => TRUE,
),
- 'activity_type_id' => array('title' => ts('Activity Type'),
+ 'activity_type_id' => array(
+ 'title' => ts('Activity Type'),
'required' => TRUE,
),
),
),
- 'civicrm_activity_source' =>
- array(
+ 'civicrm_activity_source' => array(
'dao' => 'CRM_Activity_DAO_ActivityContact',
- 'fields' =>
- array(
- 'contact_id' =>
- array(
+ 'fields' => array(
+ 'contact_id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
),
- 'civicrm_log' =>
- array(
+ 'civicrm_log' => array(
'dao' => 'CRM_Core_DAO_Log',
- 'fields' =>
- array(
- 'modified_date' =>
- array('title' => ts('Modified Date'),
+ 'fields' => array(
+ 'modified_date' => array(
+ 'title' => ts('Modified Date'),
'required' => TRUE,
),
- 'data' =>
- array('title' => ts('Description'),
+ 'data' => array(
+ 'title' => ts('Description'),
),
),
- 'filters' =>
- array(
- 'modified_date' =>
- array('title' => ts('Modified Date'),
+ 'filters' => array(
+ 'modified_date' => array(
+ 'title' => ts('Modified Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
'default' => 'this.week',
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
- if (CRM_Utils_Array::value('operatorType', $field) & CRM_Report_Form::OP_DATE) {
+ if (CRM_Utils_Array::value('operatorType', $field) &
+ CRM_Report_Form::OP_DATE
+ ) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to);
}
$row['civicrm_activity_subject'] !== ''
) {
$url = CRM_Utils_System::url('civicrm/contact/view/activity',
- 'reset=1&action=view&id=' . $row['civicrm_activity_id'] . '&cid=' . $row['civicrm_activity_source_contact_id'] . '&atype=' . $row['civicrm_activity_activity_type_id'],
+ 'reset=1&action=view&id=' . $row['civicrm_activity_id'] . '&cid=' .
+ $row['civicrm_activity_source_contact_id'] . '&atype=' .
+ $row['civicrm_activity_activity_type_id'],
$this->_absoluteUrl
);
$rows[$rowNum]['civicrm_activity_subject_link'] = $url;
protected $_phoneField_a = FALSE;
protected $_phoneField_b = FALSE;
protected $_customGroupExtends = array(
- 'Relationship');
+ 'Relationship'
+ );
public $_drilldownReport = array('contact/detail' => 'Link to Detail Report');
function __construct() {
$contact_type = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, '_');
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name_a' =>
- array('title' => ts('Contact A'),
+ 'fields' => array(
+ 'sort_name_a' => array(
+ 'title' => ts('Contact A'),
'name' => 'sort_name',
'required' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'contact_type_a' =>
- array(
+ 'contact_type_a' => array(
'title' => ts('Contact Type (Contact A)'),
'name' => 'contact_type',
),
- 'contact_sub_type_a' =>
- array(
+ 'contact_sub_type_a' => array(
'title' => ts('Contact Subtype (Contact A)'),
'name' => 'contact_sub_type',
),
),
- 'filters' =>
- array(
- 'sort_name_a' =>
- array('title' => ts('Contact A'),
+ 'filters' => array(
+ 'sort_name_a' => array(
+ 'title' => ts('Contact A'),
'name' => 'sort_name',
'operator' => 'like',
'type' => CRM_Report_Form::OP_STRING,
),
- 'contact_type_a' =>
- array('title' => ts('Contact Type A'),
+ 'contact_type_a' => array(
+ 'title' => ts('Contact Type A'),
'name' => 'contact_type',
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $contact_type,
),
'grouping' => 'conact_a_fields',
),
- 'civicrm_contact_b' =>
- array(
+ 'civicrm_contact_b' => array(
'dao' => 'CRM_Contact_DAO_Contact',
'alias' => 'contact_b',
- 'fields' =>
- array(
- 'sort_name_b' =>
- array('title' => ts('Contact B'),
+ 'fields' => array(
+ 'sort_name_b' => array(
+ 'title' => ts('Contact B'),
'name' => 'sort_name',
'required' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'contact_type_b' =>
- array(
+ 'contact_type_b' => array(
'title' => ts('Contact Type (Contact B)'),
'name' => 'contact_type',
),
- 'contact_sub_type_b' =>
- array(
+ 'contact_sub_type_b' => array(
'title' => ts('Contact Subtype (Contact B)'),
'name' => 'contact_sub_type',
),
),
- 'filters' =>
- array(
- 'sort_name_b' =>
- array('title' => ts('Contact B'),
+ 'filters' => array(
+ 'sort_name_b' => array(
+ 'title' => ts('Contact B'),
'name' => 'sort_name',
'operator' => 'like',
'type' => CRM_Report_Form::OP_STRING,
),
- 'contact_type_b' =>
- array('title' => ts('Contact Type B'),
+ 'contact_type_b' => array(
+ 'title' => ts('Contact Type B'),
'name' => 'contact_type',
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $contact_type,
),
'grouping' => 'conact_b_fields',
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email_a' =>
- array('title' => ts('Email (Contact A)'),
+ 'fields' => array(
+ 'email_a' => array(
+ 'title' => ts('Email (Contact A)'),
'name' => 'email',
),
),
'grouping' => 'conact_a_fields',
),
- 'civicrm_email_b' =>
- array(
+ 'civicrm_email_b' => array(
'dao' => 'CRM_Core_DAO_Email',
'alias' => 'email_b',
- 'fields' =>
- array(
- 'email_b' =>
- array('title' => ts('Email (Contact B)'),
+ 'fields' => array(
+ 'email_b' => array(
+ 'title' => ts('Email (Contact B)'),
'name' => 'email',
),
),
'grouping' => 'conact_b_fields',
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
'alias' => 'phone_a',
- 'fields' =>
- array(
- 'phone_a' =>
- array(
+ 'fields' => array(
+ 'phone_a' => array(
'title' => ts('Phone (Contact A)'),
'name' => 'phone',
),
- 'phone_ext_a' =>
- array(
+ 'phone_ext_a' => array(
'title' => ts('Phone Ext (Contact A)'),
'name' => 'phone_ext',
),
),
'grouping' => 'conact_a_fields',
),
- 'civicrm_phone_b' =>
- array(
+ 'civicrm_phone_b' => array(
'dao' => 'CRM_Core_DAO_Phone',
'alias' => 'phone_b',
- 'fields' =>
- array(
- 'phone_b' =>
- array(
+ 'fields' => array(
+ 'phone_b' => array(
'title' => ts('Phone (Contact B)'),
'name' => 'phone'
),
- 'phone_ext_b' =>
- array(
+ 'phone_ext_b' => array(
'title' => ts('Phone Ext (Contact B)'),
'name' => 'phone_ext'
),
),
'grouping' => 'conact_b_fields',
),
- 'civicrm_relationship_type' =>
- array(
+ 'civicrm_relationship_type' => array(
'dao' => 'CRM_Contact_DAO_RelationshipType',
- 'fields' =>
- array(
- 'label_a_b' =>
- array('title' => ts('Relationship A-B '),
+ 'fields' => array(
+ 'label_a_b' => array(
+ 'title' => ts('Relationship A-B '),
'default' => TRUE,
),
- 'label_b_a' =>
- array('title' => ts('Relationship B-A '),
+ 'label_b_a' => array(
+ 'title' => ts('Relationship B-A '),
'default' => TRUE,
),
),
'grouping' => 'relation-fields',
),
- 'civicrm_relationship' =>
- array(
+ 'civicrm_relationship' => array(
'dao' => 'CRM_Contact_DAO_Relationship',
- 'fields' =>
- array(
- 'start_date' =>
- array('title' => ts('Relationship Start Date'),
+ 'fields' => array(
+ 'start_date' => array(
+ 'title' => ts('Relationship Start Date'),
),
- 'end_date' =>
- array('title' => ts('Relationship End Date'),
+ 'end_date' => array(
+ 'title' => ts('Relationship End Date'),
),
- 'description' =>
- array('title' => ts('Description'),
+ 'description' => array(
+ 'title' => ts('Description'),
),
- 'relationship_id' =>
- array(
+ 'relationship_id' => array(
'title' => ts('Rel ID'),
'name' => 'id',
),
),
- 'filters' =>
- array(
- 'is_active' =>
- array('title' => ts('Relationship Status'),
+ 'filters' => array(
+ 'is_active' => array(
+ 'title' => ts('Relationship Status'),
'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' =>
- array(
+ 'options' => array(
'' => '- Any -',
1 => 'Active',
0 => 'Inactive',
),
'type' => CRM_Utils_Type::T_INT,
),
- 'relationship_type_id' =>
- array('title' => ts('Relationship'),
+ 'relationship_type_id' => array(
+ 'title' => ts('Relationship'),
'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' =>
- array(
- '' => '- any relationship type -') +
- CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, NULL, TRUE),
+ 'options' => array(
+ '' => '- any relationship type -'
+ ) +
+ CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, NULL, TRUE),
'type' => CRM_Utils_Type::T_INT,
),
),
'grouping' => 'relation-fields',
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'filters' =>
- array(
- 'country_id' =>
- array('title' => ts('Country'),
+ 'filters' => array(
+ 'country_id' => array(
+ 'title' => ts('Country'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::country(),
),
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::stateProvince(),
),
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($fieldName == 'email_a') {
$this->_emailField_a = TRUE;
if ($fieldName == 'email_b') {
$this->_emailField_b = TRUE;
}
- if ($fieldName == 'phone_a'){
+ if ($fieldName == 'phone_a') {
$this->_phoneField_a = TRUE;
}
- if ($fieldName == 'phone_b'){
+ if ($fieldName == 'phone_b') {
$this->_phoneField_b = TRUE;
}
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
else {
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
if ($op) {
- if (($tableName == 'civicrm_contact' || $tableName == 'civicrm_contact_b') &&
- ($fieldName == 'contact_type_a' || $fieldName == 'contact_type_b')
+ if (($tableName == 'civicrm_contact' ||
+ $tableName == 'civicrm_contact_b') &&
+ ($fieldName == 'contact_type_a' ||
+ $fieldName == 'contact_type_b')
) {
$cTypes = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
$contactTypes = $contactSubTypes = array();
if (!empty($cTypes)) {
foreach ($cTypes as $ctype) {
$getTypes = CRM_Utils_System::explode('_', $ctype, 2);
- if ($getTypes[1] && !in_array($getTypes[1], $contactSubTypes)) {
+ if ($getTypes[1] &&
+ !in_array($getTypes[1], $contactSubTypes)
+ ) {
$contactSubTypes[] = $getTypes[1];
}
- elseif ($getTypes[0] && !in_array($getTypes[0], $contactTypes)) {
+ elseif ($getTypes[0] &&
+ !in_array($getTypes[0], $contactTypes)
+ ) {
$contactTypes[] = $getTypes[0];
}
}
//for displaying relationship type filter
if ($value['title'] == 'Relationship') {
$relTypes = CRM_Core_PseudoConstant::relationshipType();
- $statistics['filters'][$id]['value'] = 'Is equal to ' . $relTypes[$this->_params['relationship_type_id_value']]['label_' . $this->relationType];
+ $statistics['filters'][$id]['value'] = 'Is equal to ' .
+ $relTypes[$this->_params['relationship_type_id_value']]['label_' .
+ $this->relationType];
}
//for displaying relationship status
}
if (!empty($groupBy)) {
- $this->_groupBy = " GROUP BY " . implode(', ', $groupBy) . " , {$this->_aliases['civicrm_relationship']}.id ";
+ $this->_groupBy = " GROUP BY " . implode(', ', $groupBy) .
+ " , {$this->_aliases['civicrm_relationship']}.id ";
}
else {
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_relationship']}.id ";
$this->_params['relationship_type_id_value'] = intval($relType[0]);
}
- $this->buildACLClause(array($this->_aliases['civicrm_contact'], $this->_aliases['civicrm_contact_b']));
+ $this->buildACLClause(array(
+ $this->_aliases['civicrm_contact'],
+ $this->_aliases['civicrm_contact_b']
+ ));
$sql = $this->buildQuery();
$this->buildRows($sql, $rows);
'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
- $rows[$rowNum]['civicrm_contact_sort_name_a'] = $rows[$rowNum]['civicrm_contact_sort_name_a'] . ' (' . $rows[$rowNum]['civicrm_contact_id'] . ')';
+ $rows[$rowNum]['civicrm_contact_sort_name_a'] =
+ $rows[$rowNum]['civicrm_contact_sort_name_a'] . ' (' .
+ $rows[$rowNum]['civicrm_contact_id'] . ')';
$rows[$rowNum]['civicrm_contact_sort_name_a_link'] = $url;
$rows[$rowNum]['civicrm_contact_sort_name_a_hover'] = ts("View Contact details for this contact.");
$entryFound = TRUE;
'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_b_id'],
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
- $rows[$rowNum]['civicrm_contact_b_sort_name_b'] = $rows[$rowNum]['civicrm_contact_b_sort_name_b'] . ' (' . $rows[$rowNum]['civicrm_contact_b_id'] . ')';
+ $rows[$rowNum]['civicrm_contact_b_sort_name_b'] =
+ $rows[$rowNum]['civicrm_contact_b_sort_name_b'] . ' (' .
+ $rows[$rowNum]['civicrm_contact_b_id'] . ')';
$rows[$rowNum]['civicrm_contact_b_sort_name_b_link'] = $url;
$rows[$rowNum]['civicrm_contact_b_sort_name_b_hover'] = ts("View Contact details for this contact.");
$entryFound = TRUE;
}
- if (array_key_exists('civicrm_relationship_relationship_id', $row) && array_key_exists('civicrm_contact_id', $row)) {
- $url = "/civicrm/contact/view/rel?reset=1&action=update&rtype=a_b&cid=" . $row['civicrm_contact_id'] . "&id=" . $row['civicrm_relationship_relationship_id'];
+ if (array_key_exists('civicrm_relationship_relationship_id', $row) &&
+ array_key_exists('civicrm_contact_id', $row)
+ ) {
+ $url =
+ "/civicrm/contact/view/rel?reset=1&action=update&rtype=a_b&cid=" .
+ $row['civicrm_contact_id'] . "&id=" .
+ $row['civicrm_relationship_relationship_id'];
$rows[$rowNum]['civicrm_relationship_relationship_id_link'] = $url;
$rows[$rowNum]['civicrm_relationship_relationship_id_hover'] = ts("Edit this relationship.");
$entryFound = TRUE;
protected $_phoneField = FALSE;
protected $_customGroupExtends = array(
- 'Contact', 'Individual', 'Household', 'Organization');
+ 'Contact',
+ 'Individual',
+ 'Household',
+ 'Organization'
+ );
public $_drilldownReport = array('contact/detail' => 'Link to Detail Report');
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,
+ '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,
+ ),
+ 'contact_type' => array(
+ 'title' => ts('Contact Type'),
+ ),
+ 'contact_sub_type' => array(
+ 'title' => ts('Contact Subtype'),
+ ),
+ '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())',
+ ),
),
- 'first_name' => array(
- 'title' => ts('First Name'),
+ 'filters' => array(
+ 'sort_name' => array('title' => ts('Contact Name')),
+ 'source' => array(
+ 'title' => ts('Contact Source'),
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
+ '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,
+ ),
),
- 'middle_name' => array(
- 'title' => ts('Middle Name'),
- ),
- 'last_name' => array(
- 'title' => ts('Last Name'),
- ),
- 'id' =>
- array(
- 'no_display' => TRUE,
- 'required' => TRUE,
- ),
- 'contact_type' =>
- array(
- 'title' => ts('Contact Type'),
- ),
- 'contact_sub_type' =>
- array(
- 'title' => ts('Contact Subtype'),
- ),
- '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())',
- ),
- ),
- 'filters' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name')),
- 'source' =>
- array('title' => ts('Contact Source'),
- 'type' => CRM_Utils_Type::T_STRING,
- ),
- '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,
+ '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'),
+ ),
),
),
- 'grouping' => 'contact-fields',
- 'order_bys' =>
- array(
- 'sort_name' =>
- array(
- 'title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC',
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
+ 'no_repeat' => TRUE,
+ ),
),
- 'gender_id' =>
- array(
- 'name' => 'gender_id',
- 'title' => ts('Gender'),
- ),
- 'birth_date' =>
- array(
- 'name' => 'birth_date',
- 'title' => ts('Birth Date'),
- ),
- ),
- ),
- 'civicrm_email' =>
- array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email' =>
- array('title' => ts('Email'),
- 'no_repeat' => TRUE,
+ 'grouping' => 'contact-fields',
+ 'order_bys' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
+ ),
),
),
- 'grouping' => 'contact-fields',
- 'order_bys' =>
- array(
- 'email' =>
- array('title' => ts('Email'),
+ 'civicrm_phone' => array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'fields' => array(
+ 'phone' => NULL,
+ 'phone_ext' => array(
+ 'title' => ts('Phone Extension')
+ )
),
+ 'grouping' => 'contact-fields',
),
- ),
- 'civicrm_phone' =>
- array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone' => NULL,
- 'phone_ext' =>
- array(
- 'title' => ts('Phone Extension')
- )
- ),
- 'grouping' => 'contact-fields',
- ),
- ) + $this->getAddressColumns(array('group_by' => FALSE));
+ ) + $this->getAddressColumns(array('group_by' => FALSE));
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_email') {
$this->_emailField = TRUE;
}
/**
* @param $rows
*/
- private function _initBasicRow(&$rows, &$entryFound, $row, $rowId, $rowNum, $types){
+ private function _initBasicRow(&$rows, &$entryFound, $row, $rowId, $rowNum, $types) {
if (!array_key_exists($rowId, $row)) {
return FALSE;
}
protected $_summary = NULL;
protected $_customGroupExtends = array(
- 'Membership');
+ 'Membership'
+ );
/**
*
*/
function __construct() {
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'required' => TRUE,
'no_repeat' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'contact_type' =>
- array(
+ 'contact_type' => array(
'title' => ts('Contact Type'),
),
- 'contact_sub_type' =>
- array(
+ 'contact_sub_type' => array(
'title' => ts('Contact Subtype'),
),
),
- 'filters' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'operator' => 'like',
),
- 'id' =>
- array('title' => ts('Contact ID'),
+ 'id' => array(
+ 'title' => ts('Contact ID'),
'no_display' => TRUE,
),
),
- 'order_bys' =>
- array(
+ 'order_bys' => array(
'sort_name' => array(
'title' => ts('Last Name, First Name'),
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_membership' =>
- array(
+ 'civicrm_membership' => array(
'dao' => 'CRM_Member_DAO_Membership',
- 'fields' =>
- array(
- 'id' =>
- array('title' => ts('Membership #'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Membership #'),
'no_display' => TRUE,
'required' => TRUE,
),
'fields' => array(
'debit_accounting_code' => array(
'title' => ts('Financial Account Code - Debit'),
- 'name' => 'accounting_code',
+ 'name' => 'accounting_code',
'alias' => 'financial_account_civireport_debit',
'default' => TRUE,
),
'credit_accounting_code' => array(
'title' => ts('Financial Account Code - Credit'),
- 'name' => 'accounting_code',
+ 'name' => 'accounting_code',
'alias' => 'financial_account_civireport_credit',
'default' => TRUE,
),
'debit_name' => array(
'title' => ts('Financial Account Name - Debit'),
- 'name' => 'name',
+ 'name' => 'name',
'alias' => 'financial_account_civireport_debit',
'default' => TRUE,
),
'credit_name' => array(
'title' => ts('Financial Account Name - Credit'),
- 'name' => 'name',
+ 'name' => 'name',
'alias' => 'financial_account_civireport_credit',
'default' => TRUE,
),
'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',
+ 'name' => 'accounting_code',
'alias' => 'financial_account_civireport_debit',
),
'credit_accounting_code' => array(
'title' => ts('Financial Account Name - Debit'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::financialAccount(),
- 'name' => 'id',
+ 'name' => 'id',
'alias' => 'financial_account_civireport_debit',
),
'credit_name' => array(
'civicrm_line_item' => array(
'dao' => 'CRM_Price_DAO_LineItem',
'fields' => array(
- 'financial_type_id' => array('title' => ts('Financial Type'),
+ 'financial_type_id' => array(
+ 'title' => ts('Financial Type'),
'default' => TRUE,
),
),
'financial_type_id' => array('title' => ts('Financial Type')),
),
),
- 'civicrm_contribution' =>
- array(
+ 'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' =>
- array(
+ 'fields' => array(
'receive_date' => array(
'default' => TRUE
),
'title' => ts('Invoice ID'),
'default' => TRUE,
),
- 'contribution_status_id' => array('title' => ts('Contribution Status'),
+ 'contribution_status_id' => array(
+ 'title' => ts('Contribution Status'),
'default' => TRUE,
),
- 'id' => array('title' => ts('Contribution #'),
+ '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'),
+ '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),
'title' => ts('Cheque #'),
'default' => TRUE,
),
- 'payment_instrument_id' => array('title' => ts('Payment Instrument'),
+ 'payment_instrument_id' => array(
+ 'title' => ts('Payment Instrument'),
'default' => TRUE,
),
'currency' => array(
- 'required' => TRUE,
- 'no_display' => TRUE,
+ 'required' => TRUE,
+ 'no_display' => TRUE,
),
'trxn_date' => array(
'title' => ts('Transaction Date'),
'default' => TRUE,
),
),
- 'filters' =>
- array(
+ '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,
+ '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'),
'type' => CRM_Utils_Type::T_STRING,
),
),
- 'filters' =>
- array(
- 'amount' =>
- array('title' => ts('Amount')),
+ 'filters' => array(
+ 'amount' => array('title' => ts('Amount')),
),
),
);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
switch ($fieldName) {
- case 'credit_accounting_code' :
- $select[] = " CASE
+ case 'credit_accounting_code' :
+ $select[] = " CASE
WHEN {$this->_aliases['civicrm_financial_trxn']}.from_financial_account_id IS NOT NULL
THEN {$this->_aliases['civicrm_financial_account']}_credit_1.accounting_code
ELSE {$this->_aliases['civicrm_financial_account']}_credit_2.accounting_code
END AS civicrm_financial_account_credit_accounting_code ";
- break;
- case 'amount' :
- $select[] = " CASE
+ break;
+ case 'amount' :
+ $select[] = " CASE
WHEN {$this->_aliases['civicrm_entity_financial_trxn']}_item.entity_id IS NOT NULL
THEN {$this->_aliases['civicrm_entity_financial_trxn']}_item.amount
ELSE {$this->_aliases['civicrm_entity_financial_trxn']}.amount
END AS civicrm_entity_financial_trxn_amount ";
- break;
- case 'credit_name' :
- $select[] = " CASE
+ break;
+ case 'credit_name' :
+ $select[] = " CASE
WHEN {$this->_aliases['civicrm_financial_trxn']}.from_financial_account_id IS NOT NULL
THEN {$this->_aliases['civicrm_financial_account']}_credit_1.name
ELSE {$this->_aliases['civicrm_financial_account']}_credit_2.name
END AS civicrm_financial_account_credit_name ";
- break;
- default :
- $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- break;
+ break;
+ default :
+ $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
+ break;
}
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
$this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
// please note this will just add the order-by columns to select query, and not display in column-headers.
// This is a solution to not throw fatal errors when there is a column in order-by, not present in select/display columns.
foreach ($this->_orderByFields as $orderBy) {
- if (!array_key_exists($orderBy['name'], $this->_params['fields']) && empty($orderBy['section'])) {
+ if (!array_key_exists($orderBy['name'], $this->_params['fields']) &&
+ empty($orderBy['section'])
+ ) {
$this->_select .= ", {$orderBy['dbAlias']} as {$orderBy['tplField']}";
}
}
}
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
$dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
$amount[] = CRM_Utils_Money::format($dao->amount, $dao->currency);
- $avg[] = CRM_Utils_Money::format(round(($dao->amount / $dao->count), 2), $dao->currency);
+ $avg[] = CRM_Utils_Money::format(round(($dao->amount /
+ $dao->count), 2), $dao->currency);
}
$statistics['counts']['amount'] = array(
- 'value' => implode(', ', $amount),
- 'title' => 'Total Amount',
- 'type' => CRM_Utils_Type::T_STRING,
+ 'value' => implode(', ', $amount),
+ 'title' => 'Total Amount',
+ 'type' => CRM_Utils_Type::T_STRING,
);
$statistics['counts']['avg'] = array(
'value' => implode(', ', $avg),
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
foreach ($rows as $rowNum => $row) {
// convert display name to links
- if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) &&
+ if (array_key_exists('civicrm_contact_sort_name', $row) &&
+ !empty($rows[$rowNum]['civicrm_contact_sort_name']) &&
array_key_exists('civicrm_contact_id', $row)
) {
$url = CRM_Utils_System::url('civicrm/contact/view',
$rows[$rowNum]['civicrm_line_item_financial_type_id'] = $contributionTypes[$value];
}
if ($value = CRM_Utils_Array::value('civicrm_entity_financial_trxn_amount', $row)) {
- $rows[$rowNum]['civicrm_entity_financial_trxn_amount'] = CRM_Utils_Money::format($rows[$rowNum]['civicrm_entity_financial_trxn_amount'],$rows[$rowNum]['civicrm_financial_trxn_currency']);
+ $rows[$rowNum]['civicrm_entity_financial_trxn_amount'] = CRM_Utils_Money::format($rows[$rowNum]['civicrm_entity_financial_trxn_amount'], $rows[$rowNum]['civicrm_financial_trxn_currency']);
}
}
}
protected $_softFrom = NULL;
- protected $_customGroupExtends = array( 'Contribution');
+ protected $_customGroupExtends = array('Contribution');
/**
*
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'),
- ),
- 'last_name' => array('title' => ts('Last Name'),
- ),
- '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('Donor Name'),
- 'operator' => 'like',
- ),
- 'id' =>
- array('title' => ts('Contact ID'),
- 'no_display' => TRUE,
- 'type' => CRM_Utils_Type::T_INT,
+ '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'),
+ ),
+ 'last_name' => array(
+ 'title' => ts('Last Name'),
+ ),
+ 'id' => array(
+ 'no_display' => TRUE,
+ 'required' => TRUE,
+ ),
+ 'contact_type' => array(
+ 'title' => ts('Contact Type'),
+ ),
+ 'contact_sub_type' => array(
+ 'title' => ts('Contact Subtype'),
+ ),
),
- ),
- 'order_bys' =>
- array(
- 'sort_name' => array(
- 'title' => ts('Last Name, First Name'),
- 'default' => '1',
- 'default_weight' => '0',
- 'default_order' => 'ASC'
+ '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,
+ ),
),
- ),
- 'grouping' => 'contact-fields',
- ),
- 'civicrm_email' =>
- array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email' =>
- array('title' => ts('Donor Email'),
- 'default' => TRUE,
+ 'order_bys' => array(
+ 'sort_name' => array(
+ 'title' => ts('Last Name, First Name'),
+ 'default' => '1',
+ 'default_weight' => '0',
+ 'default_order' => 'ASC'
+ ),
),
+ 'grouping' => 'contact-fields',
),
- 'grouping' => 'contact-fields',
- ),
- 'civicrm_phone' =>
- array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone' =>
- array('title' => ts('Donor Phone'),
- 'default' => TRUE,
- 'no_repeat' => TRUE,
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Donor Email'),
+ 'default' => TRUE,
+ ),
),
+ 'grouping' => 'contact-fields',
),
- '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"
+ 'civicrm_phone' => array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Donor Phone'),
+ 'default' => TRUE,
+ 'no_repeat' => TRUE,
+ ),
),
+ 'grouping' => 'contact-fields',
),
- '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'),
+ '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"
),
),
- '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,
+ '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')),
),
- '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,
+ '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')),
),
- 'total_amount' =>
- array('title' => ts('Contribution Amount')),
+ 'grouping' => 'contri-fields',
),
- '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_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_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'),
+ '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,
+ 'filters' => array(
+ 'note' => array(
+ 'name' => 'note',
+ 'title' => ts('Contribution Note'),
+ 'operator' => 'like',
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
),
),
- ),
- ) + $this->addAddressFields(FALSE);
+ ) + $this->addAddressFields(FALSE);
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
);
}
- // If we have active campaigns add those elements to both the fields and filters
+ // 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'),
+ $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activeCampaigns,
);
// please note this will just add the order-by columns to select query, and not display in column-headers.
// This is a solution to not throw fatal errors when there is a column in order-by, not present in select/display columns.
foreach ($this->_orderByFields as $orderBy) {
- if (!array_key_exists($orderBy['name'], $this->_params['fields']) && empty($orderBy['section'])) {
+ if (!array_key_exists($orderBy['name'], $this->_params['fields']) &&
+ empty($orderBy['section'])
+ ) {
$this->_select .= ", {$orderBy['dbAlias']} as {$orderBy['tplField']}";
}
}
INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id AND {$this->_aliases['civicrm_contribution']}.is_test = 0";
- if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'both') {
+ if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
+ 'both'
+ ) {
$this->_from .= "\n LEFT JOIN civicrm_contribution_soft contribution_soft_civireport
ON contribution_soft_civireport.contribution_id = {$this->_aliases['civicrm_contribution']}.id";
}
- elseif (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'soft_credits_only') {
+ elseif (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
+ 'soft_credits_only'
+ ) {
$this->_from .= "\n INNER JOIN civicrm_contribution_soft contribution_soft_civireport
ON contribution_soft_civireport.contribution_id = {$this->_aliases['civicrm_contribution']}.id";
}
$this->addPhoneFromClause();
- if ($this->_addressField OR (!empty($this->_params['state_province_id_value']) OR !empty($this->_params['country_id_value']))) {
+ if ($this->_addressField OR
+ (!empty($this->_params['state_province_id_value']) OR
+ !empty($this->_params['country_id_value']))
+ ) {
$this->_from .= "
LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND
{$this->_aliases['civicrm_email']}.is_primary = 1\n";
}
// include contribution note
- if (!empty($this->_params['fields']['contribution_note']) || !empty($this->_params['note_value'])) {
- $this->_from.= "
+ if (!empty($this->_params['fields']['contribution_note']) ||
+ !empty($this->_params['note_value'])
+ ) {
+ $this->_from .= "
LEFT JOIN civicrm_note {$this->_aliases['civicrm_note']}
ON ( {$this->_aliases['civicrm_note']}.entity_table = 'civicrm_contribution' AND
{$this->_aliases['civicrm_contribution']}.id = {$this->_aliases['civicrm_note']}.entity_id )";
}
//for contribution batches
if ($this->_allBatches &&
- (!empty($this->_params['fields']['batch_id']) || !empty($this->_params['bid_value']))) {
+ (!empty($this->_params['fields']['batch_id']) ||
+ !empty($this->_params['bid_value']))
+ ) {
$this->_from .= "
LEFT JOIN civicrm_entity_financial_trxn tx ON (tx.entity_id = {$this->_aliases['civicrm_contribution']}.id AND
tx.entity_table = 'civicrm_contribution')
$dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
- $totalAmount[] = CRM_Utils_Money::format($dao->amount, $dao->currency)." (".$dao->count.")";
- $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
+ $totalAmount[] =
+ CRM_Utils_Money::format($dao->amount, $dao->currency) . " (" .
+ $dao->count . ")";
+ $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
$count += $dao->count;
}
$statistics['counts']['amount'] = array(
);
// Stats for soft credits
- if ($this->_softFrom && CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) != 'contributions_only') {
+ if ($this->_softFrom &&
+ CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) !=
+ 'contributions_only'
+ ) {
$totalAmount = $average = array();
- $count = 0;
+ $count = 0;
$select = "
SELECT COUNT(contribution_soft_civireport.amount ) as count,
SUM(contribution_soft_civireport.amount ) as amount,
GROUP BY {$this->_aliases['civicrm_contribution']}.currency";
$dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
- $totalAmount[] = CRM_Utils_Money::format($dao->amount, $dao->currency)." (".$dao->count.")";
- $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
+ $totalAmount[] =
+ CRM_Utils_Money::format($dao->amount, $dao->currency) . " (" .
+ $dao->count . ")";
+ $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
$count += $dao->count;
}
$statistics['counts']['softamount'] = array(
$this->beginPostProcess();
- if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'contributions_only' && !empty($this->_params['fields']['soft_credit_type_id'])) {
+ if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
+ 'contributions_only' &&
+ !empty($this->_params['fields']['soft_credit_type_id'])
+ ) {
unset($this->_params['fields']['soft_credit_type_id']);
if (!empty($this->_params['soft_credit_type_id_value'])) {
$this->_params['soft_credit_type_id_value'] = array();
// 1. use main contribution query to build temp table 1
$sql = $this->buildQuery();
- $tempQuery = 'CREATE TEMPORARY TABLE civireport_contribution_detail_temp1 AS ' . $sql;
+ $tempQuery =
+ 'CREATE TEMPORARY TABLE civireport_contribution_detail_temp1 AS ' . $sql;
CRM_Core_DAO::executeQuery($tempQuery);
$this->setPager();
$select = str_ireplace("'Contribution' as", "'Soft Credit' as", $select);
// we inner join with temp1 to restrict soft contributions to those in temp1 table
$sql = "{$select} {$this->_from} {$this->_where} {$this->_groupBy}";
- $tempQuery = 'CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS ' . $sql;
+ $tempQuery =
+ 'CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS ' . $sql;
CRM_Core_DAO::executeQuery($tempQuery);
- if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'soft_credits_only') {
+ if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
+ 'soft_credits_only'
+ ) {
// revise pager : prev, next based on soft-credits only
$this->setPager();
}
$this->customDataFrom();
// 3. Decide where to populate temp3 table from
- if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'contributions_only') {
+ if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
+ 'contributions_only'
+ ) {
$tempQuery = "(SELECT * FROM civireport_contribution_detail_temp1)";
- } else if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'soft_credits_only') {
+ }
+ else if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
+ 'soft_credits_only'
+ ) {
$tempQuery = "(SELECT * FROM civireport_contribution_detail_temp2)";
- } else {
+ }
+ else {
$tempQuery = "
(SELECT * FROM civireport_contribution_detail_temp1)
UNION ALL
list($alias, $rest) = explode('.', $clause);
$orderClause[] = $aliases[$alias] . "_" . $rest;
}
- $orderBy = (!empty($orderClause)) ? "ORDER BY " . implode(', ', $orderClause) : '';
+ $orderBy = (!empty($orderClause)) ?
+ "ORDER BY " . implode(', ', $orderClause) : '';
}
// 6. show result set from temp table 3
$rows = array();
- $sql = "SELECT * FROM civireport_contribution_detail_temp3 {$orderBy}";
+ $sql = "SELECT * FROM civireport_contribution_detail_temp3 {$orderBy}";
$this->buildRows($sql, $rows);
// format result set.
*/
function alterDisplay(&$rows) {
// custom code to alter rows
- $checkList = array();
- $entryFound = FALSE;
- $display_flag = $prev_cid = $cid = 0;
- $contributionTypes = CRM_Contribute_PseudoConstant::financialType();
+ $checkList = array();
+ $entryFound = FALSE;
+ $display_flag = $prev_cid = $cid = 0;
+ $contributionTypes = CRM_Contribute_PseudoConstant::financialType();
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
- $contributionPages = CRM_Contribute_PseudoConstant::contributionPage();
+ $contributionPages = CRM_Contribute_PseudoConstant::contributionPage();
foreach ($rows as $rowNum => $row) {
if (!empty($this->_noRepeats) && $this->_outputMode != 'csv') {
if ($display_flag) {
foreach ($row as $colName => $colVal) {
// Hide repeats in no-repeat columns, but not if the field's a section header
- if (in_array($colName, $this->_noRepeats) && !array_key_exists($colName, $this->_sections)) {
+ if (in_array($colName, $this->_noRepeats) &&
+ !array_key_exists($colName, $this->_sections)
+ ) {
unset($rows[$rowNum][$colName]);
}
}
}
}
- if (CRM_Utils_Array::value('civicrm_contribution_contribution_or_soft', $rows[$rowNum]) == 'Contribution') {
+ if (CRM_Utils_Array::value('civicrm_contribution_contribution_or_soft', $rows[$rowNum]) ==
+ 'Contribution'
+ ) {
unset($rows[$rowNum]['civicrm_contribution_soft_soft_credit_type_id']);
}
// convert donor sort name to link
- if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) &&
+ if (array_key_exists('civicrm_contact_sort_name', $row) &&
+ !empty($rows[$rowNum]['civicrm_contact_sort_name']) &&
array_key_exists('civicrm_contact_id', $row)
) {
$url = CRM_Utils_System::url("civicrm/contact/view",
CRM_Core_Permission::check('access CiviContribute')
) {
$url = CRM_Utils_System::url("civicrm/contact/view/contribution",
- "reset=1&id=" . $row['civicrm_contribution_contribution_id'] . "&cid=" . $row['civicrm_contact_id'] . "&action=view&context=contribution&selectedChild=contribute",
+ "reset=1&id=" . $row['civicrm_contribution_contribution_id'] .
+ "&cid=" . $row['civicrm_contact_id'] .
+ "&action=view&context=contribution&selectedChild=contribute",
$this->_absoluteUrl
);
$rows[$rowNum]['civicrm_contribution_total_amount_sum_link'] = $url;
// soft credits
if (array_key_exists('civicrm_contribution_soft_credits', $row) &&
- 'Contribution' == CRM_Utils_Array::value('civicrm_contribution_contribution_or_soft', $rows[$rowNum]) &&
+ 'Contribution' ==
+ CRM_Utils_Array::value('civicrm_contribution_contribution_or_soft', $rows[$rowNum]) &&
array_key_exists('civicrm_contribution_contribution_id', $row)
) {
$query = "
SELECT civicrm_contact_id, civicrm_contact_sort_name, civicrm_contribution_total_amount_sum, civicrm_contribution_currency
FROM civireport_contribution_detail_temp2
WHERE civicrm_contribution_contribution_id={$row['civicrm_contribution_contribution_id']}";
- $dao = CRM_Core_DAO::executeQuery($query);
+ $dao = CRM_Core_DAO::executeQuery($query);
$string = '';
$separator = ($this->_outputMode !== 'csv') ? "<br/>" : ' ';
while ($dao->fetch()) {
- $url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $dao->civicrm_contact_id);
- $string = $string . ($string ? $separator : '') . "<a href='{$url}'>{$dao->civicrm_contact_sort_name}</a> " .
+ $url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' .
+ $dao->civicrm_contact_id);
+ $string = $string . ($string ? $separator : '') .
+ "<a href='{$url}'>{$dao->civicrm_contact_sort_name}</a> " .
CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_sum, $dao->civicrm_contribution_currency);
}
$rows[$rowNum]['civicrm_contribution_soft_credits'] = $string;
}
if (array_key_exists('civicrm_contribution_soft_credit_for', $row) &&
- 'Soft Credit' == CRM_Utils_Array::value('civicrm_contribution_contribution_or_soft', $rows[$rowNum]) &&
+ 'Soft Credit' ==
+ CRM_Utils_Array::value('civicrm_contribution_contribution_or_soft', $rows[$rowNum]) &&
array_key_exists('civicrm_contribution_contribution_id', $row)
) {
$query = "
SELECT civicrm_contact_id, civicrm_contact_sort_name
FROM civireport_contribution_detail_temp1
WHERE civicrm_contribution_contribution_id={$row['civicrm_contribution_contribution_id']}";
- $dao = CRM_Core_DAO::executeQuery($query);
+ $dao = CRM_Core_DAO::executeQuery($query);
$string = '';
while ($dao->fetch()) {
- $url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $dao->civicrm_contact_id);
- $string = $string . "\n<a href='{$url}'>{$dao->civicrm_contact_sort_name}</a>";
+ $url = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' .
+ $dao->civicrm_contact_id);
+ $string = $string .
+ "\n<a href='{$url}'>{$dao->civicrm_contact_sort_name}</a>";
}
$rows[$rowNum]['civicrm_contribution_soft_credit_for'] = $string;
}
}
}
- function sectionTotals( ) {
+ function sectionTotals() {
// Reports using order_bys with sections must populate $this->_selectAliases in select() method.
if (empty($this->_selectAliases)) {
if (!empty($this->_sections)) {
// build the query with no LIMIT clause
- $select = str_ireplace( 'SELECT SQL_CALC_FOUND_ROWS ', 'SELECT ', $this->_select );
+ $select = str_ireplace('SELECT SQL_CALC_FOUND_ROWS ', 'SELECT ', $this->_select);
$sql = "{$select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy}";
// pull section aliases out of $this->_sections
$addtotals = '';
- if (array_search("civicrm_contribution_total_amount_sum", $this->_selectAliases) !== FALSE) {
+ if (array_search("civicrm_contribution_total_amount_sum", $this->_selectAliases) !==
+ FALSE
+ ) {
$addtotals = ", sum(civicrm_contribution_total_amount_sum) as sumcontribs";
$showsumcontribs = TRUE;
}
$query = "select "
. implode(", ", $ifnulls)
- ."$addtotals, count(*) as ct from civireport_contribution_detail_temp3 group by ". implode(", ", $sectionAliases);
+ .
+ "$addtotals, count(*) as ct from civireport_contribution_detail_temp3 group by " .
+ implode(", ", $sectionAliases);
// initialize array of total counts
$sumcontribs = $totals = array();
$dao = CRM_Core_DAO::executeQuery($query);
if ($i == $aliasCount) {
// the last alias is the lowest-level section header; use count as-is
$totals[$key] = $dao->ct;
- if ($showsumcontribs) { $sumcontribs[$key] = $dao->sumcontribs; }
+ if ($showsumcontribs) {
+ $sumcontribs[$key] = $dao->sumcontribs;
+ }
}
else {
// other aliases are higher level; roll count into their total
- $totals[$key] = (array_key_exists($key, $totals)) ? $totals[$key] + $dao->ct : $dao->ct;
+ $totals[$key] = (array_key_exists($key, $totals)) ?
+ $totals[$key] + $dao->ct : $dao->ct;
if ($showsumcontribs) {
- $sumcontribs[$key] = array_key_exists($key, $sumcontribs) ? $sumcontribs[$key] + $dao->sumcontribs : $dao->sumcontribs;
+ $sumcontribs[$key] = array_key_exists($key, $sumcontribs) ?
+ $sumcontribs[$key] + $dao->sumcontribs : $dao->sumcontribs;
}
}
}
// ts exception to avoid having ts("%1 %2: %3")
$title = '%1 contributions / soft-credits: %2';
- if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'contributions_only') {
+ if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
+ 'contributions_only'
+ ) {
$title = '%1 contributions: %2';
- } else if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) == 'soft_credits_only') {
+ }
+ else if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
+ 'soft_credits_only'
+ ) {
$title = '%1 soft-credits: %2';
}
foreach ($totals as $key => $total) {
*/
function __construct() {
$yearsInPast = 4;
- $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, 0);
- $count = $date['maxYear'];
- $optionYear = array('' => ts('- select -'));
+ $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, 0);
+ $count = $date['maxYear'];
+ $optionYear = array('' => ts('- select -'));
$this->_yearStatisticsFrom = $date['minYear'];
$this->_yearStatisticsTo = $date['maxYear'];
}
$this->_columns = array(
- 'civicrm_contact' =>
- array(
- 'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'),
- 'default' => TRUE,
- 'required' => TRUE,
- 'no_repeat' => TRUE,
+ 'civicrm_contact' => array(
+ 'dao' => 'CRM_Contact_DAO_Contact',
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ 'default' => TRUE,
+ 'required' => TRUE,
+ 'no_repeat' => TRUE,
+ ),
+ 'id' => array(
+ 'no_display' => TRUE,
+ 'default' => TRUE,
+ 'required' => TRUE,
+ ),
+ 'contact_type' => array(
+ 'title' => ts('Contact Type'),
+ ),
+ 'contact_sub_type' => array(
+ 'title' => ts('Contact Subtype'),
+ ),
),
- 'id' =>
- array(
- 'no_display' => TRUE,
- 'default' => TRUE,
- 'required' => TRUE,
- ),
- 'contact_type' =>
- array(
- 'title' => ts('Contact Type'),
- ),
- 'contact_sub_type' =>
- array(
- 'title' => ts('Contact Subtype'),
+ 'grouping' => 'contact-fields',
+ 'filters' => array(
+ 'sort_name' => array('title' => ts('Contact Name')),
+ 'id' => array(
+ 'title' => ts('Contact ID'),
+ 'no_display' => TRUE,
+ ),
),
),
- 'grouping' => 'contact-fields',
- 'filters' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name')),
- 'id' =>
- array('title' => ts('Contact ID'),
- 'no_display' => TRUE,
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
+ 'no_repeat' => TRUE,
+ ),
),
+ 'grouping' => 'contact-fields',
),
- ),
- 'civicrm_email' =>
- array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email' =>
- array('title' => ts('Email'),
- 'no_repeat' => TRUE,
+ 'civicrm_phone' => array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone'),
+ 'no_repeat' => TRUE,
+ ),
),
+ 'grouping' => 'contact-fields',
),
- 'grouping' => 'contact-fields',
- ),
- 'civicrm_phone' =>
- array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone' =>
- array('title' => ts('Phone'),
- 'no_repeat' => TRUE,
+ ) + $this->addAddressFields(FALSE, FALSE, FALSE, array()) + array(
+ 'civicrm_relationship' => array(
+ 'dao' => 'CRM_Contact_DAO_Relationship',
+ 'fields' => array(
+ 'relationship_type_id' => array(
+ 'title' => ts('Relationship Type'),
+ 'default' => TRUE,
+ ),
+ 'contact_id_a' => array('no_display' => TRUE),
+ 'contact_id_b' => array('no_display' => TRUE),
),
- ),
- 'grouping' => 'contact-fields',
- ),
- ) + $this->addAddressFields(FALSE, FALSE, FALSE, array(
- )) + array('civicrm_relationship' =>
- array(
- 'dao' => 'CRM_Contact_DAO_Relationship',
- 'fields' =>
- array(
- 'relationship_type_id' =>
- array('title' => ts('Relationship Type'),
- 'default' => TRUE,
- ),
- 'contact_id_a' =>
- array('no_display' => TRUE),
- 'contact_id_b' =>
- array('no_display' => TRUE),
- ),
- 'filters' =>
- array(
- 'relationship_type_id' =>
- array('title' => ts('Relationship Type'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => $relationTypeOp,
- 'type' => CRM_Utils_Type::T_STRING,
+ 'filters' => array(
+ 'relationship_type_id' => array(
+ 'title' => ts('Relationship Type'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => $relationTypeOp,
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
),
),
- ),
- ) + array(
- 'civicrm_contribution' =>
- array(
- 'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' =>
- array(
- 'total_amount' =>
- array('title' => ts('Amount Statistics'),
- 'default' => TRUE,
- 'required' => TRUE,
- 'no_display' => TRUE,
- 'statistics' =>
- array('sum' => ts('Aggregate Amount')),
- ),
- 'receive_date' =>
- array(
- 'required' => TRUE,
- 'default' => TRUE,
- 'no_display' => TRUE,
- ),
- ),
- 'grouping' => 'contri-fields',
- 'filters' =>
- array(
- 'this_year' =>
- array(
- 'title' => ts('This Year'),
- 'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => $optionYear,
- 'default' => '',
- ),
- 'other_year' =>
- array(
- 'title' => ts('Other Years'),
- 'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => $optionYear,
- 'default' => '',
+ ) + array(
+ 'civicrm_contribution' => array(
+ 'dao' => 'CRM_Contribute_DAO_Contribution',
+ 'fields' => array(
+ 'total_amount' => array(
+ 'title' => ts('Amount Statistics'),
+ 'default' => TRUE,
+ 'required' => TRUE,
+ 'no_display' => TRUE,
+ 'statistics' => array('sum' => ts('Aggregate Amount')),
+ ),
+ 'receive_date' => array(
+ 'required' => TRUE,
+ 'default' => TRUE,
+ 'no_display' => TRUE,
+ ),
),
- '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),
- ),
- 'financial_type_id' => array(
- 'title' => ts('Financial Type'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::financialType(),
- ),
- 'total_amount' =>
- array('title' => ts('Contribution Amount'),
- ),
- 'total_sum' =>
- array('title' => ts('Aggregate Amount'),
- 'type' => CRM_Report_Form::OP_INT,
- 'dbAlias' => 'civicrm_contribution_total_amount_sum',
- 'having' => TRUE,
+ 'grouping' => 'contri-fields',
+ 'filters' => array(
+ 'this_year' => array(
+ 'title' => ts('This Year'),
+ 'operatorType' => CRM_Report_Form::OP_SELECT,
+ 'options' => $optionYear,
+ 'default' => '',
+ ),
+ 'other_year' => array(
+ 'title' => ts('Other Years'),
+ 'operatorType' => CRM_Report_Form::OP_SELECT,
+ 'options' => $optionYear,
+ 'default' => '',
+ ),
+ '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),
+ ),
+ 'financial_type_id' => array(
+ 'title' => ts('Financial Type'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Contribute_PseudoConstant::financialType(),
+ ),
+ 'total_amount' => array(
+ 'title' => ts('Contribution Amount'),
+ ),
+ 'total_sum' => array(
+ 'title' => ts('Aggregate Amount'),
+ 'type' => CRM_Report_Form::OP_INT,
+ 'dbAlias' => 'civicrm_contribution_total_amount_sum',
+ 'having' => TRUE,
+ ),
),
),
- ),
- );
+ );
- $this->_columns['civicrm_contribution']['fields']['civicrm_upto_' . $this->_yearStatisticsFrom] = array('title' => ts('Up To %1 Donation', array(1 => $this->_yearStatisticsFrom)),
+ $this->_columns['civicrm_contribution']['fields']['civicrm_upto_' .
+ $this->_yearStatisticsFrom] = array(
+ 'title' => ts('Up To %1 Donation', array(1 => $this->_yearStatisticsFrom)),
'default' => TRUE,
'type' => CRM_Utils_Type::T_MONEY,
'is_statistics' => TRUE,
$yearConter = $this->_yearStatisticsFrom;
$yearConter++;
while ($yearConter <= $this->_yearStatisticsTo) {
- $this->_columns['civicrm_contribution']['fields'][$yearConter] = array('title' => ts('%1 Donation', array(1 => $yearConter)),
+ $this->_columns['civicrm_contribution']['fields'][$yearConter] = array(
+ 'title' => ts('%1 Donation', array(1 => $yearConter)),
'default' => TRUE,
'type' => CRM_Utils_Type::T_MONEY,
'is_statistics' => TRUE,
$yearConter++;
}
- $this->_columns['civicrm_contribution']['fields']['aggregate_amount'] = array('title' => ts('Aggregate Amount'),
+ $this->_columns['civicrm_contribution']['fields']['aggregate_amount'] = array(
+ 'title' => ts('Aggregate Amount'),
'type' => CRM_Utils_Type::T_MONEY,
'is_statistics' => TRUE,
);
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
}
continue;
}
elseif ($fieldName == 'receive_date') {
- if ((CRM_Utils_Array::value('this_year_op', $this->_params) == 'fiscal' && !empty($this->_params['this_year_value'])) ||
- (CRM_Utils_Array::value('other_year_op', $this->_params == 'fiscal') && !empty($this->_params['other_year_value']))){
- $select[] = self::fiscalYearOffset($field['dbAlias']) . " as {$tableName}_{$fieldName}";
- }else{
- $select[] = " YEAR(".$field['dbAlias'].")" . " as {$tableName}_{$fieldName}";
- }
+ if ((CRM_Utils_Array::value('this_year_op', $this->_params) ==
+ 'fiscal' && !empty($this->_params['this_year_value'])) ||
+ (CRM_Utils_Array::value('other_year_op', $this->_params ==
+ 'fiscal') && !empty($this->_params['other_year_value']))
+ ) {
+ $select[] = self::fiscalYearOffset($field['dbAlias']) .
+ " as {$tableName}_{$fieldName}";
+ }
+ else {
+ $select[] = " YEAR(" . $field['dbAlias'] . ")" .
+ " as {$tableName}_{$fieldName}";
+ }
}
elseif ($fieldName == 'total_amount') {
$select[] = "SUM({$field['dbAlias']}) as {$tableName}_{$fieldName}";
$clause = NULL;
if ($fieldName == 'this_year' || $fieldName == 'other_year') {
continue;
- }elseif (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+ }
+ elseif (CRM_Utils_Array::value('type', $field) &
+ CRM_Utils_Type::T_DATE
+ ) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
if (!empty($relationshipWhere)) {
- $this->_relationshipWhere = ' AND ' . implode(' AND ', $relationshipWhere);
+ $this->_relationshipWhere = ' AND ' .
+ implode(' AND ', $relationshipWhere);
}
}
$count++;
}
}
- $statistics['counts']['rowCount'] = array('title' => ts('Primary Contact(s) Listed'),
+ $statistics['counts']['rowCount'] = array(
+ 'title' => ts('Primary Contact(s) Listed'),
'value' => $count,
);
if ($this->_rowsFound && ($this->_rowsFound > $count)) {
- $statistics['counts']['rowsFound'] = array('title' => ts('Total Primary Contact(s)'),
+ $statistics['counts']['rowsFound'] = array(
+ 'title' => ts('Total Primary Contact(s)'),
'value' => $this->_rowsFound,
);
}
*/
static function formRule($fields, $files, $self) {
$errors = array();
- if (!empty($fields['this_year_value']) && !empty($fields['other_year_value']) &&
+ if (!empty($fields['this_year_value']) &&
+ !empty($fields['other_year_value']) &&
($fields['this_year_value'] == $fields['other_year_value'])
) {
$errors['other_year_value'] = ts("Value for filters 'This Year' and 'Other Years' can not be same.");
$addWhere = '';
if (!empty($this->_referenceYear['other_year'])) {
- (CRM_Utils_Array::value('other_year_op', $this->_params) == 'calendar') ? $other_receive_date = 'YEAR (contri.receive_date)' : $other_receive_date = self::fiscalYearOffset('contri.receive_date');
- $addWhere .= " AND {$this->_aliases['civicrm_contact']}.id NOT IN ( SELECT DISTINCT cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND {$other_receive_date} = {$this->_referenceYear['other_year']} AND contri.is_test = 0 ) ";
+ (CRM_Utils_Array::value('other_year_op', $this->_params) ==
+ 'calendar') ? $other_receive_date = 'YEAR (contri.receive_date)' : $other_receive_date = self::fiscalYearOffset('contri.receive_date');
+ $addWhere .= " AND {$this->_aliases['civicrm_contact']}.id NOT IN ( SELECT DISTINCT cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND {$other_receive_date} = {$this->_referenceYear['other_year']} AND contri.is_test = 0 ) ";
}
if (!empty($this->_referenceYear['this_year'])) {
- (CRM_Utils_Array::value('this_year_op', $this->_params) == 'calendar') ? $receive_date = 'YEAR (contri.receive_date)' : $receive_date = self::fiscalYearOffset('contri.receive_date');
- $addWhere .= " AND {$this->_aliases['civicrm_contact']}.id IN ( SELECT DISTINCT cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND {$receive_date} = {$this->_referenceYear['this_year']} AND contri.is_test = 0 ) ";
+ (CRM_Utils_Array::value('this_year_op', $this->_params) ==
+ 'calendar') ? $receive_date = 'YEAR (contri.receive_date)' : $receive_date = self::fiscalYearOffset('contri.receive_date');
+ $addWhere .= " AND {$this->_aliases['civicrm_contact']}.id IN ( SELECT DISTINCT cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND {$receive_date} = {$this->_referenceYear['this_year']} AND contri.is_test = 0 ) ";
}
$this->limit();
$getContacts = "SELECT SQL_CALC_FOUND_ROWS {$this->_aliases['civicrm_contact']}.id as cid, SUM({$this->_aliases['civicrm_contribution']}.total_amount) as civicrm_contribution_total_amount_sum {$this->_from} {$this->_where} {$addWhere} GROUP BY {$this->_aliases['civicrm_contact']}.id {$this->_having} {$this->_limit}";
$relatedContributions = $this->buildContributionRows($relatedContactIds);
- $summaryYears = array();
+ $summaryYears = array();
$summaryYears[] = "civicrm_upto_{$this->_yearStatisticsFrom}";
- $yearConter = $this->_yearStatisticsFrom;
+ $yearConter = $this->_yearStatisticsFrom;
$yearConter++;
while ($yearConter <= $this->_yearStatisticsTo) {
$summaryYears[] = $yearConter;
return $rows;
}
- $sqlContribution = "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" . implode(',', $contactIds) . ") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} ";
+ $sqlContribution =
+ "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" .
+ implode(',', $contactIds) .
+ ") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} ";
- $dao = CRM_Core_DAO::executeQuery($sqlContribution);
+ $dao = CRM_Core_DAO::executeQuery($sqlContribution);
$contributionSum = 0;
- $yearcal = array();
+ $yearcal = array();
while ($dao->fetch()) {
if (!$dao->civicrm_contact_id) {
continue;
}
}
if ($dao->civicrm_contribution_receive_date) {
- if ($dao->civicrm_contribution_receive_date > $this->_yearStatisticsFrom) {
+ if ($dao->civicrm_contribution_receive_date >
+ $this->_yearStatisticsFrom
+ ) {
$rows[$dao->civicrm_contact_id][$dao->civicrm_contribution_receive_date] = $dao->civicrm_contribution_total_amount;
}
else {
if (!empty($this->_relationshipColumns)) {
$addRelSelect = ', ' . implode(', ', $this->_relationshipColumns);
}
- $sqlRelationship = "SELECT {$this->_aliases['civicrm_relationship']}.relationship_type_id as relationship_type_id, {$this->_aliases['civicrm_relationship']}.contact_id_a as contact_id_a, {$this->_aliases['civicrm_relationship']}.contact_id_b as contact_id_b {$addRelSelect} FROM civicrm_contact {$relContactAlias} {$this->_relationshipFrom} WHERE {$relContactAlias}.id IN (" . implode(',', $contactIds) . ") AND {$this->_aliases['civicrm_relationship']}.is_active = 1 {$this->_relationshipWhere} GROUP BY {$this->_aliases['civicrm_relationship']}.contact_id_a, {$this->_aliases['civicrm_relationship']}.contact_id_b";
+ $sqlRelationship =
+ "SELECT {$this->_aliases['civicrm_relationship']}.relationship_type_id as relationship_type_id, {$this->_aliases['civicrm_relationship']}.contact_id_a as contact_id_a, {$this->_aliases['civicrm_relationship']}.contact_id_b as contact_id_b {$addRelSelect} FROM civicrm_contact {$relContactAlias} {$this->_relationshipFrom} WHERE {$relContactAlias}.id IN (" .
+ implode(',', $contactIds) .
+ ") AND {$this->_aliases['civicrm_relationship']}.is_active = 1 {$this->_relationshipWhere} GROUP BY {$this->_aliases['civicrm_relationship']}.contact_id_a, {$this->_aliases['civicrm_relationship']}.contact_id_b";
$relationshipTypes = CRM_Core_PseudoConstant::relationshipType();
$dao = CRM_Core_DAO::executeQuery($sqlRelationship);
*/
function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'this_year' || $fieldName == 'other_year') {
- return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting'));
+ return array(
+ 'calendar' => ts('Is Calendar Year'),
+ 'fiscal' => ts('Fiscal Year Starting')
+ );
}
return parent::getOperationPair($type, $fieldName);
}
}
// Convert Display name into link
- if (!empty($row['civicrm_contact_sort_name']) && !empty($row['civicrm_contact_id'])) {
+ if (!empty($row['civicrm_contact_sort_name']) &&
+ !empty($row['civicrm_contact_id'])
+ ) {
$url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
$this->_absoluteUrl, $this->_id
}
}
}
- }
+}
'civicrm_contact_household' => array(
'dao' => 'CRM_Contact_DAO_Contact',
'fields' => array(
- 'household_name' =>
- array(
- 'title' => ts('Household Name'),
- 'required' => TRUE,
- ),
+ 'household_name' => array(
+ 'title' => ts('Household Name'),
+ 'required' => TRUE,
+ ),
'id' => array(
'no_display' => TRUE,
'required' => TRUE,
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
}
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
if ($op) {
if ($fieldName == 'relationship_type_id') {
- $clause = "{$this->_aliases['civicrm_relationship']}.relationship_type_id=" . $this->relationshipId;
+ $clause =
+ "{$this->_aliases['civicrm_relationship']}.relationship_type_id=" .
+ $this->relationshipId;
}
else {
$clause = $this->whereClause($field,
function postProcess() {
$this->beginPostProcess();
- $this->buildACLClause(array($this->_aliases['civicrm_contact'], $this->_aliases['civicrm_contact_household']));
+ $this->buildACLClause(array(
+ $this->_aliases['civicrm_contact'],
+ $this->_aliases['civicrm_contact_household']
+ ));
$sql = $this->buildQuery(TRUE);
$rows = array();
//replace retionship id by relationship name
if (array_key_exists('civicrm_relationship_relationship_type_id', $row)) {
if ($value = $row['civicrm_relationship_relationship_type_id']) {
- $rows[$rowNum]['civicrm_relationship_relationship_type_id'] = $this->relationTypes[$value . '_' . $type];
+ $rows[$rowNum]['civicrm_relationship_relationship_type_id'] = $this->relationTypes[
+ $value . '_' . $type];
$entryFound = TRUE;
}
}
//remove duplicate Organization names
- if (array_key_exists('civicrm_contact_household_household_name', $row) && $this->_outputMode != 'csv') {
+ if (array_key_exists('civicrm_contact_household_household_name', $row) &&
+ $this->_outputMode != 'csv'
+ ) {
if ($value = $row['civicrm_contact_household_household_name']) {
if ($rowNum == 0) {
$priviousHousehold = $value;
);
$rows[$rowNum]['civicrm_contact_household_household_name'] =
- "<a href='$url' title='" . ts('View contact summary for this househould') . "'>" . $value . '</a>';
+ "<a href='$url' title='" .
+ ts('View contact summary for this househould') . "'>" . $value .
+ '</a>';
}
$entryFound = TRUE;
}
}
//remove duplicate Contact names and relationship type
- if (array_key_exists('civicrm_contact_id', $row) && $this->_outputMode != 'csv') {
+ if (array_key_exists('civicrm_contact_id', $row) &&
+ $this->_outputMode != 'csv'
+ ) {
if ($value = $row['civicrm_contact_id']) {
if ($rowNum == 0) {
$priviousContact = $value;
CRM_Core_Permission::check('access CiviContribute')
) {
$url = CRM_Utils_System::url("civicrm/contact/view/contribution",
- "reset=1&id=" . $row['civicrm_contribution_id'] . "&cid=" . $row['civicrm_contact_id'] .
+ "reset=1&id=" . $row['civicrm_contribution_id'] . "&cid=" .
+ $row['civicrm_contact_id'] .
"&action=view&context=contribution&selectedChild=contribute",
$this->_absoluteUrl
);
*
*/
function __construct() {
- $yearsInPast = 10;
+ $yearsInPast = 10;
$yearsInFuture = 1;
- $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
- $count = $date['maxYear'];
+ $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
+ $count = $date['maxYear'];
while ($date['minYear'] <= $count) {
$optionYear[$date['minYear']] = $date['minYear'];
$date['minYear']++;
}
$this->_columns = array(
- 'civicrm_contact' =>
- array(
- 'dao' => 'CRM_Contact_DAO_Contact',
- 'grouping' => 'contact-field',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Donor Name'),
- 'default' => TRUE,
- 'required' => TRUE,
+ 'civicrm_contact' => array(
+ 'dao' => 'CRM_Contact_DAO_Contact',
+ 'grouping' => 'contact-field',
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Donor Name'),
+ 'default' => TRUE,
+ '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'),
+ ),
),
- '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',
+ '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_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,
+ '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,
+ )
+ + $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,
+ ),
),
- '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'),
+ ),
),
),
- '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'),
- ),
- ),
- ),
- );
+ );
// If we have a campaign, build out the relevant elements
if ($campaignEnabled && !empty($this->activeCampaigns)) {
'title' => ts('Campaign'),
'default' => 'false',
);
- $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'),
+ $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activeCampaigns,
);
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($fieldName == 'total_amount') {
$select[] = "SUM({$field['dbAlias']}) as {$tableName}_{$fieldName}";
$this->_columnHeaders["civicrm_life_time_total"]['title'] = 'LifeTime';;
}
elseif ($fieldName == 'receive_date') {
- $select[] = self::fiscalYearOffset($field['dbAlias']) . " as {$tableName}_{$fieldName} ";
+ $select[] = self::fiscalYearOffset($field['dbAlias']) .
+ " as {$tableName}_{$fieldName} ";
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName} ";
function where() {
$this->_statusClause = "";
- $clauses = array($this->_aliases['civicrm_contribution'] . '.is_test = 0');
- $current_year = $this->_params['yid_value'];
- $previous_year = $current_year - 1;
+ $clauses = array($this->_aliases['civicrm_contribution'] . '.is_test = 0');
+ $current_year = $this->_params['yid_value'];
+ $previous_year = $current_year - 1;
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('filters', $table)) {
if ($fieldName == 'yid') {
$clause = "contribution_civireport.contact_id NOT IN
(SELECT distinct contri.contact_id FROM civicrm_contribution contri
- WHERE contri.is_test = 0 AND " . self::fiscalYearOffset('contri.receive_date') . " = $current_year) AND contribution_civireport.contact_id IN (SELECT distinct contri.contact_id FROM civicrm_contribution contri
- WHERE " . self::fiscalYearOffset('contri.receive_date') . " = $previous_year AND contri.is_test = 0)";
+ WHERE contri.is_test = 0 AND " .
+ self::fiscalYearOffset('contri.receive_date') . " = $current_year) AND contribution_civireport.contact_id IN (SELECT distinct contri.contact_id FROM civicrm_contribution contri
+ WHERE " . self::fiscalYearOffset('contri.receive_date') .
+ " = $previous_year AND contri.is_test = 0)";
}
- elseif (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+ elseif (CRM_Utils_Array::value('type', $field) &
+ CRM_Utils_Type::T_DATE
+ ) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
CRM_Utils_Array::value("{$fieldName}_min", $this->_params),
CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
);
- if (($fieldName == 'contribution_status_id' || $fieldName == 'financial_type_id') && !empty($clause)) {
+ if (($fieldName == 'contribution_status_id' ||
+ $fieldName == 'financial_type_id') && !empty($clause)
+ ) {
$this->_statusClause .= " AND " . $clause;
}
}
}
function groupBy() {
- $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_contribution']}.contact_id, " . self::fiscalYearOffset($this->_aliases['civicrm_contribution'] . '.receive_date') . " WITH ROLLUP";
+ $this->_groupBy =
+ "GROUP BY {$this->_aliases['civicrm_contribution']}.contact_id, " .
+ self::fiscalYearOffset($this->_aliases['civicrm_contribution'] .
+ '.receive_date') . " WITH ROLLUP";
$this->assign('chartSupported', TRUE);
}
$sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
}
else {
- $sql = "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" . implode(',', $contactIds) . ") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} ";
+ $sql =
+ "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" .
+ implode(',', $contactIds) .
+ ") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} ";
}
- $dao = CRM_Core_DAO::executeQuery($sql);
- $current_year = $this->_params['yid_value'];
+ $dao = CRM_Core_DAO::executeQuery($sql);
+ $current_year = $this->_params['yid_value'];
$previous_year = $current_year - 1;
while ($dao->fetch()) {
function buildChart(&$rows) {
$graphRows = array();
- $count = 0;
- $display = array();
+ $count = 0;
+ $display = array();
$current_year = $this->_params['yid_value'];
$previous_year = $current_year - 1;
$interval['life_time'] = 'Life Time';
foreach ($rows as $key => $row) {
- $display['life_time'] = CRM_Utils_Array::value('life_time', $display) + $row['civicrm_life_time_total'];
- $display[$previous_year] = CRM_Utils_Array::value($previous_year, $display) + $row[$previous_year];
+ $display['life_time'] = CRM_Utils_Array::value('life_time', $display) +
+ $row['civicrm_life_time_total'];
+ $display[$previous_year] =
+ CRM_Utils_Array::value($previous_year, $display) + $row[$previous_year];
}
- $config = CRM_Core_Config::Singleton();
+ $config = CRM_Core_Config::Singleton();
$graphRows['value'] = $display;
- $chartInfo = array('legend' => ts('Lybunt Report'),
+ $chartInfo = array(
+ 'legend' => ts('Lybunt Report'),
'xname' => ts('Year'),
'yname' => ts('Amount (%1)', array(1 => $config->defaultCurrency)),
);
array_key_exists('civicrm_contribution_contact_id', $row)
) {
$url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
- 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contribution_contact_id'],
+ 'reset=1&force=1&id_op=eq&id_value=' .
+ $row['civicrm_contribution_contact_id'],
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
$rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
*/
function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'yid') {
- return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting'));
+ return array(
+ 'calendar' => ts('Is Calendar Year'),
+ 'fiscal' => ts('Fiscal Year Starting')
+ );
}
return parent::getOperationPair($type, $fieldName);
}
*/
function __construct() {
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Supporter'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Supporter'),
'required' => TRUE,
'default' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'required' => TRUE,
'no_display' => TRUE,
),
- 'contact_type' =>
- array(
+ 'contact_type' => array(
'title' => ts('Supporter Contact Type'),
),
- 'contact_sub_type' =>
- array(
+ 'contact_sub_type' => array(
'title' => ts('Supporter Contact Subtype'),
),
),
- 'filters' =>
- array(
- 'sort_name' =>
- array('title' => ts('Supporter Name'),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Supporter Name'),
'type' => CRM_Utils_Type::T_STRING,
'operator' => 'like',
),
- 'id' =>
- array('title' => ts('Contact ID'),
+ 'id' => array(
+ 'title' => ts('Contact ID'),
'no_display' => TRUE,
),
),
'grouping' => 'pcp-fields',
),
- 'civicrm_contribution_page' =>
- array(
+ 'civicrm_contribution_page' => array(
'dao' => 'CRM_Contribute_DAO_ContributionPage',
- 'fields' =>
- array(
- 'page_title' =>
- array('title' => ts('Contribution Page Title'),
+ 'fields' => array(
+ 'page_title' => array(
+ 'title' => ts('Contribution Page Title'),
'name' => 'title',
'default' => TRUE,
),
),
- 'filters' =>
- array(
- 'page_title' =>
- array('title' => ts('Contribution Page Title'),
+ 'filters' => array(
+ 'page_title' => array(
+ 'title' => ts('Contribution Page Title'),
'name' => 'title',
'type' => CRM_Utils_Type::T_STRING,
),
),
'grouping' => 'pcp-fields',
),
- 'civicrm_pcp' =>
- array(
+ 'civicrm_pcp' => array(
'dao' => 'CRM_PCP_DAO_PCP',
- 'fields' =>
- array(
- 'title' =>
- array('title' => ts('Personal Campaign Title'),
+ 'fields' => array(
+ 'title' => array(
+ 'title' => ts('Personal Campaign Title'),
'default' => TRUE,
),
- 'goal_amount' =>
- array('title' => ts('Goal Amount'),
+ 'goal_amount' => array(
+ 'title' => ts('Goal Amount'),
'type' => CRM_Utils_Type::T_MONEY,
'default' => TRUE,
),
),
- 'filters' =>
- array(
- 'title' =>
- array('title' => ts('Personal Campaign Title'),
+ 'filters' => array(
+ 'title' => array(
+ 'title' => ts('Personal Campaign Title'),
'type' => CRM_Utils_Type::T_STRING,
),
),
'grouping' => 'pcp-fields',
),
- 'civicrm_contribution_soft' =>
- array(
+ 'civicrm_contribution_soft' => array(
'dao' => 'CRM_Contribute_DAO_ContributionSoft',
- 'fields' =>
- array(
- 'amount_1' =>
- array('title' => ts('Committed Amount'),
+ 'fields' => array(
+ 'amount_1' => array(
+ 'title' => ts('Committed Amount'),
'name' => 'amount',
'type' => CRM_Utils_Type::T_MONEY,
'default' => TRUE,
- 'statistics' =>
- array('sum' => ts('Committed Amount'),
+ 'statistics' => array(
+ 'sum' => ts('Committed Amount'),
),
),
- 'amount_2' =>
- array('title' => ts('Amount Received'),
+ 'amount_2' => array(
+ 'title' => ts('Amount Received'),
'name' => 'amount',
'type' => CRM_Utils_Type::T_MONEY,
'default' => TRUE,
// nice trick with dbAlias
'dbAlias' => 'SUM(IF( contribution_civireport.contribution_status_id > 1, 0, contribution_soft_civireport.amount))',
),
- 'soft_id' =>
- array('title' => ts('Number of Donors'),
+ 'soft_id' => array(
+ 'title' => ts('Number of Donors'),
'name' => 'id',
'default' => TRUE,
- 'statistics' =>
- array('count' => ts('Number of Donors'),
+ 'statistics' => array(
+ 'count' => ts('Number of Donors'),
),
),
),
- 'filters' =>
- array(
- 'amount_2' =>
- array('title' => ts('Amount Received'),
+ 'filters' => array(
+ 'amount_2' => array(
+ 'title' => ts('Amount Received'),
'type' => CRM_Utils_Type::T_MONEY,
'dbAlias' => 'SUM(IF( contribution_civireport.contribution_status_id > 1, 0, contribution_soft_civireport.amount))',
),
),
'grouping' => 'pcp-fields',
),
- 'civicrm_contribution' =>
- array(
+ 'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' =>
- array(
- 'contribution_id' =>
- array(
+ 'fields' => array(
+ 'contribution_id' => array(
'name' => 'id',
'no_display' => TRUE,
'required' => TRUE,
),
- 'receive_date' =>
- array('title' => ts('Most Recent Contribution'),
+ 'receive_date' => array(
+ 'title' => ts('Most Recent Contribution'),
'default' => TRUE,
- 'statistics' =>
- array('max' => ts('Most Recent Contribution'),
+ 'statistics' => array(
+ 'max' => ts('Most Recent Contribution'),
),
),
),
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
- $clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
else {
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
function statistics(&$rows) {
$statistics = parent::statistics($rows);
- $select = "SELECT SUM({$this->_aliases['civicrm_pcp']}.goal_amount) as goal_total, ".
- "SUM({$this->_aliases['civicrm_contribution_soft']}.amount) as committed_total, ".
- "COUNT({$this->_aliases['civicrm_contribution_soft']}.id) as donors_total, ".
+ $select =
+ "SELECT SUM({$this->_aliases['civicrm_pcp']}.goal_amount) as goal_total, " .
+ "SUM({$this->_aliases['civicrm_contribution_soft']}.amount) as committed_total, " .
+ "COUNT({$this->_aliases['civicrm_contribution_soft']}.id) as donors_total, " .
"SUM(IF( contribution_civireport.contribution_status_id > 1, 0, contribution_soft_civireport.amount)) AS received_total ";
$sql = "{$select} {$this->_from} {$this->_where}";
$dao = CRM_Core_DAO::executeQuery($sql);
*/
function __construct() {
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
'grouping' => 'contact-fields',
- 'fields' =>
- array(
- 'sort_name' =>
- array(
+ 'fields' => array(
+ 'sort_name' => array(
'title' => ts('Contact Name'),
'no_repeat' => TRUE,
'default' => TRUE,
),
- 'display_name' =>
- array(
+ 'display_name' => array(
'title' => ts('Display Name'),
'no_repeat' => TRUE,
),
- 'addressee_display' =>
- array(
+ 'addressee_display' => array(
'title' => ts('Addressee Name'),
'no_repeat' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'contact_type' =>
- array(
+ 'contact_type' => array(
'title' => ts('Contact Type'),
'no_repeat' => TRUE,
),
- 'contact_sub_type' =>
- array(
+ 'contact_sub_type' => array(
'title' => ts('Contact Subtype'),
'no_repeat' => TRUE,
),
),
- 'filters' =>
- array(
- 'percentage_change' =>
- array(
+ 'filters' => array(
+ 'percentage_change' => array(
'title' => ts('Percentage Change'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_INT,
'dbAlias' => '( ( contribution_civireport2.total_amount_sum - contribution_civireport1.total_amount_sum ) * 100 / contribution_civireport1.total_amount_sum )',
),
),
- 'group_bys' =>
- array(
- 'id' =>
- array(
+ 'group_bys' => array(
+ 'id' => array(
'title' => ts('Contact'),
'default' => TRUE,
),
),
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email' =>
- array(
+ 'fields' => array(
+ 'email' => array(
'title' => ts('Email'),
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone' =>
- array(
+ 'fields' => array(
+ 'phone' => array(
'title' => ts('Phone'),
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
'grouping' => 'contact-fields',
- 'fields' =>
- array(
+ 'fields' => array(
'street_address' => array('title' => ts('Street Address')),
'supplemental_address_1' => array('title' => ts('Supplemental Address 1')),
'city' => array('title' => ts('City')),
'state_province_id' => array('title' => ts('State/Province')),
'postal_code' => array('title' => ts('Postal Code')),
),
- 'group_bys' =>
- array(
+ 'group_bys' => array(
'country_id' => array('title' => ts('Country')),
- 'state_province_id' => array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
),
),
- 'civicrm_financial_type' =>
- array(
+ 'civicrm_financial_type' => array(
'dao' => 'CRM_Financial_DAO_FinancialType',
'fields' => array('financial_type' => array('title' => ts('Financial Type'))),
- 'grouping' => 'contri-fields',
- 'group_bys' =>
- array('financial_type' =>
- array(
- 'name' => 'id',
- 'title' => ts('Financial Type'),
- ),
+ 'grouping' => 'contri-fields',
+ 'group_bys' => array(
+ 'financial_type' => array(
+ 'name' => 'id',
+ 'title' => ts('Financial Type'),
+ ),
),
),
- 'civicrm_contribution' =>
- array(
+ 'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' =>
- array(
+ 'fields' => array(
'contribution_source' => NULL,
- 'total_amount1' =>
- array(
+ 'total_amount1' => array(
'name' => 'total_amount',
'alias' => 'contribution1',
'title' => ts('Range One Stat'),
contribution_civireport1.total_amount_count as contribution1_total_amount_count,
contribution_civireport1.total_amount_sum as contribution1_total_amount_sum',
),
- 'total_amount2' =>
- array(
+ 'total_amount2' => array(
'name' => 'total_amount',
'alias' => 'contribution2',
'title' => ts('Range Two Stat'),
),
),
'grouping' => 'contri-fields',
- 'filters' =>
- array(
- 'receive_date1' =>
- array(
+ 'filters' => array(
+ 'receive_date1' => array(
'title' => ts('Initial Date Range'),
'default' => 'previous.year',
'type' => CRM_Utils_Type::T_DATE,
'operatorType' => CRM_Report_Form::OP_DATE,
'name' => 'receive_date',
),
- 'receive_date2' =>
- array(
+ 'receive_date2' => array(
'title' => ts('Second Date Range'),
'default' => 'this.year',
'type' => CRM_Utils_Type::T_DATE,
'operatorType' => CRM_Report_Form::OP_DATE,
'name' => 'receive_date',
),
- 'total_amount1' =>
- array(
+ 'total_amount1' => array(
'title' => ts('Range One Amount'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_INT,
'name' => 'total_amount',
),
- 'total_amount2' =>
- array(
+ 'total_amount2' => array(
'title' => ts('Range Two Amount'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_INT,
'name' => 'total_amount',
),
- 'financial_type_id' =>
- array(
+ 'financial_type_id' => array(
'title' => ts('Financial Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::financialType(),
),
- 'contribution_status_id' =>
- array(
+ 'contribution_status_id' => array(
'title' => ts('Contribution Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if (isset($field['clause'])) {
$select[] = $field['clause'];
*/
function groupBy($tableCol = FALSE) {
$this->_groupBy = "";
- if (!empty($this->_params['group_bys']) && is_array($this->_params['group_bys'])) {
+ if (!empty($this->_params['group_bys']) &&
+ is_array($this->_params['group_bys'])
+ ) {
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('group_bys', $table)) {
foreach ($table['group_bys'] as $fieldName => $field) {
$from .= "
INNER JOIN civicrm_contact {$this->_aliases['civicrm_contact']} ON {$this->_aliases['civicrm_address']}.contact_id = {$this->_aliases['civicrm_contact']}.id";
$fromAlias = $this->_aliases['civicrm_contact'];
- $fromCol = "id";
+ $fromCol = "id";
$contriCol = "contact_id";
}
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type']);
}
unset($clauses['receive_date1'], $clauses['total_amount1']);
}
- $whereClause = !empty($clauses) ? "WHERE " . implode(' AND ', $clauses) : '';
+ $whereClause = !empty($clauses) ?
+ "WHERE " . implode(' AND ', $clauses) : '';
if ($replaceAliasWith) {
$whereClause = str_replace($this->_aliases['civicrm_contribution'], $replaceAliasWith, $whereClause);
$clauses = array("atleast_one_amount" => $this->_amountClauseWithAND);
foreach ($this->_columns as $tableName => $table) {
- if (array_key_exists('filters', $table) && $tableName != 'civicrm_contribution') {
+ if (array_key_exists('filters', $table) &&
+ $tableName != 'civicrm_contribution'
+ ) {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
}
}
- $this->_where = !empty($clauses) ? "WHERE " . implode(' AND ', $clauses) : '';
+ $this->_where = !empty($clauses) ?
+ "WHERE " . implode(' AND ', $clauses) : '';
}
/**
$errors['fields'] = ts('Please select at least one Group by field.');
}
elseif ((array_key_exists('contribution_source', $fields['group_bys']) ||
- array_key_exists('contribution_type', $fields['group_bys'])
- ) &&
+ array_key_exists('contribution_type', $fields['group_bys'])
+ ) &&
(count($fields['group_bys']) > 1)
) {
$errors['fields'] = ts('You can not use other Group by with Financial type or Contribution source.');
}
if (!$found) {
$erorrGrps = implode(',', $invlidGroups);
- $tempErrors[] = ts("Do not select field %1 with Group by %2.", array(1 => $idMapping[$fld_id], 2 => $erorrGrps));
+ $tempErrors[] = ts("Do not select field %1 with Group by %2.", array(
+ 1 => $idMapping[$fld_id],
+ 2 => $erorrGrps
+ ));
}
}
}
$number_lapsed = 0;
foreach ($contact_sums as $uid => $row) {
- if ($row['contribution1_total_amount_sum'] && $row['contribution2_total_amount_sum']) {
- $change = ($row['contribution1_total_amount_sum'] - $row['contribution2_total_amount_sum']);
- if($change == 0)
+ if ($row['contribution1_total_amount_sum'] &&
+ $row['contribution2_total_amount_sum']
+ ) {
+ $change = ($row['contribution1_total_amount_sum'] -
+ $row['contribution2_total_amount_sum']);
+ if ($change == 0) {
$number_maintained += 1;
- elseif($change > 0)
+ }
+ elseif ($change > 0) {
$number_upgraded += 1;
- elseif($change < 0)
+ }
+ elseif ($change < 0) {
$number_downgraded += 1;
+ }
}
elseif ($row['contribution1_total_amount_sum']) {
- $number_new +=1;
+ $number_new += 1;
}
elseif ($row['contribution2_total_amount_sum']) {
- $number_lapsed +=1;
+ $number_lapsed += 1;
}
}
$count = $count2 = 0;
while ($dao->fetch()) {
if ($dao->amount) {
- $amount[] = CRM_Utils_Money::format($dao->amount, $dao->currency)."(".$dao->count.")";
- $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
+ $amount[] =
+ CRM_Utils_Money::format($dao->amount, $dao->currency) . "(" .
+ $dao->count . ")";
+ $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
}
$count += $dao->count;
if ($dao->amount2) {
- $amount2[] = CRM_Utils_Money::format($dao->amount2, $dao->currency)."(".$dao->count.")";
- $average2[] = CRM_Utils_Money::format($dao->avg2, $dao->currency);
+ $amount2[] =
+ CRM_Utils_Money::format($dao->amount2, $dao->currency) . "(" .
+ $dao->count . ")";
+ $average2[] = CRM_Utils_Money::format($dao->avg2, $dao->currency);
}
$count2 += $dao->count2;
}
$this->limit();
$count = 0;
- $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_limit}";
- $dao = CRM_Core_DAO::executeQuery($sql);
- $rows = array();
+ $sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_limit}";
+ $dao = CRM_Core_DAO::executeQuery($sql);
+ $rows = array();
while ($dao->fetch()) {
foreach ($this->_columnHeaders as $key => $value) {
$rows[$count][$key] = $dao->$key;
// FIXME: calculate % using query
foreach ($rows as $uid => $row) {
- if ($row['contribution1_total_amount_sum'] && $row['contribution2_total_amount_sum']) {
+ if ($row['contribution1_total_amount_sum'] &&
+ $row['contribution2_total_amount_sum']
+ ) {
$rows[$uid]['change'] = number_format((($row['contribution2_total_amount_sum'] -
- $row['contribution1_total_amount_sum']
- ) * 100) /
- ($row['contribution1_total_amount_sum']), 2
+ $row['contribution1_total_amount_sum']
+ ) * 100) /
+ ($row['contribution1_total_amount_sum']), 2
);
}
elseif ($row['contribution1_total_amount_sum']) {
$rows[$uid]['change'] = ts('New Donor');
}
if ($row['contribution1_total_amount_count']) {
- $rows[$uid]['contribution1_total_amount_sum'] = $row['contribution1_total_amount_sum'] . " ({$row['contribution1_total_amount_count']})";
+ $rows[$uid]['contribution1_total_amount_sum'] =
+ $row['contribution1_total_amount_sum'] .
+ " ({$row['contribution1_total_amount_count']})";
}
if ($row['contribution2_total_amount_count']) {
- $rows[$uid]['contribution2_total_amount_sum'] = $row['contribution2_total_amount_sum'] . " ({$row['contribution2_total_amount_count']})";
+ $rows[$uid]['contribution2_total_amount_sum'] =
+ $row['contribution2_total_amount_sum'] .
+ " ({$row['contribution2_total_amount_count']})";
}
}
$this->_columnHeaders['change'] = array(
$this->_columnHeaders['contribution1_total_amount_sum']['title'] = "$from1 -<br/> $to1";
$this->_columnHeaders['contribution2_total_amount_sum']['title'] = "$from2 -<br/> $to2";
unset($this->_columnHeaders['contribution1_total_amount_count'],
- $this->_columnHeaders['contribution2_total_amount_count']
+ $this->_columnHeaders['contribution2_total_amount_count']
);
$this->formatDisplay($rows);
$url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
"reset=1&force=1&" .
- "country_id_op=in&country_id_value={$value}&" .
- "$dateUrl",
+ "country_id_op=in&country_id_value={$value}&" .
+ "$dateUrl",
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
$url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
"reset=1&force=1&" .
- "state_province_id_op=in&state_province_id_value={$value}&" .
- "$dateUrl",
+ "state_province_id_op=in&state_province_id_value={$value}&" .
+ "$dateUrl",
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
}
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'display_name_creditor' =>
- array('title' => ts('Soft Credit Name'),
+ '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'),
+ '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'),
+ 'display_name_constituent' => array(
+ 'title' => ts('Contributor Name'),
'name' => 'sort_name',
'alias' => 'constituentname',
'required' => TRUE,
),
- 'id_constituent' =>
- array('title' => ts('Const Id'),
+ 'id_constituent' => array(
+ 'title' => ts('Const Id'),
'name' => 'id',
'alias' => 'constituentname',
'no_display' => TRUE,
'required' => TRUE,
),
- 'contact_type' =>
- array(
+ 'contact_type' => array(
'title' => ts('Contact Type'),
),
- 'contact_sub_type' =>
- array(
+ 'contact_sub_type' => array(
'title' => ts('Contact Subtype'),
),
),
- 'filters' =>
- array(
- 'sort_name' =>
- array(
+ 'filters' => array(
+ 'sort_name' => array(
'name' => 'sort_name',
'title' => ts('Soft Credit Name')
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email_creditor' =>
- array('title' => ts('Soft Credit 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'),
+ 'email_constituent' => array(
+ 'title' => ts('Contributor\'s Email'),
'name' => 'email',
'alias' => 'emailconst',
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone_creditor' =>
- array('title' => ts('Soft Credit 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'),
+ '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(
+ '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,
),
'grouping' => 'softcredit-fields',
),
- 'civicrm_contribution' =>
- array(
+ 'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' =>
- array(
+ 'fields' => array(
'contribution_source' => NULL,
'currency' => array(
'required' => TRUE,
'no_display' => TRUE,
),
- 'total_amount' =>
- array('title' => ts('Amount Statistics'),
+ 'total_amount' => array(
+ 'title' => ts('Amount Statistics'),
'default' => TRUE,
- 'statistics' =>
- array('sum' => ts('Aggregate Amount'),
+ 'statistics' => array(
+ 'sum' => ts('Aggregate Amount'),
'count' => ts('Contributions'),
'avg' => ts('Average'),
),
),
),
'grouping' => 'softcredit-fields',
- 'filters' =>
- array(
- 'receive_date' =>
- array('operatorType' => CRM_Report_Form::OP_DATE),
- 'currency' =>
- array('title' => 'Currency',
+ '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'),
+ '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'),
+ 'total_amount' => array(
+ 'title' => ts('Contribution Amount'),
),
),
),
- 'civicrm_contribution_soft' =>
- array(
+ 'civicrm_contribution_soft' => array(
'dao' => 'CRM_Contribute_DAO_ContributionSoft',
- 'fields' =>
- array(
- 'contribution_id' =>
- array('title' => ts('Contribution ID'),
+ 'fields' => array(
+ 'contribution_id' => array(
+ 'title' => ts('Contribution ID'),
'no_display' => TRUE,
'default' => TRUE,
),
- 'id' =>
- array(
+ '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',
+ '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,
'title' => ts('Campaign'),
'default' => 'false',
);
- $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'),
+ $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activeCampaigns,
);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
// include email column if set
if ($tableName == 'civicrm_email') {
function from() {
$alias_constituent = 'constituentname';
- $alias_creditor = 'contact_civireport';
- $this->_from = "
+ $alias_creditor = 'contact_civireport';
+ $this->_from = "
FROM civicrm_contribution {$this->_aliases['civicrm_contribution']}
INNER JOIN civicrm_contribution_soft {$this->_aliases['civicrm_contribution_soft']}
ON {$this->_aliases['civicrm_contribution_soft']}.contribution_id =
}
function groupBy() {
- $this->_rollup = 'WITH ROLLUP';
- $this->_groupBy = "
+ $this->_rollup = 'WITH ROLLUP';
+ $this->_groupBy = "
GROUP BY {$this->_aliases['civicrm_contribution_soft']}.contact_id, constituentname.id {$this->_rollup}";
}
$count = 0;
$totalAmount = $average = array();
while ($dao->fetch()) {
- $totalAmount[] = CRM_Utils_Money::format($dao->amount, $dao->currency).'('.$dao->count.')';
- $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
+ $totalAmount[] =
+ CRM_Utils_Money::format($dao->amount, $dao->currency) . '(' .
+ $dao->count . ')';
+ $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
$count += $dao->count;
}
$statistics['counts']['amount'] = array(
$this->buildACLClause(array('constituentname', 'contact_civireport'));
$sql = $this->buildQuery();
- $dao = CRM_Core_DAO::executeQuery($sql);
- $rows = $graphRows = array();
+ $dao = CRM_Core_DAO::executeQuery($sql);
+ $rows = $graphRows = array();
$count = 0;
while ($dao->fetch()) {
$row = array();
function alterDisplay(&$rows) {
// custom code to alter rows
- $entryFound = FALSE;
+ $entryFound = FALSE;
$dispname_flag = $phone_flag = $email_flag = 0;
- $prev_email = $prev_dispname = $prev_phone = NULL;
+ $prev_email = $prev_dispname = $prev_phone = NULL;
foreach ($rows as $rowNum => $row) {
// Link constituent (contributor) to contribution detail
) {
$url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
- 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id_constituent'],
+ 'reset=1&force=1&id_op=eq&id_value=' .
+ $row['civicrm_contact_id_constituent'],
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
$rows[$rowNum]['civicrm_contact_display_name_constituent_link'] = $url;
}
// convert soft credit contact name to link
- if (array_key_exists('civicrm_contact_display_name_creditor', $row) && !empty($rows[$rowNum]['civicrm_contact_display_name_creditor']) &&
+ if (array_key_exists('civicrm_contact_display_name_creditor', $row) &&
+ !empty($rows[$rowNum]['civicrm_contact_display_name_creditor']) &&
array_key_exists('civicrm_contact_id_creditor', $row)
) {
$url = CRM_Utils_System::url("civicrm/contact/view",
*/
function __construct() {
- // Check if CiviCampaign is a) enabled and b) has active campaigns
- $config = CRM_Core_Config::singleton();
+ // 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->_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,
- ),
- 'contact_type' =>
- array(
- 'title' => ts('Contact Type'),
+ '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,
+ ),
+ 'contact_type' => array(
+ 'title' => ts('Contact Type'),
+ ),
+ 'contact_sub_type' => array(
+ 'title' => ts('Contact Subtype'),
+ ),
),
- 'contact_sub_type' =>
- array(
- 'title' => ts('Contact Subtype'),
+ 'grouping' => 'contact-fields',
+ 'group_bys' => array(
+ 'id' => array('title' => ts('Contact ID')),
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ ),
),
),
- '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_email' =>
- array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email' =>
- array('title' => ts('Email'),
- 'no_repeat' => TRUE,
+ 'civicrm_phone' => array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone'),
+ 'no_repeat' => TRUE,
+ ),
),
+ 'grouping' => 'contact-fields',
),
- 'grouping' => 'contact-fields',
- ),
- 'civicrm_phone' =>
- array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone' =>
- array('title' => ts('Phone'),
- 'no_repeat' => TRUE,
+ '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')),
),
),
- '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',
- //'bao' => 'CRM_Contribute_BAO_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('Contribution Aggregate'),
- 'count' => ts('Contributions'),
- 'avg' => ts('Contribution Avg'),
+ 'civicrm_contribution' => array(
+ 'dao' => 'CRM_Contribute_DAO_Contribution',
+ //'bao' => 'CRM_Contribute_BAO_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('Contribution Aggregate'),
+ 'count' => ts('Contributions'),
+ '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' => '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('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,
+ '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' => '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('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,
+ ),
),
- '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'),
+ 'group_bys' => array(
+ 'receive_date' => array(
+ 'frequency' => TRUE,
+ 'default' => TRUE,
+ 'chart' => TRUE,
),
+ 'contribution_source' => NULL,
),
),
- 'grouping' => 'contri-fields',
- 'filters' =>
- array(
- 'amount' =>
- array('title' => ts('Soft Credit Amount'),
- ),
- '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,
- ),
- '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,
+ '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'),
+ ),
+ ),
),
- 'soft_avg' =>
- array('title' => ts('Soft Credit Avg'),
- 'type' => CRM_Report_Form::OP_INT,
- 'dbAlias' => 'civicrm_contribution_soft_soft_amount_avg',
- 'having' => TRUE,
+ 'grouping' => 'contri-fields',
+ 'filters' => array(
+ 'amount' => array(
+ 'title' => ts('Soft Credit Amount'),
+ ),
+ '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,
+ ),
+ '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();
+ ) + $this->addAddressFields();
// If we have a campaign, build out the relevant elements
if ($campaignEnabled && !empty($this->activeCampaigns)) {
'title' => 'Campaign',
'default' => 'false',
);
- $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'),
+ $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activeCampaigns,
);
if (!empty($this->_params['group_bys'][$fieldName])) {
switch (CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq'])) {
case 'YEARWEEK':
- $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
- $select[] = "YEARWEEK({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "WEEKOFYEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
+ $select[] = "YEARWEEK({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "WEEKOFYEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Week';
break;
case 'YEAR':
- $select[] = "MAKEDATE(YEAR({$field['dbAlias']}), 1) AS {$tableName}_{$fieldName}_start";
- $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "MAKEDATE(YEAR({$field['dbAlias']}), 1) AS {$tableName}_{$fieldName}_start";
+ $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Year';
break;
case 'MONTH':
- $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL (DAYOFMONTH({$field['dbAlias']})-1) DAY) as {$tableName}_{$fieldName}_start";
- $select[] = "MONTH({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "MONTHNAME({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL (DAYOFMONTH({$field['dbAlias']})-1) DAY) as {$tableName}_{$fieldName}_start";
+ $select[] = "MONTH({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "MONTHNAME({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Month';
break;
case 'QUARTER':
- $select[] = "STR_TO_DATE(CONCAT( 3 * QUARTER( {$field['dbAlias']} ) -2 , '/', '1', '/', YEAR( {$field['dbAlias']} ) ), '%m/%d/%Y') AS {$tableName}_{$fieldName}_start";
- $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "STR_TO_DATE(CONCAT( 3 * QUARTER( {$field['dbAlias']} ) -2 , '/', '1', '/', YEAR( {$field['dbAlias']} ) ), '%m/%d/%Y') AS {$tableName}_{$fieldName}_start";
+ $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Quarter';
break;
}
if (!empty($this->_params['group_bys_freq'][$fieldName])) {
$this->_interval = $field['title'];
- $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning';
+ $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] =
+ $field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['group_by'] = $this->_params['group_bys_freq'][$fieldName];
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
}
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
// only include statistics columns if set
if (!empty($field['statistics'])) {
}
if (empty($fields['fields']['total_amount'])) {
foreach (array(
- 'total_count_value', 'total_sum_value', 'total_avg_value') as $val) {
+ 'total_count_value',
+ 'total_sum_value',
+ 'total_avg_value'
+ ) as $val) {
if (!empty($fields[$val])) {
$errors[$val] = ts("Please select the Amount Statistics");
}
function from() {
$softCreditJoin = "LEFT";
- if (!empty($this->_params['fields']['soft_amount']) && empty($this->_params['fields']['total_amount'])) {
+ if (!empty($this->_params['fields']['soft_amount']) &&
+ empty($this->_params['fields']['total_amount'])
+ ) {
// if its only soft credit stats, use inner join
$softCreditJoin = "INNER";
}
$this->assign('chartSupported', TRUE);
}
- if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) {
+ if (!empty($table['group_bys'][$fieldName]['frequency']) &&
+ !empty($this->_params['group_bys_freq'][$fieldName])
+ ) {
$append = "YEAR({$field['dbAlias']}),";
if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]),
- array('year')
- )) {
+ array('year')
+ )) {
$append = '';
}
$this->_groupBy[] = "$append {$this->_params['group_bys_freq'][$fieldName]}({$field['dbAlias']})";
}
if (!empty($this->_statFields) &&
- (($append && count($this->_groupBy) <= 1) || (!$append)) && !$this->_having
+ (($append && count($this->_groupBy) <= 1) || (!$append)) &&
+ !$this->_having
) {
$this->_rollup = " WITH ROLLUP";
}
- $this->_groupBy = "GROUP BY " . implode(', ', $this->_groupBy) . " {$this->_rollup} ";
+ $this->_groupBy = "GROUP BY " . implode(', ', $this->_groupBy) .
+ " {$this->_rollup} ";
}
else {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_contact']}.id";
}
}
- function storeWhereHavingClauseArray(){
+ function storeWhereHavingClauseArray() {
parent::storeWhereHavingClauseArray();
- if (empty($this->_params['fields']['soft_amount']) && !empty($this->_havingClauses)){
+ if (empty($this->_params['fields']['soft_amount']) &&
+ !empty($this->_havingClauses)
+ ) {
foreach ($this->_havingClauses as $key => $havingClause) {
- if (stristr($havingClause, 'soft_soft')){
+ if (stristr($havingClause, 'soft_soft')) {
unset($this->_havingClauses[$key]);
}
}
$statistics = parent::statistics($rows);
$softCredit = CRM_Utils_Array::value('soft_amount', $this->_params['fields']);
- $onlySoftCredit = $softCredit && !CRM_Utils_Array::value('total_amount', $this->_params['fields']);
+ $onlySoftCredit = $softCredit &&
+ !CRM_Utils_Array::value('total_amount', $this->_params['fields']);
$totalAmount = $average = $softTotalAmount = $softAverage = array();
$select = "SELECT
$totalAmount = $average = $softTotalAmount = $softAverage = array();
$count = $softCount = 0;
while ($dao->fetch()) {
- $totalAmount[] = CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_sum, $dao->currency)." (".$dao->civicrm_contribution_total_amount_count.")";
+ $totalAmount[] =
+ CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_sum, $dao->currency) .
+ " (" . $dao->civicrm_contribution_total_amount_count . ")";
$average[] = CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_avg, $dao->currency);
$count += $dao->civicrm_contribution_total_amount_count;
if ($softCredit) {
- $softTotalAmount[] = CRM_Utils_Money::format($dao->civicrm_contribution_soft_soft_amount_sum, $dao->currency)." (".$dao->civicrm_contribution_soft_soft_amount_count.")";
+ $softTotalAmount[] =
+ CRM_Utils_Money::format($dao->civicrm_contribution_soft_soft_amount_sum, $dao->currency) .
+ " (" . $dao->civicrm_contribution_soft_soft_amount_count . ")";
$softAverage[] = CRM_Utils_Money::format($dao->civicrm_contribution_soft_soft_amount_avg, $dao->currency);
$softCount += $dao->civicrm_contribution_soft_soft_amount_count;
}
// both contri & soft contri stats are present
$graphRows['multiValue'][0][] = $row['civicrm_contribution_total_amount_sum'];
$graphRows['multiValue'][1][] = $row['civicrm_contribution_soft_soft_amount_sum'];
- } else if ($softContrib) {
+ }
+ else if ($softContrib) {
// only soft contributions
$graphRows['multiValue'][0][] = $row['civicrm_contribution_soft_soft_amount_sum'];
- } else {
+ }
+ else {
// only contributions
$graphRows['multiValue'][0][] = $row['civicrm_contribution_total_amount_sum'];
}
$graphRows['barKeys'][0] = ts('Contributions');
$graphRows['barKeys'][1] = ts('Soft Credits');
$graphRows['legend'] = ts('Contributions and Soft Credits');
- } else if ($softContrib) {
+ }
+ else if ($softContrib) {
$graphRows['legend'] = ts('Soft Credits');
}
// build the chart.
- $config = CRM_Core_Config::Singleton();
+ $config = CRM_Core_Config::Singleton();
$graphRows['xname'] = $this->_interval;
$graphRows['yname'] = "Amount ({$config->defaultCurrency})";
CRM_Utils_OpenFlashChart::chart($graphRows, $this->_params['charts'], $this->_interval);
foreach ($rows as $rowNum => $row) {
// make count columns point to detail report
- if (!empty($this->_params['group_bys']['receive_date']) && !empty($row['civicrm_contribution_receive_date_start']) &&
- CRM_Utils_Array::value('civicrm_contribution_receive_date_start', $row) && !empty($row['civicrm_contribution_receive_date_subtotal'])) {
+ if (!empty($this->_params['group_bys']['receive_date']) &&
+ !empty($row['civicrm_contribution_receive_date_start']) &&
+ CRM_Utils_Array::value('civicrm_contribution_receive_date_start', $row) &&
+ !empty($row['civicrm_contribution_receive_date_subtotal'])
+ ) {
$dateStart = CRM_Utils_Date::customFormat($row['civicrm_contribution_receive_date_start'], '%Y%m%d');
- $endDate = new DateTime($dateStart);
- $dateEnd = array();
+ $endDate = new DateTime($dateStart);
+ $dateEnd = array();
list($dateEnd['Y'], $dateEnd['M'], $dateEnd['d']) = explode(':', $endDate->format('Y:m:d'));
switch (strtolower($this->_params['group_bys_freq']['receive_date'])) {
case 'month':
$dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'] + 1,
- $dateEnd['d'] - 1, $dateEnd['Y']
- ));
+ $dateEnd['d'] - 1, $dateEnd['Y']
+ ));
break;
case 'year':
$dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'],
- $dateEnd['d'] - 1, $dateEnd['Y'] + 1
- ));
+ $dateEnd['d'] - 1, $dateEnd['Y'] + 1
+ ));
break;
case 'yearweek':
$dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'],
- $dateEnd['d'] + 6, $dateEnd['Y']
- ));
+ $dateEnd['d'] + 6, $dateEnd['Y']
+ ));
break;
case 'quarter':
$dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'] + 3,
- $dateEnd['d'] - 1, $dateEnd['Y']
- ));
+ $dateEnd['d'] - 1, $dateEnd['Y']
+ ));
break;
}
$url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
- "reset=1&force=1&receive_date_from={$dateStart}&receive_date_to={$dateEnd}",
- $this->_absoluteUrl,
- $this->_id,
- $this->_drilldownReport
- );
+ "reset=1&force=1&receive_date_from={$dateStart}&receive_date_to={$dateEnd}",
+ $this->_absoluteUrl,
+ $this->_id,
+ $this->_drilldownReport
+ );
$rows[$rowNum]['civicrm_contribution_receive_date_start_link'] = $url;
$rows[$rowNum]['civicrm_contribution_receive_date_start_hover'] = ts('List all contribution(s) for this date unit.');
$entryFound = TRUE;
*
*/
function __construct() {
- $yearsInPast = 10;
+ $yearsInPast = 10;
$yearsInFuture = 1;
- $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
- $count = $date['maxYear'];
+ $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
+ $count = $date['maxYear'];
while ($date['minYear'] <= $count) {
$optionYear[$date['minYear']] = $date['minYear'];
$date['minYear']++;
}
$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,
+ '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'),
+ ),
),
- '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',
+ '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_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,
+ '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,
+ )
+ + $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,
+ ),
),
- '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'),
+ ),
),
),
- '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'),
- ),
- ),
- ),
- );
+ );
// If we have a campaign, build out the relevant elements
if ($campaignEnabled && !empty($this->activeCampaigns)) {
'title' => ts('Campaign'),
'default' => 'false',
);
- $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'),
+ $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activeCampaigns,
);
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($fieldName == 'total_amount') {
$select[] = "SUM({$field['dbAlias']}) as {$tableName}_{$fieldName}";
$this->_columnHeaders["civicrm_life_time_total"]['title'] = 'LifeTime';;
}
elseif ($fieldName == 'receive_date') {
- $select[] = self::fiscalYearOffset($field['dbAlias']) . " as {$tableName}_{$fieldName}";
+ $select[] = self::fiscalYearOffset($field['dbAlias']) .
+ " as {$tableName}_{$fieldName}";
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
if ($fieldName == 'yid') {
$clause = "contribution_civireport.contact_id NOT IN
(SELECT distinct cont.id FROM civicrm_contact cont, civicrm_contribution contri
- WHERE cont.id = contri.contact_id AND " . self::fiscalYearOffset('contri.receive_date') . " = {$this->_params['yid_value']} AND contri.is_test = 0 )";
+ WHERE cont.id = contri.contact_id AND " .
+ self::fiscalYearOffset('contri.receive_date') .
+ " = {$this->_params['yid_value']} AND contri.is_test = 0 )";
}
- elseif (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
+ elseif (CRM_Utils_Array::value('type', $field) &
+ CRM_Utils_Type::T_DATE
+ ) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
CRM_Utils_Array::value("{$fieldName}_min", $this->_params),
CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
);
- if (($fieldName == 'contribution_status_id' || $fieldName == 'financial_type_id') && !empty($clause)) {
+ if (($fieldName == 'contribution_status_id' ||
+ $fieldName == 'financial_type_id') && !empty($clause)
+ ) {
$this->_statusClause .= " AND " . $clause;
}
}
function groupBy() {
$this->assign('chartSupported', TRUE);
- $this->_groupBy = "Group BY {$this->_aliases['civicrm_contribution']}.contact_id, " . self::fiscalYearOffset($this->_aliases['civicrm_contribution'] . '.receive_date') . " WITH ROLLUP ";
+ $this->_groupBy =
+ "Group BY {$this->_aliases['civicrm_contribution']}.contact_id, " .
+ self::fiscalYearOffset($this->_aliases['civicrm_contribution'] .
+ '.receive_date') . " WITH ROLLUP ";
}
/**
$sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
}
else {
- $sql = "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" . implode(',', $contactIds) . ") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} ";
+ $sql =
+ "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" .
+ implode(',', $contactIds) .
+ ") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} ";
}
- $current_year = $this->_params['yid_value'];
- $previous_year = $current_year - 1;
- $previous_pyear = $current_year - 2;
+ $current_year = $this->_params['yid_value'];
+ $previous_year = $current_year - 1;
+ $previous_pyear = $current_year - 2;
$previous_ppyear = $current_year - 3;
- $upTo_year = $current_year - 4;
+ $upTo_year = $current_year - 4;
- $rows = $row = array();
- $dao = CRM_Core_DAO::executeQuery($sql);
+ $rows = $row = array();
+ $dao = CRM_Core_DAO::executeQuery($sql);
$contributionSum = 0;
- $yearcal = array();
+ $yearcal = array();
while ($dao->fetch()) {
if (!$dao->civicrm_contribution_contact_id) {
continue;
}
else {
$rows[$dao->civicrm_contribution_contact_id]['civicrm_life_time_total'] = $dao->civicrm_contribution_total_amount;
- if (($dao->civicrm_contribution_total_amount - $contributionSum) > 0) {
- $rows[$dao->civicrm_contribution_contact_id]["civicrm_upto_{$upTo_year}"] = $dao->civicrm_contribution_total_amount - $contributionSum;
+ if (($dao->civicrm_contribution_total_amount - $contributionSum) > 0
+ ) {
+ $rows[$dao->civicrm_contribution_contact_id]["civicrm_upto_{$upTo_year}"] =
+ $dao->civicrm_contribution_total_amount - $contributionSum;
}
$contributionSum = 0;
}
* @param $rows
*/
function buildChart(&$rows) {
- $graphRows = array();
- $count = 0;
- $current_year = $this->_params['yid_value'];
- $previous_year = $current_year - 1;
- $previous_two_year = $current_year - 2;
+ $graphRows = array();
+ $count = 0;
+ $current_year = $this->_params['yid_value'];
+ $previous_year = $current_year - 1;
+ $previous_two_year = $current_year - 2;
$previous_three_year = $current_year - 3;
- $upto = $current_year - 4;
+ $upto = $current_year - 4;
$interval[$previous_year] = $previous_year;
$interval[$previous_two_year] = $previous_two_year;
$interval["upto_{$upto}"] = "Up To {$upto}";
foreach ($rows as $key => $row) {
- $display["upto_{$upto}"] = CRM_Utils_Array::value("upto_{$upto}", $display) + CRM_Utils_Array::value("civicrm_upto_{$upto}", $row);
- $display[$previous_year] = CRM_Utils_Array::value($previous_year, $display) + CRM_Utils_Array::value($previous_year, $row);
- $display[$previous_two_year] = CRM_Utils_Array::value($previous_two_year, $display) + CRM_Utils_Array::value($previous_two_year, $row);
- $display[$previous_three_year] = CRM_Utils_Array::value($previous_three_year, $display) + CRM_Utils_Array::value($previous_three_year, $row);
+ $display["upto_{$upto}"] =
+ CRM_Utils_Array::value("upto_{$upto}", $display) +
+ CRM_Utils_Array::value("civicrm_upto_{$upto}", $row);
+ $display[$previous_year] =
+ CRM_Utils_Array::value($previous_year, $display) +
+ CRM_Utils_Array::value($previous_year, $row);
+ $display[$previous_two_year] =
+ CRM_Utils_Array::value($previous_two_year, $display) +
+ CRM_Utils_Array::value($previous_two_year, $row);
+ $display[$previous_three_year] =
+ CRM_Utils_Array::value($previous_three_year, $display) +
+ CRM_Utils_Array::value($previous_three_year, $row);
}
$graphRows['value'] = $display;
- $config = CRM_Core_Config::Singleton();
- $chartInfo = array(
+ $config = CRM_Core_Config::Singleton();
+ $chartInfo = array(
'legend' => 'Sybunt Report',
'xname' => 'Year',
'yname' => "Amount ({$config->defaultCurrency})",
array_key_exists('civicrm_contribution_contact_id', $row)
) {
$url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
- 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contribution_contact_id'],
+ 'reset=1&force=1&id_op=eq&id_value=' .
+ $row['civicrm_contribution_contact_id'],
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
$rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
*/
function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'yid') {
- return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting'));
+ return array(
+ 'calendar' => ts('Is Calendar Year'),
+ 'fiscal' => ts('Fiscal Year Starting')
+ );
}
return parent::getOperationPair($type, $fieldName);
}
*/
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'),
+ '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'),
),
- ),
- '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,
+ )
+ + $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,
),
- '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('Contribution Status'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
- 'default' => array(1),
+ '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('Contribution 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,
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
+ 'default' => TRUE,
+ 'no_repeat' => TRUE,
+ ),
),
+ 'grouping' => 'email-fields',
),
- 'grouping' => 'email-fields',
- ),
-
- 'civicrm_phone' =>
- array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone' =>
- array('title' => ts('Phone'),
- 'default' => TRUE,
- 'no_repeat' => TRUE,
+ 'civicrm_phone' => array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone'),
+ 'default' => TRUE,
+ 'no_repeat' => TRUE,
+ ),
),
+ 'grouping' => 'phone-fields',
),
- 'grouping' => 'phone-fields',
- ),
- );
+ );
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
// only include statistics columns if set
if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
$val = CRM_Utils_Array::value('total_range_value', $fields);
if (!in_array($op, array(
- 'eq', 'lte'))) {
+ 'eq',
+ 'lte'
+ ))
+ ) {
$errors['total_range_op'] = ts("Please select 'Is equal to' OR 'Is Less than or equal to' operator");
}
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
unset($_POST['crmPID_B']);
}
else {
- $pageId = max((int)@$_POST['crmPID_B'], 1);
+ $pageId = max((int) @$_POST['crmPID_B'], 1);
}
}
$rows[$rowNum]['civicrm_donor_rank'] = $rank++;
// convert display name to links
if (array_key_exists('civicrm_contact_display_name', $row) &&
- array_key_exists('civicrm_contact_id', $row) && !empty($row['civicrm_contribution_currency'])) {
+ array_key_exists('civicrm_contact_id', $row) &&
+ !empty($row['civicrm_contribution_currency'])
+ ) {
$url = CRM_Report_Utils_Report::getNextUrl('contribute/detail',
- 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'] . "¤cy_value=" . $row['civicrm_contribution_currency'],
+ 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'] .
+ "¤cy_value=" . $row['civicrm_contribution_currency'],
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
$rows[$rowNum]['civicrm_contact_display_name_link'] = $url;
'participant_count' => array(
'title' => ts('Participants'),
'default' => TRUE,
- 'statistics' =>
- array(
- 'count' => ts('Participants'),
- ),
+ 'statistics' => array(
+ 'count' => ts('Participants'),
+ ),
),
'line_total' => array(
'title' => ts('Income Statistics'),
'type' => CRM_Utils_Type::T_MONEY,
'default' => TRUE,
- 'statistics' =>
- array(
- 'sum' => ts('Income'),
- 'avg' => ts('Average'),
- ),
+ 'statistics' => array(
+ 'sum' => ts('Income'),
+ 'avg' => ts('Average'),
+ ),
),
),
),
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
while ($dao->fetch()) {
$row = array();
foreach ($this->_columnHeaders as $key => $value) {
- if (($key == 'civicrm_event_start_date') || ($key == 'civicrm_event_end_date')) {
+ if (($key == 'civicrm_event_start_date') ||
+ ($key == 'civicrm_event_end_date')
+ ) {
//get event start date and end date in custom datetime format
$row[$key] = CRM_Utils_Date::customFormat($dao->$key);
}
elseif ($key == 'civicrm_participant_fee_amount_avg') {
- if ($dao->civicrm_participant_fee_amount_sum && $dao->civicrm_line_item_participant_count_count) {
- $row[$key] = $dao->civicrm_participant_fee_amount_sum / $dao->civicrm_line_item_participant_count_count;
+ if ($dao->civicrm_participant_fee_amount_sum &&
+ $dao->civicrm_line_item_participant_count_count
+ ) {
+ $row[$key] = $dao->civicrm_participant_fee_amount_sum /
+ $dao->civicrm_line_item_participant_count_count;
}
}
elseif ($key == 'civicrm_line_item_line_total_avg') {
- if ($dao->civicrm_line_item_line_total_sum && $dao->civicrm_line_item_participant_count_count) {
- $row[$key] = $dao->civicrm_line_item_line_total_sum / $dao->civicrm_line_item_participant_count_count;
+ if ($dao->civicrm_line_item_line_total_sum &&
+ $dao->civicrm_line_item_participant_count_count
+ ) {
+ $row[$key] = $dao->civicrm_line_item_line_total_sum /
+ $dao->civicrm_line_item_participant_count_count;
}
}
else {
if ($value['civicrm_event_id']) {
$graphRows['totalParticipants'][] = ($rows[$key]['civicrm_line_item_participant_count_count']);
$graphRows[$this->_interval][] =
- substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" . $rows[$key]['civicrm_event_id'] . ") ";
+ substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" .
+ $rows[$key]['civicrm_event_id'] . ") ";
$graphRows['value'][] = ($rows[$key]['civicrm_line_item_participant_count_count']);
}
}
*/
function __construct() {
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Name'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Name'),
'default' => TRUE,
'no_repeat' => TRUE,
'required' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
'grouping' => 'contact-fields',
'filters' => array(
- 'sort_name' =>
- array('title' => ts('Participant Name'),
+ 'sort_name' => array(
+ 'title' => ts('Participant Name'),
'operator' => 'like',
),
),
),
- 'civicrm_employer' =>
- array(
- 'dao' => 'CRM_Contact_DAO_Contact',
- 'grouping' => 'contact-fields',
- 'fields' => array(
- 'id' => array(
- 'no_display' => true,
- 'required' => true,
+ 'civicrm_employer' => array(
+ 'dao' => 'CRM_Contact_DAO_Contact',
+ 'grouping' => 'contact-fields',
+ 'fields' => array(
+ 'id' => array(
+ 'no_display' => TRUE,
+ 'required' => TRUE,
),
'organization_name' => array(
- 'title' => 'Employer',
- 'default' => TRUE,
- 'no_repeat' => TRUE,
+ 'title' => 'Employer',
+ 'default' => TRUE,
+ 'no_repeat' => TRUE,
),
),
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
'fields' => array(
- 'email' =>
- array('title' => ts('Email'),
+ 'email' => array(
+ 'title' => ts('Email'),
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
- 'filters' =>
- array(
- 'email' =>
- array('title' => ts('Participant E-mail'),
+ 'filters' => array(
+ 'email' => array(
+ 'title' => ts('Participant E-mail'),
'operator' => 'like',
),
),
),
- 'civicrm_phone' =>
- array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'grouping' => 'contact-fields',
- 'fields' => array(
- 'phone' => array(
- 'title' => ts( 'Phone No' ),
- 'default' => true,
- ),
- ),
- ),
- 'civicrm_address' =>
- array(
+ 'civicrm_phone' => array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'grouping' => 'contact-fields',
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone No'),
+ 'default' => TRUE,
+ ),
+ ),
+ ),
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'fields' =>
- array(
+ 'fields' => array(
'street_address' => NULL,
'city' => NULL,
'postal_code' => NULL,
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
- 'country_id' =>
- array('title' => ts('Country'),
+ 'country_id' => array(
+ 'title' => ts('Country'),
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_participant' =>
- array(
+ 'civicrm_participant' => array(
'dao' => 'CRM_Event_DAO_Participant',
- 'fields' =>
- array(
- 'participant_id' =>
- array('title' => ts('Participant ID'),
+ 'fields' => array(
+ 'participant_id' => array(
+ 'title' => ts('Participant ID'),
'default' => TRUE,
),
- 'event_id' =>
- array('title' => ts('Event'),
+ 'event_id' => array(
+ 'title' => ts('Event'),
'type' => CRM_Utils_Type::T_STRING,
),
- 'role_id' =>
- array('title' => ts('Role'),
+ 'role_id' => array(
+ 'title' => ts('Role'),
'default' => TRUE,
),
- 'status_id' =>
- array('title' => ts('Status'),
+ 'status_id' => array(
+ 'title' => ts('Status'),
'default' => TRUE,
),
- 'participant_register_date' =>
- array('title' => ts('Registration Date'),
+ 'participant_register_date' => array(
+ 'title' => ts('Registration Date'),
),
),
'grouping' => 'event-fields',
- 'filters' =>
- array(
+ '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)),
+ 'attributes' => array(
+ 'entity' => 'event',
+ 'select' => array('minimumInputLength' => 0)
+ ),
),
- 'sid' =>
- array(
+ '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(
+ 'rid' => array(
'name' => 'role_id',
'title' => ts('Participant Role'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT_SEPARATOR,
'options' => CRM_Event_PseudoConstant::participantRole(),
),
- 'participant_register_date' => array('title' => ts('Registration Date'),
+ 'participant_register_date' => array(
+ 'title' => ts('Registration Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
),
- 'group_bys' =>
- array(
- 'event_id' =>
- array('title' => ts('Event'),
+ 'group_bys' => array(
+ 'event_id' => array(
+ 'title' => ts('Event'),
),
),
),
- 'civicrm_event' =>
- array(
+ 'civicrm_event' => array(
'dao' => 'CRM_Event_DAO_Event',
- 'fields' =>
- array(
- 'event_type_id' =>
- array('title' => ts('Event Type'),
+ 'fields' => array(
+ 'event_type_id' => array(
+ 'title' => ts('Event Type'),
),
- 'start_date' =>
- array('title' => ts('Event Start Date'),
+ 'start_date' => array(
+ 'title' => ts('Event Start Date'),
),
- 'end_date' =>
- array('title' => ts('Event End Date'),
+ 'end_date' => array(
+ 'title' => ts('Event End Date'),
),
),
'grouping' => 'event-fields',
'filters' => array(
- 'eid' =>
- 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(
+ 'event_start_date' => array(
'name' => 'start_date',
'title' => ts('Event Start Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
- 'event_end_date' =>
- array(
+ 'event_end_date' => array(
'name' => 'end_date',
'title' => ts('Event End Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
),
- 'group_bys' =>
- array(
- 'event_type_id' =>
- array('title' => ts('Event Type '),
+ 'group_bys' => array(
+ 'event_type_id' => array(
+ 'title' => ts('Event Type '),
),
),
),
- 'civicrm_line_item' =>
- array(
+ 'civicrm_line_item' => array(
'dao' => 'CRM_Price_DAO_LineItem',
- 'fields' =>
- array(
- 'line_total' =>
- array('title' => ts('Income'),
+ 'fields' => array(
+ 'line_total' => array(
+ 'title' => ts('Income'),
'default' => TRUE,
- 'statistics' =>
- array('sum' => ts('Amount'),
+ 'statistics' => array(
+ 'sum' => ts('Amount'),
'avg' => ts('Average'),
),
),
- 'participant_count' =>
- array('title' => ts('Count'),
+ 'participant_count' => array(
+ 'title' => ts('Count'),
'default' => TRUE,
- 'statistics' =>
- array('sum' => ts('Count'),
+ 'statistics' => array(
+ 'sum' => ts('Count'),
),
),
),
);
$this->_options = array(
- 'blank_column_begin' =>
- array('title' => ts('Blank column at the Begining'),
+ 'blank_column_begin' => array(
+ 'title' => ts('Blank column at the Begining'),
'type' => 'checkbox',
),
- 'blank_column_end' =>
- array('title' => ts('Blank column at the End'),
+ 'blank_column_end' => array(
+ 'title' => ts('Blank column at the End'),
'type' => 'select',
'options' => array(
'' => '-select-',
function statistics(&$rows) {
$statistics = parent::statistics($rows);
- $avg = NULL;
- $select = " SELECT SUM( {$this->_aliases['civicrm_line_item']}.participant_count ) as count,
+ $avg = NULL;
+ $select = " SELECT SUM( {$this->_aliases['civicrm_line_item']}.participant_count ) as count,
SUM( {$this->_aliases['civicrm_line_item']}.line_total ) as amount
";
$sql = "{$select} {$this->_from} {$this->_where}";
$this->_columnHeaders = array();
//add blank column at the Start
- if (array_key_exists('options', $this->_params) && !empty($this->_params['options']['blank_column_begin'])) {
+ if (array_key_exists('options', $this->_params) &&
+ !empty($this->_params['options']['blank_column_begin'])
+ ) {
$select[] = " '' as blankColumnBegin";
$this->_columnHeaders['blankColumnBegin']['title'] = '_ _ _ _';
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if (!empty($field['statistics'])) {
foreach ($field['statistics'] as $stat => $label) {
switch (strtolower($stat)) {
}
if (!empty($this->_groupBy)) {
- $this->_groupBy = "ORDER BY " . implode(', ', $this->_groupBy) . ", {$this->_aliases['civicrm_contact']}.sort_name";
+ $this->_groupBy = "ORDER BY " . implode(', ', $this->_groupBy) .
+ ", {$this->_aliases['civicrm_contact']}.sort_name";
}
else {
$this->_groupBy = "ORDER BY {$this->_aliases['civicrm_contact']}.sort_name";
}
- $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_participant']}.id " . $this->_groupBy;
+ $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_participant']}.id " .
+ $this->_groupBy;
}
function postProcess() {
) {
if ($value = $row['civicrm_participant_participant_id']) {
$url = CRM_Utils_System::url("civicrm/contact/view/participant",
- 'reset=1&id=' . $row['civicrm_participant_participant_id'] . '&cid=' . $row['civicrm_contact_id'] . '&action=view&context=participant',
+ 'reset=1&id=' . $row['civicrm_participant_participant_id'] .
+ '&cid=' . $row['civicrm_contact_id'] .
+ '&action=view&context=participant',
$this->_absoluteUrl
);
$rows[$rowNum]['civicrm_participant_participant_id_link'] = $url;
protected $_tagFilter = TRUE;
protected $activeCampaigns;
- protected $_customGroupExtends = array('Participant', 'Contact', 'Individual', 'Event');
+ protected $_customGroupExtends = array(
+ 'Participant',
+ 'Contact',
+ 'Individual',
+ 'Event'
+ );
public $_drilldownReport = array('event/income' => 'Link to Detail Report');
}
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name_linked' =>
- array('title' => ts('Participant Name'),
+ 'fields' => array(
+ 'sort_name_linked' => array(
+ 'title' => ts('Participant Name'),
'required' => TRUE,
'no_repeat' => TRUE,
'dbAlias' => 'contact_civireport.sort_name',
),
- 'first_name' => array('title' => ts('First Name'),
+ 'first_name' => array(
+ 'title' => ts('First Name'),
),
- 'last_name' => array('title' => ts('Last Name'),
+ 'last_name' => array(
+ 'title' => ts('Last Name'),
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'gender_id' =>
- array('title' => ts('Gender'),
+ 'gender_id' => array(
+ 'title' => ts('Gender'),
),
- 'birth_date' =>
- array('title' => ts('Birth Date'),
+ 'birth_date' => array(
+ 'title' => ts('Birth Date'),
),
'age' => array(
- 'title' => ts('Age'),
+ 'title' => ts('Age'),
'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())',
),
'age_at_event' => array(
- 'title' => ts('Age at Event'),
+ 'title' => ts('Age at Event'),
'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, event_civireport.start_date)',
),
- 'employer_id' =>
- array('title' => ts('Organization'),
+ 'employer_id' => array(
+ 'title' => ts('Organization'),
),
),
'grouping' => 'contact-fields',
- 'order_bys' =>
- array(
- 'sort_name' =>
- array('title' => ts('Last Name, First Name'),
+ 'order_bys' => array(
+ 'sort_name' => array(
+ 'title' => ts('Last Name, First Name'),
'default' => '1',
'default_weight' => '0',
'default_order' => 'ASC',
),
- 'gender_id' =>
- array(
+ 'gender_id' => array(
'name' => 'gender_id',
'title' => ts('Gender'),
),
- 'birth_date' =>
- array(
+ 'birth_date' => array(
'name' => 'birth_date',
'title' => ts('Birth Date'),
),
- 'age_at_event' =>
- array(
+ 'age_at_event' => array(
'name' => 'age_at_event',
'title' => ts('Age at Event'),
),
),
- 'filters' =>
- array(
- 'sort_name' =>
- array('title' => ts('Participant Name'),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Participant Name'),
'operator' => 'like',
),
- 'gender_id' =>
- array('title' => ts('Gender'),
+ '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
+ 'type' => CRM_Utils_Type::T_DATE
),
),
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email' =>
- array('title' => ts('Email'),
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
- 'filters' =>
- array(
- 'email' =>
- array('title' => ts('Participant E-mail'),
+ 'filters' => array(
+ 'email' => array(
+ 'title' => ts('Participant E-mail'),
'operator' => 'like',
),
),
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'fields' =>
- array(
+ 'fields' => array(
'street_address' => NULL,
'city' => NULL,
'postal_code' => NULL,
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
- 'country_id' =>
- array('title' => ts('Country'),
+ 'country_id' => array(
+ 'title' => ts('Country'),
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_participant' =>
- array(
+ 'civicrm_participant' => array(
'dao' => 'CRM_Event_DAO_Participant',
- 'fields' =>
- array('participant_id' => array('title' => 'Participant ID'),
+ 'fields' => array(
+ 'participant_id' => array('title' => 'Participant ID'),
'participant_record' => array(
'name' => 'id',
'no_display' => TRUE,
'default' => TRUE,
'type' => CRM_Utils_Type::T_STRING,
),
- 'status_id' => array('title' => ts('Status'),
- 'default' => TRUE,
+ 'status_id' => array(
+ 'title' => ts('Status'),
+ 'default' => TRUE,
),
- 'role_id' => array('title' => ts('Role'),
- 'default' => TRUE,
+ 'role_id' => array(
+ 'title' => ts('Role'),
+ 'default' => TRUE,
),
'fee_currency' => array(
'required' => TRUE,
'participant_register_date' => array('title' => ts('Registration Date')),
),
'grouping' => 'event-fields',
- 'filters' =>
- array(
+ '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)),
+ 'attributes' => array(
+ 'entity' => 'event',
+ 'select' => array('minimumInputLength' => 0)
+ ),
),
'sid' => array(
'name' => 'status_id',
'title' => 'Registration Date',
'operatorType' => CRM_Report_Form::OP_DATE,
),
- 'fee_currency' =>
- array('title' => ts('Fee Currency'),
+ 'fee_currency' => array(
+ 'title' => ts('Fee Currency'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
'default' => NULL,
),
),
- 'order_bys' =>
- array(
- 'participant_register_date' =>
- array('title' => ts('Registration Date'),
+ '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'),
+ 'event_id' => array(
+ 'title' => ts('Event'),
+ 'default_weight' => '1',
+ 'default_order' => 'ASC'
+ ),
),
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone' =>
- array('title' => ts('Phone'),
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone'),
'default' => TRUE,
'no_repeat' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_event' =>
- 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(
+ 'filters' => array(
'eid' => array(
'name' => 'event_type_id',
'title' => ts('Event Type'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
),
- 'order_bys' =>
- array(
- 'event_type_id' =>
- array('title' => ts('Event Type'), 'default_weight' => '2', 'default_order' => 'ASC'),
+ 'order_bys' => array(
+ 'event_type_id' => array(
+ 'title' => ts('Event Type'),
+ 'default_weight' => '2',
+ 'default_order' => 'ASC'
+ ),
),
),
'civicrm_contribution' => 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(),
+ '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,
+ '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(),
+ '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
+ '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',
$this->_columnHeaders = array();
//add blank column at the Start
- if (array_key_exists('options', $this->_params) && !empty($this->_params['options']['blank_column_begin'])) {
+ if (array_key_exists('options', $this->_params) &&
+ !empty($this->_params['options']['blank_column_begin'])
+ ) {
$select[] = " '' as blankColumnBegin";
$this->_columnHeaders['blankColumnBegin']['title'] = '_ _ _ _';
}
foreach ($this->_columns as $tableName => $table) {
- if ($tableName == 'civicrm_line_item'){
+ if ($tableName == 'civicrm_line_item') {
$this->_lineitemField = TRUE;
}
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_contribution') {
$this->_contribField = TRUE;
}
ON (pp.contribution_id = {$this->_aliases['civicrm_contribution']}.id)
";
}
- if ($this->_lineitemField){
+ if ($this->_lineitemField) {
$this->_from .= "
LEFT JOIN civicrm_line_item line_item_civireport
ON line_item_civireport.entity_table = 'civicrm_participant' AND
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
if ($fieldName == 'rid') {
$value = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
if (!empty($value)) {
- $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" . implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
+ $clause = "( {$field['dbAlias']} REGEXP '[[:<:]]" .
+ implode('[[:>:]]|[[:<:]]', $value) . "[[:>:]]' )";
}
$op = NULL;
}
if ($op) {
$clause = $this->whereClause($field,
- $op,
- CRM_Utils_Array::value("{$fieldName}_value", $this->_params),
- CRM_Utils_Array::value("{$fieldName}_min", $this->_params),
- CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
+ $op,
+ CRM_Utils_Array::value("{$fieldName}_value", $this->_params),
+ CRM_Utils_Array::value("{$fieldName}_min", $this->_params),
+ CRM_Utils_Array::value("{$fieldName}_max", $this->_params)
);
}
}
$this->_where = "WHERE {$this->_aliases['civicrm_participant']}.is_test = 0 ";
}
else {
- $this->_where = "WHERE {$this->_aliases['civicrm_participant']}.is_test = 0 AND " . implode(' AND ', $clauses);
+ $this->_where =
+ "WHERE {$this->_aliases['civicrm_participant']}.is_test = 0 AND " .
+ implode(' AND ', $clauses);
}
if ($this->_aclWhere) {
$this->_where .= " AND {$this->_aclWhere} ";
}
}
- function groupBy(){
+ function groupBy() {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_participant']}.id";
}
* @param $rowNum
* @param $types
*/
- private function _initBasicRow(&$rows, &$entryFound, $row, $rowId, $rowNum, $types){
+ private function _initBasicRow(&$rows, &$entryFound, $row, $rowId, $rowNum, $types) {
if (!array_key_exists($rowId, $row)) {
return FALSE;
}
$entryFound = FALSE;
$eventType = CRM_Core_OptionGroup::values('event_type');
- $financialTypes = CRM_Contribute_PseudoConstant::financialType();
+ $financialTypes = CRM_Contribute_PseudoConstant::financialType();
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
$genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id', array('localize' => TRUE));
$rows[$rowNum]['civicrm_participant_event_id'] = CRM_Event_PseudoConstant::event($eventId, FALSE);
$url = CRM_Report_Utils_Report::getNextUrl('event/income',
- 'reset=1&force=1&id_op=in&id_value=' . $eventId,
- $this->_absoluteUrl, $this->_id, $this->_drilldownReport
+ 'reset=1&force=1&id_op=in&id_value=' . $eventId,
+ $this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
$rows[$rowNum]['civicrm_participant_event_id_link'] = $url;
$rows[$rowNum]['civicrm_participant_event_id_hover'] = ts("View Event Income Details for this Event");
if ($displayName && $cid && $id) {
$url = CRM_Report_Utils_Report::getNextUrl('contact/detail',
- "reset=1&force=1&id_op=eq&id_value=$cid",
- $this->_absoluteUrl, $this->_id, $this->_drilldownReport
+ "reset=1&force=1&id_op=eq&id_value=$cid",
+ $this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
$viewUrl = CRM_Utils_System::url("civicrm/contact/view/participant",
- "reset=1&id=$id&cid=$cid&action=view&context=participant"
+ "reset=1&id=$id&cid=$cid&action=view&context=participant"
);
$contactTitle = ts('View Contact Details');
$rows[$rowNum]['civicrm_contact_sort_name_linked'] = "<a title='$contactTitle' href=$url>$displayName</a>";
if ($this->_outputMode !== 'csv') {
- $rows[$rowNum]['civicrm_contact_sort_name_linked'] .= "<span style='float: right;'><a title='$participantTitle' href=$viewUrl>" . ts('View') . "</a></span>";
+ $rows[$rowNum]['civicrm_contact_sort_name_linked'] .=
+ "<span style='float: right;'><a title='$participantTitle' href=$viewUrl>" .
+ ts('View') . "</a></span>";
}
$entryFound = TRUE;
}
$rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($countryId, TRUE);
}
$entryFound = TRUE;
- }
+ }
// Handle state/province id
if (array_key_exists('civicrm_address_state_province_id', $row)) {
// Handle employer id
if (array_key_exists('civicrm_contact_employer_id', $row)) {
- $employerId = $row['civicrm_contact_employer_id'];
+ $employerId = $row['civicrm_contact_employer_id'];
if ($employerId) {
$rows[$rowNum]['civicrm_contact_employer_id'] = CRM_Contact_BAO_Contact::displayName($employerId);
$url = CRM_Utils_System::url('civicrm/contact/view',
- 'reset=1&cid=' . $employerId, $this->_absoluteUrl
+ 'reset=1&cid=' . $employerId, $this->_absoluteUrl
);
$rows[$rowNum]['civicrm_contact_employer_id_link'] = $url;
$rows[$rowNum]['civicrm_contact_employer_id_hover'] = ts('View Contact Summary for this Contact.');
protected $_add2groupSupported = FALSE;
protected $_customGroupExtends = array(
- 'Event');
+ 'Event'
+ );
public $_drilldownReport = array('event/income' => 'Link to Detail Report');
/**
function __construct() {
$this->_columns = array(
- 'civicrm_event' =>
- array(
+ 'civicrm_event' => array(
'dao' => 'CRM_Event_DAO_Event',
- 'fields' =>
- array(
+ 'fields' => array(
'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'title' => array('title' => ts('Event Title'),
+ 'title' => array(
+ 'title' => ts('Event Title'),
'required' => TRUE,
),
- 'event_type_id' => array('title' => ts('Event Type'),
+ 'event_type_id' => array(
+ 'title' => ts('Event Type'),
'required' => TRUE,
),
'fee_label' => array('title' => ts('Fee Label')),
- 'event_start_date' => array('title' => ts('Event Start Date'),
+ 'event_start_date' => array(
+ 'title' => ts('Event Start Date'),
),
'event_end_date' => array('title' => ts('Event End Date')),
- 'max_participants' => array('title' => ts('Capacity'),
+ 'max_participants' => array(
+ 'title' => ts('Capacity'),
'type' => CRM_Utils_Type::T_INT,
),
),
- 'filters' =>
- array(
+ 'filters' => array(
'id' => array(
'title' => ts('Event'),
'operatorType' => CRM_Report_Form::OP_ENTITYREF,
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
}
}
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
$participant_info[$event_id]['totalAmount'] = $amt;
$participant_info[$event_id]['statusType1'] = $particiType1;
$participant_info[$event_id]['statusType2'] = $particiType2;
- $participant_info[$event_id]['currency'] = $currency[$event_id];
+ $participant_info[$event_id]['currency'] = $currency[$event_id];
$amt = $particiType1 = $particiType2 = 0;
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
$this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
while ($dao->fetch()) {
$row = array();
foreach ($this->_columnHeaders as $key => $value) {
- if (($key == 'civicrm_event_start_date') || ($key == 'civicrm_event_end_date')) {
+ if (($key == 'civicrm_event_start_date') ||
+ ($key == 'civicrm_event_end_date')
+ ) {
//get event start date and end date in custom datetime format
$row[$key] = CRM_Utils_Date::customFormat($dao->$key);
}
if (!empty($this->_params['charts'])) {
foreach ($rows as $key => $value) {
$graphRows['totalAmount'][] = $graphRows['value'][] = CRM_Utils_Array::value('totalAmount', $rows[$key]);
- $graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" . $rows[$key]['civicrm_event_id'] . ") ";
+ $graphRows[$this->_interval][] =
+ substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" .
+ $rows[$key]['civicrm_event_id'] . ") ";
}
if (CRM_Utils_Array::value('totalAmount', $rows[$key]) == 0) {
$eventType = CRM_Core_OptionGroup::values('event_type');
foreach ($rows as $rowNum => $row) {
- if (array_key_exists('totalAmount', $row) && array_key_exists('currency', $row)) {
+ if (array_key_exists('totalAmount', $row) &&
+ array_key_exists('currency', $row)
+ ) {
$rows[$rowNum]['totalAmount'] = CRM_Utils_Money::format($rows[$rowNum]['totalAmount'], $rows[$rowNum]['currency']);
}
if (array_key_exists('civicrm_event_title', $row)) {
foreach ($this->_columns as $tablename => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $field => $specs) {
- if (in_array($tablename . '_' . $field, $selectedFields) && array_key_exists('alter_display', $specs)) {
- $alterfunctions[$tablename . '_' . $field] = $specs['alter_display'];
+ if (in_array($tablename . '_' . $field, $selectedFields) &&
+ array_key_exists('alter_display', $specs)
+ ) {
+ $alterfunctions[$tablename . '_' .
+ $field] = $specs['alter_display'];
$altermap[$tablename . '_' . $field] = $field;
}
}
*/
function getLineItemColumns() {
return array(
- 'civicrm_line_item' =>
- array(
+ 'civicrm_line_item' => array(
'dao' => 'CRM_Price_BAO_LineItem',
- 'fields' =>
- array(
- 'qty' =>
- array('title' => ts('Quantity'),
+ 'fields' => array(
+ 'qty' => array(
+ 'title' => ts('Quantity'),
'type' => CRM_Utils_Type::T_INT,
- 'statistics' =>
- array('sum' => ts('Total Quantity Selected')),
+ 'statistics' => array('sum' => ts('Total Quantity Selected')),
),
- 'unit_price' =>
- array('title' => ts('Unit Price'),
+ 'unit_price' => array(
+ 'title' => ts('Unit Price'),
),
- 'line_total' =>
- array('title' => ts('Line Total'),
+ 'line_total' => array(
+ 'title' => ts('Line Total'),
'type' => CRM_Utils_Type::T_MONEY,
- 'statistics' =>
- array('sum' => ts('Total of Line Items')),
+ 'statistics' => array('sum' => ts('Total of Line Items')),
),
),
- 'participant_count' =>
- array('title' => ts('Participant Count'),
- 'statistics' =>
- array('sum' => ts('Total Participants')),
+ 'participant_count' => array(
+ 'title' => ts('Participant Count'),
+ 'statistics' => array('sum' => ts('Total Participants')),
),
- 'filters' =>
- array(
- 'qty' =>
- array('title' => ts('Quantity'),
+ 'filters' => array(
+ 'qty' => array(
+ 'title' => ts('Quantity'),
'type' => CRM_Utils_Type::T_INT,
'operator' => CRM_Report_Form::OP_INT,
),
),
- 'group_bys' =>
- array(
- 'price_field_id' =>
- array('title' => ts('Price Field'),
+ 'group_bys' => array(
+ 'price_field_id' => array(
+ 'title' => ts('Price Field'),
),
- 'price_field_value_id' =>
- array('title' => ts('Price Field Option'),
+ 'price_field_value_id' => array(
+ 'title' => ts('Price Field Option'),
),
- 'line_item_id' =>
- array('title' => ts('Individual Line Item'),
+ 'line_item_id' => array(
+ 'title' => ts('Individual Line Item'),
'name' => 'id',
+ ),
),
),
- ),
);
}
*/
function getPriceFieldValueColumns() {
return array(
- 'civicrm_price_field_value' =>
- array(
+ 'civicrm_price_field_value' => array(
'dao' => 'CRM_Price_BAO_PriceFieldValue',
'fields' => array(
- 'price_field_value_label' =>
- array('title' => ts('Price Field Value Label'),
+ 'price_field_value_label' => array(
+ 'title' => ts('Price Field Value Label'),
'name' => 'label',
),
),
- 'filters' =>
- array(
- 'price_field_value_label' =>
- array('title' => ts('Price Fields Value Label'),
+ 'filters' => array(
+ 'price_field_value_label' => array(
+ 'title' => ts('Price Fields Value Label'),
'type' => CRM_Utils_Type::T_STRING,
'operator' => 'like',
'name' => 'label',
),
),
- 'order_bys' =>
- array(
- 'label' =>
- array('title' => ts('Price Field Value Label'),
+ 'order_bys' => array(
+ 'label' => array(
+ 'title' => ts('Price Field Value Label'),
),
),
- 'group_bys' =>
- //note that we have a requirement to group by label such that all 'Promo book' lines
+ 'group_bys' => //note that we have a requirement to group by label such that all 'Promo book' lines
// are grouped together across price sets but there may be a separate need to group
// by id so that entries in one price set are distinct from others. Not quite sure what
// to call the distinction for end users benefit
- array(
- 'price_field_value_label' =>
- array('title' => ts('Price Field Value Label'),
- 'name' => 'label',
+ array(
+ 'price_field_value_label' => array(
+ 'title' => ts('Price Field Value Label'),
+ 'name' => 'label',
+ ),
),
- ),
),
);
}
*/
function getPriceFieldColumns() {
return array(
- 'civicrm_price_field' =>
- array(
+ 'civicrm_price_field' => array(
'dao' => 'CRM_Price_BAO_PriceField',
- 'fields' =>
- array(
- 'price_field_label' =>
- array('title' => ts('Price Field Label'),
+ 'fields' => array(
+ 'price_field_label' => array(
+ 'title' => ts('Price Field Label'),
'name' => 'label',
),
),
- 'filters' =>
- array(
- 'price_field_label' =>
- array('title' => ts('Price Field Label'),
+ 'filters' => array(
+ 'price_field_label' => array(
+ 'title' => ts('Price Field Label'),
'type' => CRM_Utils_Type::T_STRING,
'operator' => 'like',
'name' => 'label',
),
),
- 'order_bys' =>
- array(
- 'price_field_label' =>
- array('title' => ts('Price Field Label'),
- 'name' => 'label',
+ 'order_bys' => array(
+ 'price_field_label' => array(
+ 'title' => ts('Price Field Label'),
+ 'name' => 'label',
),
),
- 'group_bys' =>
- array(
- 'price_field_label' =>
- array('title' => ts('Price Field Label'),
+ 'group_bys' => array(
+ 'price_field_label' => array(
+ 'title' => ts('Price Field Label'),
'name' => 'label',
),
),
CRM_Core_PseudoConstant::populate($_events['all'], 'CRM_Event_DAO_Event', FALSE, 'title', 'is_active', "is_template IS NULL OR is_template = 0", 'end_date DESC');
}
return array(
- 'civicrm_participant' =>
- array(
+ 'civicrm_participant' => array(
'dao' => 'CRM_Event_DAO_Participant',
- 'fields' =>
- array('participant_id' => array('title' => 'Participant ID'),
+ 'fields' => array(
+ 'participant_id' => array('title' => 'Participant ID'),
'participant_record' => array(
'name' => 'id',
'title' => ts('Participant ID'),
),
- 'event_id' => array('title' => ts('Event ID'),
+ 'event_id' => array(
+ 'title' => ts('Event ID'),
'type' => CRM_Utils_Type::T_STRING,
'alter_display' => 'alterEventID',
),
- 'status_id' => array('title' => ts('Status'),
+ 'status_id' => array(
+ 'title' => ts('Status'),
'alter_display' => 'alterParticipantStatus',
),
- 'role_id' => array('title' => ts('Role'),
+ 'role_id' => array(
+ 'title' => ts('Role'),
'alter_display' => 'alterParticipantRole',
),
'participant_fee_level' => NULL,
'participant_register_date' => array('title' => ts('Registration Date')),
),
'grouping' => 'event-fields',
- 'filters' =>
- array(
- 'event_id' => array('name' => 'event_id',
+ 'filters' => array(
+ 'event_id' => array(
+ 'name' => 'event_id',
'title' => ts('Event'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $_events['all'],
'operatorType' => CRM_Report_Form::OP_DATE,
),
),
- 'order_bys' =>
- array(
- 'event_id' =>
- array('title' => ts('Event'), 'default_weight' => '1', 'default_order' => 'ASC'),
+ 'order_bys' => array(
+ 'event_id' => array(
+ 'title' => ts('Event'),
+ 'default_weight' => '1',
+ 'default_order' => 'ASC'
+ ),
),
- 'group_bys' =>
- array(
- 'event_id' =>
- array('title' => ts('Event')),
+ 'group_bys' => array(
+ 'event_id' => array('title' => ts('Event')),
),
),
);
return array(
'civicrm_event' => array(
'dao' => 'CRM_Event_DAO_Event',
- 'fields' =>
- array(
+ 'fields' => array(
'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'title' => array('title' => ts('Event Title'),
+ 'title' => array(
+ 'title' => ts('Event Title'),
'required' => TRUE,
),
- 'event_type_id' => array('title' => ts('Event Type'),
+ 'event_type_id' => array(
+ 'title' => ts('Event Type'),
'required' => TRUE,
'alter_display' => 'alterEventType',
),
'fee_label' => array('title' => ts('Fee Label')),
- 'event_start_date' => array('title' => ts('Event Start Date'),
- ),
+ 'event_start_date' => array(
+ 'title' => ts('Event Start Date'),
+ ),
'event_end_date' => array('title' => ts('Event End Date')),
- 'max_participants' => array('title' => ts('Capacity'),
+ 'max_participants' => array(
+ 'title' => ts('Capacity'),
'type' => CRM_Utils_Type::T_INT,
),
),
),
'group_bys' => array(
'event_type_id' => array(
- 'title' => ts('Event Type'),
- ),
+ 'title' => ts('Event Type'),
+ ),
),
),
);
*/
function getContributionColumns() {
return array(
- 'civicrm_contribution' =>
- array(
+ 'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' =>
- array(
+ 'fields' => array(
'contribution_id' => array(
'name' => 'id',
),
- 'financial_type_id' => array('title' => ts('Financial Type'),
+ 'financial_type_id' => array(
+ 'title' => ts('Financial Type'),
'default' => TRUE,
'alter_display' => 'alterContributionType',
),
- 'payment_instrument_id' => array('title' => ts('Payment Instrument'),
+ 'payment_instrument_id' => array(
+ 'title' => ts('Payment Instrument'),
'alter_display' => 'alterPaymentType',
),
'source' => array('title' => 'Contribution Source'),
'receipt_date' => NULL,
'fee_amount' => NULL,
'net_amount' => NULL,
- 'total_amount' => array('title' => ts('Amount'),
- 'statistics' =>
- array('sum' => ts('Total Amount')),
+ 'total_amount' => array(
+ 'title' => ts('Amount'),
+ 'statistics' => array('sum' => ts('Total Amount')),
'type' => CRM_Utils_Type::T_MONEY,
),
),
- 'filters' =>
- array(
- 'receive_date' =>
- array('operatorType' => CRM_Report_Form::OP_DATE),
- 'financial_type_id' =>
- array('title' => ts('Financial Type'),
+ '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(),
),
- 'payment_instrument_id' =>
- array('title' => ts('Payment Type'),
+ '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'),
+ 'contribution_status_id' => array(
+ 'title' => ts('Contribution Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
),
- 'total_amount' =>
- array('title' => ts('Contribution Amount')),
+ 'total_amount' => array('title' => ts('Contribution Amount')),
),
- 'order_bys' =>
- array(
- 'payment_instrument_id' =>
- array('title' => ts('Payment Instrument'),
+ 'order_bys' => array(
+ 'payment_instrument_id' => array(
+ 'title' => ts('Payment Instrument'),
+ ),
+ 'financial_type_id' => array(
+ 'title' => ts('Financial Type'),
),
- 'financial_type_id' =>
- array('title' => ts('Financial Type'),
- ),
),
- 'group_bys' =>
- array('financial_type_id' =>
- array('title' => ts('Financial Type')),
- 'payment_instrument_id' =>
- array('title' => ts('Payment Instrument')),
- 'contribution_id' =>
- array('title' => ts('Individual Contribution'),
+ 'group_bys' => array(
+ 'financial_type_id' => array('title' => ts('Financial Type')),
+ 'payment_instrument_id' => array('title' => ts('Payment Instrument')),
+ 'contribution_id' => array(
+ 'title' => ts('Individual Contribution'),
'name' => 'id',
- ),
+ ),
'source' => array('title' => 'Contribution Source'),
),
'grouping' => 'contribution-fields',
'id' => array(
'title' => ts('Contact ID'),
)
- ,
+ ,
'sort_name' => array(
'title' => ts('Contact Name'),
),
'fields' => array(
'id' => array(
'title' => ts('Case ID'),
- 'required' => false
+ 'required' => FALSE
),
'subject' => array(
'title' => ts('Case Subject'),
- 'default' => true
+ 'default' => TRUE
),
'status_id' => array(
'title' => ts('Status'),
- 'default' => true
+ 'default' => TRUE
),
'case_type_id' => array(
'title' => ts('Case Type'),
- 'default' => true
+ 'default' => TRUE
),
'case_start_date' => array(
'title' => ts('Case Start Date'),
'name' => 'start_date',
- 'default' => true
+ 'default' => TRUE
),
'case_end_date' => array(
'title' => ts('Case End Date'),
'name' => 'end_date',
- 'default' => true
+ 'default' => TRUE
),
'case_duration' => array(
'name' => 'duration',
'title' => ts('Duration (Days)'),
- 'default' => false
+ 'default' => FALSE
),
'case_is_deleted' => array(
'name' => 'is_deleted',
'title' => ts('Case Deleted?'),
- 'default' => false,
+ 'default' => FALSE,
'type' => CRM_Utils_Type::T_INT
)
),
*/
/**
* Get address columns to add to array
+ *
* @param array $options
* - prefix Prefix to add to table (in case of more than one instance of the table)
* - prefix_label Label to give columns from this address table instance
+ *
* @return array address columns definition
*/
/**
$defaultOptions = array(
'prefix' => '',
'prefix_label' => '',
- 'group_by' => false,
- 'order_by' => true,
- 'filters' => true,
+ 'group_by' => FALSE,
+ 'order_by' => TRUE,
+ 'filters' => TRUE,
'defaults' => array(
'country_id' => TRUE
),
- );
+ );
- $options = array_merge($defaultOptions,$options);
+ $options = array_merge($defaultOptions, $options);
$addressFields = array(
$options['prefix'] . 'civicrm_address' => array(
'name' => 'street_address',
),
$options['prefix'] . 'supplemental_address_1' => array(
- 'title' => ts($options['prefix_label'] . 'Supplementary Address Field 1'),
+ 'title' => ts($options['prefix_label'] .
+ 'Supplementary Address Field 1'),
'default' => CRM_Utils_Array::value('supplemental_address_1', $options['defaults'], FALSE),
'name' => 'supplemental_address_1',
),
$options['prefix'] . 'supplemental_address_2' => array(
- 'title' => ts($options['prefix_label'] . 'Supplementary Address Field 2'),
+ 'title' => ts($options['prefix_label'] .
+ 'Supplementary Address Field 2'),
'default' => CRM_Utils_Array::value('supplemental_address_2', $options['defaults'], FALSE),
'name' => 'supplemental_address_2',
),
'title' => ts($options['prefix_label'] . 'State/Province'),
'default' => CRM_Utils_Array::value('state_province_id', $options['defaults'], FALSE),
'alter_display' => 'alterStateProvinceID',
- 'name' => 'state_province_id',
+ 'name' => 'state_province_id',
),
$options['prefix'] . 'country_id' => array(
'title' => ts($options['prefix_label'] . 'Country'),
);
if ($options['filters']) {
- $addressFields[$options['prefix'] .'civicrm_address']['filters'] = array(
+ $addressFields[$options['prefix'] . 'civicrm_address']['filters'] = array(
$options['prefix'] . 'street_number' => array(
'title' => ts($options['prefix_label'] . 'Street Number'),
'type' => 1,
}
if ($options['order_by']) {
- $addressFields[$options['prefix'] . 'civicrm_address']['order_bys'] = array(
+ $addressFields[$options['prefix'] .
+ 'civicrm_address']['order_bys'] = array(
$options['prefix'] . 'street_name' => array(
'title' => ts($options['prefix_label'] . 'Street Name'),
'name' => 'street_name',
/**
* @param string $prefix
*/
- function joinAddressFromContact( $prefix = '') {
- $this->_from .= " LEFT JOIN civicrm_address {$this->_aliases[$prefix . 'civicrm_address']}
- ON {$this->_aliases[$prefix . 'civicrm_address']}.contact_id = {$this->_aliases[$prefix . 'civicrm_contact']}.id";
+ function joinAddressFromContact($prefix = '') {
+ $this->_from .= " LEFT JOIN civicrm_address {$this->_aliases[$prefix .
+ 'civicrm_address']}
+ ON {$this->_aliases[$prefix .
+ 'civicrm_address']}.contact_id = {$this->_aliases[$prefix .
+ 'civicrm_contact']}.id";
}
function joinPriceFieldValueFromLineItem() {
* @return string
*/
function alterNickName($value, &$row) {
- if(empty($row['civicrm_contact_id'])){
+ if (empty($row['civicrm_contact_id'])) {
return;
}
$contactID = $row['civicrm_contact_id'];
function alterCountryID($value, &$row, $selectedfield, $criteriaFieldName) {
$url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
$row[$selectedfield . '_link'] = $url;
- $row[$selectedfield . '_hover'] = ts("%1 for this country.", array(1 => $value));
- $countries = CRM_Core_PseudoConstant::country($value, FALSE);
- if(!is_array($countries)){
+ $row[$selectedfield .
+ '_hover'] = ts("%1 for this country.", array(1 => $value));
+ $countries = CRM_Core_PseudoConstant::country($value, FALSE);
+ if (!is_array($countries)) {
return $countries;
}
}
*
* @return array
*/
- function alterCountyID($value, &$row,$selectedfield, $criteriaFieldName) {
+ function alterCountyID($value, &$row, $selectedfield, $criteriaFieldName) {
$url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
$row[$selectedfield . '_link'] = $url;
- $row[$selectedfield . '_hover'] = ts("%1 for this county.", array(1 => $value));
+ $row[$selectedfield .
+ '_hover'] = ts("%1 for this county.", array(1 => $value));
$counties = CRM_Core_PseudoConstant::county($value, FALSE);
- if(!is_array($counties)){
+ if (!is_array($counties)) {
return $counties;
}
}
function alterStateProvinceID($value, &$row, $selectedfield, $criteriaFieldName) {
$url = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&force=1&{$criteriaFieldName}_op=in&{$criteriaFieldName}_value={$value}", $this->_absoluteUrl);
$row[$selectedfield . '_link'] = $url;
- $row[$selectedfield . '_hover'] = ts("%1 for this state.", array(1 => $value));
+ $row[$selectedfield .
+ '_hover'] = ts("%1 for this state.", array(1 => $value));
- $states = CRM_Core_PseudoConstant::stateProvince($value, FALSE);
- if(!is_array($states)){
+ $states = CRM_Core_PseudoConstant::stateProvince($value, FALSE);
+ if (!is_array($states)) {
return $states;
}
}
* @return mixed
*/
function alterContactID($value, &$row, $fieldname) {
- $row[$fieldname . '_link'] = CRM_Utils_System::url("civicrm/contact/view", 'reset=1&cid=' . $value, $this->_absoluteUrl);
+ $row[$fieldname . '_link'] = CRM_Utils_System::url("civicrm/contact/view",
+ 'reset=1&cid=' . $value, $this->_absoluteUrl);
return $value;
}
protected $_addressField = FALSE;
protected $_customGroupExtends = array(
- 'Grant');
+ 'Grant'
+ );
/**
*
*/
function __construct() {
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'required' => TRUE,
'no_repeat' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
'grouping' => 'contact-fields',
- 'filters' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'operator' => 'like',
),
- 'gender_id' =>
- array('title' => ts('Gender'),
+ 'gender_id' => array(
+ 'title' => ts('Gender'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
),
- 'id' =>
- array('title' => ts('Contact ID'),
+ 'id' => array(
+ 'title' => ts('Contact ID'),
'no_display' => TRUE,
),
),
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'filters' =>
- array(
- 'country_id' =>
- array('title' => ts('Country'),
+ 'filters' => array(
+ 'country_id' => array(
+ 'title' => ts('Country'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::country(),
),
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::stateProvince(),
),
),
),
- 'civicrm_grant' =>
- array(
+ 'civicrm_grant' => array(
'dao' => 'CRM_Grant_DAO_Grant',
- 'fields' =>
- array(
- 'grant_type_id' =>
- array(
+ 'fields' => array(
+ 'grant_type_id' => array(
'name' => 'grant_type_id',
'title' => ts('Grant Type'),
),
- 'status_id' =>
- array(
+ 'status_id' => array(
'name' => 'status_id',
'title' => ts('Grant Status'),
),
- 'amount_total' =>
- array(
+ 'amount_total' => array(
'name' => 'amount_total',
'title' => ts('Amount Requested'),
'type' => CRM_Utils_Type::T_MONEY,
),
- 'amount_granted' =>
- array(
+ 'amount_granted' => array(
'name' => 'amount_granted',
'title' => ts('Amount Granted'),
),
- 'application_received_date' =>
- array(
+ 'application_received_date' => array(
'name' => 'application_received_date',
'title' => ts('Application Received'),
'default' => TRUE,
),
- 'money_transfer_date' =>
- array(
+ 'money_transfer_date' => array(
'name' => 'money_transfer_date',
'title' => ts('Money Transfer Date'),
'type' => CRM_Utils_Type::T_DATE,
),
- 'grant_due_date' =>
- array(
+ 'grant_due_date' => array(
'name' => 'grant_due_date',
'title' => ts('Grant Report Due'),
'type' => CRM_Utils_Type::T_DATE,
),
- 'decision_date' =>
- array(
+ 'decision_date' => array(
'name' => 'decision_date',
'title' => ts('Grant Decision Date'),
'type' => CRM_Utils_Type::T_DATE,
),
- 'rationale' =>
- array(
+ 'rationale' => array(
'name' => 'rationale',
'title' => ts('Rationale'),
),
- 'grant_report_received' =>
- array(
+ 'grant_report_received' => array(
'name' => 'grant_report_received',
'title' => ts('Grant Report Received'),
),
),
- 'filters' =>
- array(
- 'grant_type' =>
- array(
+ 'filters' => array(
+ 'grant_type' => array(
'name' => 'grant_type_id',
'title' => ts('Grant Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id'),
),
- 'status_id' =>
- array(
+ 'status_id' => array(
'name' => 'status_id',
'title' => ts('Grant Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id'),
),
- 'amount_granted' =>
- array(
+ 'amount_granted' => array(
'title' => ts('Amount Granted'),
'operatorType' => CRM_Report_Form::OP_INT,
),
- 'amount_total' =>
- array(
+ 'amount_total' => array(
'title' => ts('Amount Requested'),
'operatorType' => CRM_Report_Form::OP_INT,
),
- 'application_received_date' =>
- array(
+ 'application_received_date' => array(
'title' => ts('Application Received'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
- 'money_transfer_date' =>
- array(
+ 'money_transfer_date' => array(
'title' => ts('Money Transfer Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
- 'grant_due_date' =>
- array(
+ 'grant_due_date' => array(
'title' => ts('Grant Report Due'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Report_Form::OP_DATE,
),
- 'decision_date' =>
- array(
+ 'decision_date' => array(
'title' => ts('Grant Decision Date'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
),
- 'group_bys' =>
- array(
- 'grant_type_id' =>
- array(
+ 'group_bys' => array(
+ 'grant_type_id' => array(
'title' => ts('Grant Type'),
),
- 'status_id' =>
- array(
+ 'status_id' => array(
'title' => ts('Grant Status'),
),
- 'amount_total' =>
- array(
+ 'amount_total' => array(
'title' => ts('Amount Requested'),
),
- 'amount_granted' =>
- array(
+ 'amount_granted' => array(
'title' => ts('Amount Granted'),
),
- 'application_received_date' =>
- array(
+ 'application_received_date' => array(
'title' => ts('Application Received Date'),
),
- 'money_transfer_date' =>
- array(
+ 'money_transfer_date' => array(
'title' => ts('Money Transfer Date'),
),
- 'decision_date' =>
- array(
+ 'decision_date' => array(
'title' => ts('Grant Decision Date'),
),
),
}
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
if (!empty($this->_groupBy)) {
- $this->_groupBy = "ORDER BY " . implode(', ', $this->_groupBy) . ", {$this->_aliases['civicrm_contact']}.sort_name";
+ $this->_groupBy = "ORDER BY " . implode(', ', $this->_groupBy) .
+ ", {$this->_aliases['civicrm_contact']}.sort_name";
}
else {
$this->_groupBy = "ORDER BY {$this->_aliases['civicrm_contact']}.sort_name";
*/
function __construct() {
$this->_columns = array(
- 'civicrm_grant' =>
- array(
+ 'civicrm_grant' => array(
'dao' => 'CRM_Grant_DAO_Grant',
- 'fields' =>
- array(
- 'summary_statistics' =>
- array(
+ 'fields' => array(
+ 'summary_statistics' => array(
'name' => 'id',
'title' => ts('Summary Statistics'),
'required' => TRUE,
),
- 'grant_type_id' =>
- array(
+ 'grant_type_id' => array(
'name' => 'grant_type_id',
'title' => ts('By Grant Type'),
),
- 'status_id' =>
- array(
+ 'status_id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'amount_total' =>
- array(
+ 'amount_total' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'grant_report_received' =>
- array(
+ 'grant_report_received' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'currency' =>
- array(
+ 'currency' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
- 'filters' =>
- array(
- 'application_received_date' =>
- array(
+ 'filters' => array(
+ 'application_received_date' => array(
'name' => 'application_received_date',
'title' => ts('Application Received'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
- 'decision_date' =>
- array(
+ 'decision_date' => array(
'name' => 'decision_date',
'title' => ts('Grant Decision'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
- 'money_transfer_date' =>
- array(
+ 'money_transfer_date' => array(
'name' => 'money_transfer_date',
'title' => ts('Money Transferred'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
- 'grant_due_date' =>
- array(
+ 'grant_due_date' => array(
'name' => 'grant_due_date',
'title' => ts('Grant Report Due'),
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE,
),
- 'grant_type' =>
- array(
+ 'grant_type' => array(
'name' => 'grant_type_id',
'title' => ts('Grant Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id'),
),
- 'status_id' =>
- array(
+ 'status_id' => array(
'name' => 'status_id',
'title' => ts('Grant Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id'),
),
- 'amount_requested' =>
- array(
+ 'amount_requested' => array(
'name' => 'amount_requested',
'title' => ts('Amount Requested'),
'type' => CRM_Utils_Type::T_MONEY,
),
- 'amount_granted' =>
- array(
+ 'amount_granted' => array(
'name' => 'amount_granted',
'title' => ts('Amount Granted'),
),
- 'grant_report_received' =>
- array(
+ 'grant_report_received' => array(
'name' => 'grant_report_received',
'title' => ts('Report Received'),
'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => array('' => ts('- select -'),
+ 'options' => array(
+ '' => ts('- select -'),
0 => ts('No'),
1 => ts('Yes'),
),
),
),
),
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'id' =>
- array(
+ 'fields' => array(
+ 'id' => array(
'required' => TRUE,
'no_display' => TRUE,
),
- 'gender_id' =>
- array(
+ 'gender_id' => array(
'name' => 'gender_id',
'title' => ts('By Gender'),
),
- 'contact_type' =>
- array(
+ 'contact_type' => array(
'name' => 'contact_type',
'title' => ts('By Contact Type'),
),
),
- 'filters' =>
- array(
- 'gender_id' =>
- array(
+ 'filters' => array(
+ 'gender_id' => array(
'name' => 'gender_id',
'title' => ts('Gender'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
),
- 'contact_type' =>
- array(
+ 'contact_type' => array(
'name' => 'contact_type',
'title' => ts('Contact Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
),
'grouping' => 'contact-fields',
),
- 'civicrm_world_region' =>
- array(
+ 'civicrm_world_region' => array(
'dao' => 'CRM_Core_DAO_Worldregion',
- 'fields' =>
- array(
- 'id' =>
- array(
+ 'fields' => array(
+ 'id' => array(
'no_display' => TRUE,
),
- 'name' =>
- array(
+ 'name' => array(
'name' => 'name',
'title' => ts('By World Region'),
),
),
- 'filters' =>
- array(
- 'region_id' =>
- array(
+ 'filters' => array(
+ 'region_id' => array(
'name' => 'id',
'title' => ts('World Region'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
),
),
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'fields' =>
- array(
- 'country_id' =>
- array(
+ 'fields' => array(
+ 'country_id' => array(
'name' => 'country_id',
'title' => ts('By Country'),
),
),
- 'filters' =>
- array(
- 'country_id' =>
- array('title' => ts('Country'),
+ 'filters' => array(
+ 'country_id' => array(
+ 'title' => ts('Country'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::country(),
),
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
if (in_array($tableName, array(
- 'civicrm_address', 'civicrm_world_region'))) {
+ 'civicrm_address',
+ 'civicrm_world_region'
+ ))) {
$this->_addressField = TRUE;
}
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
else {
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
if (($fieldName == 'grant_report_received') &&
- (CRM_Utils_Array::value("{$fieldName}_value", $this->_params) === 0)
+ (CRM_Utils_Array::value("{$fieldName}_value", $this->_params) ===
+ 0)
) {
$op = 'nll';
$this->_params["{$fieldName}_value"] = NULL;
if (!empty($clause)) {
$clauses[] = $clause;
$this->_where .= " AND " . implode(' AND ', $clauses);
- $this->_whereClause = $whereClause . " AND " . implode(' AND ', $clauses);
+ $this->_whereClause = $whereClause . " AND " .
+ implode(' AND ', $clauses);
}
}
}
* @param $rows
*/
function alterDisplay(&$rows) {
- $totalStatistics = $grantStatistics = array();
- $totalStatistics = parent::statistics($rows);
+ $totalStatistics = $grantStatistics = array();
+ $totalStatistics = parent::statistics($rows);
$awardedGrantsAmount = $grantsReceived = $totalAmount = $awardedGrants = $grantReportsReceived = 0;
- $grantStatistics = array();
+ $grantStatistics = array();
$grantTypes = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id');
- $countries = CRM_Core_PseudoConstant::country();
- $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
+ $countries = CRM_Core_PseudoConstant::country();
+ $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
$grantAmountTotal = "
SELECT COUNT({$this->_aliases['civicrm_grant']}.id) as count ,
}
$values = CRM_Core_DAO::executeQuery($grantAmountAwarded);
while ($values->fetch()) {
- $awardedGrants = $values->count;
+ $awardedGrants = $values->count;
$awardedGrantsAmount = $values->totalAmount;
- $amountGranted = $values->grantedAmount;
+ $amountGranted = $values->grantedAmount;
}
foreach ($rows as $key => $values) {
}
}
- $totalStatistics['total_statistics'] = array('grants_received' => array('title' => ts('Grant Requests Received'),
+ $totalStatistics['total_statistics'] = array(
+ 'grants_received' => array(
+ 'title' => ts('Grant Requests Received'),
'count' => $grantsReceived,
'amount' => $totalAmount,
),
- 'grants_awarded' => array('title' => ts('Grants Awarded'),
+ 'grants_awarded' => array(
+ 'title' => ts('Grants Awarded'),
'count' => $awardedGrants,
'amount' => $amountGranted,
),
- 'grants_report_received' => array('title' => ts('Grant Reports Received'),
+ 'grants_report_received' => array(
+ 'title' => ts('Grant Reports Received'),
'count' => $grantReportsReceived,
),
);
$this->_outputMode == 'pdf'
) {
$row = array();
- $this->_columnHeaders = array('civicrm_grant_total_grants' => array('title' => ts('Summary')),
+ $this->_columnHeaders = array(
+ 'civicrm_grant_total_grants' => array('title' => ts('Summary')),
'civicrm_grant_count' => array('title' => ts('Count')),
'civicrm_grant_amount' => array('title' => ts('Amount')),
);
foreach ($value['value'] as $field => $values) {
foreach ($values['currency'] as $currency => $amount) {
- $totalAmount[$currency] = $currency . $amount['value'] . "({$values['percentage']}%)";
+ $totalAmount[$currency] = $currency . $amount['value'] .
+ "({$values['percentage']}%)";
}
$totalAmt = implode(', ', $totalAmount);
- $count = (boolean)CRM_Utils_Array::value('count', $values, 0) ? $values['count'] . " ({$values['percentage']}%)" : '';
- $row[] = array(
+ $count = (boolean) CRM_Utils_Array::value('count', $values, 0) ?
+ $values['count'] . " ({$values['percentage']}%)" : '';
+ $row[] = array(
'civicrm_grant_total_grants' => $field,
'civicrm_grant_count' => $count,
'civicrm_grant_amount' => $totalAmt,
* @param bool $customData
*/
static function getStatistics(&$grantStatistics, $fieldValue, $values,
- $awardedGrants, $awardedGrantsAmount, $customData = FALSE
+ $awardedGrants, $awardedGrantsAmount, $customData = FALSE
) {
if (!$awardedGrantsAmount) {
return;
if (!$customData) {
if (!isset($grantStatistics['value'][$fieldValue]['currency'][$currency])
- || !isset($grantStatistics['value'][$fieldValue]['currency'][$currency]['value'])) {
+ ||
+ !isset($grantStatistics['value'][$fieldValue]['currency'][$currency]['value'])
+ ) {
$grantStatistics['value'][$fieldValue]['currency'][$currency]['value'] = 0;
}
$grantStatistics['value'][$fieldValue]['currency'][$currency]['value'] += $values['civicrm_grant_amount_total'];
- $grantStatistics['value'][$fieldValue]['currency'][$currency]['percentage'] = round(($grantStatistics['value'][$fieldValue]['currency'][$currency]['value'] / $awardedGrantsAmount) * 100);
+ $grantStatistics['value'][$fieldValue]['currency'][$currency]['percentage'] = round(($grantStatistics['value'][$fieldValue]['currency'][$currency]['value'] /
+ $awardedGrantsAmount) * 100);
if (!isset($grantStatistics['value'][$fieldValue]['count'])) {
$grantStatistics['value'][$fieldValue]['count'] = 0;
}
$grantStatistics['value'][$fieldValue]['count']++;
- $grantStatistics['value'][$fieldValue]['percentage'] = round(($grantStatistics['value'][$fieldValue]['count'] / $awardedGrants) * 100);
+ $grantStatistics['value'][$fieldValue]['percentage'] = round(($grantStatistics['value'][$fieldValue]['count'] /
+ $awardedGrants) * 100);
}
else {
if (!isset($grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency])
- || !isset($grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['value'])) {
+ ||
+ !isset($grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['value'])
+ ) {
$grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['value'] = 0;
}
$grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['value'] += $values['civicrm_grant_amount_total'];
- $grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['percentage'] = round(($grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['value'] / $awardedGrantsAmount) * 100);
+ $grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['percentage'] = round(($grantStatistics['value'][$fieldValue]['unassigned_currency'][$currency]['value'] /
+ $awardedGrantsAmount) * 100);
$grantStatistics['value'][$fieldValue]['unassigned_count']++;
- $grantStatistics['value'][$fieldValue]['unassigned_percentage'] = round(($grantStatistics['value'][$fieldValue]['unassigned_count'] / $awardedGrants) * 100);
+ $grantStatistics['value'][$fieldValue]['unassigned_percentage'] = round(($grantStatistics['value'][$fieldValue]['unassigned_count'] /
+ $awardedGrants) * 100);
}
}
}
// just a toggle we use to build the from
protected $_mailingidField = FALSE;
- protected $_customGroupExtends = array('Contact', 'Individual', 'Household', 'Organization');
+ protected $_customGroupExtends = array(
+ 'Contact',
+ 'Individual',
+ 'Household',
+ 'Organization'
+ );
protected $_charts = array(
'' => 'Tabular',
'title' => ts('Contact ID'),
'required' => TRUE,
),
- 'sort_name' =>
- array(
+ 'sort_name' => array(
'title' => ts('Contact Name'),
'required' => TRUE,
),
'no_display' => TRUE,
),
),
- 'order_bys' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'), 'default' => TRUE, 'default_order' => 'ASC'),
+ 'order_bys' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ 'default' => TRUE,
+ 'default_order' => 'ASC'
+ ),
),
'grouping' => 'contact-fields',
);
'operator' => 'like',
),
),
- 'order_bys' =>
- array(
- 'mailing_name' =>
- array(
+ 'order_bys' => array(
+ 'mailing_name' => array(
'name' => 'name',
'title' => ts('Mailing'),
),
'title' => ts('Bounce Reason'),
),
),
- 'order_bys' =>
- array(
- 'bounce_reason' =>
- array('title' => ts('Bounce Reason')),
+ 'order_bys' => array(
+ 'bounce_reason' => array('title' => ts('Bounce Reason')),
),
'grouping' => 'mailing-fields',
);
'operator' => 'like',
),
),
- 'order_bys' =>
- array(
- 'bounce_name' =>
- array(
+ 'order_bys' => array(
+ 'bounce_name' => array(
'name' => 'name',
'title' => ts('Bounce Type'),
),
'required' => TRUE,
),
),
- 'order_bys' =>
- array(
- 'email' =>
- array('title' => ts('Email'), 'default_order' => 'ASC'),
+ 'order_bys' => array(
+ 'email' => array('title' => ts('Email'), 'default_order' => 'ASC'),
),
'grouping' => 'contact-fields',
);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_email') {
$this->_emailField = TRUE;
}
return;
}
- $chartInfo = array('legend' => ts('Mail Bounce Report'),
+ $chartInfo = array(
+ 'legend' => ts('Mail Bounce Report'),
'xname' => ts('Mailing'),
'yname' => ts('Bounce'),
'xLabelAngle' => 20,
protected $_phoneField = FALSE;
- protected $_customGroupExtends = array('Contact', 'Individual', 'Household', 'Organization');
+ protected $_customGroupExtends = array(
+ 'Contact',
+ 'Individual',
+ 'Household',
+ 'Organization'
+ );
protected $_charts = array(
'' => 'Tabular',
'title' => ts('Contact ID'),
'required' => TRUE,
),
- 'sort_name' =>
- array(
+ 'sort_name' => array(
'title' => ts('Contact Name'),
'required' => TRUE,
),
'no_display' => TRUE,
),
),
- 'order_bys' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'), 'default' => TRUE, 'default_order' => 'ASC'),
+ 'order_bys' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ 'default' => TRUE,
+ 'default_order' => 'ASC'
+ ),
),
'grouping' => 'contact-fields',
);
'operator' => 'like',
),
),
- 'order_bys' =>
- array(
- 'mailing_name' =>
- array(
+ 'order_bys' => array(
+ 'mailing_name' => array(
'name' => 'name',
'title' => ts('Mailing'),
),
'title' => ts('Click through URL'),
),
),
- 'order_bys' =>
- array(
- 'url' =>
- array('title' => ts('Click through URL')),
+ 'order_bys' => array(
+ 'url' => array('title' => ts('Click through URL')),
),
'grouping' => 'mailing-fields',
);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_email') {
$this->_emailField = TRUE;
}
return;
}
- $chartInfo = array('legend' => ts('Mail Clickthrough Report'),
+ $chartInfo = array(
+ 'legend' => ts('Mail Clickthrough Report'),
'xname' => ts('Mailing'),
'yname' => ts('Clicks'),
'xLabelAngle' => 20,
$this->_columns['civicrm_contact'] = array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'id' =>
- array(
+ 'fields' => array(
+ 'id' => array(
'name' => 'id',
'title' => ts('Contact ID'),
'required' => TRUE,
'no_display' => TRUE,
),
- 'sort_name' =>
- array(
+ 'sort_name' => array(
'title' => ts('Contact Name'),
'required' => TRUE,
),
),
- 'filters' =>
- array(
- 'sort_name' =>
- array(
+ 'filters' => array(
+ 'sort_name' => array(
'title' => ts('Contact Name'),
),
- 'id' =>
- array(
+ 'id' => array(
'title' => ts('Contact ID'),
'no_display' => TRUE,
),
),
- 'order_bys' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'order_bys' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'default' => TRUE,
'default_order' => 'ASC',
),
$this->_columns['civicrm_mailing'] = array(
'dao' => 'CRM_Mailing_DAO_Mailing',
- 'fields' =>
- array(
- 'mailing_name' =>
- array(
+ 'fields' => array(
+ 'mailing_name' => array(
'name' => 'name',
'title' => ts('Mailing'),
'default' => TRUE,
),
),
- 'filters' =>
- array(
- 'mailing_id' =>
- array(
+ 'filters' => array(
+ 'mailing_id' => array(
'name' => 'id',
'title' => ts('Mailing'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Mailing_BAO_Mailing::getMailingsList(),
),
),
- 'order_bys' =>
- array(
- 'mailing_name' =>
- array(
+ 'order_bys' => array(
+ 'mailing_name' => array(
'name' => 'name',
'title' => ts('Mailing'),
),
$this->_columns['civicrm_mailing_event_delivered'] = array(
'dao' => 'CRM_Mailing_Event_DAO_Delivered',
- 'fields' =>
- array(
- 'delivery_id' =>
- array(
+ 'fields' => array(
+ 'delivery_id' => array(
'name' => 'id',
'title' => ts('Delivery Status'),
'default' => TRUE,
),
),
- 'filters' =>
- array(
- 'delivery_status' =>
- array(
+ 'filters' => array(
+ 'delivery_status' => array(
'name' => 'delivery_status',
'title' => ts('Delivery Status'),
'operatorType' => CRM_Report_Form::OP_SELECT,
$this->_columns['civicrm_mailing_event_unsubscribe'] = array(
'dao' => 'CRM_Mailing_Event_DAO_Unsubscribe',
- 'fields' =>
- array(
- 'unsubscribe_id' =>
- array(
+ 'fields' => array(
+ 'unsubscribe_id' => array(
'name' => 'id',
'title' => ts('Unsubscribe'),
'default' => TRUE,
),
- 'optout_id' =>
- array(
+ 'optout_id' => array(
'name' => 'id',
'title' => ts('Opt-out'),
'default' => TRUE,
'alias' => 'mailing_event_unsubscribe_civireport2',
),
),
- 'filters' =>
- array(
- 'is_unsubscribed' =>
- array(
+ 'filters' => array(
+ 'is_unsubscribed' => array(
'name' => 'id',
'title' => ts('Unsubscribed'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => array('' => ts('Any'), '0' => ts('No'), '1' => ts('Yes')),
+ 'options' => array(
+ '' => ts('Any'),
+ '0' => ts('No'),
+ '1' => ts('Yes')
+ ),
'clause' => 'mailing_event_unsubscribe_civireport.id IS NULL',
),
- 'is_optout' =>
- array(
+ 'is_optout' => array(
'title' => ts('Opted-out'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => array('' => ts('Any'), '0' => ts('No'), '1' => ts('Yes')),
+ 'options' => array(
+ '' => ts('Any'),
+ '0' => ts('No'),
+ '1' => ts('Yes')
+ ),
'clause' => 'mailing_event_unsubscribe_civireport2.id IS NULL',
),
),
$this->_columns['civicrm_mailing_event_reply'] = array(
'dao' => 'CRM_Mailing_Event_DAO_Reply',
- 'fields' =>
- array(
- 'reply_id' =>
- array(
+ 'fields' => array(
+ 'reply_id' => array(
'name' => 'id',
'title' => ts('Reply'),
),
),
- 'filters' =>
- array(
- 'is_replied' =>
- array(
+ 'filters' => array(
+ 'is_replied' => array(
'name' => 'id',
'title' => ts('Replied'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => array('' => ts('Any'), '0' => ts('No'), '1' => ts('Yes')),
+ 'options' => array(
+ '' => ts('Any'),
+ '0' => ts('No'),
+ '1' => ts('Yes')
+ ),
'clause' => 'mailing_event_reply_civireport.id IS NULL',
),
),
$this->_columns['civicrm_mailing_event_forward'] = array(
'dao' => 'CRM_Mailing_Event_DAO_Forward',
- 'fields' =>
- array(
- 'forward_id' =>
- array(
+ 'fields' => array(
+ 'forward_id' => array(
'name' => 'id',
'title' => ts('Forwarded to Email'),
),
),
- 'filters' =>
- array(
- 'is_forwarded' =>
- array(
+ 'filters' => array(
+ 'is_forwarded' => array(
'name' => 'id',
'title' => ts('Forwarded'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => array('' => ts('Any'), '0' => ts('No'), '1' => ts('Yes')),
+ 'options' => array(
+ '' => ts('Any'),
+ '0' => ts('No'),
+ '1' => ts('Yes')
+ ),
'clause' => 'mailing_event_forward_civireport.id IS NULL',
),
),
$this->_columns['civicrm_email'] = array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email' =>
- array(
+ 'fields' => array(
+ 'email' => array(
'title' => ts('Email'),
'required' => TRUE,
),
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if (in_array($fieldName, array(
- 'unsubscribe_id', 'optout_id', 'forward_id', 'reply_id'))) {
+ 'unsubscribe_id',
+ 'optout_id',
+ 'forward_id',
+ 'reply_id'
+ ))) {
$select[] = "IF({$field['dbAlias']} IS NULL, 'No', 'Yes') as {$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
$this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
ON {$this->_aliases['civicrm_mailing_event_delivered']}.event_queue_id = civicrm_mailing_event_queue.id
LEFT JOIN civicrm_mailing_event_bounce {$this->_aliases['civicrm_mailing_event_bounce']}
ON {$this->_aliases['civicrm_mailing_event_bounce']}.event_queue_id = civicrm_mailing_event_queue.id";
- if (CRM_Utils_Array::value('delivery_status_value', $this->_params) == 'bounced') {
+ if (CRM_Utils_Array::value('delivery_status_value', $this->_params) ==
+ 'bounced'
+ ) {
$this->_columns['civicrm_mailing_event_delivered']['filters']['delivery_status']['clause'] = "{$this->_aliases['civicrm_mailing_event_bounce']}.id IS NOT NULL";
}
- elseif (CRM_Utils_Array::value('delivery_status_value', $this->_params) == 'successful') {
+ elseif (CRM_Utils_Array::value('delivery_status_value', $this->_params) ==
+ 'successful'
+ ) {
$this->_columns['civicrm_mailing_event_delivered']['filters']['delivery_status']['clause'] = "{$this->_aliases['civicrm_mailing_event_delivered']}.id IS NOT NULL";
}
}
if (array_key_exists('unsubscribe_id', $this->_params['fields']) ||
is_numeric(CRM_Utils_Array::value('is_unsubscribed_value', $this->_params))
) {
- if (CRM_Utils_Array::value('is_unsubscribed_value', $this->_params) == 1) {
+ if (CRM_Utils_Array::value('is_unsubscribed_value', $this->_params) == 1
+ ) {
$joinType = 'INNER';
$this->_columns['civicrm_mailing_event_unsubscribe']['filters']['is_unsubscribed']['clause'] = '(1)';
}
*/
function mailingList() {
- $data = array();
+ $data = array();
$mailing = new CRM_Mailing_BAO_Mailing();
- $query = "SELECT name FROM civicrm_mailing ";
+ $query = "SELECT name FROM civicrm_mailing ";
$mailing->query($query);
while ($mailing->fetch()) {
protected $_phoneField = FALSE;
- protected $_customGroupExtends = array('Contact', 'Individual', 'Household', 'Organization');
+ protected $_customGroupExtends = array(
+ 'Contact',
+ 'Individual',
+ 'Household',
+ 'Organization'
+ );
protected $_charts = array(
'' => 'Tabular',
'title' => ts('Contact ID'),
'required' => TRUE,
),
- 'sort_name' =>
- array(
+ 'sort_name' => array(
'title' => ts('Contact Name'),
'required' => TRUE,
),
'no_display' => TRUE,
),
),
- 'order_bys' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'), 'default' => TRUE, 'default_order' => 'ASC'),
+ 'order_bys' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ 'default' => TRUE,
+ 'default_order' => 'ASC'
+ ),
),
'grouping' => 'contact-fields',
);
$this->_columns['civicrm_mailing'] = array(
'dao' => 'CRM_Mailing_DAO_Mailing',
- 'fields' =>
- array(
+ 'fields' => array(
'mailing_name' => array(
'name' => 'name',
'title' => ts('Mailing'),
'operator' => 'like',
),
),
- 'order_bys' =>
- array(
- 'mailing_name' =>
- array(
+ 'order_bys' => array(
+ 'mailing_name' => array(
'name' => 'name',
'title' => ts('Mailing'),
),
'required' => TRUE,
),
),
- 'order_bys' =>
- array(
- 'email' =>
- array('title' => ts('Email'), 'default_order' => 'ASC'),
+ 'order_bys' => array(
+ 'email' => array('title' => ts('Email'), 'default_order' => 'ASC'),
),
'grouping' => 'contact-fields',
);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_email') {
$this->_emailField = TRUE;
}
return;
}
- $chartInfo = array('legend' => ts('Mail Opened Report'),
+ $chartInfo = array(
+ 'legend' => ts('Mail Opened Report'),
'xname' => ts('Mailing'),
'yname' => ts('Opened'),
'xLabelAngle' => 20,
protected $_allBatches = NULL;
protected $_customGroupExtends = array(
- 'Contribution', 'Membership');
+ 'Contribution',
+ 'Membership'
+ );
/**
*
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,
+ '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'),
+ ),
),
- ),
- 'grouping' => 'contact-fields',
- ),
- 'civicrm_email' =>
- array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array(
- 'email' =>
- array('title' => ts('Donor Email'),
- 'default' => TRUE,
- 'no_repeat' => TRUE,
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Donor Name'),
+ 'operator' => 'like',
+ ),
+ 'id' => array(
+ 'title' => ts('Contact ID'),
+ 'no_display' => TRUE,
+ ),
),
+ 'grouping' => 'contact-fields',
),
- 'grouping' => 'contact-fields',
- ),
- 'civicrm_phone' =>
- array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array(
- 'phone' =>
- array('title' => ts('Donor Phone'),
- 'default' => TRUE,
- 'no_repeat' => TRUE,
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Donor Email'),
+ 'default' => TRUE,
+ 'no_repeat' => TRUE,
+ ),
),
+ 'grouping' => 'contact-fields',
),
- '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_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,
- '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,
+ '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,
+ ),
),
),
- '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),
+ '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,
+ ),
),
- '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'),
+ '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_contribution_product' =>
- array(
- 'dao' => 'CRM_Contribute_DAO_ContributionProduct',
- 'fields' =>
- array(
- 'product_id' => array(
- 'no_display' => TRUE,
- ),
- 'product_option' => array(
- 'title' => ts('Premium Option'),
- ),
- 'contribution_id' => array(
- 'no_display' => TRUE,
+ 'civicrm_product' => array(
+ 'dao' => 'CRM_Contribute_DAO_Product',
+ 'fields' => array(
+ 'product_name' => array(
+ 'name' => 'name',
+ 'title' => ts('Premium'),
+ ),
),
),
- ),
- '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_contribution_product' => array(
+ 'dao' => 'CRM_Contribute_DAO_ContributionProduct',
+ 'fields' => array(
+ 'product_id' => array(
+ 'no_display' => TRUE,
+ ),
+ 'product_option' => array(
+ 'title' => ts('Premium Option'),
+ ),
+ 'contribution_id' => array(
+ 'no_display' => TRUE,
),
),
),
- ),
- '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,
+ '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',
+ ),
+ ),
),
- '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(),
+ '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',
),
- '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,
+ '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'),
+ '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',
),
- 'grouping' => 'member-fields',
- ),
- 'civicrm_note' =>
- array(
- 'dao' => 'CRM_Core_DAO_Note',
- 'fields' =>
- array(
- 'contribution_note' =>
- array(
- 'name' => 'note',
- 'title' => ts('Contribution Note'),
+ '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,
+ 'filters' => array(
+ 'note' => array(
+ 'name' => 'note',
+ 'title' => ts('Contribution Note'),
+ 'operator' => 'like',
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
),
),
- ),
- ) + $this->addAddressFields(FALSE);
+ ) + $this->addAddressFields(FALSE);
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
'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']['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'));
}
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
}
}
}
}
- elseif ($fieldName == 'first_donation_date' || $fieldName == 'first_donation_amount') {
+ elseif ($fieldName == 'first_donation_date' ||
+ $fieldName == 'first_donation_amount'
+ ) {
$baseField = CRM_Utils_Array::value('base_field', $field);
$select[] = "{$this->_aliases['civicrm_contribution']}.{$baseField} as {$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
";
//for premiums
- if (!empty($this->_params['fields']['product_name']) || !empty($this->_params['fields']['product_option'])) {
+ if (!empty($this->_params['fields']['product_name']) ||
+ !empty($this->_params['fields']['product_option'])
+ ) {
$this->_from .= "
LEFT JOIN civicrm_contribution_product {$this->_aliases['civicrm_contribution_product']}
ON ({$this->_aliases['civicrm_contribution_product']}.contribution_id = {$this->_aliases['civicrm_contribution']}.id)
}
// include contribution note
- if (!empty($this->_params['fields']['contribution_note']) || !empty($this->_params['note_value'])) {
- $this->_from.= "
+ if (!empty($this->_params['fields']['contribution_note']) ||
+ !empty($this->_params['note_value'])
+ ) {
+ $this->_from .= "
LEFT JOIN civicrm_note {$this->_aliases['civicrm_note']}
ON ( {$this->_aliases['civicrm_note']}.entity_table = 'civicrm_contribution' AND
{$this->_aliases['civicrm_contribution']}.id = {$this->_aliases['civicrm_note']}.entity_id )";
}
//for contribution batches
if ($this->_allBatches &&
- (!empty($this->_params['fields']['batch_id']) || !empty($this->_params['bid_value']))) {
+ (!empty($this->_params['fields']['batch_id']) ||
+ !empty($this->_params['bid_value']))
+ ) {
$this->_from .= "
LEFT JOIN civicrm_entity_financial_trxn tx ON (tx.entity_id = {$this->_aliases['civicrm_contribution']}.id AND
tx.entity_table = 'civicrm_contribution')
ON {$this->_aliases['civicrm_batch']}.id = {$this->_aliases['civicrm_entity_batch']}.batch_id";
}
- if ($this->_addressField OR (!empty($this->_params['state_province_id_value']) OR !empty($this->_params['country_id_value']))) {
+ if ($this->_addressField OR
+ (!empty($this->_params['state_province_id_value']) OR
+ !empty($this->_params['country_id_value']))
+ ) {
$this->_from .= "
LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND
function orderBy() {
$this->_orderBy = " ORDER BY {$this->_aliases['civicrm_contact']}.sort_name, {$this->_aliases['civicrm_contact']}.id ";
- if (!empty($this->_params['fields']['first_donation_date']) || !empty($this->_params['fields']['first_donation_amount'])) {
+ if (!empty($this->_params['fields']['first_donation_date']) ||
+ !empty($this->_params['fields']['first_donation_amount'])
+ ) {
$this->_orderBy .= ", {$this->_aliases['civicrm_contribution']}.receive_date";
}
}
$dao = CRM_Core_DAO::executeQuery($sql);
$totalAmount = $average = array();
while ($dao->fetch()) {
- $totalAmount[] = CRM_Utils_Money::format($dao->amount, $dao->currency)."(".$dao->count.")";
- $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
+ $totalAmount[] =
+ CRM_Utils_Money::format($dao->amount, $dao->currency) . "(" .
+ $dao->count . ")";
+ $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
}
$statistics['counts']['amount'] = array(
'title' => ts('Total Amount'),
// custom code to alter rows
$checkList = array();
- $entryFound = FALSE;
- $contributionTypes = CRM_Contribute_PseudoConstant::financialType();
+ $entryFound = FALSE;
+ $contributionTypes = CRM_Contribute_PseudoConstant::financialType();
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
}
// allow repeat for first donation amount and date in csv
- $fAmt = '';
+ $fAmt = '';
$fDate = '';
foreach ($rows as $rowNum => $row) {
if ($this->_outputMode == 'csv') {
if (array_key_exists('civicrm_contact_id', $row)) {
if ($contactId = $row['civicrm_contact_id']) {
if ($rowNum == 0) {
- $pcid = $contactId;
- $fAmt = $row['first_donation_first_donation_amount'];
+ $pcid = $contactId;
+ $fAmt = $row['first_donation_first_donation_amount'];
$fDate = $row['first_donation_first_donation_date'];
}
else {
if ($pcid == $contactId) {
$rows[$rowNum]['first_donation_first_donation_amount'] = $fAmt;
- $rows[$rowNum]['first_donation_first_donation_date'] = $fDate;
+ $rows[$rowNum]['first_donation_first_donation_date'] = $fDate;
$pcid = $contactId;
}
else {
- $fAmt = $row['first_donation_first_donation_amount'];
+ $fAmt = $row['first_donation_first_donation_amount'];
$fDate = $row['first_donation_first_donation_date'];
$pcid = $contactId;
}
}
// convert donor sort name to link
- if (array_key_exists('civicrm_contact_sort_name', $row) && !empty($rows[$rowNum]['civicrm_contact_sort_name']) &&
+ if (array_key_exists('civicrm_contact_sort_name', $row) &&
+ !empty($rows[$rowNum]['civicrm_contact_sort_name']) &&
array_key_exists('civicrm_contact_id', $row)
) {
$url = CRM_Utils_System::url('civicrm/contact/view',
CRM_Core_Permission::check('access CiviContribute')
) {
$url = CRM_Utils_System::url('civicrm/contact/view/contribution',
- 'reset=1&id=' . $row['civicrm_contribution_contribution_id'] . '&cid=' . $row['civicrm_contact_id'] . '&action=view&context=contribution&selectedChild=contribute',
+ 'reset=1&id=' . $row['civicrm_contribution_contribution_id'] .
+ '&cid=' . $row['civicrm_contact_id'] .
+ '&action=view&context=contribution&selectedChild=contribute',
$this->_absoluteUrl
);
$rows[$rowNum]['civicrm_contribution_total_amount_sum_link'] = $url;
protected $_phoneField = FALSE;
protected $_charts = array('' => 'Tabular');
protected $_customGroupExtends = array(
- 'Membership');
+ 'Membership'
+ );
public $_drilldownReport = array('member/detail' => 'Link to Detail Report');
/**
}
// UI for selecting columns to appear in the report list
- // array conatining the columns, group_bys and filters build and provided to Form
+ // array containing the columns, group_bys and filters build and provided to Form
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Member Name'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Member Name'),
'no_repeat' => TRUE,
'required' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'first_name' =>
- array('title' => ts('First Name'),
+ 'first_name' => array(
+ 'title' => ts('First Name'),
'no_repeat' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'last_name' =>
- array('title' => ts('Last Name'),
+ 'last_name' => array(
+ 'title' => ts('Last Name'),
'no_repeat' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
- 'contact_type' =>
- array(
+ 'contact_type' => array(
'title' => ts('Contact Type'),
),
- 'contact_sub_type' =>
- array(
+ 'contact_sub_type' => array(
'title' => ts('Contact Subtype'),
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_membership_type' =>
- array(
+ 'civicrm_membership_type' => array(
'dao' => 'CRM_Member_DAO_MembershipType',
'grouping' => 'member-fields',
- 'filters' =>
- array(
- 'tid' =>
- array(
+ 'filters' => array(
+ 'tid' => array(
'name' => 'id',
'title' => ts('Membership Types'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
),
),
),
- 'civicrm_membership' =>
- array(
+ 'civicrm_membership' => array(
'dao' => 'CRM_Member_DAO_Membership',
'grouping' => 'member-fields',
- 'fields' =>
- array(
- 'membership_type_id' =>
- array(
+ '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_start_date' => array(
+ 'title' => ts('Current Cycle Start Date'),
),
- 'membership_end_date' => array('title' => ts('Membership Lapse Date'),
+ 'membership_end_date' => array(
+ 'title' => ts('Membership Lapse Date'),
'required' => TRUE,
),
),
- 'filters' =>
- array(
- 'membership_end_date' =>
- array(
+ 'filters' => array(
+ 'membership_end_date' => array(
'title' => 'Lapsed Memberships',
'operatorType' => CRM_Report_Form::OP_DATE,
),
),
),
- 'civicrm_membership_status' =>
- array(
+ 'civicrm_membership_status' => array(
'dao' => 'CRM_Member_DAO_MembershipStatus',
'alias' => 'mem_status',
- 'fields' =>
- array(
- 'name' => array('title' => ts('Current Status'),
+ 'fields' => array(
+ 'name' => array(
+ 'title' => ts('Current Status'),
'required' => TRUE,
),
),
'grouping' => 'member-fields',
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'fields' =>
- array(
+ 'fields' => array(
'street_address' => NULL,
'city' => NULL,
'postal_code' => NULL,
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
- 'country_id' =>
- array('title' => ts('Country'),
+ 'country_id' => array(
+ 'title' => ts('Country'),
'default' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
'alias' => 'phone',
- 'fields' =>
- array('phone' => NULL),
+ 'fields' => array('phone' => NULL),
'grouping' => 'contact-fields',
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array('email' => NULL),
+ 'fields' => array('email' => NULL),
'grouping' => 'contact-fields',
),
);
'title' => 'Campaign',
'default' => 'false',
);
- $this->_columns['civicrm_membership']['filters']['campaign_id'] = array('title' => ts('Campaign'),
+ $this->_columns['civicrm_membership']['filters']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activeCampaigns,
);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
// to include optional columns address ,email and phone only if checked
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
if ($field['operatorType'] & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
if (empty($clauses)) {
- $this->_where = "WHERE end_date < '" . date('Y-m-d') . "' AND {$this->_aliases['civicrm_membership_status']}.name = 'Expired'";
+ $this->_where = "WHERE end_date < '" . date('Y-m-d') .
+ "' AND {$this->_aliases['civicrm_membership_status']}.name = 'Expired'";
}
else {
if (!array_key_exists('end_date', $clauses)) {
- $this->_where = "WHERE end_date < '" . date('Y-m-d') . "' AND " . implode(' AND ', $clauses);
+ $this->_where = "WHERE end_date < '" . date('Y-m-d') . "' AND " .
+ implode(' AND ', $clauses);
}
else {
$this->_where = "WHERE " . implode(' AND ', $clauses);
$this->buildACLClause($this->_aliases['civicrm_contact']);
$sql = $this->buildQuery(TRUE);
- $dao = CRM_Core_DAO::executeQuery($sql);
- $rows = $graphRows = array();
+ $dao = CRM_Core_DAO::executeQuery($sql);
+ $rows = $graphRows = array();
$count = 0;
while ($dao->fetch()) {
$row = array();
// 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();
+ $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->_columns = array(
- 'civicrm_membership' =>
- array(
+ 'civicrm_membership' => array(
'dao' => 'CRM_Member_DAO_MembershipType',
'grouping' => 'member-fields',
- 'fields' =>
- array(
- 'membership_type_id' =>
- array(
+ 'fields' => array(
+ 'membership_type_id' => array(
'title' => 'Membership Type',
'required' => TRUE,
),
),
- 'filters' =>
- array(
- 'join_date' =>
- array('title' => ts('Member Since'),
+ '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(
+ '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(
+ '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'),
+ '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'),
+ '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'),
+ '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'),
+ 'group_bys' => array(
+ 'join_date' => array(
+ 'title' => ts('Member Since'),
'default' => TRUE,
'frequency' => TRUE,
'chart' => TRUE,
'type' => 12,
),
- 'membership_type_id' =>
- array(
+ 'membership_type_id' => array(
'title' => 'Membership Type',
'default' => TRUE,
'chart' => TRUE,
),
),
),
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'contact_id' =>
- array(
+ 'fields' => array(
+ 'contact_id' => array(
'no_display' => TRUE,
),
- 'contact_type' =>
- array(
+ 'contact_type' => array(
'title' => ts('Contact Type'),
),
- 'contact_sub_type' =>
- array(
+ 'contact_sub_type' => array(
'title' => ts('Contact Subtype'),
),
),
),
- 'civicrm_contribution' =>
- array(
+ 'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' =>
- array(
- 'currency' =>
- array('required' => TRUE,
+ 'fields' => array(
+ 'currency' => array(
+ 'required' => TRUE,
'no_display' => TRUE,
),
- 'total_amount' =>
- array('title' => ts('Amount Statistics'),
+ 'total_amount' => array(
+ 'title' => ts('Amount Statistics'),
'required' => TRUE,
- 'statistics' =>
- array('sum' => ts('Total Payments Made'),
+ 'statistics' => array(
+ 'sum' => ts('Total Payments Made'),
'count' => ts('Contribution Count'),
'avg' => ts('Average'),
),
),
),
- 'filters' =>
- array(
- 'currency' =>
- array('title' => 'Currency',
+ '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'),
+ 'contribution_status_id' => array(
+ 'title' => ts('Contribution Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
),
'title' => 'Campaign',
'default' => 'false',
);
- $this->_columns['civicrm_membership']['filters']['campaign_id'] = array('title' => ts('Campaign'),
+ $this->_columns['civicrm_membership']['filters']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activeCampaigns,
);
$this->_columnHeaders = array();
$select[] = " COUNT( DISTINCT {$this->_aliases['civicrm_membership']}.id ) as civicrm_membership_member_count";
$select['joinDate'] = " {$this->_aliases['civicrm_membership']}.join_date as civicrm_membership_member_join_date";
- $this->_columnHeaders["civicrm_membership_member_join_date"] = array('title' => ts('Member Since'),
+ $this->_columnHeaders["civicrm_membership_member_join_date"] = array(
+ 'title' => ts('Member Since'),
'type' => CRM_Utils_Type::T_DATE,
);
foreach ($this->_columns as $tableName => $table) {
case 'YEARWEEK':
$select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
- $select[] = "YEARWEEK({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "WEEKOFYEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "YEARWEEK({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "WEEKOFYEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Week';
break;
case 'YEAR':
- $select[] = "MAKEDATE(YEAR({$field['dbAlias']}), 1) AS {$tableName}_{$fieldName}_start";
- $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "MAKEDATE(YEAR({$field['dbAlias']}), 1) AS {$tableName}_{$fieldName}_start";
+ $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Year';
break;
case 'MONTH':
- $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL (DAYOFMONTH({$field['dbAlias']})-1) DAY) as {$tableName}_{$fieldName}_start";
- $select[] = "MONTH({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "MONTHNAME({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL (DAYOFMONTH({$field['dbAlias']})-1) DAY) as {$tableName}_{$fieldName}_start";
+ $select[] = "MONTH({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "MONTHNAME({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Month';
break;
case 'QUARTER':
- $select[] = "STR_TO_DATE(CONCAT( 3 * QUARTER( {$field['dbAlias']} ) -2 , '/', '1', '/', YEAR( {$field['dbAlias']} ) ), '%m/%d/%Y') AS {$tableName}_{$fieldName}_start";
- $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
- $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
+ $select[] = "STR_TO_DATE(CONCAT( 3 * QUARTER( {$field['dbAlias']} ) -2 , '/', '1', '/', YEAR( {$field['dbAlias']} ) ), '%m/%d/%Y') AS {$tableName}_{$fieldName}_start";
+ $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
+ $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
$field['title'] = 'Quarter';
break;
}
if (!empty($this->_params['group_bys_freq'][$fieldName])) {
$this->_interval = $field['title'];
- $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning';
+ $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] =
+ $field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['group_by'] = $this->_params['group_bys_freq'][$fieldName];
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
// only include statistics columns if set
if (!empty($field['statistics'])) {
}
}
elseif ($fieldName == 'membership_type_id') {
- if (empty($this->_params['group_bys']['membership_type_id']) && !empty($this->_params['group_bys']['join_date'])) {
+ if (empty($this->_params['group_bys']['membership_type_id']) &&
+ !empty($this->_params['group_bys']['join_date'])
+ ) {
$select[] = "GROUP_CONCAT(DISTINCT {$field['dbAlias']} ORDER BY {$field['dbAlias']} ) as {$tableName}_{$fieldName}";
}
else {
}
}
}
- $this->_columnHeaders["civicrm_membership_member_count"] = array('title' => ts('Member Count'),
+ $this->_columnHeaders["civicrm_membership_member_count"] = array(
+ 'title' => ts('Member Count'),
'type' => CRM_Utils_Type::T_INT,
);
}
LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
ON payment.contribution_id = {$this->_aliases['civicrm_contribution']}.id";
}
+
// end of from
function where() {
if (!empty($field['chart'])) {
$this->assign('chartSupported', TRUE);
}
- if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) {
+ if (!empty($table['group_bys'][$fieldName]['frequency']) &&
+ !empty($this->_params['group_bys_freq'][$fieldName])
+ ) {
$append = "YEAR({$field['dbAlias']}),";
if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]),
- array('year')
- )) {
+ array('year')
+ )) {
$append = '';
}
$this->_groupBy[] = "$append {$this->_params['group_bys_freq'][$fieldName]}({$field['dbAlias']})";
}
$this->_rollup = ' WITH ROLLUP';
- $this->_groupBy = 'GROUP BY ' . implode(', ', $this->_groupBy) . " {$this->_rollup} ";
+ $this->_groupBy = 'GROUP BY ' . implode(', ', $this->_groupBy) .
+ " {$this->_rollup} ";
}
else {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_membership']}.join_date";
$totalAmount = $average = array();
$count = $memberCount = 0;
while ($dao->fetch()) {
- $totalAmount[] = CRM_Utils_Money::format($dao->amount, $dao->currency)."(".$dao->count.")";
- $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
+ $totalAmount[] =
+ CRM_Utils_Money::format($dao->amount, $dao->currency) . "(" .
+ $dao->count . ")";
+ $average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
$count += $dao->count;
$memberCount += $dao->memberCount;
}
'type' => CRM_Utils_Type::T_STRING,
);
- if (!(int)$statistics['counts']['amount']['value']) {
+ if (!(int) $statistics['counts']['amount']['value']) {
//if total amount is zero then hide Chart Options
$this->assign('chartSupported', FALSE);
}
if (!empty($this->_params['charts'])) {
foreach ($rows as $key => $row) {
if (!($row['civicrm_membership_join_date_subtotal'] &&
- $row['civicrm_membership_membership_type_id']
- )) {
+ $row['civicrm_membership_membership_type_id']
+ )
+ ) {
continue;
}
if ($isMembershipType) {
$displayRange = $year;
break;
}
- $membershipType = $displayRange . "-" . $membershipTypeValues[$row['civicrm_membership_membership_type_id']];
+ $membershipType = $displayRange . "-" .
+ $membershipTypeValues[$row['civicrm_membership_membership_type_id']];
}
else {
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
// make count columns point to detail report
- if (!empty($this->_params['group_bys']['join_date']) && !empty($row['civicrm_membership_join_date_start']) &&
+ if (!empty($this->_params['group_bys']['join_date']) &&
+ !empty($row['civicrm_membership_join_date_start']) &&
$row['civicrm_membership_join_date_start'] &&
$row['civicrm_membership_join_date_subtotal']
) {
$dateStart = CRM_Utils_Date::customFormat($row['civicrm_membership_join_date_start'], '%Y%m%d');
- $endDate = new DateTime($dateStart);
- $dateEnd = array();
+ $endDate = new DateTime($dateStart);
+ $dateEnd = array();
list($dateEnd['Y'], $dateEnd['M'], $dateEnd['d']) = explode(':', $endDate->format('Y:m:d'));
switch (strtolower($this->_params['group_bys_freq']['join_date'])) {
case 'month':
$dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'] + 1,
- $dateEnd['d'] - 1, $dateEnd['Y']
- ));
+ $dateEnd['d'] - 1, $dateEnd['Y']
+ ));
break;
case 'year':
$dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'],
- $dateEnd['d'] - 1, $dateEnd['Y'] + 1
- ));
+ $dateEnd['d'] - 1, $dateEnd['Y'] + 1
+ ));
break;
case 'yearweek':
$dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'],
- $dateEnd['d'] + 6, $dateEnd['Y']
- ));
+ $dateEnd['d'] + 6, $dateEnd['Y']
+ ));
break;
case 'quarter':
$dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'] + 3,
- $dateEnd['d'] - 1, $dateEnd['Y']
- ));
+ $dateEnd['d'] - 1, $dateEnd['Y']
+ ));
break;
}
$typeUrl = '';
}
$statusUrl = '';
if (!empty($this->_params['status_id_value'])) {
- $statusUrl = "&sid_op=in&sid_value=" . implode(",", $this->_params['status_id_value']);
+ $statusUrl = "&sid_op=in&sid_value=" .
+ implode(",", $this->_params['status_id_value']);
}
$url = CRM_Report_Utils_Report::getNextUrl('member/detail',
"reset=1&force=1&join_date_from={$dateStart}&join_date_to={$dateEnd}{$typeUrl}{$statusUrl}",
// 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(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Member Name'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Member Name'),
'no_repeat' => TRUE,
'required' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
- 'group_bys' =>
- array(
- 'id' =>
- array('title' => ts('Contact ID')),
- 'display_name' =>
- array('title' => ts('Contact Name'),
+ 'group_bys' => array(
+ 'id' => array('title' => ts('Contact ID')),
+ 'display_name' => array(
+ 'title' => ts('Contact Name'),
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_membership_type' =>
- array(
+ 'civicrm_membership_type' => array(
'dao' => 'CRM_Member_DAO_MembershipType',
'grouping' => 'member-fields',
- 'filters' =>
- array(
- 'gid' =>
- array(
+ 'filters' => array(
+ 'gid' => array(
'name' => 'id',
'title' => ts('Membership Types'),
'type' => CRM_Utils_Type::T_INT + CRM_Utils_Type::T_ENUM,
),
),
),
- 'civicrm_membership' =>
- array(
+ 'civicrm_membership' => array(
'dao' => 'CRM_Member_DAO_Membership',
'grouping' => 'member-fields',
- 'fields' =>
- array(
- 'membership_type_id' =>
- array(
+ 'fields' => array(
+ 'membership_type_id' => array(
'title' => 'Membership Type',
'required' => TRUE,
),
'join_date' => NULL,
- 'start_date' => array('title' => ts('Current Cycle Start Date'),
+ 'start_date' => array(
+ 'title' => ts('Current Cycle Start Date'),
),
- 'end_date' => array('title' => ts('Current Cycle End Date'),
+ 'end_date' => array(
+ 'title' => ts('Current Cycle End Date'),
),
),
- 'group_bys' =>
- array(
- 'membership_type_id' =>
- array('title' => ts('Membership Type')),
+ 'group_bys' => array(
+ 'membership_type_id' => array('title' => ts('Membership Type')),
),
- 'filters' =>
- array(
- 'join_date' =>
- array('type' => CRM_Utils_Type::T_DATE),
+ 'filters' => array(
+ 'join_date' => array('type' => CRM_Utils_Type::T_DATE),
),
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'fields' =>
- array(
+ 'fields' => array(
'street_address' => NULL,
'city' => NULL,
'postal_code' => NULL,
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
- 'country_id' =>
- array('title' => ts('Country'),
+ 'country_id' => array(
+ 'title' => ts('Country'),
'default' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array('email' => NULL),
+ 'fields' => array('email' => NULL),
'grouping' => 'contact-fields',
),
- 'civicrm_contribution' =>
- array(
+ 'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
- 'filters' =>
- array(
- 'total_amount' =>
- array('title' => ts('Contribution Amount'),
+ 'filters' => array(
+ 'total_amount' => array(
+ 'title' => ts('Contribution Amount'),
),
),
),
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
// to include optional columns address and email, only if checked
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
$clause = NULL;
if ($field['type'] & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to);
*/
function statistics(&$rows) {
$statistics = array();
- $statistics[] = array('title' => ts('Row(s) Listed'),
+ $statistics[] = array(
+ 'title' => ts('Row(s) Listed'),
'value' => count($rows),
);
return $statistics;
) {
$this->_rollup = " WITH ROLLUP";
}
- $this->_groupBy = "GROUP BY " . implode(', ', $this->_groupBy) . " {$this->_rollup} ";
+ $this->_groupBy = "GROUP BY " . implode(', ', $this->_groupBy) .
+ " {$this->_rollup} ";
}
else {
$this->_groupBy = "GROUP BY contact.id";
$sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
- $dao = CRM_Core_DAO::executeQuery($sql);
- $rows = $graphRows = array();
+ $dao = CRM_Core_DAO::executeQuery($sql);
+ $rows = $graphRows = array();
$count = 0;
while ($dao->fetch()) {
$row = array();
if (!empty($this->_params['charts'])) {
foreach (array(
- 'receive_date', $this->_interval, 'value') as $ignore) {
+ 'receive_date',
+ $this->_interval,
+ 'value'
+ ) as $ignore) {
unset($graphRows[$ignore][$count - 1]);
}
'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
$this->_absoluteUrl
);
- $rows[$rowNum]['civicrm_contact_sort_name'] = "<a href='$url'>" . $row["civicrm_contact_sort_name"] . '</a>';
+ $rows[$rowNum]['civicrm_contact_sort_name'] =
+ "<a href='$url'>" . $row["civicrm_contact_sort_name"] . '</a>';
$entryFound = TRUE;
}
*/
- /*
- * !!!!!!!!!!!!!!!!!!!!
- * NB: this is named detail but behaves like a summary report.
- * It is also accessed through the Pledge Summary link in the UI
- * This should presumably be changed.
- * ~ Doten
- * !!!!!!!!!!!!!!!!!!!!
- *
- */
+/*
+ * !!!!!!!!!!!!!!!!!!!!
+ * NB: this is named detail but behaves like a summary report.
+ * It is also accessed through the Pledge Summary link in the UI
+ * This should presumably be changed.
+ * ~ Doten
+ * !!!!!!!!!!!!!!!!!!!!
+ *
+ */
/**
*
*
*/
function __construct() {
- $this->_pledgeStatuses = CRM_Contribute_PseudoConstant::contributionStatus();
- // Check if CiviCampaign is a) enabled and b) has active campaigns
- $config = CRM_Core_Config::singleton();
+ $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->_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,
- ),
- '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,
+ 'civicrm_contact' => array(
+ 'dao' => 'CRM_Contact_DAO_Contact',
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ 'required' => TRUE,
+ 'no_repeat' => TRUE,
+ ),
),
- 'status_id' =>
- array('title' => ts('Pledge Status'),
- 'required' => TRUE,
+ 'filters' => array(
+ 'sort_name' => array('title' => ts('Contact Name')),
+ 'id' => array('no_display' => TRUE),
),
+ 'grouping' => 'contact-fields',
),
- '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,
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array('no_repeat' => TRUE),
),
- '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'),
+ '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,
+ ),
+ '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'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Core_OptionGroup::values('contribution_status'),
+ ),
+ ),
),
- ),
- 'civicrm_pledge_payment' =>
- array(
- 'dao' => 'CRM_Pledge_DAO_PledgePayment',
- 'fields' =>
- array(
- 'total_paid' =>
- array(
+ '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(
+ 'balance_due' => array(
'title' => ts('Balance Due'),
'default' => TRUE,
'type' => CRM_Utils_Type::T_MONEY,
),
+ ),
),
- ),
- )
- + $this->getAddressColumns(array('group_by' => FALSE))
- + $this->getPhoneColumns();
+ )
+ + $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->_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'));
}
* @return bool|string
*/
function selectClause(&$tableName, $tableKey, &$fieldName, &$field) {
- if($fieldName == 'total_paid'){
+ if ($fieldName == 'total_paid') {
$this->_totalPaid = TRUE; // add pledge_payment join
$this->_columnHeaders["{$tableName}_{$fieldName}"] = array(
'title' => $field['title'],
);
return "COALESCE(sum({$this->_aliases[$tableName]}.actual_amount), 0) as {$tableName}_{$fieldName}";
}
- if($fieldName == 'balance_due'){
+ if ($fieldName == 'balance_due') {
$cancelledStatus = array_search('Cancelled', $this->_pledgeStatuses);
$completedStatus = array_search('Completed', $this->_pledgeStatuses);
$this->_totalPaid = TRUE; // add pledge_payment join
'title' => $field['title'],
'type' => $field['type']
);
- return "IF({$this->_aliases['civicrm_pledge']}.status_id IN({$cancelledStatus}, $completedStatus), 0, COALESCE({$this->_aliases['civicrm_pledge']}.amount, 0) - COALESCE(sum({$this->_aliases[$tableName]}.actual_amount),0)) as {$tableName}_{$fieldName}";
+ return "IF({$this->_aliases['civicrm_pledge']}.status_id IN({$cancelledStatus}, $completedStatus), 0, COALESCE({$this->_aliases['civicrm_pledge']}.amount, 0) - COALESCE(sum({$this->_aliases[$tableName]}.actual_amount),0)) as {$tableName}_{$fieldName}";
}
return FALSE;
}
function groupBy() {
parent::groupBy();
if (empty($this->_groupBy) && $this->_totalPaid) {
- $this->_groupBy = " GROUP BY {$this->_aliases['civicrm_pledge']}.id, {$this->_aliases['civicrm_pledge']}.currency" ;
+ $this->_groupBy = " GROUP BY {$this->_aliases['civicrm_pledge']}.id, {$this->_aliases['civicrm_pledge']}.currency";
}
}
+
function from() {
$this->_from = "
FROM civicrm_pledge {$this->_aliases['civicrm_pledge']}
{$this->_aliases['civicrm_pledge']}.contact_id )
{$this->_aclFrom} ";
- if($this->_totalPaid){
+ if ($this->_totalPaid) {
$this->_from .= "
LEFT JOIN civicrm_pledge_payment {$this->_aliases['civicrm_pledge_payment']} ON
{$this->_aliases['civicrm_pledge']}.id = {$this->_aliases['civicrm_pledge_payment']}.pledge_id
*/
function statistics(&$rows) {
$statistics = parent::statistics($rows);
- //regenerate the from field without extra left join on pledge payments
+ //regenerate the from field without extra left join on pledge payments
$this->_totalPaid = FALSE;
$this->from();
$this->customDataFrom();
$dao = CRM_Core_DAO::executeQuery($sql);
$count = $index = $totalCount = 0;
// this will run once per currency
- while($dao->fetch()) {
+ while ($dao->fetch()) {
$totalAmount = CRM_Utils_Money::format($dao->amount, $dao->currency);
- $average = CRM_Utils_Money::format($dao->avg, $dao->currency);
+ $average = CRM_Utils_Money::format($dao->avg, $dao->currency);
$count = $dao->count;
$totalCount .= $count;
$statistics['counts']['amount' . $index] = array(
'value' => $count,
'type' => CRM_Utils_Type::T_INT,
);
- $index ++;
+ $index++;
}
- if($totalCount > $count) {
+ if ($totalCount > $count) {
$statistics['counts']['count' . $index] = array(
'title' => ts('Total No Pledges'),
'value' => $totalCount,
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);
- $sql = $this->buildQuery();
- $rows = $payment = array();
+ $sql = $this->buildQuery();
+ $rows = $payment = array();
$dao = CRM_Core_DAO::executeQuery($sql);
$this->_columnHeaders['scheduled_date'] = array(
'type' => CRM_Utils_Type::T_DATE,
'title' => 'Next Payment Due',
- );
- $this->_columnHeaders['scheduled_amount'] = array(
- 'type' => CRM_Utils_Type::T_MONEY,
- 'title' => 'Next Payment Amount',
- );
- $this->_columnHeaders['status_id'] = NULL;
-
- /*
- * this is purely about ordering the total paid & balance due fields off to the end
- * of the table in case custom or address fields cause them to fall in the middle
- * (arguably the pledge amount should be moved to after these fields too)
- *
- */
- $tableHeaders = array(
- 'civicrm_pledge_payment_total_paid',
- 'civicrm_pledge_payment_balance_due'
- );
+ );
+ $this->_columnHeaders['scheduled_amount'] = array(
+ 'type' => CRM_Utils_Type::T_MONEY,
+ 'title' => 'Next Payment Amount',
+ );
+ $this->_columnHeaders['status_id'] = NULL;
+
+ /*
+ * this is purely about ordering the total paid & balance due fields off to the end
+ * of the table in case custom or address fields cause them to fall in the middle
+ * (arguably the pledge amount should be moved to after these fields too)
+ *
+ */
+ $tableHeaders = array(
+ 'civicrm_pledge_payment_total_paid',
+ 'civicrm_pledge_payment_balance_due'
+ );
foreach ($tableHeaders as $header) {
//per above, unset & reset them so they move to the end
- if(isset($this->_columnHeaders[$header])){
+ if (isset($this->_columnHeaders[$header])) {
$headervalue = $this->_columnHeaders[$header];
unset($this->_columnHeaders[$header]);
$this->_columnHeaders[$header] = $headervalue;
*/
function alterDisplay(&$rows) {
// custom code to alter rows
- $entryFound = FALSE;
- $checkList = array();
+ $entryFound = FALSE;
+ $checkList = array();
$display_flag = $prev_cid = $cid = 0;
foreach ($rows as $rowNum => $row) {
public $_drilldownReport = array('pledge/summary' => 'Link to Detail Report');
protected $_customGroupExtends = array(
- 'Pledge');
+ 'Pledge'
+ );
/**
*
}
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'sort_name' =>
- array('title' => ts('Constituent Name'),
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Constituent Name'),
'required' => TRUE,
'no_repeat' => TRUE,
),
- 'id' =>
- array(
+ 'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_pledge' =>
- array(
+ 'civicrm_pledge' => array(
'dao' => 'CRM_Pledge_DAO_Pledge',
- 'fields' =>
- array(
- 'pledge_create_date' =>
- array('title' => ts('Pledge Made'),
+ 'fields' => array(
+ 'pledge_create_date' => array(
+ 'title' => ts('Pledge Made'),
'required' => TRUE,
),
- 'financial_type_id' =>
- array('title' => ts('Financial Type'),
+ 'financial_type_id' => array(
+ 'title' => ts('Financial Type'),
'requried' => TRUE,
),
- 'amount' =>
- array('title' => ts('Amount'),
+ 'amount' => array(
+ 'title' => ts('Amount'),
'required' => TRUE,
'type' => CRM_Utils_Type::T_MONEY,
),
- 'currency' =>
- array(
+ 'currency' => array(
'required' => TRUE,
'no_display' => TRUE,
),
- 'status_id' =>
- array('title' => ts('Status'),
+ 'status_id' => array(
+ 'title' => ts('Status'),
),
),
- 'filters' =>
- array(
- 'pledge_create_date' =>
- array(
+ 'filters' => array(
+ 'pledge_create_date' => array(
'title' => ts('Pledge Made'),
'operatorType' => CRM_Report_Form::OP_DATE,
),
- 'currency' =>
- array('title' => 'Currency',
+ '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'),
+ 'financial_type_id' => array(
+ 'title' => ts('Financial Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::financialType(),
+ 'options' => CRM_Contribute_PseudoConstant::financialType(),
),
),
'grouping' => 'pledge-fields',
),
- 'civicrm_pledge_payment' =>
- array(
+ 'civicrm_pledge_payment' => array(
'dao' => 'CRM_Pledge_DAO_PledgePayment',
- 'fields' =>
- array(
+ 'fields' => array(
'scheduled_date' => array(
'title' => ts('Next Payment Due'),
'type' => CRM_Utils_Type::T_DATE,
'required' => TRUE,
),
),
- 'filters' =>
- array(
- 'scheduled_date' =>
- array(
+ '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(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'fields' =>
- array(
+ 'fields' => array(
'street_address' => NULL,
'city' => NULL,
'postal_code' => NULL,
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
),
- 'country_id' =>
- array('title' => ts('Country'),
+ 'country_id' => array(
+ 'title' => ts('Country'),
'default' => TRUE,
),
),
'grouping' => 'contact-fields',
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array('email' => NULL),
+ 'fields' => array('email' => NULL),
'grouping' => 'contact-fields',
),
- 'civicrm_group' =>
- array(
+ 'civicrm_group' => array(
'dao' => 'CRM_Contact_DAO_Group',
'alias' => 'cgroup',
- 'filters' =>
- array(
- 'gid' =>
- array(
+ 'filters' => array(
+ 'gid' => array(
'name' => 'group_id',
'title' => ts('Group'),
'group' => TRUE,
'title' => 'Campaign',
'default' => 'false',
);
- $this->_columns['civicrm_pledge']['filters']['campaign_id'] = array('title' => ts('Campaign'),
+ $this->_columns['civicrm_pledge']['filters']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => $this->activeCampaigns,
);
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
// to include optional columns address and email, only if checked
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$pendingStatus = array_search('Pending', $allStatus);
foreach (array(
- 'Pending', 'In Progress', 'Overdue') as $statusKey) {
+ 'Pending',
+ 'In Progress',
+ 'Overdue'
+ ) as $statusKey) {
if ($key = CRM_Utils_Array::key($statusKey, $allStatus)) {
$unpaidStatus[] = $key;
}
*/
function alterDisplay(&$rows) {
// custom code to alter rows
- $entryFound = FALSE;
- $checkList = array();
+ $entryFound = FALSE;
+ $checkList = array();
$display_flag = $prev_cid = $cid = 0;
foreach ($rows as $rowNum => $row) {
if (array_key_exists('civicrm_pledge_financial_type_id', $row)) {
if ($value = $row['civicrm_pledge_financial_type_id']) {
$rows[$rowNum]['civicrm_pledge_financial_type_id'] =
- CRM_Contribute_PseudoConstant::financialType($value, false);
+ CRM_Contribute_PseudoConstant::financialType($value, FALSE);
}
$entryFound = TRUE;
}
*/
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'),
+ '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,
),
),
- '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'),
+ 'grouping' => 'contact-fields',
+ 'group_bys' => array(
+ 'id' => array('title' => ts('Contact ID')),
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ ),
),
),
- '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'),
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array(
+ 'no_repeat' => TRUE,
+ 'title' => ts('email'),
+ ),
),
+ 'grouping' => 'contact-fields',
),
- 'group_bys' =>
- array(
- 'pledge_create_date' =>
- array(
- 'frequency' => TRUE,
- 'default' => TRUE,
- 'chart' => TRUE,
+ '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'),
+ ),
),
- 'frequency_unit' =>
- array('title' => ts('Frequency Unit'),
+ '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'),
+ ),
),
- 'status_id' =>
- array('title' => ts('Pledge 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(
+ '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)',
),
+ ),
),
- ),
- ) + $this->addAddressFields();
+ ) + $this->addAddressFields();
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
{$this->_aliases['civicrm_email']}.is_primary = 1\n";
}
- if (!empty($this->_params['fields']['total_paid'])){
+ if (!empty($this->_params['fields']['total_paid'])) {
$this->_from .= "
LEFT JOIN civicrm_pledge_payment {$this->_aliases['civicrm_pledge_payment']} ON
{$this->_aliases['civicrm_pledge']}.id = {$this->_aliases['civicrm_pledge_payment']}.pledge_id
$this->assign('chartSupported', TRUE);
}
- if (!empty($table['group_bys'][$fieldName]['frequency']) && !empty($this->_params['group_bys_freq'][$fieldName])) {
+ if (!empty($table['group_bys'][$fieldName]['frequency']) &&
+ !empty($this->_params['group_bys_freq'][$fieldName])
+ ) {
$append = "YEAR({$field['dbAlias']}),";
if (in_array(strtolower($this->_params['group_bys_freq'][$fieldName]),
- array('year')
- )) {
+ array('year')
+ )) {
$append = '';
}
$this->_groupBy[] = "$append {$this->_params['group_bys_freq'][$fieldName]}({$field['dbAlias']})";
}
if (!empty($this->_statFields) &&
- (($append && count($this->_groupBy) <= 1) || (!$append)) && !$this->_having
+ (($append && count($this->_groupBy) <= 1) || (!$append)) &&
+ !$this->_having
) {
$this->_rollup = " WITH ROLLUP";
}
- $this->_groupBy = "GROUP BY " . implode(', ', $this->_groupBy) . " {$this->_rollup} ";
+ $this->_groupBy = "GROUP BY " . implode(', ', $this->_groupBy) .
+ " {$this->_rollup} ";
}
else {
$this->_groupBy = "GROUP BY {$this->_aliases['civicrm_contact']}.id";
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
*/
function alterDisplay(&$rows) {
// custom code to alter rows
- $entryFound = FALSE;
- $checkList = array();
+ $entryFound = FALSE;
+ $checkList = array();
$display_flag = $prev_cid = $cid = 0;
foreach ($rows as $rowNum => $row) {
public $_drilldownReport = array('contact/detail' => 'Link to Detail Report');
protected $_customGroupExtends = array(
- 'Contact', 'Individual', 'Household', 'Organization'
+ 'Contact',
+ 'Individual',
+ 'Household',
+ 'Organization'
);
/**
*/
function __construct() {
$this->_columns = array(
- 'civicrm_contact' =>
- array(
+ 'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' =>
- array(
- 'id' =>
- array('title' => ts('Contact ID'),
+ 'fields' => array(
+ 'id' => array(
+ 'title' => ts('Contact ID'),
'no_display' => TRUE,
'required' => TRUE,
),
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'required' => TRUE,
'no_repeat' => TRUE,
),
),
- 'filters' =>
- array(
- 'sort_name' =>
- array('title' => ts('Contact Name'),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'operator' => 'like',
),
),
'grouping' => 'contact-fields',
- 'order_bys' =>
- array('sort_name' => array('title' => ts('Contact Name'),
+ 'order_bys' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
'required' => TRUE,
- )),
+ )
+ ),
),
- 'civicrm_address' =>
- array(
+ 'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
- 'fields' =>
- array(
- 'street_number' => array('title' => ts('Street Number'),
+ 'fields' => array(
+ 'street_number' => array(
+ 'title' => ts('Street Number'),
'type' => 1,
),
'street_address' => NULL,
'city' => NULL,
'postal_code' => NULL,
- 'state_province_id' =>
- array('title' => ts('State/Province'),
+ 'state_province_id' => array(
+ 'title' => ts('State/Province'),
'default' => TRUE,
),
- 'country_id' =>
- array('title' => ts('Country'),
+ 'country_id' => array(
+ 'title' => ts('Country'),
),
),
- 'filters' =>
- array(
- 'street_number' => array('title' => ts('Street Number'),
+ 'filters' => array(
+ 'street_number' => array(
+ 'title' => ts('Street Number'),
'type' => 1,
'name' => 'street_number',
),
),
'grouping' => 'location-fields',
),
- 'civicrm_email' =>
- array(
+ 'civicrm_email' => array(
'dao' => 'CRM_Core_DAO_Email',
- 'fields' =>
- array('email' => array('default' => TRUE)),
+ 'fields' => array('email' => array('default' => TRUE)),
'grouping' => 'location-fields',
),
- 'civicrm_phone' =>
- array(
+ 'civicrm_phone' => array(
'dao' => 'CRM_Core_DAO_Phone',
- 'fields' =>
- array('phone' => NULL),
+ 'fields' => array('phone' => NULL),
'grouping' => 'location-fields',
),
);
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
foreach ($table['fields'] as $fieldName => $field) {
- if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
+ if (!empty($field['required']) ||
+ !empty($this->_params['fields'][$fieldName])
+ ) {
if ($tableName == 'civicrm_address') {
$this->_addressField = TRUE;
}
if ($field['type'] & CRM_Utils_Type::T_DATE) {
$relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
+ $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
$params['start_date_time']
)) < CRM_Utils_Date::format(date('YmdHi00'))) {
return array(
- 'start_date' =>
- ts('Start date cannot be earlier than the current time.'),
+ 'start_date' => ts('Start date cannot be earlier than the current time.'),
);
}
return TRUE;
*
* @param $postUpgradeMessage string, alterable
* @param $rev string, an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs
+ *
* @return void
*/
function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
if ($rev == '4.1.alpha1') {
- $postUpgradeMessage .= '<br />' . ts('WARNING! CiviCRM 4.1 introduces an improved way of handling cron jobs. However the new method is NOT backwards compatible. <strong>Please notify your system administrator that all CiviCRM related cron jobs will cease to work, and will need to be re-configured (this includes sending CiviMail mailings, updating membership statuses, etc.).</strong> Refer to the <a href="%1">online documentation</a> for detailed instructions.', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC41/Managing+Scheduled+Jobs'));
- $postUpgradeMessage .= '<br />' . ts('The CiviCRM Administration menu structure has been re-organized during this upgrade to make it easier to find things and reduce the number of keystrokes. If you have customized this portion of the navigation menu - you should take a few minutes to review the changes. You may need to reimplement or move your customizations.');
+ $postUpgradeMessage .= '<br />' .
+ ts('WARNING! CiviCRM 4.1 introduces an improved way of handling cron jobs. However the new method is NOT backwards compatible. <strong>Please notify your system administrator that all CiviCRM related cron jobs will cease to work, and will need to be re-configured (this includes sending CiviMail mailings, updating membership statuses, etc.).</strong> Refer to the <a href="%1">online documentation</a> for detailed instructions.', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC41/Managing+Scheduled+Jobs'));
+ $postUpgradeMessage .= '<br />' .
+ ts('The CiviCRM Administration menu structure has been re-organized during this upgrade to make it easier to find things and reduce the number of keystrokes. If you have customized this portion of the navigation menu - you should take a few minutes to review the changes. You may need to reimplement or move your customizations.');
- $postUpgradeMessage .= '<br />' . ts('Yahoo recently discontinued their geocoding and mapping API service. If you previously used Yahoo, you will need to select and configure an alternate service in order to continue using geocoding/mapping tools.');
+ $postUpgradeMessage .= '<br />' .
+ ts('Yahoo recently discontinued their geocoding and mapping API service. If you previously used Yahoo, you will need to select and configure an alternate service in order to continue using geocoding/mapping tools.');
- $postUpgradeMessage .= '<br />' . ts('We have integrated KCFinder with CKEditor and TinyMCE, which enables user to upload images. Note that all the images uploaded using KCFinder will be public.');
+ $postUpgradeMessage .= '<br />' .
+ ts('We have integrated KCFinder with CKEditor and TinyMCE, which enables user to upload images. Note that all the images uploaded using KCFinder will be public.');
}
}
if ($afterUpgradeMessage = $template->get_template_vars('afterUpgradeMessage')) {
$afterUpgradeMessage .= "<br/><br/>";
}
- $afterUpgradeMessage .= '<div class="crm-upgrade-case-views-error" style="background-color: #E43D2B; padding: 10px;">' . ts("There was a problem creating CiviCase database views. Please create the following views manually before using CiviCase:");
- $afterUpgradeMessage .= '<div class="crm-upgrade-case-views-query"><div>' . CRM_Case_BAO_Case::createCaseViewsQuery('upcoming') . '</div><div>' . CRM_Case_BAO_Case::createCaseViewsQuery('recent') . '</div>' . '</div></div>';
+ $afterUpgradeMessage .=
+ '<div class="crm-upgrade-case-views-error" style="background-color: #E43D2B; padding: 10px;">' .
+ ts("There was a problem creating CiviCase database views. Please create the following views manually before using CiviCase:");
+ $afterUpgradeMessage .=
+ '<div class="crm-upgrade-case-views-query"><div>' .
+ CRM_Case_BAO_Case::createCaseViewsQuery('upcoming') . '</div><div>' .
+ CRM_Case_BAO_Case::createCaseViewsQuery('recent') . '</div>' .
+ '</div></div>';
$template->assign('afterUpgradeMessage', $afterUpgradeMessage);
}
}
);
-
$userColumnNames = array(
self::NAVIGATION_NAME => array(
'navigation',
function createNewSettings() {
$domainColumns = array(
- CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME =>
- array(array('contact_ajax_check_similar', 1),
+ CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
+ array('contact_ajax_check_similar', 1),
array('activity_assignee_notification', 1),
),
- CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME =>
- array(array('tag_unconfirmed', 'Unconfirmed'),
+ CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME => array(
+ array('tag_unconfirmed', 'Unconfirmed'),
array('petition_contacts', 'Petition Contacts'),
),
- CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME =>
- array(array('enable_cart', 0),
+ CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME => array(
+ array('enable_cart', 0),
),
- CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME =>
- array(array('profile_double_optin', 1),
+ CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME => array(
+ array('profile_double_optin', 1),
array('profile_add_to_group_double_optin', 0),
array('track_civimail_replies', 0),
array('civimail_workflow', 0),
array('civimail_server_wide_lock', 0),
),
- CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME =>
- array(array('default_renewal_contribution_page', NULL),
+ CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME => array(
+ array('default_renewal_contribution_page', NULL),
),
- CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME =>
- array(array('is_enabled', 0),
+ CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME => array(
+ array('is_enabled', 0),
array('uniq_email_per_site', 0),
array('domain_group_id', 0),
array('event_price_set_domain_id', 0),
),
- CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME =>
- array(array('uploadDir', NULL),
+ CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME => array(
+ array('uploadDir', NULL),
array('imageUploadDir', NULL),
array('customFileUploadDir', NULL),
array('customTemplateDir', NULL),
array('customPHPPathDir', NULL),
array('extensionsDir', NULL),
),
- CRM_Core_BAO_Setting::URL_PREFERENCES_NAME =>
- array(array('userFrameworkResourceURL', NULL),
+ CRM_Core_BAO_Setting::URL_PREFERENCES_NAME => array(
+ array('userFrameworkResourceURL', NULL),
array('imageUploadURL', NULL),
array('customCSSURL', NULL),
),
foreach ($domainColumns as $groupName => $settings) {
foreach ($settings as $setting) {
- if (isset($dbSettings[$groupName][$setting[0]]) && !empty($dbSettings[$groupName][$setting[0]])) {
+ if (isset($dbSettings[$groupName][$setting[0]]) &&
+ !empty($dbSettings[$groupName][$setting[0]])
+ ) {
$setting[1] = $dbSettings[$groupName][$setting[0]];
}
* @param $rev
*/
function upgrade_4_1_alpha2($rev) {
- $dao = new CRM_Core_DAO_Setting();
+ $dao = new CRM_Core_DAO_Setting();
$dao->group_name = 'Directory Preferences';
- $dao->name = 'customTemplateDir';
+ $dao->name = 'customTemplateDir';
if (!($dao->find(TRUE))) {
- $dao->domain_id = CRM_Core_Config::domainID();
+ $dao->domain_id = CRM_Core_Config::domainID();
$dao->created_date = date('YmdHis');
- $dao->is_domain = 0;
+ $dao->is_domain = 0;
$dao->save();
}
$dao->free();
}
$domainCols = array(
- CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
'contact_ajax_check_similar',
'activity_assignee_notification',
),
- CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME => array(
'tag_unconfirmed',
'petition_contacts',
),
- CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME => array(
'enable_cart',
),
- CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME => array(
'profile_double_optin',
'profile_add_to_group_double_optin',
'track_civimail_replies',
'civimail_workflow',
'civimail_server_wide_lock',
),
- CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::MEMBER_PREFERENCES_NAME => array(
'default_renewal_contribution_page',
),
- CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME => array(
'is_enabled',
'uniq_email_per_site',
'domain_group_id',
'event_price_set_domain_id',
),
- CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME => array(
'uploadDir',
'imageUploadDir',
'customFileUploadDir',
'customPHPPathDir',
'extensionsDir',
),
- CRM_Core_BAO_Setting::URL_PREFERENCES_NAME =>
- array(
+ CRM_Core_BAO_Setting::URL_PREFERENCES_NAME => array(
'userFrameworkResourceURL',
'imageUploadURL',
'customCSSURL',
);
$arrGroupNames = array_keys($domainCols);
- $groupNames = implode("','", $arrGroupNames);
- $arrNames = array();
+ $groupNames = implode("','", $arrGroupNames);
+ $arrNames = array();
foreach ($domainCols as $groupName => $names) {
$arrNames[] = implode("','", $names);
}
*/
static function task_4_2_alpha1_createPriceSets(CRM_Queue_TaskContext $ctx, $rev) {
$upgrade = new CRM_Upgrade_Form();
- $daoName =
- array(
- 'civicrm_contribution_page' =>
- array(
+ $daoName = array(
+ 'civicrm_contribution_page' => array(
'CRM_Contribute_BAO_ContributionPage',
CRM_Core_Component::getComponentID('CiviContribute')
),
- 'civicrm_event' =>
- array(
+ 'civicrm_event' => array(
'CRM_Event_BAO_Event',
CRM_Core_Component::getComponentID('CiviEvent')
),
if (self::$_requiredTokens == NULL) {
self::$_requiredTokens = array(
'domain.address' => ts("Domain address - displays your organization's postal address."),
- 'action.optOutUrl or action.unsubscribeUrl' =>
- array(
+ 'action.optOutUrl or action.unsubscribeUrl' => array(
'action.optOut' => ts("'Opt out via email' - displays an email address for recipients to opt out of receiving emails from your organization."),
'action.optOutUrl' => ts("'Opt out via web page' - creates a link for recipients to click if they want to opt out of receiving emails from your organization. Alternatively, you can include the 'Opt out via email' token."),
'action.unsubscribe' => ts("'Unsubscribe via email' - displays an email address for recipients to unsubscribe from the specific mailing list used to send this message."),
class CRM_Widget_Widget {
static $_methodTable;
+
function initialize() {
if (!self::$_methodTable) {
self::$_methodTable = array(
- 'getContributionPageData' =>
- array(
+ 'getContributionPageData' => array(
'description' => 'Gets all campaign related data and returns it as a std class.',
'access' => 'remote',
'arguments' => array(
'widgetID',
),
),
- 'getEmbedCode' =>
- array(
+ 'getEmbedCode' => array(
'description' => 'Gets embed code. Perhaps overkill, but we can track dropoffs in this case. by # of people reqeusting emebed code / number of unique instances.',
'access' => 'remote',
'arguments' => array(
$data->is_active = FALSE;
}
- $data->is_active = TRUE;
- $data->title = $widget->title;
- $data->logo = $widget->url_logo;
+ $data->is_active = TRUE;
+ $data->title = $widget->title;
+ $data->logo = $widget->url_logo;
$data->button_title = $widget->button_title;
- $data->button_url = CRM_Utils_System::url('civicrm/contribute/transact',
+ $data->button_url = CRM_Utils_System::url('civicrm/contribute/transact',
"reset=1&id=$contributionPageID",
TRUE, NULL, FALSE, TRUE
);
*/
public function getEmbedCode($contributionPageID, $widgetID, $format = "normal") {
self::registerRequest($contributionPageID, $widgetID, __FUNCTION__);
- return "<embed>.......................</embed>" . print_r(func_get_args(), 1);
+ return "<embed>.......................</embed>" .
+ print_r(func_get_args(), 1);
}
}