Skip to content

Commit

Permalink
Merge pull request #141 from pradpnayak/CRM-12065
Browse files Browse the repository at this point in the history
-- fixed formatting, static errors and replaced contribution_type to fin...
  • Loading branch information
colemanw committed Mar 14, 2013
2 parents e9dea4f + b914f4e commit 9c6adde
Show file tree
Hide file tree
Showing 15 changed files with 113 additions and 111 deletions.
8 changes: 4 additions & 4 deletions CRM/Report/Form/Contact/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function __construct() {
'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,
Expand Down Expand Up @@ -795,9 +795,9 @@ function alterComponentDisplay(&$componentRows) {
foreach ($rows as $rowNum => $row) {
// handle contribution
if ($component == 'contribution_civireport') {
if ($val = CRM_Utils_Array::value('civicrm_contribution_contribution_type_id', $row)) {
$componentRows[$contactID][$component][$rowNum]['civicrm_contribution_contribution_type_id'] =
CRM_Contribute_PseudoConstant::financialType( $val, false );
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);
}

if ($val = CRM_Utils_Array::value('civicrm_contribution_contribution_status_id', $row)) {
Expand Down
6 changes: 3 additions & 3 deletions CRM/Report/Form/Contribute/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function __construct() {
'no_display' => TRUE,
'required' => TRUE,
),
'financial_type_id' => array( 'title' => ts('Financial Type'),
'financial_type_id' => array('title' => ts('Financial Type'),
'default' => TRUE,
),
'contribution_status_id' => array('title' => ts('Contribution Status'),
Expand Down Expand Up @@ -210,7 +210,7 @@ function __construct() {
'type' => CRM_Utils_Type::T_STRING,
),
'financial_type_id' =>
array( 'title' => ts( 'Financial Type' ),
array('title' => ts('Financial Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::financialType(),
'type' => CRM_Utils_Type::T_INT,
Expand Down Expand Up @@ -526,7 +526,7 @@ function alterDisplay(&$rows) {
$checkList = array();
$entryFound = FALSE;
$display_flag = $prev_cid = $cid = 0;
$contributionTypes = CRM_Contribute_PseudoConstant::financialType( );
$contributionTypes = CRM_Contribute_PseudoConstant::financialType();
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
$honorTypes = CRM_Core_OptionGroup::values('honor_type', FALSE, FALSE, FALSE, NULL, 'label');
Expand Down
6 changes: 3 additions & 3 deletions CRM/Report/Form/Contribute/History.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ function __construct() {
'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
'default' => array(1),
),
'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(),
),
'total_amount' =>
array('title' => ts('Donation Amount'),
Expand Down
8 changes: 4 additions & 4 deletions CRM/Report/Form/Contribute/LoggingSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function __construct() {
'default' => TRUE,
'title' => ts('Action'),
),
'financial_type_id' => array(
'financial_type_id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
Expand Down Expand Up @@ -123,15 +123,15 @@ function __construct() {
),
),
),
'civicrm_financial_type' => array(
'dao' => 'CRM_Financial_DAO_FinancialType',
'civicrm_financial_type' => array(
'dao' => 'CRM_Financial_DAO_FinancialType',
'fields' => array(
'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
'name' => array(
'title' => ts('Financial Type'),
'title' => ts('Financial Type'),
'type' => CRM_Utils_Type::T_STRING,
),
),
Expand Down
8 changes: 4 additions & 4 deletions CRM/Report/Form/Contribute/Lybunt.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
'options' => $optionYear,
'default' => date('Y'),
),
'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(),
),
Expand Down Expand Up @@ -271,7 +271,7 @@ function where() {
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;
}
}
Expand Down Expand Up @@ -435,7 +435,7 @@ function alterDisplay(&$rows) {
}

// Override "This Year" $op options
function getOperationPair($type = "string", $fieldName = NULL) {
static function getOperationPair($type = "string", $fieldName = NULL) {
if ($fieldName == 'yid') {
return array('calendar' => ts('Is Calendar Year'), 'fiscal' => ts('Fiscal Year Starting'));
}
Expand Down
24 changes: 12 additions & 12 deletions CRM/Report/Form/Contribute/Repeat.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ function __construct() {
),
'civicrm_financial_type' =>
array(
'dao' => 'CRM_Financial_DAO_FinancialType',
'fields' => array('financial_type' => array('title' => ts('Financial Type'))),
'dao' => 'CRM_Financial_DAO_FinancialType',
'fields' => array('financial_type' => array('title' => ts('Financial Type'))),
'grouping' => 'contri-fields',
'group_bys' =>
array( 'financial_type' =>
array('financial_type' =>
array(
'name' => 'id',
'title' => ts('Financial Type'),
Expand Down Expand Up @@ -212,15 +212,15 @@ function __construct() {
'operatorType' => CRM_Report_Form::OP_INT,
'name' => 'total_amount',
),
'financial_type_id' =>
'financial_type_id' =>
array(
'title' => ts('Financial Type'),
'title' => ts('Financial Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::financialType( ) ,
'options' => CRM_Contribute_PseudoConstant::financialType(),
),
'contribution_status_id' =>
array(
'title' => ts('Financial Status'),
'title' => ts('Contribution Status'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
'default' => array('1'),
Expand Down Expand Up @@ -263,7 +263,7 @@ function select() {
$select = array();
$append = NULL;
// since contact fields not related to financial type
if ( array_key_exists('financial_type', $this->_params['group_bys']) ||
if (array_key_exists('financial_type', $this->_params['group_bys']) ||
array_key_exists('contribution_source', $this->_params['group_bys'])
) {
unset($this->_columns['civicrm_contact']['fields']['id']);
Expand Down Expand Up @@ -337,8 +337,8 @@ function from() {
ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND {$this->_aliases['civicrm_phone']}.is_primary = 1";

}
else if ( $fromTable == 'civicrm_financial_type' ) {
$contriCol = "financial_type_id";
else if ($fromTable == 'civicrm_financial_type') {
$contriCol = "financial_type_id";
}
elseif ($fromTable == 'civicrm_contribution') {
$contriCol = $fromCol;
Expand Down Expand Up @@ -467,15 +467,15 @@ function formRule($fields, $files, $self) {
'country_id' => array('country_id'),
'state_province_id' => array('country_id', 'state_province_id'),
'contribution_source' => array('contribution_source'),
'financial_type' => array( 'financial_type' ),
'financial_type' => array('financial_type'),
);

$idMapping = array(
'id' => ts('Contact'),
'country_id' => ts('Country'),
'state_province_id' => ts('State/Province'),
'contribution_source' => ts('Contribution Source'),
'financial_type' => ts('Financial Type'),
'financial_type' => ts('Financial Type'),
'sort_name' => ts('Contact Name'),
'email' => ts('Email'),
'phone' => ts('Phone'),
Expand Down
13 changes: 7 additions & 6 deletions CRM/Report/Form/Contribute/SoftCredit.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,19 @@ function __construct() {
),
'grouping' => 'contact-fields',
),
'civicrm_financial_type' =>
array( 'dao' => 'CRM_Financial_DAO_FinancialType',
'fields' =>
array( 'financial_type' => null, ),
'civicrm_financial_type' =>
array('dao' => 'CRM_Financial_DAO_FinancialType',
'fields' => array('financial_type' => null,),
'filters' =>
array(
'id' =>
array(
'name' => 'id',
'title' => ts( 'Financial Type' ),
'title' => ts('Financial Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::financialType( ) ),),
'options' => CRM_Contribute_PseudoConstant::financialType()
),
),
'grouping' => 'softcredit-fields',
),
'civicrm_contribution' =>
Expand Down
21 changes: 11 additions & 10 deletions CRM/Report/Form/Contribute/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,14 @@ function __construct() {
),
'grouping' => 'contact-fields',
),
'civicrm_financial_type' =>
array( 'dao' => 'CRM_Financial_DAO_FinancialType',
'fields' =>
array( 'financial_type' => null, ),
'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')), ), ),
'group_bys' => array(
'financial_type' => array('title' => ts('Financial Type')),
),
),
'civicrm_contribution' =>
array(
'dao' => 'CRM_Contribute_DAO_Contribution',
Expand Down Expand Up @@ -145,10 +146,10 @@ function __construct() {
'default' => array(1),
'type' => CRM_Utils_Type::T_INT,
),
'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(),
'type' => CRM_Utils_Type::T_INT,
),
'total_amount' =>
Expand Down Expand Up @@ -344,7 +345,7 @@ static function formRule($fields, $files, $self) {
foreach ($table['fields'] as $fieldName => $field) {
if (CRM_Utils_Array::value($field['name'], $fields['fields']) &&
$fields['fields'][$field['name']] &&
in_array( $field['name'], array( 'sort_name', 'postal_greeting_display', 'contribution_source', 'financial_type' ) ) ) {
in_array( $field['name'], array('sort_name', 'postal_greeting_display', 'contribution_source', 'financial_type'))) {
$grouping[] = $field['title'];
}
}
Expand Down
8 changes: 4 additions & 4 deletions CRM/Report/Form/Contribute/Sybunt.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
'options' => $optionYear,
'default' => date('Y'),
),
'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(),
),
'contribution_status_id' =>
array('title' => ts('Contribution Status'),
Expand Down Expand Up @@ -272,7 +272,7 @@ function where() {
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;
}
}
Expand Down
6 changes: 3 additions & 3 deletions CRM/Report/Form/Contribute/TopDonor.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ function __construct() {
'default_op' => 'eq',
),
'financial_type_id' =>
array( 'name' => 'financial_type_id',
'title' => ts( 'Financial Type' ),
array('name' => 'financial_type_id',
'title' => ts('Financial Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::financialType( )
'options' => CRM_Contribute_PseudoConstant::financialType() ,
),
'contribution_status_id' =>
array('title' => ts('Donation Status'),
Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Form/Extended.php
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ function alterNickName($value, &$row) {
* Retrieve text for contribution type from pseudoconstant
*/
function alterContributionType($value, &$row) {
return is_string( CRM_Contribute_PseudoConstant::financialType( $value, FALSE ) ) ? CRM_Contribute_PseudoConstant::financialType( $value, FALSE ) : '';
return is_string(CRM_Contribute_PseudoConstant::financialType($value, FALSE)) ? CRM_Contribute_PseudoConstant::financialType($value, FALSE) : '';
}

/*
Expand Down
10 changes: 5 additions & 5 deletions CRM/Report/Form/Member/ContributionDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ function __construct() {
'title' => ts('Contribution ID'),
),
'financial_type_id' => array('title' => ts('Financial Type'),
'default' => TRUE,
'default' => TRUE,
),
'contribution_recur_id' => array('title' => ts('Recurring Contribution Id'),
'name' => 'contribution_recur_id',
'required' => TRUE,
'no_display' => TRUE,
'csv_display' => TRUE,
'name' => 'contribution_recur_id',
'required' => TRUE,
'no_display' => TRUE,
'csv_display' => TRUE,
),
'contribution_status_id' => array('title' => ts('Contribution Status'),
),
Expand Down
12 changes: 6 additions & 6 deletions CRM/Report/Form/Pledge/Pbnp.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function __construct() {
'required' => TRUE,
),
'financial_type_id' =>
array( 'title' => ts('Financial Type'),
array('title' => ts('Financial Type'),
'requried' => TRUE,
),
'amount' =>
Expand Down Expand Up @@ -303,11 +303,11 @@ function alterDisplay(&$rows) {
}
}

//handle the Financial Type Ids
if (array_key_exists('civicrm_pledge_contribution_type_id', $row)) {
if ($value = $row['civicrm_pledge_contribution_type_id']) {
$rows[$rowNum]['civicrm_pledge_contribution_type_id'] =
CRM_Contribute_PseudoConstant::financialType( $value, false );
//handle the Financial Type Ids
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);
}
$entryFound = TRUE;
}
Expand Down
82 changes: 41 additions & 41 deletions sql/civicrm_generated.mysql

Large diffs are not rendered by default.

Loading

0 comments on commit 9c6adde

Please sign in to comment.