From 39eb89f4cada6e115eb4a531af6bf9470f76a4c9 Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Thu, 7 Mar 2013 13:54:32 -0800 Subject: [PATCH] More php 5.4 notice fixes and errors --- CRM/ACL/BAO/ACL.php | 2 +- CRM/Mailing/BAO/Mailing.php | 4 +-- CRM/Mailing/Page/Browse.php | 11 +++--- CRM/Member/BAO/Membership.php | 4 +-- .../Form/Contribute/HouseholdSummary.php | 27 +++++++------- CRM/Report/Form/Contribute/Sybunt.php | 18 +++++----- CRM/Report/Form/Grant/Statistics.php | 36 ++++++------------- CRM/Utils/ICalendar.php | 2 +- 8 files changed, 45 insertions(+), 59 deletions(-) diff --git a/CRM/ACL/BAO/ACL.php b/CRM/ACL/BAO/ACL.php index 0562921998..5cb31b5306 100644 --- a/CRM/ACL/BAO/ACL.php +++ b/CRM/ACL/BAO/ACL.php @@ -599,7 +599,7 @@ SELECT $acl.* $rule->query($query); while ($rule->fetch()) { - $results[$rule->id] = &$rule->toArray(); + $results[$rule->id] = $rule->toArray(); } // also get all acls for "Any Role" case diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 61718cc6c6..aff46def7c 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -519,7 +519,7 @@ ORDER BY i.contact_id, i.{$tempColumn} 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 @@ -2682,7 +2682,7 @@ AND e.id NOT IN ( SELECT email_id FROM civicrm_mailing_recipients mr WHERE ma $dao = CRM_Core_DAO::executeQuery($sql, $params); } - function getMailingsList($isSMS = FALSE) { + static function getMailingsList($isSMS = FALSE) { static $list = array(); $where = " WHERE "; if (!$isSMS) { diff --git a/CRM/Mailing/Page/Browse.php b/CRM/Mailing/Page/Browse.php index bcc94654a7..afeee905fe 100644 --- a/CRM/Mailing/Page/Browse.php +++ b/CRM/Mailing/Page/Browse.php @@ -124,22 +124,19 @@ class CRM_Mailing_Page_Browse extends CRM_Core_Page { * * @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 diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 4bf3f690b6..de2260d0ad 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -2298,7 +2298,7 @@ LEFT JOIN civicrm_membership mem ON ( cr.id = mem.contribution_recur_id ) * 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 )'; @@ -2338,7 +2338,7 @@ INNER JOIN civicrm_contact contact ON ( membership.contact_id = contact.id AND * 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 )'; diff --git a/CRM/Report/Form/Contribute/HouseholdSummary.php b/CRM/Report/Form/Contribute/HouseholdSummary.php index bcaec9eeee..7aad7912f4 100644 --- a/CRM/Report/Form/Contribute/HouseholdSummary.php +++ b/CRM/Report/Form/Contribute/HouseholdSummary.php @@ -234,25 +234,25 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { $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 "; } } @@ -320,7 +320,10 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { //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]; } } @@ -355,14 +358,14 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form { $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']; diff --git a/CRM/Report/Form/Contribute/Sybunt.php b/CRM/Report/Form/Contribute/Sybunt.php index 75ccba9cb0..1978ce8dd4 100644 --- a/CRM/Report/Form/Contribute/Sybunt.php +++ b/CRM/Report/Form/Contribute/Sybunt.php @@ -135,7 +135,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { '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( ) @@ -229,15 +229,15 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { 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 "; } @@ -302,7 +302,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { if (!empty($rows)) { $select = " - SELECT + SELECT SUM({$this->_aliases['civicrm_contribution']}.total_amount ) as amount "; $sql = "{$select} {$this->_from} {$this->_where}"; @@ -449,7 +449,7 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { } // 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')); } diff --git a/CRM/Report/Form/Grant/Statistics.php b/CRM/Report/Form/Grant/Statistics.php index 65128e2a54..950a056ee6 100644 --- a/CRM/Report/Form/Grant/Statistics.php +++ b/CRM/Report/Form/Grant/Statistics.php @@ -59,11 +59,6 @@ class CRM_Report_Form_Grant_Statistics extends CRM_Report_Form { '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, @@ -273,27 +268,27 @@ class CRM_Report_Form_Grant_Statistics extends CRM_Report_Form { 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} "; @@ -390,11 +385,10 @@ WHERE {$this->_aliases['civicrm_grant']}.amount_total IS NOT NULL $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)) { @@ -412,7 +406,7 @@ SELECT COUNT({$this->_aliases['civicrm_grant']}.id) as count , } $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} "; @@ -440,14 +434,6 @@ SELECT COUNT({$this->_aliases['civicrm_grant']}.id) as count , ); } - 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'; diff --git a/CRM/Utils/ICalendar.php b/CRM/Utils/ICalendar.php index 23774804cf..49d03e7767 100644 --- a/CRM/Utils/ICalendar.php +++ b/CRM/Utils/ICalendar.php @@ -106,7 +106,7 @@ class CRM_Utils_ICalendar { * @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"); -- 2.25.1