Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CiviContribute - Fix SQL error when interpreting ACL #23235

Merged
merged 1 commit into from
Apr 19, 2022

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Fixes a regression sql error in the annual query (e.g on contribution tab) for an acld user without permission to view deleted contacts in 5.48+

Before

Fatal ...
SELECT COUNT(*) AS count, SUM(total_amount) AS amount, AVG(total_amount) AS average, currency
FROM civicrm_contribution b
WHERE b.contact_id IN (SELECT contact_id FROM civicrm_acl_contact_cache WHERE user_id = 202)
AND b.contact_idIN(SELECT id FROM civicrm_contact WHERE is_deleted != 1)
AND b.financial_type_id IN (1)
AND b.contact_id IN (71)
AND b.is_test = 0
AND b.receive_date >= 20220101
AND b.receive_date < 20230101
GROUP BY currency, contribution_status_id
HAVING contribution_status_id = 1

After

works

Technical Details

This patch
56f5e9d#diff-4c9d0b1abe07057a4eea2b47bc627eecb95face8ed8d86c1c005312a52cca811R4377

added the acl for deleted contacts - but it is being joined with no space

Comments

We should backport but the fact it is tied to the view deleted permission is probably why no-one noticed as yet...

@civibot
Copy link

civibot bot commented Apr 17, 2022

(Standard links)

@yashodha
Copy link
Contributor

@eileenmcnaughton merging this.

@yashodha yashodha merged commit 25b0e81 into civicrm:5.49 Apr 19, 2022
@eileenmcnaughton
Copy link
Contributor Author

thanks @yashodha

@eileenmcnaughton eileenmcnaughton deleted the acl branch April 19, 2022 19:40
@eileenmcnaughton eileenmcnaughton mentioned this pull request Apr 19, 2022
@totten totten changed the title Fix sql error on acl user CiviContribute - Fix SQL error when interpreting ACL Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants