More php 5.4 notice fixes and errors
authorDonald A. Lobo <lobo@civicrm.org>
Thu, 7 Mar 2013 21:54:32 +0000 (13:54 -0800)
committerDonald A. Lobo <lobo@civicrm.org>
Fri, 8 Mar 2013 01:11:55 +0000 (17:11 -0800)
CRM/ACL/BAO/ACL.php
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/Page/Browse.php
CRM/Member/BAO/Membership.php
CRM/Report/Form/Contribute/HouseholdSummary.php
CRM/Report/Form/Contribute/Sybunt.php
CRM/Report/Form/Grant/Statistics.php
CRM/Utils/ICalendar.php

index 0562921998181931e380e2ad0361a9ab98a1885d..5cb31b53065a897bc0251bca020fe3c9c55a54a1 100644 (file)
@@ -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
index 61718cc6c663429090dfe2302afd84a8a16c1844..aff46def7ca36f93b54178509056e020b285a850 100644 (file)
@@ -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) {
index bcc94654a7c33df49946ba3d505a239f434e753e..afeee905fef2a2cec48a149f37f9e138548b4164 100644 (file)
@@ -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
index 4bf3f690b6fd217922a83793e25b96ee81b63d4b..de2260d0ad459e746e69226324f33f0d8d3946da 100644 (file)
@@ -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 )';
index bcaec9eeee5ccc7e69e6c2e77aaccffb27211012..7aad7912f46806709d4817d180f4192be6040682 100644 (file)
@@ -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'];
index 75ccba9cb03babd6e58e0f6b036745e9c809f61a..1978ce8dd47a878a96b497d396f34d7b37fe3d27 100644 (file)
@@ -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'));
     }
index 65128e2a54fc904fef5f7b201f4894de13322e69..950a056ee662dffa710b9efc96bc42f3a40d15fc 100644 (file)
@@ -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';
index 23774804cf1dfe744757a0bff901bdbcf2039100..49d03e77674027a40a4f917f852a491be1de46e2 100644 (file)
@@ -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");