Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-8501

Caching issue on pledge summary report

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.4
    • Fix Version/s: 3.4.5
    • Component/s: CiviPledge, CiviReport
    • Labels:
      None

      Description

      Pledge summary report calls

      SELECT v.label as label ,v.value as value FROM civicrm_option_value v, civicrm_option_group g WHERE v.option_group_id = g.id AND g.name = 'contribution_status' AND g.is_active = 1 AND v.value = 2 AND v.is_active = 1

      31 times when I run it &

      SELECT v.label as label ,v.value as value FROM civicrm_option_value v, civicrm_option_group g WHERE v.option_group_id = g.id AND g.name = 'contribution_status' AND g.is_active = 1 AND v.value = 2 AND v.is_active = 1
      19 times (50 rows)

      The patch below seems to fix it.

      If I search the codebase for CRM_Core_OptionGroup::getLabel I find a small handful of instances where the non-cached getLabel function is being called instead of the appropriate pseudoConstant e.g. line 75 of CRM_Case_Form_Activity_ChangeCaseStatus

      Index: CRM/Report/Form/Pledge/Summary.php
      ===================================================================
      — CRM/Report/Form/Pledge/Summary.php (revision 35373)
      +++ CRM/Report/Form/Pledge/Summary.php (working copy)
      @@ -488,8 +488,9 @@
      //handle status id
      if ( array_key_exists( 'civicrm_pledge_status_id', $row ) ) {
      if ( $value = $row['civicrm_pledge_status_id'] )

      { + require_once 'CRM/Contribute/PseudoConstant.php'; $rows[$rowNum]['civicrm_pledge_status_id'] = - CRM_Core_OptionGroup::getLabel( 'contribution_status', $value ); + CRM_Contribute_PseudoConstant::contributionStatus($value); }

      $entryFound = true;
      }

        Attachments

          Activity

            People

            • Assignee:
              rajan Rajan P Mayekar
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: