Development issueshttps://lab.civicrm.org/groups/dev/-/issues2021-03-13T02:40:22Zhttps://lab.civicrm.org/dev/core/-/issues/2138Error in the selected phone to send an SMS when the Mobile type label is modi...2021-03-13T02:40:22ZdmunioError in the selected phone to send an SMS when the Mobile type label is modifiedOverview
----------------------------------------
When wanting to send an SMS, a mobile phone is not identified if it is not primary and if the label of the mobile phone type has been translated or modifed.
Reproduction steps
----------...Overview
----------------------------------------
When wanting to send an SMS, a mobile phone is not identified if it is not primary and if the label of the mobile phone type has been translated or modifed.
Reproduction steps
----------------------------------------
1. Change the label of the "Mobile" phone type.
![image](/uploads/3a758fbef44cf889539d8c47f498b3d4/image.png)
2. Use contact that has:
- Main phone with type other than "Mobile".
- A second "Mobile" type telephone number
![image](/uploads/816ff22a82c194b665cd51a9eb2bb21b/image.png)
3. Add task: Outbound SMS. The phone to which the sms is sent is the primary phone, not the Mobile type phone.
![image](/uploads/fd20d0d1faf8f17a31775170d7adad7a/image.png)5.32.0https://lab.civicrm.org/dev/user-interface/-/issues/34Use of <th> tags for labels on Contribution Ammounts tab gives them unique st...2020-10-23T16:47:09ZnicolUse of <th> tags for labels on Contribution Ammounts tab gives them unique stylingAs identified here https://lab.civicrm.org/extensions/finsburypark/-/issues/2 - the Ammounts tab in the Contribution page config screen sets the labels as `<th>` which can pick up styling from the admin theme and the rest of Civi, for e....As identified here https://lab.civicrm.org/extensions/finsburypark/-/issues/2 - the Ammounts tab in the Contribution page config screen sets the labels as `<th>` which can pick up styling from the admin theme and the rest of Civi, for e.g. on Drupal 7 with Seven admin theme, the labels appear in caps. On other tabs the labels appear
File:
https://github.com/civicrm/civicrm-core/blob/master/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl
Example - Drupal with Seven Admin theme
![image](/uploads/0ae39fa25d69469ffef1fceeaa6276ba/image.png)
Joomla
![image](/uploads/d05305e94a9ba2f822f8bf28cec69fff/image.png)
Wordpress
![image](/uploads/430b17cefb986cda377c22a75627af47/image.png)
Display in other tabs
![image](/uploads/3268514d100433e75bf52f7bed7fee56/image.png)
Quickest fix would be to remove the `<th>`.5.32.0https://lab.civicrm.org/dev/core/-/issues/2137Asset building breaks the site2021-03-10T23:23:22ZAlanDixonAsset building breaks the site## NOTE:
This ticket is not about how to solve this problem, which has some known causes and some unknown causes, it was just about logging instead of crashing. Check your civi log (ConfigAndLog) or visit https://civicrm.stackexchange.co...## NOTE:
This ticket is not about how to solve this problem, which has some known causes and some unknown causes, it was just about logging instead of crashing. Check your civi log (ConfigAndLog) or visit https://civicrm.stackexchange.com/questions/37994/why-cant-the-asset-builder-find for help solving the problem.
## Description:
Upon upgrade of a Drupal 8 site to CiviCRM 5.30.1 from 5.29.something, the site broke completely with this php error in the drupal watchdog:
`Civi\Core\Exception\UnknownAssetException: Unrecognized asset name: crm-menubar.css in Civi\Core\AssetBuilder->render() (line 217 of /var/www/drupal/vendor/civicrm/civicrm-core/Civi/Core/AssetBuilder.php).`
Missing assets shouldn't break the site.5.36.0https://lab.civicrm.org/dev/core/-/issues/2131New deprecation Warning alternative2021-01-03T23:19:01ZeileenNew deprecation Warning alternativeWe were adding CRM_Core_Error::deprecationWarning to code that we wanted to be avoided. It was discussed in matter-most that it was a bit inaccurate so the bar for deprecating code became that we had to agree a new function first.
I pre...We were adding CRM_Core_Error::deprecationWarning to code that we wanted to be avoided. It was discussed in matter-most that it was a bit inaccurate so the bar for deprecating code became that we had to agree a new function first.
I pretty much stopped deprecating code after that but the deprecation process has been really helpful and the helper is much more grepable - in the meantime I'll switch back to
Civi::log()->warning("$className needs to be regenerated. Missing getEntityTitle method.", ['civi.tag' => 'deprecated']);5.34.0https://lab.civicrm.org/dev/core/-/issues/2127Contact import by CSV fails when string ends with "à"2020-12-29T19:07:07Zsluc23Contact import by CSV fails when string ends with "à"Overview
----------------------------------------
When importing a Contact with a CSV file, the strings that end with character `à` are replaced by a non-printing character.
![bug_trim](/uploads/c6df28ed3579a66b77d2433d90fc2d4d/bug_tr...Overview
----------------------------------------
When importing a Contact with a CSV file, the strings that end with character `à` are replaced by a non-printing character.
![bug_trim](/uploads/c6df28ed3579a66b77d2433d90fc2d4d/bug_trim.gif)
Reproduction steps
----------------------------------------
1. Create CSV file with string field ending with `à`
2. Import Contact by CSV, and choose this file
3. The file has been loaded in a temp table, and final `à` character is replaced by a non-printing character
Current behaviour
----------------------------------------
String ending with `à` is broken and replaced by a non-printing character
Expected behaviour
----------------------------------------
String must remain as-it-is
Environment information
----------------------------------------
Reproduced in `5.27.7` and in `dmaster`
Comments
----------------------------------------
This line of code is the culprit of replacing the character:
https://github.com/civicrm/civicrm-core/blob/master/CRM/Import/DataSource/CSV.php#L227
Included in PR:
https://github.com/civicrm/civicrm-core/pull/7813
Not sure what's the best fix for this, to avoid removing the original fix for bug:
https://issues.civicrm.org/jira/browse/CRM-178595.34.0https://lab.civicrm.org/dev/core/-/issues/2121Option to rename the file before downloading2022-02-13T20:28:19Zshahrukh_compucorpOption to rename the file before downloadingOverview
----------------------------------------
CiviCRM has functionality to allow you to generate PDF letters.
The files that are being created throughout the system has a specific name depending on the nature of the file and does n...Overview
----------------------------------------
CiviCRM has functionality to allow you to generate PDF letters.
The files that are being created throughout the system has a specific name depending on the nature of the file and does not provide any option to rename the file.
As such the file downloaded and the file recorded on an activity record against a contact record is always called "CiviLetter.pdf".
This makes it difficult for users to know what the letter was for.
Problem statement
----------------------------------------
The key point is **not** the name of the file that is downloaded to your Computer, a user can obviously always change this after it is downloaded. The problem is that CiviCRM creates an activity with the file in the activity listing and the filename of the file that is created automatically by CiviCRM is also named "CiviLetter.pdf". This makes it impossible for a user to know what the file was once it was created. There is no way for the user to change this.
Example use-case
----------------------------------------
1. Go to activities tab in contact detail page.
2. Choose Print/Merge Document from New Activity menu.
3. Fill the form and Proceed to download or preview the document.
4. The name of the file will be CiviLetter.pdf
5. CiviCRM will create an activity with the new CiviLetter.pdf attached
6. Users will not know what the CiviLetter.pdf was about after it was created and there is no way to change the name of that file as a user.
Current behaviour
----------------------------------------
The downloaded file has always the same specific name and the PDF attached to the activity always has that name.
Proposed behaviour
----------------------------------------
The `postProcess` method in class `CRM/Contact/Form/Task/PDFLetterCommon.php` can be changed such that it looks for the filename field being posted and if it does find that field then it uses the field value for naming the downloading file otherwise it uses the activity subject and even that is empty then it falls back to default 'CiviLetter'. This way the processing for the filename will be added as a work in progress and the ui for it can be added later.5.42.0https://lab.civicrm.org/dev/core/-/issues/2120Do not attempt to obsolete primary key on log tables2021-01-03T20:28:57ZeileenDo not attempt to obsolete primary key on log tablesUnder some replication scenarios it is necessary to add an auto-increment primary key to log tables.
The log table reconciliation recognises these as 'obsolete' columns and attempt to make them NULLABLE. This is not a big problem in the...Under some replication scenarios it is necessary to add an auto-increment primary key to log tables.
The log table reconciliation recognises these as 'obsolete' columns and attempt to make them NULLABLE. This is not a big problem in the sense mysql ignores it - but since we upgraded mysql it has become sloooooowwww on upgrade - ie I'm 2 ours inn on our staging server ...5.33.0https://lab.civicrm.org/dev/core/-/issues/2109Greenwich buttons2020-10-09T23:31:44ZeileenGreenwich buttons@colemanw @totten the action button text disappears on search kit.... we should probably improve this - in 5.31 probably
![Screen_Shot_2020-10-09_at_4.16.53_PM](/uploads/f29dd63936aa7977c61b79e39a2343e8/Screen_Shot_2020-10-09_at_4.16.53...@colemanw @totten the action button text disappears on search kit.... we should probably improve this - in 5.31 probably
![Screen_Shot_2020-10-09_at_4.16.53_PM](/uploads/f29dd63936aa7977c61b79e39a2343e8/Screen_Shot_2020-10-09_at_4.16.53_PM.png)
![Screen_Shot_2020-10-09_at_4.16.59_PM](/uploads/a51a057e202c5c465b87e39a3a77b787/Screen_Shot_2020-10-09_at_4.16.59_PM.png)5.31.1https://lab.civicrm.org/dev/core/-/issues/2104Add more columns for Activity Report2023-05-03T05:47:11ZyashodhaAdd more columns for Activity ReportAdd more columns for Activity Report e,g target related fields currently it is showing target name and email only.Add more columns for Activity Report e,g target related fields currently it is showing target name and email only.5.62.0yashodhayashodhahttps://lab.civicrm.org/dev/core/-/issues/2103Event location "used by 1 other events"2022-05-13T17:23:04Zaydunsaidan.saunders@squiffle.ukEvent location "used by 1 other events"Overview
----------------------------------------
When viewing event location configuration it displays this:
![image](/uploads/ef57dddf378f249ac33ab7a22e5c1e01/image.png)
Issues
------
1. It is not used by '1 **other** events', it is o...Overview
----------------------------------------
When viewing event location configuration it displays this:
![image](/uploads/ef57dddf378f249ac33ab7a22e5c1e01/image.png)
Issues
------
1. It is not used by '1 **other** events', it is only used here. (You can check by creating an event with a new random address and see that it still shows this.)
1. It always says '1' other location, regardless of how many actually use it. (Check by creating new events and reusing existing locations.
1. It is not easy to see what other events use that location.
Proposed behaviour
----------------------------------------
1. Only show the message if there are other events using this location, excluding this event.
1. Correctly show how many other events are using this location. (Consider whether that is all events, or just active and/or future events) Handle singular/plural correctly.
Bonus:
1. Maybe include a link to search for events using that location. The 'Find Events' on 'Manage Events' could be enhanced to search by location.
Comments
----------------------------------------
Might be suitable for someone looking for a 'getting started' PR5.49.0https://lab.civicrm.org/dev/core/-/issues/2102Changing address on event hangs2020-10-10T19:34:14Zaydunsaidan.saunders@squiffle.ukChanging address on event hangsOverview
----------------------------------------
Changing the address on an event causes hang (spinning logo)
Reproduction steps
----------------------------------------
1. Create an Event with a location & Save.
1. On Event configurat...Overview
----------------------------------------
Changing the address on an event causes hang (spinning logo)
Reproduction steps
----------------------------------------
1. Create an Event with a location & Save.
1. On Event configuration select 'Event Location' tab
1. Click **Create new location** radio
1. Enter address details
1. Click **Save**
Current behaviour
----------------------------------------
Spinning logo. On reloading the page, 'Create new location' is still selected with no address details
Expected behaviour
----------------------------------------
Should save as normal
Environment information
----------------------------------------
* __CiviCRM:__ _Master_
Comments
----------------------------------------
Also tested on test site for https://github.com/civicrm/civicrm-core/pull/18710 (ie not fixed by PR 18710)
Regression since 5.28.25.31.1https://lab.civicrm.org/dev/core/-/issues/2071Mandatory keys check fails erroneously for float 0.0 value in civicrm_api3_ve...2021-05-21T04:01:28ZorigamiusaMandatory keys check fails erroneously for float 0.0 value in civicrm_api3_verify_mandatory()Overview
----------------------------------------
The mandatory keys check in function `civicrm_api3_verify_mandatory()` fails erroneously if the key exists but it has the floating-point value of 0.0.
Reproduction steps
----------------...Overview
----------------------------------------
The mandatory keys check in function `civicrm_api3_verify_mandatory()` fails erroneously if the key exists but it has the floating-point value of 0.0.
Reproduction steps
----------------------------------------
Using APIv3, create an entity that contains a required key with the floating-point value of 0.0, for example, line_total in a price field element.
Current behaviour
----------------------------------------
APIv3 throws a `Mandatory key(s) missing from params array:` exception.
Expected behaviour
----------------------------------------
Successful creation.
Environment information
----------------------------------------
* __Browser:__ _Safari_
* __CiviCRM:__ _5.29.1_
* __PHP:__ _7.3.9__
* __CMS:__ _Drupal 7.73_
Comments
----------------------------------------
To fix, in civicrm/api/v3/utils.php, change line 92 from
```
if (!array_key_exists($key, $params) || (empty($params[$key]) && $params[$key] !== 0 && $params[$key] !== '0')) {
```
to
```
if (!array_key_exists($key, $params) || (empty($params[$key]) && $params[$key] !== 0.0 && $params[$key] !== '0')) {
```
The second version will match on both integer 0 and float 0.0, while the first only matches on integer 0 but not float 0.0.5.39.0https://lab.civicrm.org/dev/drupal/-/issues/141Drupal 8 hook_uninstall not implemented2021-03-15T15:49:45ZDaveDDrupal 8 hook_uninstall not implementedUninstalling civi using the UI or drush doesn't currently uninstall anything it just tells drupal basically to uncheck the box on the modules list page, but all the data is still there. This leaves drupal+civi in an inconsistent state an...Uninstalling civi using the UI or drush doesn't currently uninstall anything it just tells drupal basically to uncheck the box on the modules list page, but all the data is still there. This leaves drupal+civi in an inconsistent state and trying to check the box again leads to a borked UI because civi keeps trying to do a first run but can't because as far as it's concerned it's already installed.
In drupal 7 hook_uninstall is implemented and drops all the civi tables.
https://github.com/civicrm/civicrm-drupal-8/pull/45#issuecomment-6989822575.37.0https://lab.civicrm.org/dev/core/-/issues/2056Performance - do not retrieve soft credits & pcps when not required2020-10-08T00:17:06ZeileenPerformance - do not retrieve soft credits & pcps when not requiredPer https://lab.civicrm.org/dev/core/-/issues/2033 3.5% (14 out of 393) of the queries I recorded when importing 7 contacts with 7 contributions were for retrieving pcp & soft credit information. However, this retrieved information is di...Per https://lab.civicrm.org/dev/core/-/issues/2033 3.5% (14 out of 393) of the queries I recorded when importing 7 contacts with 7 contributions were for retrieving pcp & soft credit information. However, this retrieved information is discarded unless the params hold the key 'pcp' or 'soft_credit' so we can simply bypass these queries almost all the time.
examples
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
| 15/09/20 2:54 | SELECT id FROM civicrm_contribution_soft WHERE contribution_id = 49769031 AND pcp_id IS NOT NULL | 0.000624 | 0 | 0 |
| 15/09/20 2:54 | SELECT id FROM civicrm_contribution_soft WHERE contribution_id = 49769031 AND pcp_id IS NULL | 0.000616 | 0 | 0 |5.31.0https://lab.civicrm.org/dev/core/-/issues/2047Merge - ensure location entities remaining on deleted contacts have is_primar...2020-10-16T01:52:16ZeileenMerge - ensure location entities remaining on deleted contacts have is_primary integrityThe testing I'm doing for https://lab.civicrm.org/dev/core/-/issues/2039 highlights that when a contact is deleted by merge they can be left with 1 or more address/email etc but none marked primary,
I thought about fixing the test to ex...The testing I'm doing for https://lab.civicrm.org/dev/core/-/issues/2039 highlights that when a contact is deleted by merge they can be left with 1 or more address/email etc but none marked primary,
I thought about fixing the test to exclude deleted contacts but
1) if they are undeleted again then the integrity is not fixed
2) having integrity on all contacts makes it a bit easier to check for integrity (ie the query in the test is faster than once we start filtering out deleted contacts)
I've started on some preparatory cleanup
https://github.com/civicrm/civicrm-core/pull/18499
https://github.com/civicrm/civicrm-core/pull/185005.32.0eileeneileenhttps://lab.civicrm.org/dev/core/-/issues/2044Proposal apiv4 - revisit required parameters on location entities2020-10-02T01:41:10ZeileenProposal apiv4 - revisit required parameters on location entitiesI propose we adjust the location api required fields inn v4api
- Address - don't require contact_id, make location_type_id required in xml
- Email - don't require contact_id, make location_type_id required in xml
- Phone - don't require...I propose we adjust the location api required fields inn v4api
- Address - don't require contact_id, make location_type_id required in xml
- Email - don't require contact_id, make location_type_id required in xml
- Phone - don't require contact_id, make location_type_id required in xml
For all these entities we have a valid use case for no contact_id in the context of location blocks for addresses. I wanted to cleanup the code in ManageLocation around addresses https://github.com/civicrm/civicrm-core/pull/18488 & found I can't use Address::save to do in a better way due to the above
@colemanw how far did you go down this path?5.31.0https://lab.civicrm.org/dev/core/-/issues/2041Plaintext version of email not replacing tokens in some situations2021-09-29T04:57:25ZDaveDPlaintext version of email not replacing tokens in some situationsI'm still trying to nail down the exact situations but here's one way to reproduce:
1. Create an outbound email.
1. Send it to two people in the To field, and one in the Cc.
1. In the html body put {contact.first_name} somewhere.
1. In ...I'm still trying to nail down the exact situations but here's one way to reproduce:
1. Create an outbound email.
1. Send it to two people in the To field, and one in the Cc.
1. In the html body put {contact.first_name} somewhere.
1. In the text body put {contact.last_name} somewhere.
Everything is correct except the text body inserts blank for the token.5.43.0https://lab.civicrm.org/dev/core/-/issues/2040Multiple email activity cc recipients get scrunched together in recorded acti...2020-09-23T00:47:08ZDaveDMultiple email activity cc recipients get scrunched together in recorded activity details fieldRecently refactored and the comma separator went missing: https://github.com/civicrm/civicrm-core/commit/a01fb99f56574eae7b6ade7cbb4f3292c505fe7d#diff-e604b19bd1979412f2455096459e761bR411-L439
https://github.com/civicrm/civicrm-core/blo...Recently refactored and the comma separator went missing: https://github.com/civicrm/civicrm-core/commit/a01fb99f56574eae7b6ade7cbb4f3292c505fe7d#diff-e604b19bd1979412f2455096459e761bR411-L439
https://github.com/civicrm/civicrm-core/blob/b3925388349a3d356b8852ead72361123e3ed196/CRM/Contact/Form/Task/EmailTrait.php#L564
Also the contact link url contains force=1 which seems unnecessary.
1. Send an outbound email in civi to multiple cc recipients.
1. Look at the details field on the recorded activity.
I can do a PR - came up while reviewing https://github.com/civicrm/civicrm-core/pull/182995.31.0https://lab.civicrm.org/dev/core/-/issues/2039Address extraneous location queries2022-02-01T08:31:54ZeileenAddress extraneous location queriesWhen importing a 'contact with a donation' 18% of the total queries come from [this line of code](https://github.com/civicrm/civicrm-core/blob/d357f225f281a0862b67a60d027c703ed2292f8b/CRM/Core/BAO/Location.php#L73) for [this issue](https...When importing a 'contact with a donation' 18% of the total queries come from [this line of code](https://github.com/civicrm/civicrm-core/blob/d357f225f281a0862b67a60d027c703ed2292f8b/CRM/Core/BAO/Location.php#L73) for [this issue](https://issues.civicrm.org/jira/browse/CRM-5051). I believe the handling in the create classes likely makes it obsolete.
I'm going to dig a bit further on that & put up a PR with the case for removing the line (unless I find a reason not to)
Per https://lab.civicrm.org/dev/core/-/issues/2033
examples - openid queries make up 4% of the total queries! and the line is 18% when including all location entities. This would be higher if it were only Contact.create that were being called
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
| Location queries | 15/09/20 2:54 | SELECT * FROM `civicrm_openid` WHERE ( ( is_primary = 0 OR is_primary IS NULL ) ) AND ( `civicrm_openid`.`contact_id` = 46011839 ) | 0.000643 | 0 | 0 |
| Location queries | 15/09/20 2:54 | SELECT * FROM `civicrm_openid` WHERE ( ( is_primary = 0 OR is_primary IS NULL ) ) AND ( `civicrm_openid`.`contact_id` = 46011840 ) | 0.000517 | 0 | 0 |
| Location queries | 15/09/20 2:54 | SELECT * FROM `civicrm_openid` WHERE ( ( is_primary = 1 ) ) AND ( `civicrm_openid`.`contact_id` = 46011834 ) | 0.001377 | 0 | 0 |5.31.0https://lab.civicrm.org/dev/core/-/issues/2033Performance - query analysis2020-10-13T02:06:15ZeileenPerformance - query analysisUsing the methodology described [here](https://lab.civicrm.org/extensions/systemtools/-/blob/master/README.md) I have analysed the queries to pipe 7 contributions into CiviCRM and analyse all the queries to see if we can eliminate some. ...Using the methodology described [here](https://lab.civicrm.org/extensions/systemtools/-/blob/master/README.md) I have analysed the queries to pipe 7 contributions into CiviCRM and analyse all the queries to see if we can eliminate some. Analysis follows (I will look to address some)
1. This is on a server that uses Redis with associated reduction of queries
2. Main civi api calls called are Contact.create & contribution.create.
3. None of the queries are slow - the focus here is on removing unnecessary queries from high volume code paths
4. All 7 contributions were inserted within the total time of one second. We normally process 2000 donations per code run so reducing 1 query per row saves 2000 per run
5. 18% of the total queries come from [this line of code](https://github.com/civicrm/civicrm-core/blob/d357f225f281a0862b67a60d027c703ed2292f8b/CRM/Core/BAO/Location.php#L73) for [this issue](https://issues.civicrm.org/jira/browse/CRM-5051). I believe the handling in the create classes likely makes it obsolete - https://lab.civicrm.org/dev/core/-/issues/2039
| Type of query | Count |proportion queries that are unnecessary|
|--------------------|-------|-------|
| Activity wrangling #2057 | 42 |high|
| CiviCRM log | 14 |medium|
| greeting queries | 6 |undetermined|
| Initialisation | 24 |low|
| Insert actions | 97 |Low|
| location queries #2039 | 119 |very high|
| metadata | 51 |low|
| pcp #2056 | 14 |high|
| uf match queries #2087 | 14 |medium|
| wmf | 14 |low|
| **Grand Total** | **395** |
Visual https://docs.google.com/document/d/1Min5WxmC8O0_MF4nK3LMTXcVZ-WQU_4k1WSJtMeqLl8/edit?usp=sharing
**Activity wrangling 42**
I haven't dug very far but my sense is this is likely about checking for existing activities linked to the contributions. As these are new contributions these checks might be largely avoidable
Examples
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
| 15/09/20 2:54 | SELECT * FROM `civicrm_activity_contact` WHERE ( `civicrm_activity_contact`.`activity_id` = 112183025 ) AND ( `civicrm_activity_contact`.`contact_id` = 46011835 ) AND ( `civicrm_activity_contact`.`record_type_id` = 2 ) | 0.000549 | 0 | 0 |
| 15/09/20 2:54 | SELECT * FROM `civicrm_activity_contact` WHERE ( `civicrm_activity_contact`.`activity_id` = 112183025 ) AND ( `civicrm_activity_contact`.`record_type_id` = 1 ) | 0.000606 | 0 | 0 |
| 15/09/20 2:54 | SELECT * FROM `civicrm_activity_contact` WHERE ( `civicrm_activity_contact`.`activity_id` = 112183025 ) AND ( `civicrm_activity_contact`.`record_type_id` = 2 ) | 0.000725 | 0 | 0 |
| 15/09/20 2:54 | SELECT * FROM `civicrm_activity_contact` WHERE ( `civicrm_activity_contact`.`activity_id` = 112183025 ) AND ( `civicrm_activity_contact`.`record_type_id` = 2 ) | 0.000605 | 1 | 1 |
| 15/09/20 2:54 | SELECT * FROM `civicrm_activity_contact` WHERE ( `civicrm_activity_contact`.`activity_id` = 112183025 ) AND ( `civicrm_activity_contact`.`record_type_id` = 3 ) | 0.000636 | 0 | 0 |
**CiviCRM Log = 14**
I split these out from the main insert queries as my feeling is that we don't need to add to civicrm log when logging is enabled - I'm pretty sure there is another GL on this & it's not quite that black and white
Examples
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
|15/09/20 2:54 |INSERT INTO `civicrm_log` (`entity_table` , `entity_id` , `data` , `modified_id` , `modified_date` ) VALUES ('civicrm_activity' , 112183024 , 'Activity created for source=46011834' , 46011834 , 20200909141546 )| |
**greeting queries = 6**
I haven't done any analysis on these - I suspect we have skipGreeting enabled in our api call so it's only 6
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
| 15/09/20 2:54 | SELECT contact_a.id as contact_id, contact_a.email_greeting_id as email_greeting_id, contact_a.postal_greeting_id as postal_greeting_id, contact_a.addressee_id as addressee_id, contact_a.addressee_display as addressee_display, contact_a.addressee_custom as addressee_custom, contact_a.email_greeting_display as email_greeting_display, contact_a.email_greeting_custom as email_greeting_custom, contact_a.postal_greeting_display as postal_greeting_display, contact_a.postal_greeting_custom as postal_greeting_custom FROM civicrm_contact contact_a WHERE ( contact_a.id = '46011839' ) LIMIT 0, 25 | 0.000734
| 15/09/20 2:54 | SELECT contact_a.id as contact_id, contact_a.email_greeting_id as email_greeting_id, contact_a.postal_greeting_id as postal_greeting_id, contact_a.addressee_id as addressee_id, contact_a.addressee_display as addressee_display, contact_a.addressee_custom as addressee_custom, contact_a.email_greeting_display as email_greeting_display, contact_a.email_greeting_custom as email_greeting_custom, contact_a.postal_greeting_display as postal_greeting_display, contact_a.postal_greeting_custom as postal_greeting_custom FROM civicrm_contact contact_a WHERE ( contact_a.id = '46011840' ) LIMIT 0, 25 | 0.000913 | 1 | 1 |
**Initialisation queries 24**
These are all pretty necessary
examples
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
| 15/09/20 2:53 | ( SELECT * FROM civicrm_menu WHERE path in ( 'civicrm' ) AND domain_id = 1 ORDER BY length(path) DESC LIMIT 1 ) UNION ( SELECT * FROM civicrm_menu WHERE path IN ( 'navigation' ) AND domain_id = 1 ) | 0.001571 | 1 | 1 |
| 15/09/20 2:53 | /*!40101 SET NAMES utf8 */ | | | |
| 15/09/20 2:53 | /*!50503 SET NAMES utf8mb4 */ | | | |
| 15/09/20 2:53 | BEGIN | | | |
**Insert actions 97**
This is where the work is done - nothing extraneous in the query list here
example
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
| 15/09/20 2:54 | INSERT INTO `civicrm_entity_financial_trxn` (`entity_table` , `entity_id` , `financial_trxn_id` , `amount` ) VALUES ('civicrm_financial_item' , 67488679 , 67491096 , 2.35 ) |
**Location queries 119**
These seem to be mainly extraneous. 70 of them come from what appears to be an outdated effort to handle is_primary (including 10 on open id which we don't support). At least some of the remaining 39 appear to be variants of this - this is the lowest hanging fruit
examples
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
| Location queries | 15/09/20 2:54 | SELECT * FROM `civicrm_openid` WHERE ( ( is_primary = 0 OR is_primary IS NULL ) ) AND ( `civicrm_openid`.`contact_id` = 46011839 ) | 0.000643 | 0 | 0 |
| Location queries | 15/09/20 2:54 | SELECT * FROM `civicrm_openid` WHERE ( ( is_primary = 0 OR is_primary IS NULL ) ) AND ( `civicrm_openid`.`contact_id` = 46011840 ) | 0.000517 | 0 | 0 |
| Location queries | 15/09/20 2:54 | SELECT * FROM `civicrm_openid` WHERE ( ( is_primary = 1 ) ) AND ( `civicrm_openid`.`contact_id` = 46011834 ) | 0.001377 | 0 | 0 |
**Metadata queries 51**
This is less of a concern for us in this context as these (almost) all only ran once and none ran once per contribution. There is scope to improve them though & UI users would probably be helped. We would prefer they used the Redis-backed metadata cache
examples
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
| 15/09/20 2:54 | SELECT a.id as `id`, a.custom_group_id as `custom_group_id`, a.name as `name`, a.label as `label`, a.data_type as `data_type`, a.html_type as `html_type`, a.default_value as `default_value`, a.is_required as `is_required`, a.is_searchable as `is_searchable`, a.is_search_range as `is_search_range`, a.weight as `weight`, a.help_pre as `help_pre`, a.help_post as `help_post`, a.mask as `mask`, a.attributes as `attributes`, a.javascript as `javascript`, a.is_active as `is_active`, a.is_view as `is_view`, a.options_per_line as `options_per_line`, a.text_length as `text_length`, a.start_date_years as `start_date_years`, a.end_date_years as `end_date_years`, a.date_format as `date_format`, a.time_format as `time_format`, a.note_columns as `note_columns`, a.note_rows as `note_rows`, a.column_name as `column_name`, a.option_group_id as `option_group_id`, a.serialize as `serialize`, a.filter as `filter`, a.in_selector as `in_selector` FROM civicrm_custom_field a INNER JOIN `civicrm_custom_group` `custom_group_id_to_civicrm_custom_group` ON a.custom_group_id = custom_group_id_to_civicrm_custom_group.id WHERE (a.name = "original_currency" OR a.label = "original_currency") AND (custom_group_id_to_civicrm_custom_group.name = "contribution_extra" OR custom_group_id_to_civicrm_custom_group.title = "contribution_extra") LIMIT 25 OFFSET 0 | 0.001292 | 1 | 1 |
| 15/09/20 2:54 | SELECT a.id as `id`, a.custom_group_id as `custom_group_id`, a.name as `name`, a.label as `label`, a.data_type as `data_type`, a.html_type as `html_type`, a.default_value as `default_value`, a.is_required as `is_required`, a.is_searchable as `is_searchable`, a.is_search_range as `is_search_range`, a.weight as `weight`, a.help_pre as `help_pre`, a.help_post as `help_post`, a.mask as `mask`, a.attributes as `attributes`, a.javascript as `javascript`, a.is_active as `is_active`, a.is_view as `is_view`, a.options_per_line as `options_per_line`, a.text_length as `text_length`, a.start_date_years as `start_date_years`, a.end_date_years as `end_date_years`, a.date_format as `date_format`, a.time_format as `time_format`, a.note_columns as `note_columns`, a.note_rows as `note_rows`, a.column_name as `column_name`, a.option_group_id as `option_group_id`, a.serialize as `serialize`, a.filter as `filter`, a.in_selector as `in_selector` FROM civicrm_custom_field a INNER JOIN `civicrm_custom_group` `custom_group_id_to_civicrm_custom_group` ON a.custom_group_id = custom_group_id_to_civicrm_custom_group.id WHERE (a.name = "original_amount" OR a.label = "original_amount") AND (custom_group_id_to_civicrm_custom_group.name = "contribution_extra" OR custom_group_id_to_civicrm_custom_group.title = "contribution_extra") LIMIT 25 OFFSET 0 | 0.001085 | 1 | 1 |
| 15/09/20 2:54 | SELECT a.id as `id`, a.custom_group_id as `custom_group_id`, a.name as `name`, a.label as `label`, a.data_type as `data_type`, a.html_type as `html_type`, a.default_value as `default_value`, a.is_required as `is_required`, a.is_searchable as `is_searchable`, a.is_search_range as `is_search_range`, a.weight as `weight`, a.help_pre as `help_pre`, a.help_post as `help_post`, a.mask as `mask`, a.attributes as `attributes`, a.javascript as `javascript`, a.is_active as `is_active`, a.is_view as `is_view`, a.options_per_line as `options_per_line`, a.text_length as `text_length`, a.start_date_years as `start_date_years`, a.end_date_years as `end_date_years`, a.date_format as `date_format`, a.time_format as `time_format`, a.note_columns as `note_columns`, a.note_rows as `note_rows`, a.column_name as `column_name`, a.option_group_id as `option_group_id`, a.serialize as `serialize`, a.filter as `filter`, a.in_selector as `in_selector` FROM civicrm_custom_field a WHERE (a.name = "opt_in" OR a.label = "opt_in") LIMIT 25 OFFSET 0 | 0.001043 | 1 | 1 |
| 15/09/20 2:54 | SELECT a.id as `id`, a.entity_table as `entity_table`, a.entity_id as `entity_id`, a.account_relationship as `account_relationship`, a.financial_account_id as `financial_account_id` FROM civicrm_entity_financial_account a WHERE (a.entity_id = "9") AND (a.entity_table = "civicrm_financial_type") LIMIT 25 OFFSET 0 | 0.000718 | 6 | 6 |
| 15/09/20 2:54 | SELECT a.id as `id`, a.financial_account_id as `financial_account_id` FROM civicrm_entity_financial_account a WHERE (a.entity_table = "civicrm_option_value") AND (a.entity_id = "6342") LIMIT 1 OFFSET 0 | 0.001156 | 1 | 1 |
| 15/09/20 2:54 | SELECT a.id as `id`, a.financial_account_id as `financial_account_id` FROM civicrm_entity_financial_account a WHERE (a.entity_table = "civicrm_option_value") AND (a.entity_id = "844") LIMIT 1 OFFSET 0 | 0.000697 | 1 | 1 |
**PCP 14 queries**
I haven't done much analysis but I think these should be avoidable on sites without pcps - maybe the same way we no longer have product queries
examples
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
| 15/09/20 2:54 | SELECT id FROM civicrm_contribution_soft WHERE contribution_id = 49769031 AND pcp_id IS NOT NULL | 0.000624 | 0 | 0 |
| 15/09/20 2:54 | SELECT id FROM civicrm_contribution_soft WHERE contribution_id = 49769031 AND pcp_id IS NULL | 0.000616 | 0 | 0 |
| 15/09/20 2:54 | SELECT id FROM civicrm_contribution_soft WHERE contribution_id = 49769032 AND pcp_id IS NOT NULL | 0.000503 | 0 | 0 |
| 15/09/20 2:54 | SELECT id FROM civicrm_contribution_soft WHERE contribution_id = 49769032 AND pcp_id IS NULL | 0.000562 | 0 | 0 |
**uf match queries - 14**
These are not relevant to the incoming but not sure if they are avoidable - the duplication might be though
|timestamp|query|seconds|rows found|columns requested|
|----------|-------|-------|-------|-------|
| 15/09/20 2:54 | SELECT * FROM `civicrm_uf_match` WHERE ( `civicrm_uf_match`.`domain_id` = 1 ) AND ( `civicrm_uf_match`.`contact_id` = 46011840 ) | 0.000567 | 0 | 0 |
| 15/09/20 2:54 | SELECT * FROM `civicrm_uf_match` WHERE ( `civicrm_uf_match`.`domain_id` = 1 ) AND ( `civicrm_uf_match`.`contact_id` = 46011840 ) | 0.00053 | 0 | 0 |
**wmf queries - 14**
these are specific to our script5.32.0