Commit 312b6572 authored by eileen's avatar eileen

Update extended report

parent fd85c257
......@@ -5,6 +5,7 @@
*/
class CRM_Extendedreport_Form_Report_ActivityPivot extends CRM_Extendedreport_Form_Report_ExtendedReport {
protected $_baseTable = 'civicrm_activity';
protected $_customGroupExtends = ['Activity'];
protected $skipACL = FALSE;
protected $isPivot = TRUE;
protected $_customGroupAggregates = TRUE;
......
......@@ -16,16 +16,12 @@ class CRM_Extendedreport_Form_Report_Case_CasePivot extends CRM_Extendedreport_F
protected $_potentialCriteria = array();
protected $isPivot = TRUE;
protected $_noFields = TRUE;
protected $_customGroupExtends = ['Case'];
/**
* Class constructor.
*/
public function __construct() {
$this->_customGroupExtended['civicrm_case'] = array(
'extends' => array('Case'),
'filters' => TRUE,
'title' => ts('Case'),
);
$this->_columns = $this->getColumns('Case', array(
'fields' => FALSE,
......
......@@ -15,6 +15,7 @@ class CRM_Extendedreport_Form_Report_Case_CaseWithActivityPivot extends CRM_Exte
public $_drilldownReport = array();
protected $isPivot = TRUE;
protected $_noFields = TRUE;
protected $_customGroupExtends = ['Case', 'Activity'];
/**
* PreConstrain means the query gets run twice - the first time for generating temp tables
* which go in the from the second time around
......@@ -34,17 +35,6 @@ class CRM_Extendedreport_Form_Report_Case_CaseWithActivityPivot extends CRM_Exte
*
*/
public function __construct() {
$this->_customGroupExtended['civicrm_case'] = array(
'extends' => array('Case'),
'filters' => TRUE,
'title' => ts('Case'),
);
$this->_customGroupExtended['civicrm_activity'] = array(
'extends' => array('Activity'),
'filters' => TRUE,
'title' => ts('Activity'),
);
$this->_columns = $this->getColumns('Case', array(
'fields' => FALSE,
)
......
......@@ -12,7 +12,7 @@ class CRM_Extendedreport_Form_Report_Contact_Extendedcontact extends CRM_Extende
protected $_customGroupAggregates = TRUE;
protected $isPivot = TRUE;
protected $_noFields = TRUE;
protected $_customGroupExtends = ['Contact', 'Individual', 'Household', 'Organization'];
/**
* Class constructor.
......
......@@ -14,6 +14,7 @@ class CRM_Extendedreport_Form_Report_Contribute_ContributionPivot extends CRM_Ex
protected $isPivot = TRUE;
protected $_potentialCriteria = array();
protected $_noFields = TRUE;
protected $_customGroupExtends = ['Contribution', 'Contact', 'Individual', 'Household', 'Organization'];
/**
* Class constructor.
......
<?php
// This file declares a managed database record of type "ReportTemplate".
// The record will be automatically inserted, updated, or deleted from the
// database as appropriate. For more details, see "hook_civicrm_managed" at:
// http://wiki.civicrm.org/confluence/display/CRMDOC42/Hook+Reference
return [
0 => [
'name' => 'Extended Report - Recurring Contribution Pivot Chart',
'entity' => 'ReportTemplate',
'params' => [
'version' => 3,
'label' => 'Extended Report - Recurring Contribution Pivot Chart',
'description' => 'Extended Report - Contribution Recur Pivot Chart',
'class_name' => 'CRM_Extendedreport_Form_Report_Contribute_ContributionRecurPivot',
'report_url' => 'contribution/recur-pivot',
'component' => 'CiviContribute',
],
],
];
<?php
/**
* Class CRM_Extendedreport_Form_Report_ContributionPivot
*/
class CRM_Extendedreport_Form_Report_Contribute_ContributionRecurPivot extends CRM_Extendedreport_Form_Report_ExtendedReport {
protected $_baseTable = 'civicrm_contribution_recur';
protected $skipACL = FALSE;
protected $_customGroupAggregates = TRUE;
protected $_aggregatesIncludeNULL = TRUE;
protected $_aggregatesAddTotal = TRUE;
protected $_rollup = 'WITH ROLLUP';
public $_drilldownReport = [];
protected $isPivot = TRUE;
protected $_potentialCriteria = [];
protected $_noFields = TRUE;
protected $_customGroupExtends = ['ContributionRecur', 'Contact', 'Individual', 'Household', 'Organization'];
/**
* Class constructor.
*/
public function __construct() {
$this->_columns = $this->getColumns('ContributionRecur', [
'fields' => FALSE,
])
+ $this->getColumns('Contact', [
'fields' => FALSE,
])
+ $this->getColumns('Address', [
'fields' => FALSE,
'aggregate_rows' => TRUE,
]);
parent::__construct();
}
/**
* Get sql FROM clauses.
*
* @return array
*/
public function fromClauses() {
return [
'contact_from_contribution_recur',
'address_from_contact',
];
}
}
<?php
// This file declares a managed database record of type "ReportTemplate".
// The record will be automatically inserted, updated, or deleted from the
// database as appropriate. For more details, see "hook_civicrm_managed" at:
// http://wiki.civicrm.org/confluence/display/CRMDOC42/Hook+Reference
return [
0 => [
'name' => 'Extended Report - Recurring Contributions',
'entity' => 'ReportTemplate',
'params' => [
'version' => 3,
'label' => 'Extended Report - Recurring Contributions',
'description' => 'Extended Report - Recurring Contributions',
'class_name' => 'CRM_Extendedreport_Form_Report_Contribute_RecurringContributions',
'report_url' => 'contribution/recurring_contributions',
'component' => 'CiviContribute',
],
],
];
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
*/
class CRM_Extendedreport_Form_Report_Contribute_RecurringContributions extends CRM_Extendedreport_Form_Report_ExtendedReport {
/**
* Can this report be used on a contact tab.
*
* The report must support contact_id in the url for this to work.
*
* @var bool
*/
protected $isSupportsContactTab = TRUE;
/**
* Add order bys for custom fields.
*
* @var bool
*/
protected $_customGroupOrderBy = TRUE;
/**
* Add group bys for custom fields.
*
* @var bool
*/
protected $_customGroupGroupBy = TRUE;
/**
* @var array
*/
protected $_customGroupExtends = [
'ContributionRecur',
'Contact',
'Individual',
'Organization',
'Household',
];
protected $_baseTable = 'civicrm_contribution_recur';
/**
* Class constructor.
*/
public function __construct() {
$this->_columns = $this->getColumns('ContributionRecur', ['group_by' => TRUE])
+ $this->getColumns('Contact', ['group_by' => TRUE])
+ $this->getColumns('Email', ['group_by' => TRUE])
+ $this->getColumns('Address', ['group_by' => TRUE])
+ $this->getColumns('Phone', ['group_by' => TRUE])
+ $this->getColumns('Website', [
'group_by' => TRUE,
'join_filters' => TRUE,
]);
parent::__construct();
}
/**
* @return array
*/
function fromClauses() {
return [
'contact_from_contribution_recur',
'email_from_contact',
'phone_from_contact',
'address_from_contact',
'website_from_contact',
];
}
}
......@@ -14,6 +14,7 @@ class CRM_Extendedreport_Form_Report_Event_EventPivot extends CRM_Extendedreport
public $_drilldownReport = array('event/participantlist' => 'Link to Participants');
protected $_participantTable = 'civicrm_participant';
protected $_noFields = TRUE;
protected $_customGroupExtends = ['Participant', 'Event', 'Contact', 'Individual', 'Household', 'Organization'];
protected $_potentialCriteria = array(
'rid',
'sid',
......@@ -59,4 +60,5 @@ class CRM_Extendedreport_Form_Report_Event_EventPivot extends CRM_Extendedreport
'contact_from_participant',
);
}
}
......@@ -4,35 +4,37 @@
* Class CRM_Extendedreport_Form_Report_Contact_Extendedcontact
*/
class CRM_Extendedreport_Form_Report_Member_MembershipPivot extends CRM_Extendedreport_Form_Report_ExtendedReport {
protected $_baseTable = 'civicrm_membership';
protected $skipACL = TRUE;
protected $_customGroupAggregates = TRUE;
protected $_aggregatesIncludeNULL = TRUE;
protected $_aggregatesAddTotal = TRUE;
protected $_rollup = 'WITH ROLLUP';
protected $isPivot = TRUE;
public $_drilldownReport = array('membership/membershipdetail' => 'Link to Participants');
protected $_potentialCriteria = array();
public $_drilldownReport = ['membership/membershipdetail' => 'Link to Participants'];
protected $_noFields = TRUE;
protected $_customGroupExtends = ['Membership', 'Contact', 'Individual', 'Household', 'Organization'];
/**
* Class constructor.
*/
public function __construct() {
$this->_customGroupExtended['civicrm_membership'] = array(
'extends' => array('Membership'),
'filters' => TRUE,
'title' => ts('Membership'),
);
$this->_columns = $this->getColumns('membership', array(
'fields' => FALSE,
'order_by' => FALSE,
)
) + $this->getColumns('contact', array(
'fields' => FALSE,
'order_by' => FALSE,
)
);
$this->_columns = $this->getColumns('membership', [
'fields' => FALSE,
'order_by' => FALSE,
]
) + $this->getColumns('contact', [
'fields' => FALSE,
'order_by' => FALSE,
]
);
$this->_columns['civicrm_membership']['fields']['id']['required'] = TRUE;
parent::__construct();
}
......@@ -41,8 +43,8 @@ class CRM_Extendedreport_Form_Report_Member_MembershipPivot extends CRM_Extended
* @return array
*/
public function fromClauses() {
return array(
return [
'contact_from_membership',
);
];
}
}
......@@ -45,12 +45,18 @@ class CRM_Extendedreport_Form_Report_Price_Lineitem extends CRM_Extendedreport_F
public function __construct() {
$this->_columns
= $this->getColumns('Contact', array('order_by' => TRUE))
+ $this->getColumns('Email', [
'fields' => TRUE,
'order_by' => FALSE,
]
)
+ $this->getColumns('Event')
+ $this->getColumns('Participant')
+ $this->getColumns('Contribution', array('order_by' => TRUE))
+ $this->getColumns('PriceField', array('order_by' => TRUE))
+ $this->getColumns('PriceFieldValue' , array('order_by' => TRUE))
+ $this->getColumns('LineItem', array('order_by' => TRUE, 'fields_defaults' => array('financial_type_id', 'line_total'))) +
$this->getColumns('BillingAddress') +
$this->getColumns('Address');
parent::__construct();
}
......@@ -79,6 +85,8 @@ class CRM_Extendedreport_Form_Report_Price_Lineitem extends CRM_Extendedreport_F
'contact_from_contribution',
'event_from_participant',
'address_from_contact',
'address_from_contribution',
'email_from_contact',
);
}
......
......@@ -29,40 +29,39 @@
<div class="panel panel-default">
<div class="panel-heading">
<div id="extendedReportSortingConfig" ng-show="'sorting' == selectedTab">
<div class="floatleft">
<h2>{{ ts('Available Sorting fields') }}</h2>
<div ui-sortable="sortableOrderByOptions" class="order-bys-container screen floatleft" ng-model="orderBysList">
<div class="fieldItem" ng-repeat="fieldItem in orderBysList">{{fieldItem.title}}</div>
<div id="extendedReportSortingConfig" ng-show="'sorting' == selectedTab">
<div class="floatleft">
<h2>{{ ts('Available Sorting fields') }}</h2>
<div ui-sortable="sortableOrderByOptions" class="order-bys-container screen floatleft" ng-model="orderBysList">
<div class="fieldItem" ng-repeat="fieldItem in orderBysList">{{fieldItem.title}}</div>
</div>
</div>
</div>
<div class="floatleft">
<h2>{{ ts('Selected Sorting fields') }}</h2>
<div ui-sortable="sortableOrderByOptions" class="order-bys-container screen floatleft" ng-model="reportOrderByFields">
<div class="fieldItem" ng-repeat="fieldItem in reportOrderByFields">
<span class="fieldTitle" ng-model="fieldItem.title" ng-click="selectOrderBy(fieldItem)">{{fieldItem.title}}</span></div>
<div class="floatleft">
<h2>{{ ts('Selected Sorting fields') }}</h2>
<div ui-sortable="sortableOrderByOptions" class="order-bys-container screen floatleft" ng-model="reportOrderByFields">
<div class="fieldItem" ng-repeat="fieldItem in reportOrderByFields">
<span class="fieldTitle" ng-model="fieldItem.title" ng-click="selectOrderBy(fieldItem)">{{fieldItem.title}}</span></div>
</div>
</div>
</div>
<div class="floatleft" ng-if="selectedOrderBy">
<h2>{{ ts('Selected field') }}</h2>
<div class="ex-report-block" ng-model=selectedOrderBy>
<h3 class="fieldTitle" extendedreport-editable ng-model="selectedOrderBy.title">{{selectedOrderBy.title}}</h3>
<div ng-model="selectedOrderBy.order">{{selectedOrderBy.order}}</div>
<div>Fallback field:</div>
<select ng-model="selectedOrderBy.field_on_null_usage">
<option value="on_null">{{ ts('On null value') }}</option>
<option value="on_empty">{{ ts('On null or empty value') }}</option>
</select>
<div ui-sortable="sortableOrderByOptions" class="order-bys-container" ng-model=selectedOrderBy.field_on_null>
<div class="fieldItem" ng-repeat="fieldItem in selectedOrderBy.field_on_null">{{fieldItem.title}}</div>
<div class="floatleft" ng-if="selectedOrderBy">
<h2>{{ ts('Selected field') }}</h2>
<div class="ex-report-block" ng-model=selectedOrderBy>
<h3 class="fieldTitle" extendedreport-editable ng-model="selectedOrderBy.title">{{selectedOrderBy.title}}</h3>
<div ng-model="selectedOrderBy.order">{{selectedOrderBy.order}}</div>
<div>Fallback field:</div>
<select ng-model="selectedOrderBy.field_on_null_usage">
<option value="on_null">{{ ts('On null value') }}</option>
<option value="on_empty">{{ ts('On null or empty value') }}</option>
</select>
<div ui-sortable="sortableOrderByOptions" class="order-bys-container" ng-model=selectedOrderBy.field_on_null>
<div class="fieldItem" ng-repeat="fieldItem in selectedOrderBy.field_on_null">{{fieldItem.title}}</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div id="extendedReportFieldsConfig" ng-show="'fields' == selectedTab">
<div id="extendedReportFieldsConfig" ng-show="'fields' == selectedTab">
<div class="floatleft">
<h2>{{ ts('Available fields') }}</h2>
<div ui-sortable="sortableFieldOptions" class="fields-container screen floatleft" ng-model="fieldList">
......
......@@ -166,6 +166,8 @@ function extendedreport_civicrm_contactSummaryBlocks(&$blocks) {
];
foreach ($reports as $report) {
$blocks['extendedreports']['blocks']['report_' . $report['id']] = [
'id' => 'report_' . $report['id'],
'icon' => 'crm-i fa-bar-chart',
'title' => $report['title'],
'tpl_file' => 'CRM/Extendedreport/Page/Inline/ExtendedReport.tpl',
'edit' => FALSE,
......
......@@ -13,11 +13,11 @@
<author>Eileen McNaughton</author>
<email>eileen@fuzion.co.nz</email>
</maintainer>
<releaseDate>2019-03-06</releaseDate>
<version>4.1</version>
<releaseDate>2019-06-05</releaseDate>
<version>4.5</version>
<develStage>stable</develStage>
<compatibility>
<ver>5.11</ver>
<ver>5.13</ver>
</compatibility>
<comments>Extended reports create other report options such as crosstab urls, multiple contact custom fields, price
set reports
......
......@@ -12,5 +12,8 @@
{$form.aggregate_column_headers.html}
</td>
</tr>
<tr>
<td>{$form.delete_null.label} {$form.delete_null.html}</td></td>
</tr>
</table>
</div>
......@@ -30,18 +30,6 @@
<td class="label report-contents">{$field.title}</td>
{include file="CRM/Core/DateRange.tpl" fieldName=$fieldName from='_from' to='_to'}
</tr>
{* custom override for handling of single date concept - ie. a dividing date *}
{elseif $field.operatorType eq 3}
<tr class="report-contents crm-report crm-report-criteria-filter crm-report-criteria-filter-{$tableName}" {if $field.no_display} style="display: none;"{/if}>
<td class="label report-contents">{$field.title}</td>
<td class="report-contents">{$form.$fieldOp.html}</td>
<td>
<span id="{$filterVal}_cell">{include file="CRM/common/jcalendar.tpl" elementName=$filterVal}</span>
<span id="{$filterMin}_max_cell">{$form.$filterMin.label}&nbsp;{$form.$filterMin.html}
&nbsp;&nbsp;{$form.$filterMax.label}&nbsp;{$form.$filterMax.html}</span>
</td>
</tr>
{* end of custom override *}
{elseif $form.$fieldOp.html}
<tr class="report-contents crm-report crm-report-criteria-filter crm-report-criteria-filter-{$tableName}" {if $field.no_display} style="display: none;"{/if}>
<td class="label report-contents">{$field.title}</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment