*/
class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form {
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
'total_amount' => array(
'title' => ts('Amount Contributed to Date'),
'statistics' => array(
- 'sum' => ts("Total Amount Contributed")
+ 'sum' => ts("Total Amount Contributed"),
),
),
),
'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,
),
'frequency_unit' => array(
'title' => ts('Frequency Unit'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_OptionGroup::values('recur_frequency_units'),
+ 'options' => CRM_Core_OptionGroup::values('recur_frequency_units'),
'type' => CRM_Utils_Type::T_INT,
),
'frequency_interval' => array(
'title' => ts('Calculated end date (either end date or date all installments will be made)'),
'description' => "does this work?",
'operatorType' => CRM_Report_Form::OP_DATE,
- 'pseudofield' => TRUE
+ 'pseudofield' => TRUE,
),
),
- )
+ ),
);
$this->_currencyColumn = 'civicrm_contribution_recur_currency';
parent::__construct();
}
- function getTemplateName() {
- return 'CRM/Report/Form.tpl' ;
+
+ public function getTemplateName() {
+ return 'CRM/Report/Form.tpl';
}
- function from() {
+ public function from() {
$this->_from = "
FROM civicrm_contact {$this->_aliases['civicrm_contact']}
INNER JOIN civicrm_contribution_recur {$this->_aliases['civicrm_contribution_recur']}
{$this->_aliases['civicrm_phone']}.is_primary = 1)";
}
- function groupBy() {
+ public function groupBy() {
$this->_groupBy = "GROUP BY " . $this->_aliases['civicrm_contribution_recur'] . ".id";
}
- function where() {
+ public function where() {
parent::where();
// Handle calculated end date. This can come from one of two sources:
// Either there is a specified end date for the end_date field
// installments * intervals using the mysql date_add function, along
// with the interval unit (e.g. DATE_ADD(start_date, INTERVAL 12 * 1 MONTH)
$date_suffixes = array('relative', 'from', 'to');
- while(list(,$suffix) = each($date_suffixes)) {
+ while (list(, $suffix) = each($date_suffixes)) {
// Check to see if the user wants to search by calculated date.
- if(!empty($this->_params['calculated_end_date_' . $suffix])) {
+ if (!empty($this->_params['calculated_end_date_' . $suffix])) {
// The calculated date field is in use - spring into action
// Gather values
$relative = CRM_Utils_Array::value("calculated_end_date_relative", $this->_params);
$start_date_db_alias = $this->_columns['civicrm_contribution_recur']['filters']['start_date']['dbAlias'];
// The end date clause is simple to construct
- $end_date_clause = $this->dateClause($end_date_db_alias, $relative, $from, $to, $end_date_type, NULL, NULL);
+ $end_date_clause = $this->dateClause($end_date_db_alias, $relative, $from, $to, $end_date_type, NULL, NULL);
// NOTE: For the calculation based on installment, there doesn't
// seem to be a way to include the interval unit (e.g. month,
$installment_clause = '(' .
$this->dateClause("DATE_ADD($start_date_db_alias, INTERVAL $installments_db_alias * COALESCE($frequency_interval_db_alias,1) month)",
- $relative, $from, $to, $start_date_type, NULL, NULL);
+ $relative, $from, $to, $start_date_type, NULL, NULL);
$installment_clause .= " AND $frequency_unit_db_alias = 'month' ) OR \n";
$installment_clause .= '(' .
$this->dateClause("DATE_ADD($start_date_db_alias, INTERVAL $installments_db_alias * COALESCE($frequency_interval_db_alias,1) day)",
- $relative, $from, $to, $start_date_type, NULL, NULL);
+ $relative, $from, $to, $start_date_type, NULL, NULL);
$installment_clause .= " AND $frequency_unit_db_alias = 'day' ) OR \n";
$installment_clause .= '(' .
$this->dateClause("DATE_ADD($start_date_db_alias, INTERVAL $installments_db_alias * COALESCE($frequency_interval_db_alias, 1) week)",
- $relative, $from, $to, $start_date_type, NULL, NULL);
+ $relative, $from, $to, $start_date_type, NULL, NULL);
$installment_clause .= " AND $frequency_unit_db_alias = 'week' ) OR \n";
$installment_clause .= '(' .
$this->dateClause("DATE_ADD($start_date_db_alias, INTERVAL $installments_db_alias * COALESCE($frequency_interval_db_alias, 1) year)",
- $relative, $from, $to, $start_date_type, NULL, NULL);
+ $relative, $from, $to, $start_date_type, NULL, NULL);
$installment_clause .= " AND $frequency_unit_db_alias = 'year' )\n";
$this->_where .= " AND ";
}
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
foreach ($rows as $rowNum => $row) {
// convert display name to links
if ($value = CRM_Utils_Array::value('civicrm_contribution_recur_contribution_status_id', $row)) {
$rows[$rowNum]['civicrm_contribution_recur_contribution_status_id'] = $contributionStatus[$value];
}
-
+
if ($value = CRM_Utils_Array::value('civicrm_contribution_recur_amount', $row)) {
- $rows[$rowNum]['civicrm_contribution_recur_amount'] = CRM_Utils_Money::format($rows[$rowNum]['civicrm_contribution_recur_amount'],$rows[$rowNum]['civicrm_contribution_recur_currency']);
+ $rows[$rowNum]['civicrm_contribution_recur_amount'] = CRM_Utils_Money::format($rows[$rowNum]['civicrm_contribution_recur_amount'], $rows[$rowNum]['civicrm_contribution_recur_currency']);
}
-
+
}
}
-}
\ No newline at end of file
+}