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

Checking Contribution Note field in reports results in no rows

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Important
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.18
    • Fix Version/s: 4.7.23
    • Component/s: None
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      No

      Description

      When using civireport (Contribution Detail Report) & checking Contribution Note field ( see attached screenshot.png ) generated SQL contains part that works like a filter (it's not set). In our case civicrm_note table is empty.

       

      Contribution Note part of query

       

      WHERE (1) AND ( contribution_civireport.contribution_status_id IN (1) ) AND `note_civireport`.`id` IN (SELECT id 
      
      FROM `civicrm_note` 
      
      WHERE ((entity_table = 'civicrm_relationship')) OR ((entity_table = 'civicrm_contact')) OR ((entity_table = 'civicrm_participant')) OR ((entity_table = 'civicrm_contribution')))   
      

       

       

      Full query: 

       

      SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_sort_name, contact_civireport.id as civicrm_contact_id, contact_civireport.id as civicrm_contact_exposed_id, email_civireport.email as civicrm_email_email, phone_civireport.phone as civicrm_phone_phone, contribution_civireport.id as civicrm_contribution_contribution_id, contribution_civireport.financial_type_id as civicrm_contribution_financial_type_id, contribution_civireport.contribution_status_id as civicrm_contribution_contribution_status_id, contribution_civireport.payment_instrument_id as civicrm_contribution_payment_instrument_id, contribution_civireport.currency as civicrm_contribution_currency, contribution_civireport.trxn_id as civicrm_contribution_trxn_id, contribution_civireport.receive_date as civicrm_contribution_receive_date, contribution_civireport.receipt_date as civicrm_contribution_receipt_date, contribution_civireport.total_amount as civicrm_contribution_total_amount_sum, contribution_civireport.fee_amount as civicrm_contribution_fee_amount, contribution_civireport.net_amount as civicrm_contribution_net_amount, 'Contribution' as civicrm_contribution_contribution_or_soft, note_civireport.note as civicrm_note_contribution_note, address_civireport.street_address as civicrm_address_street_address, address_civireport.supplemental_address_1 as civicrm_address_supplemental_address_1, address_civireport.supplemental_address_2 as civicrm_address_supplemental_address_2, address_civireport.street_number as civicrm_address_street_number, address_civireport.street_name as civicrm_address_street_name, address_civireport.street_unit as civicrm_address_street_unit, address_civireport.city as civicrm_address_city, address_civireport.postal_code as civicrm_address_postal_code, address_civireport.country_id as civicrm_address_country_id, address_civireport.state_province_id as civicrm_address_state_province_id, address_civireport.county_id as civicrm_address_county_id   
      
      FROM civicrm_contact contact_civireport   
            INNER JOIN civicrm_contribution contribution_civireport
              ON contact_civireport.id = contribution_civireport.contact_id
              AND contribution_civireport.is_test = 0
            
        LEFT JOIN civicrm_phone phone_civireport
            ON (contact_civireport.id =
            phone_civireport.contact_id) AND
            phone_civireport.is_primary = 1
      
                       
        LEFT JOIN civicrm_address address_civireport
                                 ON (contact_civireport.id =
                                     address_civireport.contact_id) AND
                                     address_civireport.is_primary = 1
      
                  
        LEFT JOIN civicrm_email email_civireport
                         ON contact_civireport.id = email_civireport.contact_id AND
                            email_civireport.is_primary = 1
      
                  
        LEFT JOIN civicrm_note note_civireport
                            ON ( note_civireport.entity_table = 'civicrm_contribution' AND
                                 contribution_civireport.id = note_civireport.entity_id ) 
      
      WHERE (1) AND ( contribution_civireport.contribution_status_id IN (1) ) AND `note_civireport`.`id` IN (SELECT id 
      
      FROM `civicrm_note` 
      
      WHERE ((entity_table = 'civicrm_relationship')) OR ((entity_table = 'civicrm_contact')) OR ((entity_table = 'civicrm_participant')) OR ((entity_table = 'civicrm_contribution')))   
      
      GROUP BY contact_civireport.id, contribution_civireport.id  
      
      ORDER BY contact_civireport.sort_name ASC  
      
      LIMIT 0, 50
      

       

       

        Attachments

        1. note-report.sql.txt
          4 kB
          Stoob
        2. screenshot.png
          40 kB
          Allen Shaw

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              flies Arkadiusz Rzadkowolski
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: