CiviCRM Core issueshttps://lab.civicrm.org/dev/core/-/issues2022-06-25T11:47:09Zhttps://lab.civicrm.org/dev/core/-/issues/3691Improve code comments for Activity: parent_id and source_record_id2022-06-25T11:47:09ZherbdoolImprove code comments for Activity: parent_id and source_record_idI've done some investigating of the codebase to try to figure out what two columns for Activity entity are for and whether I can. I think I've figured it mostly out but not sure where to document. At the very least I'll improve the comme...I've done some investigating of the codebase to try to figure out what two columns for Activity entity are for and whether I can. I think I've figured it mostly out but not sure where to document. At the very least I'll improve the comments in the codebase. We don't seem to have a section in the dev guide to deal with this.
So if someone creates a generic activity and schedules a follow-up, the new follow-up activity references the first activity in `parent_id` column. Then assigning it to a contact will send an email to that contact and create an activity. And that activity references the follow-up activity in the source_record_id column. I haven't found much documentation yet, except in the parent_id column description where it says that it's for "follow-up items" but claims that it is "not currently implemented." Hm...
The description of `source_record_id` also seems to be the only documentation:
> Artificial FK to original transaction (e.g. contribution) IF it is not an Activity. Table can be figured out through activity_type_id, and further through component registry.
As far as I can tell, "table can be figured out", means just checking for particular activity types before trying to figure out the "FK", and assuming the code creating the activity assigned the `activity_type_id` properly.
I'm not really sure what "component registry" means here. As far as I can tell from the code, the component doesn't matter. It's only based on checking the right `activity_type_id`.
If Activity was created fresh now I'm guessing it would have gotten entity_table and entity_id instead of this older approach?5.52.0https://lab.civicrm.org/dev/core/-/issues/3601MS Exchange - IMAP-XOAuth2 authentication fails2022-09-12T18:25:55ZtottenMS Exchange - IMAP-XOAuth2 authentication failsOverview
----------------------------------------
https://lab.civicrm.org/dev/core/-/issues/2141 introduced support for (1) obtaining OAuth2 tokens and (2) using the OAuth2 tokens for IMAP-XOAuth2.
In my test setup, I am able to obtai...Overview
----------------------------------------
https://lab.civicrm.org/dev/core/-/issues/2141 introduced support for (1) obtaining OAuth2 tokens and (2) using the OAuth2 tokens for IMAP-XOAuth2.
In my test setup, I am able to obtain a token from Microsoft which appears valid -- but their IMAP server is not accepting the token.
The "Critical Evaluation" below include a more thorough review of theories/data, but here's a high-level summary of debugging efforts:
| Provider | OAuth2 initiation | Use token for IMAP/XOAuth2 | Use token for HTTP/REST |
| -- | -- | -- | -- |
| Microsoft Exchange Online | :white_check_mark: | :stop_sign: fails, tho JWT has IMAP claims | :white_check_mark: |
| Google Mail | :white_check_mark: | :white_check_mark: | (not tested) |
Reproduction steps
----------------------------------------
Configure Civi's OAuth client as described in the draft documentation: https://lab.civicrm.org/documentation/docs/sysadmin/-/merge_requests/278
Recap:
1. Enable `oauth-client`
2. Register the OAuth details in Civi and in Azure Portal.
3. In Civi's "Admin => CiviMail => Mail Accounts", add a mail account
4. For the newly created account, choose "Save & Test".
Current behavior
----------------------------------------
The IMAP server responds with `NO AUTHENTICATE failed.` and `* BAD Command Error. 12`
In the GUI, it appears as:
![Screen_Shot_2020-11-06_at_5.10.49_PM](/uploads/dfa7fd59bd5be48743ef1be7132778c8/Screen_Shot_2020-11-06_at_5.10.49_PM.png)
On a network level, the interaction is:
```
<< * OK The Microsoft Exchange IMAP4 service is ready. [{_LONG_RANDOM_CODE_}]
>> A0001 AUTHENTICATE XOAUTH2 {_THE_XOAUTH2_TOKEN_}
<< A0001 NO AUTHENTICATE failed.
>>
<< * BAD Command Error. 12
>> A0002 LOGOUT
<< * BAD Command Error. 12
```
(To see this, I applied [a hack to log network I/O](https://gist.github.com/totten/05de1aaf6948513792a40fb6f1eafb26) and re-ran the check via CLI.)
Expected behavior
----------------------------------------
The IMAP test should succeed.
Environment information
----------------------------------------
* __Browser:__ _Firefox_
* __CiviCRM:__ _5.32.beta1_
* __PHP:__ _7.1_
* __CMS:__ _Drupal 7_
* __Database:__ _MySQL 5.6_
* __Web Server:__ _Apache 2.4_
Critical evaluation
----------------------------------------
Here are a few theories for where the problem may reside.
1. The problem is in the OAuth2 client.
1. The OAuth2 client is broken - it does not obtain a real token from Microsoft.
2. The OAuth2 client obtains a real token - but the token does not have the proper scopes.
3. The OAuth2 client obtains a valid token with proper scopes - but it doesn't speak IMAP-XOAuth2 correctly.
2. The problem is in the OAuth2 service provider (either the authorization-server or the resource-server/IMAP-server).
1. There is a problem in the account flags/configuration.
2. There is a bug in the OAuth2 service provider.
Let's consider each in turn to see if we can prove/disprove the theory:
## (Theory 1.1) The OAuth2 client is broken - it does not obtain a real token from Microsoft.
This explanation doesn't hold -- because the same token works for other scenarios.
* Navigate to "Admin => System Settings => OAuth => ms-exchange"
![Screen_Shot_2020-11-06_at_5.41.30_PM](/uploads/c7cd3286bdebf306c40466d3b22b7555/Screen_Shot_2020-11-06_at_5.41.30_PM.png)
* Click "Inspect"
* Find "Access Token: Raw". Copy the value.
* In CLI, make an HTTP request to MS with the same token:
```
$ curl 'https://graph.microsoft.com/v1.0/me' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN_VALUE>'
{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users/$entity","businessPhones":["XXX-XXX-XXXX"],"displayName":"My Name","givenName":"My","jobTitle":null,"mail":"myname@wariomail.onmicrosoft.com","mobilePhone":null,"officeLocation":null,"preferredLanguage":"en-US","surname":"Name","userPrincipalName":"myname@wariomail.onmicrosoft.com","id":"XXXXX-XXXX-XXXXX"}
```
* The response is well-formed and has the correct information.
## (Theory 1.2) The OAuth2 client obtains a real token - but the token does not have the proper scopes.
I can show that the client works according to spec.
* In the Microsoft documentation [Authenticate an IMAP, POP or SMTP connection using OAuth](https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth#configure-your-application), we can see the required scope is `IMAP.AccessAsUser.All`.
* In Azure Portal, navigate to "Azure Active Directory => App registrations => (my-app) => API permissions". Note the list of permissions includes IMAP:
![Screen_Shot_2020-11-06_at_6.06.48_PM](/uploads/739adc203b05b30fdeb3efd152b340f7/Screen_Shot_2020-11-06_at_6.06.48_PM.png)
* In CiviCRM, navigate to "Admin => System Settings => OAuth => ms-exchange"
* In the "Details" tab, we can see the list of scopes that requested during setup:
![Screen_Shot_2020-11-06_at_5.56.41_PM](/uploads/9f23d454175a2ed8d8b16da55b5a4bd1/Screen_Shot_2020-11-06_at_5.56.41_PM.png)
* In the "Client #X" tab, we can "Inspect" the token.
* Observe: The "Token Record" shows that the `raw` response from the OAuth2 service. It indicates approval for the necessary scopes:
![Screen_Shot_2020-11-06_at_5.58.47_PM](/uploads/3ebf06fe493d8aa83d22c25fc3ce3380/Screen_Shot_2020-11-06_at_5.58.47_PM.png)
* Observe: The "Access Token: JWT Payload" also reports these scopes:
```
"scp": "IMAP.AccessAsUser.All POP.AccessAsUser.All SMTP.Send User.Read profile openid email",
```
So, it appears that every component (from Azure app registration, to the client's request configuration, to the received token data, to the decoded JWT token data) reports `IMAP.AccessAsUser.All` as an included scope.
There is a subtle discrepancy in how the scope is labeled - sometimes, it's presented as the shorter `IMAP.AccessAsUser.All`; other times, it's the longer `https://outlook.office.com/IMAP.AccessAsUser.All`. To be sure, I've requested tokens with both notations -- and in both cases, the outcome is the same. (To wit: the JWT token has `IMAP.AccessAsUser.All` - but it does not work for IMAP access.)
## (Theory 1.3) The OAuth2 client obtains a valid token with proper scopes - but it doesn't speak IMAP-XOAuth2 correctly.
I've tested this theory a few ways:
1. Connect to another service (Google Mail) which uses the same protocol (IMAP-XOauth2). It works. :white_check_mark:
2. Hack the PHP IMAP library (`imap_transport.php`) to inspect the wire-communication. Manually decode the XOAuth2 statement to ensure that it follows [the XOAuth2 formula](https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth#sasl-xoauth2). :white_check_mark:
3. Write a new script with a different PHP IMAP library to try the same token. The alternate library works with Google Mail but not Microsoft Exchange.
## (Theory 2.1) There is a problem in the account flags/configuration.
As I mentioned above (theory 1.2), the "App registration" has all the scopes described in the docs
![Screen_Shot_2020-11-06_at_6.06.48_PM](/uploads/afe29d69f170150a89b98802fd5262b8/Screen_Shot_2020-11-06_at_6.06.48_PM.png)
In the "Exchange Administration Center", the account has IMAP enabled:
![Screen_Shot_2020-11-06_at_6.32.17_PM](/uploads/a5980fff21dcf85add1df96d03e1c9b2/Screen_Shot_2020-11-06_at_6.32.17_PM.png)
In the Exchange webmail UI, there is a settings page with a search-box. Search for "IMAP", and it shows:
![Screen_Shot_2020-11-06_at_6.27.06_PM](/uploads/a4ae9d1aebae308df98a41b3ac348379/Screen_Shot_2020-11-06_at_6.27.06_PM.png)
It's peculiar that searching for "IMAP" presents an inert radio-button for POP, but it does show connection details for IMAP.
TBH, Microsoft's backend here is labyrinthine, so it's hard to be sure that I've checked every possible permission. But I can't find anything else that would prevent IMAP access.
Perhaps someone with more experience in Microsoft's backend should try to run on a different account? Perhaps an account that has been demonstrated to work with IMAP?
## (Theory 2.2) There is a bug in the OAuth2 service provider.
I can't really prove or disprove this theory. I don't really want to believe this is the problem (*surely this stuff works for other people...*). OTOH, maybe it's actually quite rare for people to use IMAP+XOAuth2 with Exchange Online...5.32.0https://lab.civicrm.org/dev/core/-/issues/3583Incorrect Total Count on mail summary report2022-06-11T14:54:52ZMonish DebIncorrect Total Count on mail summary reportWhen you visit the mail summary report, the `Total Count` is incorrect which includes the open count of all mailings, instead of its corresponding mail.
Here's the screenshot to show the difference in count.
Mailing Summary report(sho...When you visit the mail summary report, the `Total Count` is incorrect which includes the open count of all mailings, instead of its corresponding mail.
Here's the screenshot to show the difference in count.
Mailing Summary report(shows incorrect `Total opens` count which is 6):
![Screen_Shot_2018-06-01_at_5.29.57_PM](/uploads/24f196c6e8f88d138b4e557b8c52572a/Screen_Shot_2018-06-01_at_5.29.57_PM.png)
Mailing Status page(shows correct `Total Opens` count which is 5):
![Screen_Shot_2018-06-01_at_5.28.48_PM](/uploads/741cb845269b8f408fe535b0ab080528/Screen_Shot_2018-06-01_at_5.28.48_PM.png)5.3.0Monish DebMonish Debhttps://lab.civicrm.org/dev/core/-/issues/3523Don't cache the full path of extensions so they don't break with dynamic paths2022-06-11T14:41:17ZherbdoolDon't cache the full path of extensions so they don't break with dynamic pathsExtension paths are cached as full paths, which are incompatible with cloud services that might have dynamic filepaths (such as Pantheon). Instead the full path can be determined by other means.
This is an example of what gets cached in...Extension paths are cached as full paths, which are incompatible with cloud services that might have dynamic filepaths (such as Pantheon). Instead the full path can be determined by other means.
This is an example of what gets cached in CRM_Extension_Mapper::getActiveModuleFiles:
```
a:6:{i:0;a:2:{s:6:"prefix";s:4:"iats";s:8:"filePath";s:101:"/var/www/vhosts/httpdocs/sites/all/civicrm_custom/extensions/com.iatspayments.civicrm/iats.php";}i:1;a:2:{s:6:"prefix";s:14:"extendedreport";s:8:"filePath";s:114:"/var/www/vhosts/httpdocs/sites/all/civicrm_custom/extensions/nz.co.fuzion.extendedreport/extendedreport.php";}i:2;a:2:{s:6:"prefix";s:12:"cividiscount";s:8:"filePath";s:116:"/var/www/vhosts/httpdocs/sites/all/civicrm_custom/extensions/org.civicrm.module.cividiscount/cividiscount.php";}i:3;a:2:{s:6:"prefix";s:9:"sumfields";s:8:"filePath";s:108:"/var/www/vhosts/httpdocs/sites/all/civicrm_custom/extensions/net.ourpowerbase.sumfields/sumfields.php";}i:4;a:2:{s:6:"prefix";s:4:"gdpr";s:8:"filePath";s:102:"/var/www/vhosts/httpdocs/sites/all/civicrm_custom/extensions/uk.co.vedaconsulting.gdpr/gdpr.php";}i:5;a:2:{s:6:"prefix";s:10:"l10nupdate";s:8:"filePath";s:107:"/var/www/vhosts/httpdocs/sites/all/civicrm_custom/extensions/com.cividesk.l10n.update/l10nupdate.php";}}
```
Previous solution was to use the patch in this issue https://www.drupal.org/node/2347897 but it meant there was a performance hit by always skipping cache.5.24.0https://lab.civicrm.org/dev/core/-/issues/3491Multiple log files on multilanguage environments2022-06-25T11:49:50ZjensschuppeMultiple log files on multilanguage environmentsMulti-language environments with path prefixes for each language cause multiple CiviCRM log files in `ConfigAndLog`.
As the log file name contains a hash that includes the `userFrameworkBaseURL`, each language creates a separate log fil...Multi-language environments with path prefixes for each language cause multiple CiviCRM log files in `ConfigAndLog`.
As the log file name contains a hash that includes the `userFrameworkBaseURL`, each language creates a separate log file, see https://github.com/civicrm/civicrm-core/blob/5.48.1/CRM/Core/Error.php#L637-L657.
Since those log files are about the same environment, there should be only one active log file.5.52.0https://lab.civicrm.org/dev/core/-/issues/3485Installer - CiviGrant option no longer works2022-06-11T15:47:08ZtottenInstaller - CiviGrant option no longer worksOverview
----------------------------------------
When performing a web-based installation on Drupal or WordPress, it presents a list of components that you can toggle. One option no longer works correctly.
Reproduction steps
---------...Overview
----------------------------------------
When performing a web-based installation on Drupal or WordPress, it presents a list of components that you can toggle. One option no longer works correctly.
Reproduction steps
----------------------------------------
1. Create an empty D7/BD/WP site
2. Enable CiviCRM
3. In the status alert, click the link to `civicrm/setup`
4. Enable the CiviGrant option
5. Proceed with install
Current behaviour
----------------------------------------
CiviGrant is not activated
Expected behaviour
----------------------------------------
Activate CiviGrant extension
Or: Don't present the option
Environment information
----------------------------------------
Hydra site for WP: http://site-list.test-1.civicrm.org:8001/?filter=hydra-* (http://hydra-wp.test-1.civicrm.org:8002/)
Comments
----------------------------------------
I noticed this while trying the 5.50 installer, but it probably regressed circa 5.48.
The installer currently presents a list of components (https://github.com/civicrm/civicrm-core/blob/master/setup/plugins/blocks/components.civi-setup.php) and populates `$e->getModel()->components`.
To configurably toggle extensions during install, it needs to update `$e->getModel()->extensions`.
https://github.com/civicrm/civicrm-core/blob/master/setup/src/Setup/Model.php#L42-L455.51.0https://lab.civicrm.org/dev/core/-/issues/3481Primary email is not visually marked as primary2022-06-03T21:55:57Zmagnolia61Primary email is not visually marked as primaryFor phone numbers a visual sign is shown to show which is the primary phone number.
For email addresses this is not the case.
What would be needed to show which email address is the primary one?
Is this a civicrm core thing firstly?
us...For phone numbers a visual sign is shown to show which is the primary phone number.
For email addresses this is not the case.
What would be needed to show which email address is the primary one?
Is this a civicrm core thing firstly?
using contactlayout without shoreditch
![image](https://user-images.githubusercontent.com/2195908/170932708-81876bb9-e1ca-41c3-8c19-9c65ea386503.png)
using contactlayout with shoredich
![image](https://user-images.githubusercontent.com/2195908/170933137-f6aaaa8d-29d7-43f0-8664-3fb8a2c0f47c.png)5.51.0https://lab.civicrm.org/dev/core/-/issues/3467Drupal8/9 Sync email own user from Civi2022-05-27T13:27:06ZCésarDrupal8/9 Sync email own user from CiviHello all,
Modifying your own email from civi does not modify it in drupal, but you can modify any email of any contact and its sync fine. It works fine in D7.
Is this a good approach? Or am I missing something? I have also tested th...Hello all,
Modifying your own email from civi does not modify it in drupal, but you can modify any email of any contact and its sync fine. It works fine in D7.
Is this a good approach? Or am I missing something? I have also tested the permissions of the userprotect module.
I discussed this problem some time ago in the CiviCRM chat for Drupal 8:
https://chat.civicrm.org/civicrm/pl/i6fyu7a3jpb1mfgffqcmyrxhmr
I found this validation when contact is updated and Symfony throws the error:
```
Your current password is missing or incorrect; it's required to change the %name.
```
Source: https://github.com/civicrm/civicrm-core/blob/5.45.1/CRM/Utils/System/Drupal8.php#L117
Tested in CiviCRM 5.45
Reproduction steps
----------------------------------------
1. Edit your own email in the CiviCRM.
2. Editing another contact's email in CiviCRM.5.51.0https://lab.civicrm.org/dev/core/-/issues/3463Prefer frontend_title for mailing groups in {mailing.group}2022-06-22T02:00:05ZufundoPrefer frontend_title for mailing groups in {mailing.group}The {mailing.group} token in CiviMail currently displays the `title` field from groups. Now we can set a different `frontend_title` it would be good to use this if set.
Currently there is a hard-coded SQL query - https://lab.civicrm.org...The {mailing.group} token in CiviMail currently displays the `title` field from groups. Now we can set a different `frontend_title` it would be good to use this if set.
Currently there is a hard-coded SQL query - https://lab.civicrm.org/dev/core/-/blob/master/CRM/Mailing/BAO/Mailing.php#L1418 - I wonder if API4 could be used instead?5.52.0https://lab.civicrm.org/dev/core/-/issues/3438Drupal 9: `cv` fails on CiviCRM 5.48.22024-01-19T16:05:09ZmasettoDrupal 9: `cv` fails on CiviCRM 5.48.2Overview
----------------------------------------
`cv` command fails on CiviCRM 5.48.2 on Drupal 9
Reproduction steps
----------------------------------------
1. run any cv command, such as: `cv ext:list -L`
1. Got an error
```
In Drup...Overview
----------------------------------------
`cv` command fails on CiviCRM 5.48.2 on Drupal 9
Reproduction steps
----------------------------------------
1. run any cv command, such as: `cv ext:list -L`
1. Got an error
```
In Drupal.php line 170:
\Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.
```
Environment information
----------------------------------------
* __CiviCRM:__ 5.48.2
* __PHP:__ 7.4
* __CMS:__ Drupal 9.3.12
* __Database:__ MariaDB 10.5.12
* __cv:__ v0.3.21 (installed by composer). This is composer.json part:
```
"require": {
"civicrm/civicrm-core": "~5.46",
"civicrm/civicrm-drupal-8": "~5.46",
"civicrm/civicrm-packages": "~5.46",
"civicrm/cv": "^0.3.16",
```5.61.0https://lab.civicrm.org/dev/core/-/issues/3436Multivalue custom field as "tab with table" does not show values2022-05-25T08:20:07ZjmargrafMultivalue custom field as "tab with table" does not show valuesMultivalue custom field as "tab with table" does not show the tab content
Create a custom field group and set it to be multivalue with style Tab with Table.
Add a field.
Visit a contact record and click on the new tab.
C...Multivalue custom field as "tab with table" does not show the tab content
Create a custom field group and set it to be multivalue with style Tab with Table.
Add a field.
Visit a contact record and click on the new tab.
Create a new entry. The entry will not be showed in the table
I can see the following error message in the browser console:
```
Uncaught SyntaxError: unexpected token: identifier
jQuery 7
globalEval
globalEval
Ga
append
html
X
html
refresh https://crmtest.sci-d.de/sites/all/modules/civicrm/js/crm.ajax.js?rb98g8:310
jQuery 4
jquery.min.js:3:67
jQuery 7
refresh https://crmtest.sci-d.de/sites/all/modules/civicrm/js/crm.ajax.js?rb98g8:310
jQuery 4
```
CiviCRM Version: 5.46.35.50.0https://lab.civicrm.org/dev/core/-/issues/3432Greenwich theme: transparent background on pop-ups2022-06-23T22:07:08ZherbdoolGreenwich theme: transparent background on pop-upsOn 5.48.2, using default (Greenwich) admin theme:
![2022-04-28_15.51.38_xm2.lndo.site_d1e1f03fb990](/uploads/678c53c44f0cdf394c4e3e3f87ef985f/2022-04-28_15.51.38_xm2.lndo.site_d1e1f03fb990.png)
And with "unstyled" admin theme:
![2022-...On 5.48.2, using default (Greenwich) admin theme:
![2022-04-28_15.51.38_xm2.lndo.site_d1e1f03fb990](/uploads/678c53c44f0cdf394c4e3e3f87ef985f/2022-04-28_15.51.38_xm2.lndo.site_d1e1f03fb990.png)
And with "unstyled" admin theme:
![2022-04-28_15.57.43_xm2.lndo.site_8080eb78c5ef](/uploads/bd8487b62e72dc3e201b708652319b9c/2022-04-28_15.57.43_xm2.lndo.site_8080eb78c5ef.png)
Using Drupal 9, Seven admin theme.
Environment information
----------------------------------------
* __Browser:__ Chrome
* __CiviCRM:__ 5.48.2
* __PHP:__ 7.4
* __CMS:__ Drupal 95.52.0https://lab.civicrm.org/dev/core/-/issues/3377Why are unique labels for price fields required?2022-04-22T16:22:10ZStoobWhy are unique labels for price fields required?This is a question not a proposal or bug report. Should a unique label for price fields be enforced (seen attached)?
Here are two use cases:
* event registration where the price of attendance changes over time (early bird) but the e...This is a question not a proposal or bug report. Should a unique label for price fields be enforced (seen attached)?
Here are two use cases:
* event registration where the price of attendance changes over time (early bird) but the event itself or the nature of the registration doesn't change
* membership registration 'special' where prior to a certain date memberships are on sale
It seems in these cases a unique label is not necessary.
![why](/uploads/5b0f604ac6fba41973e16fcfd865932b/why.png)5.47.0AllenShawAllenShawhttps://lab.civicrm.org/dev/core/-/issues/3360deprecated function error2022-04-22T16:21:37ZJoeMurraydeprecated function errorOn dmaster go to Manage Events, then click on the leftmost icon on top right (blue in the included image).
![Screenshot_20210219-171528_Chrome](/uploads/f6ff11c7f923ca071f8fce241bec2bf2/Screenshot_20210219-171528_Chrome.png)
Error tha...On dmaster go to Manage Events, then click on the leftmost icon on top right (blue in the included image).
![Screenshot_20210219-171528_Chrome](/uploads/f6ff11c7f923ca071f8fce241bec2bf2/Screenshot_20210219-171528_Chrome.png)
Error that shows is:
Deprecated function: Non-static method CRM_Event_ICalendar::run() should not be called statically in CRM_Core_Invoke::runItem() (line 278 of /srv/buildkit/build/dmaster/web/sites/all/modules/civicrm/CRM/Core/Invoke.php).5.36.0Monish DebMonish Debhttps://lab.civicrm.org/dev/core/-/issues/3339Wrong frequency when purchasing a membership2024-01-05T03:42:45ZsudomanWrong frequency when purchasing a membershipWe patched a bug in CiviCRM core that has been around for a while now. When buying an annual membership, sometimes donors are charged the annual price, but on a monthly basis. (We offer both annual and monthly memberships on the same mem...We patched a bug in CiviCRM core that has been around for a while now. When buying an annual membership, sometimes donors are charged the annual price, but on a monthly basis. (We offer both annual and monthly memberships on the same membership page). This patch is a hack that works for us, but may have some hard coded values for our instance.
One way to check if your server has this problem is to use a payment processor like PayPal, which lets you see the recurring contrib details before you actually pay. This issue comes up somewhat randomly, so you might have to try a few times.
Thanks! : )
```
diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php
index 41fcb7da3e..075d29ab20 100644
--- a/CRM/Contribute/Form/ContributionBase.php
+++ b/CRM/Contribute/Form/ContributionBase.php
@@ -1371,7 +1371,14 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
$this->_params['is_recur'] = $this->_values['is_recur'] = 1;
// check if price set is not quick config
if (!empty($this->_params['priceSetId']) && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_params['priceSetId'], 'is_quick_config')) {
- list($this->_params['frequency_interval'], $this->_params['frequency_unit']) = CRM_Price_BAO_PriceSet::getRecurDetails($this->_params['priceSetId']);
+
+ // Extract the ids for all of the line items that have been chosen.
+ $priceFieldValueIds = array_keys($this->_lineItem[$this->_params['priceSetId']])[0];
+ if (empty($priceFieldValueIds))
+ $priceFieldValueIds = array_keys($this->_params['price_126'])[0];
+ list($this->_params['frequency_interval'], $this->_params['frequency_unit']) = CRM_Price_BAO_PriceSet::getRecurDetails($this->_params['priceSetId'], $priceFieldValueIds);
}
else {
// FIXME: set interval and unit based on selected membership type
diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php
index 91118ecd97..0277bdbaed 100644
--- a/CRM/Price/BAO/PriceSet.php
+++ b/CRM/Price/BAO/PriceSet.php
@@ -1332,13 +1332,14 @@ GROUP BY mt.member_of_contact_id ";
* @return array
* associate array of frequency interval and unit
*/
- public static function getRecurDetails($priceSetId) {
+ public static function getRecurDetails($priceSetId, $priceFieldValueIds) {
$query = 'SELECT mt.duration_interval, mt.duration_unit
FROM civicrm_price_field_value pfv
INNER JOIN civicrm_membership_type mt ON pfv.membership_type_id = mt.id
INNER JOIN civicrm_price_field pf ON pfv.price_field_id = pf.id
- WHERE pf.price_set_id = %1 LIMIT 1';
+ WHERE pf.price_set_id = %1 AND pfv.id = '
+ . $priceFieldValueIds . ' LIMIT 1';
$params = [1 => [$priceSetId, 'Integer']];
$dao = CRM_Core_DAO::executeQuery($query, $params);
```5.69.0https://lab.civicrm.org/dev/core/-/issues/3319Creating a relationship fails when a related membership has a contact referen...2022-04-22T16:17:01ZjaapjansmaCreating a relationship fails when a related membership has a contact reference custom field.**How to reproduce?**
1. Create a new membership type. Set **Relationship type** to Employer of
2. Create a custom field set for this membership type
3. Add a custom field of type Contact Reference
4. Create a new organization
5. Add th...**How to reproduce?**
1. Create a new membership type. Set **Relationship type** to Employer of
2. Create a custom field set for this membership type
3. Add a custom field of type Contact Reference
4. Create a new organization
5. Add the membership and fill in a value at the custom field
6. Now add a **Employer of** relationship between this organization and an Individual, press save
**Expected results**
Relationship gets saved and a related membership is created with the correct value for the custom field
**Actual results**
No relationship is created, no error is shown, the civicrm logo stays on the screen turning around.
Also when refreshing the page an error popups with something: **custom_xx is not a valid integer**
**Extra information**
When debuging this issue I disovered that a `Membership.get` api is used. And those values are passed to a `Membership.create` api call. The paramaters for the custom field have the format of `custom_xx = 'Joe'` and `custom_xx_id = 202`5.39.0jaapjansmajaapjansmahttps://lab.civicrm.org/dev/core/-/issues/3291Activity Type and Case Type not being combined correctly in Advanced Search2022-04-22T15:53:58ZalistairjamesActivity Type and Case Type not being combined correctly in Advanced SearchSteps to create (5.29)
- Create CaseType1 containing a Meeting
- Create CaseType2 containing a Meeting
- Create a Case for Contact_A of CaseType1
- Create a Case for Contact_A of CaseType2
Advance Search: Display: Activities, Logical_Op...Steps to create (5.29)
- Create CaseType1 containing a Meeting
- Create CaseType2 containing a Meeting
- Create a Case for Contact_A of CaseType1
- Create a Case for Contact_A of CaseType2
Advance Search: Display: Activities, Logical_Operator: AND, Activity Type: Meeting, Case Type:CaseType1
Search description displayed:
Activity Type ID In Meeting ...AND...
Activity targeted to ...AND...
Case Type(s) In CaseType1 ...AND...
Case = All Cases
Actual Result (two meetings returned instead of one):
Meeting (from CaseType1)
Meeting (from CaseType2)
Nothing I tried enabled me to exclude the Meeting in CaseType2. If a Contact had Cases of both CaseType1 and CaseType2 all their Meetings were reported in the results and the Case Type filter did not work.5.37.0https://lab.civicrm.org/dev/core/-/issues/3290Contact Logging Detail report crashes when a contribution and contact are upd...2022-04-22T15:53:55ZJonGoldContact Logging Detail report crashes when a contribution and contact are updated togetherThis is a regression, but it dates back to Civi 5.35, so I'm not going to target the RC.
### Steps to replicate
* Turn on advanced logging.
* Record a donation through a contribution page for either a) a new contact, b) an existing cont...This is a regression, but it dates back to Civi 5.35, so I'm not going to target the RC.
### Steps to replicate
* Turn on advanced logging.
* Record a donation through a contribution page for either a) a new contact, b) an existing contact, but adding/changing their name.
* Go to that contact's change log, and try to view the details of the most recent change (by clicking **Update** next to the change).
### Expected result
You see the changes.
### Actual result
`DB Error: Syntax Error`.
This regression comes from [PR 19504](https://github.com/civicrm/civicrm-core/pull/19504). Previously, not every DAO had a `_labelField` property - so `CRM_Logging_ReportDetail::convertForeignKeyValuesToLabels()` checking if the property existed was basically the same as checking if it was defined. Now it will always exist (in `CRM_Core_DAO`) but not always be defined. So we change the conditional to reflect that.5.48.0JonGoldJonGoldhttps://lab.civicrm.org/dev/core/-/issues/3273Performance issue when exporting to CSV from reports with custom fields2022-04-22T15:53:23ZJonGoldPerformance issue when exporting to CSV from reports with custom fields### User Story
As an end user, I want to run a report of my organization's alumni. This is about 16,000 contacts, and my report contains 6 custom fields. However, this report takes about 8.5 minutes to generate, far longer than the 300...### User Story
As an end user, I want to run a report of my organization's alumni. This is about 16,000 contacts, and my report contains 6 custom fields. However, this report takes about 8.5 minutes to generate, far longer than the 300 second timeout on processes.
### Profiling
I stepped through the code until I saw that `CRM_Core_BAO_CustomField::displayValue()` was the culprit, which is called ~96,000 times (# of rows * custom fields). I used a profiler and it reported that 97% of the time was spent in the `CRM_Core_BAO_CustomField::getOptions()` method.
### Improvements
* `CRM_Core_BAO_CustomField::getOptions()` is called on every custom field - even those that don't use it (e.g. text or money fields). By moving it so it's only called when needed, I immediately got a speedup.
* `getOptions()` should only be called 6 times in my example, not 96,000 times. I'm going to put a cache into `getOptions()`.5.21.0JonGoldJonGoldhttps://lab.civicrm.org/dev/core/-/issues/3233Address location type search errors when using a search profile2022-04-22T15:51:34ZMonish DebAddress location type search errors when using a search profileSteps to replicate the issue:
1. Create a profile for use as a search view. The fields I have used - address name, phone, city, state
2. Go to Advanced Search
3. Trigger a search using that profile, and select an address location type.
...Steps to replicate the issue:
1. Create a profile for use as a search view. The fields I have used - address name, phone, city, state
2. Go to Advanced Search
3. Trigger a search using that profile, and select an address location type.
_Environment details_
```
CiviCRM ver - 5.37.alpha1 / master
CMS - Drupal 7.78
```
Error:
```
DB Error: no such field
$Fatal Error Details = Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => exceptionHandler
)
[code] => -19
[message] => DB Error: no such field
[mode] => 16
[debug_info] => SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name
FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id )
LEFT JOIN civicrm_location_type `1-location_type` ON ( ( `1-address`.location_type_id = `1-location_type`.id ) )
WHERE ( civicrm_address.location_type_id IN (5) ) AND ( 1 ) AND (contact_a.is_deleted = 0) [nativecode=1054 ** Unknown column '1-address.location_type_id' in 'on clause']
[type] => DB_Error
[user_info] => SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name
FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id )
LEFT JOIN civicrm_location_type `1-location_type` ON ( ( `1-address`.location_type_id = `1-location_type`.id ) )
WHERE ( civicrm_address.location_type_id IN (5) ) AND ( 1 ) AND (contact_a.is_deleted = 0) [nativecode=1054 ** Unknown column '1-address.location_type_id' in 'on clause']
[to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name
FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id )
LEFT JOIN civicrm_location_type `1-location_type` ON ( ( `1-address`.location_type_id = `1-location_type`.id ) )
WHERE ( civicrm_address.location_type_id IN (5) ) AND ( 1 ) AND (contact_a.is_deleted = 0) [nativecode=1054 ** Unknown column '1-address.location_type_id' in 'on clause']"]
)
Mar 10 08:47:38 [debug] $backTrace = #0 /Users/monish/src/civicrm-core/CRM/Core/Error.php(942): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /Users/monish/src/civicrm-core/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error))
#2 /Users/monish/src/civicrm-core/vendor/pear/db/DB.php(998): PEAR_Error->__construct("DB Error: no such field", -19, 16, (Array:2), "SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n FROM civicr...")
#3 /Users/monish/src/civicrm-core/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-19, 16, (Array:2), "SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n FROM civicr...")
#4 /Users/monish/src/civicrm-core/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -19, 16, (Array:2), "SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n FROM civicr...", "DB_Error", TRUE)
#5 /Users/monish/src/civicrm-core/vendor/pear/db/DB/common.php(1928): PEAR->__call("raiseError", (Array:7))
#6 /Users/monish/src/civicrm-core/vendor/pear/db/DB/mysqli.php(936): DB_common->raiseError(-19, NULL, NULL, "SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n FROM civicr...", "1054 ** Unknown column '1-address.location_type_id' in 'on clause'")
#7 /Users/monish/src/civicrm-core/vendor/pear/db/DB/mysqli.php(406): DB_mysqli->mysqliRaiseError()
#8 /Users/monish/src/civicrm-core/vendor/pear/db/DB/common.php(1234): DB_mysqli->simpleQuery("SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n FROM civicr...")
#9 /Users/monish/src/civicrm-core/packages/DB/DataObject.php(2696): DB_common->query("SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n FROM civicr...")
#10 /Users/monish/src/civicrm-core/packages/DB/DataObject.php(1829): DB_DataObject->_query("SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n FROM civicr...")
#11 /Users/monish/src/civicrm-core/CRM/Core/DAO.php(454): DB_DataObject->query("SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n FROM civicr...")
#12 /Users/monish/src/civicrm-core/CRM/Core/DAO.php(1565): CRM_Core_DAO->query("SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n FROM civicr...", TRUE)
#13 /Users/monish/src/civicrm-core/CRM/Contact/BAO/Query.php(4988): CRM_Core_DAO::executeQuery("SELECT DISTINCT LEFT(contact_a.sort_name, 1) as sort_name\n FROM civicr...")
#14 /Users/monish/src/civicrm-core/CRM/Contact/Selector.php(1194): CRM_Contact_BAO_Query->alphabetQuery()
#15 /Users/monish/src/civicrm-core/CRM/Utils/PagerAToZ.php(92): CRM_Contact_Selector->alphabetQuery()
#16 /Users/monish/src/civicrm-core/CRM/Utils/PagerAToZ.php(121): CRM_Utils_PagerAToZ::getDynamicCharacters(Object(CRM_Contact_Selector), FALSE)
#17 /Users/monish/src/civicrm-core/CRM/Utils/PagerAToZ.php(36): CRM_Utils_PagerAToZ::createLinks(Object(CRM_Contact_Selector), NULL, FALSE)
#18 /Users/monish/src/civicrm-core/CRM/Contact/Form/Search.php(853): CRM_Utils_PagerAToZ::getAToZBar(Object(CRM_Contact_Selector), NULL)
#19 /Users/monish/src/civicrm-core/CRM/Contact/Form/Search/Advanced.php(305): CRM_Contact_Form_Search->postProcess()
#20 /Users/monish/src/civicrm-core/CRM/Core/Form.php(526): CRM_Contact_Form_Search_Advanced->postProcess()
```
Screencast:
![before](/uploads/38cc7c6898e1b2e9e89b279a6c40ea6a/before.gif)5.37.0Monish DebMonish Deb