$rule->query($query);
while ($rule->fetch()) {
- $results[$rule->id] = &$rule->toArray();
+ $results[$rule->id] = $rule->toArray();
}
// also get all acls for "Any Role" case
private function _getMailingGroupIds($type = 'Include') {
$mailingGroup = new CRM_Mailing_DAO_Group();
$group = CRM_Contact_DAO_Group::getTableName();
- if (!isset($this->id)) {
+ if (!isset($thi->sid)) {
// we're just testing tokens, so return any group
$query = "SELECT id AS entity_id
FROM $group
$dao = CRM_Core_DAO::executeQuery($sql, $params);
}
- function getMailingsList($isSMS = FALSE) {
+ static function getMailingsList($isSMS = FALSE) {
static $list = array();
$where = " WHERE ";
if (!$isSMS) {
*
* @return void
*/
- function run($newArgs) {
+ function run() {
$this->preProcess();
+ $newArgs = func_get_args();
if (isset($_GET['runJobs']) || CRM_Utils_Array::value('2', $newArgs) == 'queue') {
$config = CRM_Core_Config::singleton();
-
-
CRM_Mailing_BAO_Job::runJobs_pre($config->mailerJobSize);
CRM_Mailing_BAO_Job::runJobs();
CRM_Mailing_BAO_Job::runJobs_post();
}
- $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter',
- 'String',
- $this
- );
+ $this->_sortByCharacter =
+ CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
// CRM-11920 all should set sortByCharacter to null, not empty string
* whose join_date is between $startDate and $endDate and
* whose start_date is between $startDate and $endDate
*/
- function getMembershipJoins($membershipTypeId, $startDate, $endDate, $isTest = 0) {
+ static function getMembershipJoins($membershipTypeId, $startDate, $endDate, $isTest = 0) {
$testClause = 'membership.is_test = 1';
if (!$isTest) {
$testClause = '( membership.is_test IS NULL OR membership.is_test = 0 )';
* whose join_date is before $startDate and
* whose start_date is between $startDate and $endDate
*/
- function getMembershipRenewals($membershipTypeId, $startDate, $endDate, $isTest = 0) {
+ static function getMembershipRenewals($membershipTypeId, $startDate, $endDate, $isTest = 0) {
$testClause = 'membership.is_test = 1';
if (!$isTest) {
$testClause = '( membership.is_test IS NULL OR membership.is_test = 0 )';
$this->_from = NULL;
$this->_from = "
- FROM civicrm_relationship {$this->_aliases['civicrm_relationship']}
- LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact_household']} ON
+ FROM civicrm_relationship {$this->_aliases['civicrm_relationship']}
+ LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact_household']} ON
({$this->_aliases['civicrm_contact_household']}.id = {$this->_aliases['civicrm_relationship']}.$this->householdContact AND {$this->_aliases['civicrm_contact_household']}.contact_type='Household')
- LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']} ON
- ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_relationship']}.$this->otherContact )
+ LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']} ON
+ ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_relationship']}.$this->otherContact )
{$this->_aclFrom}
INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']} ON
({$this->_aliases['civicrm_contribution']}.contact_id = {$this->_aliases['civicrm_relationship']}.$this->otherContact ) AND {$this->_aliases['civicrm_contribution']}.is_test = 0 ";
if ($this->_addressField) {
- $this->_from .= "
- LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']} ON
- {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND
+ $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_address']}.is_primary = 1\n ";
}
if ($this->_emailField) {
$this->_from .= "
- LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']} ON
- {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND
+ LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']} ON
+ {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND
{$this->_aliases['civicrm_email']}.is_primary = 1\n ";
}
}
//hack filter display for relationship type
$type = substr($this->_params['relationship_type_id_value'], -3);
foreach ($statistics['filters'] as $id => $value) {
- if ($value['title'] == 'Relationship Type') {
+ if (
+ $value['title'] == 'Relationship Type' &&
+ isset($this->relationTypes[$this->relationshipId . '_' . $type])
+ ) {
$statistics['filters'][$id]['value'] = 'Is equal to ' . $this->relationTypes[$this->relationshipId . '_' . $type];
}
}
$this->relationTypes = $relationTypes = array();
$params = array('contact_type_b' => 'Household', 'version' => 3);
- $typesA = &civicrm_api('relationship_type', 'get', $params);
+ $typesA = civicrm_api('relationship_type', 'get', $params);
if (!CRM_Utils_Array::value('is_error', $typesA)) {
foreach ($typesA['values'] as $rel) {
$relationTypes[$rel['id']][$rel['id'] . '_b_a'] = $rel['label_b_a'];
}
}
$params = array('contact_type_a' => 'Household', 'version' => 3);
- $typesB = &civicrm_api('relationship_type', 'get', $params);
+ $typesB = civicrm_api('relationship_type', 'get', $params);
if (!CRM_Utils_Array::value('is_error', $typesB)) {
foreach ($typesB['values'] as $rel) {
$relationTypes[$rel['id']][$rel['id'] . '_a_b'] = $rel['label_a_b'];
'options' => $optionYear,
'default' => date('Y'),
),
- 'financial_type_id' =>
+ 'financial_type_id' =>
array( 'title' => ts( 'Financial Type' ),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::financialType( )
function from() {
- $this->_from = "
+ $this->_from = "
FROM civicrm_contribution {$this->_aliases['civicrm_contribution']}
- INNER JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
- ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id
+ INNER JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
+ ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id
{$this->_aclFrom}
- LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']}
- ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id
+ LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']}
+ ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id
AND {$this->_aliases['civicrm_email']}.is_primary = 1
- LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']}
+ LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']}
ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND
{$this->_aliases['civicrm_phone']}.is_primary = 1 ";
}
if (!empty($rows)) {
$select = "
- SELECT
+ SELECT
SUM({$this->_aliases['civicrm_contribution']}.total_amount ) as amount ";
$sql = "{$select} {$this->_from} {$this->_where}";
}
// 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'));
}
'name' => 'grant_type_id',
'title' => ts('By Grant Type'),
),
- 'grant_program_id' =>
- array(
- 'name' => 'grant_program_id' ,
- 'title' => ts('By Grant Program'),
- ),
'status_id' =>
array(
'no_display' => TRUE,
function from() {
$this->_from = "
FROM civicrm_grant {$this->_aliases['civicrm_grant']}
- LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
+ LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact']}
ON ({$this->_aliases['civicrm_grant']}.contact_id = {$this->_aliases['civicrm_contact']}.id ) ";
if ($this->_addressField) {
$this->_from .= "
- LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
- ON {$this->_aliases['civicrm_contact']}.id =
- {$this->_aliases['civicrm_address']}.contact_id AND
+ LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
+ ON {$this->_aliases['civicrm_contact']}.id =
+ {$this->_aliases['civicrm_address']}.contact_id AND
{$this->_aliases['civicrm_address']}.is_primary = 1\n
LEFT JOIN civicrm_country country
- ON {$this->_aliases['civicrm_address']}.country_id =
+ ON {$this->_aliases['civicrm_address']}.country_id =
country.id
LEFT JOIN civicrm_worldregion {$this->_aliases['civicrm_world_region']}
- ON country.region_id =
+ ON country.region_id =
{$this->_aliases['civicrm_world_region']}.id";
}
}
function where() {
$approved = array_search( 'Approved', CRM_Grant_PseudoConstant::grantStatus( ) );
- $whereClause = "
-WHERE {$this->_aliases['civicrm_grant']}.amount_total IS NOT NULL
+ $whereClause = "
+WHERE {$this->_aliases['civicrm_grant']}.amount_total IS NOT NULL
AND {$this->_aliases['civicrm_grant']}.amount_total > 0";
$this->_where = $whereClause . " AND {$this->_aliases['civicrm_grant']}.status_id = {$approved} ";
$grantTypes = CRM_Grant_PseudoConstant::grantType();
$countries = CRM_Core_PseudoConstant::country();
$gender = CRM_Core_PseudoConstant::gender();
- $grantPrograms = CRM_Grant_BAO_Grant::getGrantPrograms();
$grantAmountTotal = "
-SELECT COUNT({$this->_aliases['civicrm_grant']}.id) as count ,
- SUM({$this->_aliases['civicrm_grant']}.amount_total) as totalAmount
+SELECT COUNT({$this->_aliases['civicrm_grant']}.id) as count ,
+ SUM({$this->_aliases['civicrm_grant']}.amount_total) as totalAmount
{$this->_from} ";
if (!empty($this->_whereClause)) {
}
$grantAmountAwarded = "
-SELECT COUNT({$this->_aliases['civicrm_grant']}.id) as count ,
+SELECT COUNT({$this->_aliases['civicrm_grant']}.id) as count ,
SUM({$this->_aliases['civicrm_grant']}.amount_granted) as grantedAmount,
SUM({$this->_aliases['civicrm_grant']}.amount_total) as totalAmount
{$this->_from} ";
);
}
- if ( CRM_Utils_Array::value( 'civicrm_grant_grant_program_id', $values ) ) {
- $grantProgram = CRM_Utils_Array::value( $values['civicrm_grant_grant_program_id'], $grantPrograms );
- $grantStatistics['civicrm_grant_grant_program_id']['title'] = ts( 'By Grant Program' );
- self::getStatistics( $grantStatistics['civicrm_grant_grant_program_id'], $grantProgram, $values,
- $awardedGrants, $awardedGrantsAmount
- );
- }
-
if (array_key_exists('civicrm_world_region_name', $values)) {
$region = CRM_Utils_Array::value('civicrm_world_region_name', $values);
$region = ($region) ? $region : 'Unassigned';
* @return void
*
*/
- function send($calendar, $content_type = 'text/calendar', $charset = 'us-ascii', $fileName = NULL, $disposition = NULL) {
+ static function send($calendar, $content_type = 'text/calendar', $charset = 'us-ascii', $fileName = NULL, $disposition = NULL) {
$config = CRM_Core_Config::singleton();
$lang = $config->lcMessages;
header("Content-Language: $lang");