# CiviCRM 5.40.0
Released August 5, 2021
- **[Bugs resolved](#bugs)**
## <a name="synopsis"></a>Synopsis
| *Does this version...?* | |
| Fix security vulnerabilities? | no |
| **Change the database schema?** | **yes** |
| **Alter the API?** | **yes** |
| Require attention to configuration options? | no |
| **Fix problems installing or upgrading to a previous version?** | **yes** |
| **Introduce features?** | **yes** |
| **Fix bugs?** | **yes** |
## <a name="features"></a>Features
### Core CiviCRM
- **Move check for presence of the phone strip function to a Check (currently
done whenever a phone number is edited)
CiviCRM relies on a MySQL function to generate a numeric-only version of phone
numbers. This change adds a system check to ensure the function exists
instead of checking for the function each time a phone number is added or
- **Add calling function to deprecatedWarning log message
- **Add contact-summary-image region
Adds a new region around the contact summary image.
- **Replace extension key with description in 'Add New' tab
Improves the "Extensions" -> "Add New" form user experience by displaying the
description below the extension name instead of the extension key.
- **User experience improvement - Remove the confusing mixed terminology used to
describe Tags: "Tags (Categories)" and "Tag (Category)"
Improves user experience by removing the term "Category" when referencing
- **Improve output triggers when logged to file
Improves output triggers when logged to a file by adding an asort, putting all
the triggers into an array keyed by the statement and opening and closing the
delimiters just once.
- **Show smarty E-notices when in debug mode
Improves the user experience in debug mode by showing php notices (e.g.
- **Add pseudoconstant to acl_entity_role
Adds a pseudoconstant for `acl_entity_role`.
- **[php8-compact] Allow for CiviCRM to be installed by 3rd parties using
composer on php8 systems
Makes it so sites can install and update CiviCRM via CLI when their CLI uses
### Afform and SearchKit
- **Searchkit display with event location data
Adds LocBlock entity to display event location data in SearchKit.
- **SearchKit - Allow super admins to disable Search Display access checks
Allows users with 'all CiviCRM permissions and ACLs' to configure a search
display to bypass permission checks and display all records to the user.
- **SearchKit - Add translatable descriptions to entities
Adds user-friendly descriptions to the top-level entities in SearchKit, and
makes it possible to add them to other entities as well.
- **SearchKit - Show Pledge as a primary entity
Shows Pledges as a primary entity in SearchKit, since it has its own tab on
the contact summary screen.
- **SearchKit - Add ability to join on multi-select ContactRef fields
Improves support for custom contact Reference fields in APIv4, SearchKit, and
Afform. Makes it possible to save, search for, and filter by serialized
(multi-select) custom Contact Reference fields.
### API version 4
- **Improve api consistency on custom field creation
Makes it so the parameter "option_type" is not needed to create an
option_value in APIv4.
- **APIv4 Explorer: show joins for write actions
Displays information about joins for write operations in the API Explorer.
- **APIv4 - Add `@since` annotation to each entity
Adds since version for each entity to APIv4 code documentation.
- **APIv4 - Allow FK dot notation in create/update/save actions
Makes it possible to reference other entities during create without knowing
their ID when using the APIv4. Makes it easier to package entities e.g. with
- **APIv4 - Add filter for entity tags
Adds a SearchKit/APIv4 filter for tags similar to the "groups" filter recently
added to SearchKit.
- **APIv4 - add is_current as a pseudo (calculated) field
Adds an "is_current" field to SearchKit for relationships, events & campaigns.
It checks that the record is active and has a non-past end date and a
non-future start date.
- **APIv4 Explorer - When joining via EntityBridge, make bridge fields
Improves the APIv4 Explorer by displaying bridge fields.
- **Canonize API for storing translated data (Work Towards
Adds APIv4 support for the "Translation" entity. Allows translation of fields
which lack an explicit HTML type.
- **Apiv4 entity parity
(Work Towards [dev/core#2486](https://lab.civicrm.org/dev/core/-/issues/2486):
Adds a foreign key on civicrm_contribution_product.product_id.
- **Move financialACLs to a core extension (Work Towards
Moves financial acl code out of APIv3 Contribution.create and assorted cleanup
towards moving the Financial ACL code to an extension.
- **Proposal - make future recurring contribution instances modifiable & not
fail if the only contribution is deleted. (Work Towards
Work to make it possible to edit recurring contributions.
- **Make Order api easier to use for default price set
Improves the order api by making it not necessary to figure out the details of
the default price set when using it to create memberships.
- **Display SMS segment count when constructing a Mass SMS
message so that it also shows how many SMS segments are required to send the
### WordPress Integration
- **Fail gracefully when errors are detected
Rewrites the error checking that the WordPress plugin performs and fails
gracefully instead of throwing fatal errors and making WordPress inoperable.
Introduces a "CiviCRM Troubleshooting" page to help diagnose and fix problems.
## <a name="bugs"></a>Bugs resolved
### Core CiviCRM
- **Regression: Smart group rebuild in default config crashes cron
- **Syntax errors when loading sample data
- **During upgrade ConfigAndLog has errors about crm-l10n.js for every upgrade
step because assets aren't built during upgrade
- **Exporting in localized civicrm crashes due to long translation for
preferred_mail_format varchar(8) field.
- **failing update Smart Groups for installs with none
- **Menu link for "New Tag" doesn't quite work
Points the "New Tag" menu link to form to create a new tag instead of "Manage
- **Special characters in password cause trouble.
- **Upgrade to Nightly (5.40.alpha1) from Stable (5.38.1) fails with DB Error:
- **[php8-compact] Add in more protection for unset variables in various smarty
templates ((https://github.com/civicrm/civicrm-core/pull/20546) and
- **Force cleanup of setting value type "checkboxes" when is empty
Fixes a bug where custom settings of the type "checkboxes" with no checked
values were not saving to the database correctly.
- **Fix activity_date_time_relative filter when `preserve_activity_tab_filter`
setting is on ((https://github.com/civicrm/civicrm-core/pull/20602))**
- **Support saving more than 25 records in Profile.submit api
- **Fix schema support for composite primary keys
- **Fix sorting for drop triggers
- **Fix Schema calculation of usePrefix to cope with rpow:
- **Fixed url ((https://github.com/civicrm/civicrm-core/pull/20641))**
- **Ensure custom group name does not conflict with existing field
- **Force the right path in github action script
The original script ran in a repo called civicrm-regen, but because the name
of this repo is civicrm-core and hence the github workspace folder contains
the literal "civicrm-core" in it, the civicrm.config.php file determines that
this must be a composer install, and so it gets the path to
- **Always assign mode to smarty
- **AngularLoader - Emit warning when setModules method is used.
Emits a warning when extensions do something that could potentially cause
problems with other extensions.
- **Throw exception when baoName is not found
- **Convert Notes to use option_group instead of hardcoded list
- **Fix a few more undefined template vars
- **CKEditor - Fix .tpl insertion on every form
- **Fix undefined tpl vars in CiviReport
- **smarty notice - title is only set for a list of existing report instances
- **smarty notice - confirm_message is usually irrelevant in report listings
- **Minor tpl simplificaiton, notice reduction
- **Fix undefined tpl variables on contact summary
- **Some php warnings on new case
- **Remove deprecated use of format money
- **Fix possibly undefined custom groupTree tpl variable
- **Fix undefined tpl vars on contact summary page
- **Tpl enotice fix
- **Fix undefined indexes in tpls
- **Enotice fix Remove references to savedFieldMapping in page 2 of the import
- **Fix undefined tpl vars on custom field page
- **Fix often undefined variable $row.class in tpl tables
- **Throw exception rather than allow php fail
Throws an exception rather than allow php fail when the api class is not
- **Proposal - store metadata on membership renewal on line item (Work Towards
Adds a new column to the civicrm_line_item table: membership_num_terms.
### Afform and SearchKit
- **Afform - cosmetic fixes in palette panel
- **Search-kit - declaring joins breaks deduping
- **SearchKit - use primary_key info instead of assuming 'id'
Fixes a bug in SearchKit when dealing with entities without "id" as their
primary key field.
- **SearchKit - Remove automatic filter from address
Usability fix for SearchKit - stops automatically add "Location Type" to the
search when joining with Address.
- **OR term in WHERE clause crashes Search Kit
Fixes an error when saving or opening a search with an OR group in a clause.
### API version 4
- **APIv4 - Silently ignore non-permissioned fields instead of throwing
- **APIv4 - Fix same-table joins and remove unused code
- **APIv4 - Don't assume the identifier field for a table is named 'id'
- **APIv4 - Deprecate Entity::getLinks action
- **APIv4 - Deprecate passing 'id' to basic actions
- **APIv4 Explorer - Only apply default limit 25 for "get" action
- **Failing api4 test
- **Case Manager is not shown for closed cases.
Ensures inactive active case role are shown for closed cases.
- **Some php warnings on case dashboard
- **smarty notice - case dashboard when no upcoming/recent cases
- **smarty notices - New case screen - Case.hlp
- **Error when sorting case roles table by end date
- **Error submitting contribution form if ""is_monetary=0""
- **Can't remove previously-added currencies
- **civicrm/payment/form url got empty currency argument in backoffice live CC
- **"Non-static method CRM_Financial_Form_BatchTransaction::links() should not
be called statically" when viewing accounting batch
- **pre hook is not triggered for LineItem delete
- **Undefined variable ids in CRM\Core\Payment\AuthorizeNetIPN.php
- **Send pcp notification only when the contribution is completed
- **Add missing "View Recurring Contribution" link to contribution view
Add missing "View Recurring Contribution" link to contribution view when
displaying line items.
- **Fix bug where only one participant registration is completed
- **Unwanted mail blast sent by Scheduled Reminders
Adds Effective start and end date to the Schedule Reminder UI.
- **Specifying a "Selection Method" without a location type gives a DB error
- **Mailing label prints name twice
- **Fix invalid defaults for Mailing.update_email_resetdate API
- **Use mysql to set mailing.created_date
### Drupal Integration
- **hook_civicrm_buildProfile not working on Drupal 8
## <a name="misc"></a>Miscellany
- **Unused smarty variable
- **Remove unreachable code from admin page
- **replace unnecessary function call with string literal
- **APIv4 - Remove POC code leftover from early alpha development
- **Move upgrade code to correct version
- **Move determination of priceSetID to the internal order class
- **CRM_Utils_Array::asColumns() - Add helper to rotate a matrix (from rows to
- **CRM_Utils_Array - Implement pathUnset() method
- **Handle participant payment create in line item
- **APIv4 Explorer - Render joins using addJoin function in OOP
- **Deprecate duplicate getLoggedInContactID() function
- **Remove deprecated function
- **Hopefully fix time rollover problem in MessageTemplateTest
- **Extract feeBlock to it's own tpl
- **Deprecate passing in 'null' for tax
- **Add test validation for Membership & participant payments
- **Fix up on invalid test data
- **Fix test to use valid amounts
- **Fix test to use valid financials
- **Improve CustomGroupTest
- **Test cleanup - specify return
- **Clean up code to determine line items for membership batch entry
- **AssetBuilderTest - Raise threshold for timeout
- **Reduce test api calls with no 'return'
- **Fix BaseIPN test to (mostly) pass invalid financials checks
- **Fix test set up to user Order api
- **[REF] Membership api for v4 (Work Towards
- **[Ref] Remove (more) unreachable code from order api
- **[REF] Add in template guard for not being always set as per html format
- **[REF] Remove isPayLater from membership batch screen
- **[REF] Extend testing on membership batch entry & minor cleanup
- **[REF] Fix trying to access array offset from boolean value
- **[REF] Alter new Setup process to use CiviCRM's Event Dispatcher
- **[REF] - Improve efficiency of APIv4 GetInfo
- **REF - Get Contact Summary tab counts after calling hook to avoid wasting
- **[REF] Remove always false if
- **[REF] Extract CKEditor into its own core extension
- **(REF) crmUi - Support onCrmUiSelect for using select2 as a picklist
- **[REF] Tidy up param transforms
- **[REF] Follow up clean up - remove contribution_mode
- **[REF] Remove unnecessary variable wrangling in case roles section
- **[REF] Follow up fix to fixing note entity tables in views
- **[REF] Follow up fix to fixing note entity tables in views
- **[NFC] - update code comment
- **[NFC] Fix test failure on MySQL8 because of lack of order in API
- **[NFC] [Test] Remove duplicate cleanup
- **[NFC] [TEST] cleanup, more use of return in ActivityTest
- **[NFC] Cleanup on membership test
- **[NFC] [Test] Remove duplicate cleanup
- **[NFC] Cleanup on contribution v3 api test
- **[NFC] Add in unit test to lock in the fix for the is_deleted in where clause
- **[NFC] Afform - Regenerate civix files
- **[NFC] Fix test setup on a couple of tests to make them pass in php8
- **[NFC] Update various npm depdencies used only in unit testing
- **[NFC] Improve use of return parameters in ContributionPage test class
- **[NFC] Unit test for 20602
- **[NFC] Remove boilerplate comment block from APIv4 classes
- **[NFC] Github action script to run regen.sh for you
- **[NFC] Regenerate ContributeProduct DAO and also fix search_kit install on
MySQL 5.6 on test boxes
- **[NFC] Fixes an issue in this unit test where we are trying to do an array
access on an integer
- **[NFC] [Test] Cleanup on membership type test
- **[NFC/Unit test] - Add a test for getCaseRoles when there's a lot of roles
- **[NFC] [TEST] cleanup, more use of return in AddressTest
- **[NFC] [Test] Specify return values on get calls
- **[TEST][NFC] CiviCRM reaching MySQL join limit (Work Towards
- **[php8-compact][NFC] Update testGroupClause unit test to work on php8
- **[php8-compact][REF] Fix failing custom group test on php8 by better handling
strings in 2nd key of the extends array and also validating the child and main
entity work ((https://github.com/civicrm/civicrm-core/pull/20616))**
- **[php8-compact] Fix APIv4 Group Concat Test by setting dataType to be NULL if
the first expression is a SQL Function
- **[php8-compact] Fix issues with participant message templates causing Event
Tests to fail ((https://github.com/civicrm/civicrm-core/pull/20613))**
- **[php8-compact] Add in guards into common templates to assit with fixing test
failures on php8
- **[php8-compact] Fix Array to String in formButtons in CRM_Core_FormTest
- **[php8-compact] Fix Event Form test for php8 by setting totalAmount in the
form params ((https://github.com/civicrm/civicrm-core/pull/20623))**
- **[php8-compat] Alternate to the alternate for testOpeningForms
- **[php8-compact] Fix apiv4 tests in php8 by not incrementing an array
- **[php8-compact] Further test fixes for php8
- **[php8-compact] Fix failing AuthorizeNetIPN tests on php8
- **[php8-compact] Fix failing CRM_Core_InvokeTest on php8
- **[php8-compact] Fix Session Test errors in php8
- **[php8-compact] Fix Case Activity Message Template to fix test failure in
- **[php8-compact] Fix PDF Letter Test by ensuring that all actual DB fields
are in the tokens array and also by resetting the static cache of tokens
- **[php8-compact] Add in guards into various templates to fix the
- **[php8-compact] Fixes test failures in the
CRM_Contribute_Form_ContributionTest class due to template issues
- **[php8-compact] Fix Dashboard Tests by adding in if guards into smarty
- **[php8-compact] Add in guards into various templates to fix issues in test
runs on php8 ((https://github.com/civicrm/civicrm-core/pull/20544))**
## <a name="credits"></a>Credits
This release was developed by the following code authors:
AGH Strategies - Alice Frumin, Andie Hunt; Agileware - Francis Whittle, Justin
Freeman; Akos Garai; Australian Greens - John Twyman; Blackfly Solutions - Alan
Dixon; Christian Wach; Circle Interactive - Pradeep Nayak; CiviCoop - Jaap
Jansma; CiviCRM - Coleman Watts, Tim Otten; CompuCorp - Debarshi Bhaumik; Dave
D; Gokhalemethod- Sadashiv; iXiam - Luciano Spiegel; JMA Consulting - Monish
Deb, Seamus Lee; Lemniscus - Noah Miller; Lighthouse Consulting and Design -
Brian Shaughnessy; Megaphone Technology Consulting - Jon Goldberg; MJW
Consulting - Matthew Wire; Skvare - Sunil Pawar; Wikimedia Foundation - Eileen
Most authors also reviewed code for this release; in addition, the following
reviewers contributed their comments:
Artful Robot - Rich Lott; Bob Silvern; CiviCoop - Klaas Eikelboom; CiviDesk -
Yashodha Chaku; Coop SymbioTIC - Mathieu Lutfy; Freeform Solutions - Herb van
den Dool; Fuzion - Jitendra Purohit; JMA Consulting - Joe Murray; Ray Wright;
Semper IT - Karin Gerritsen; Squiffle Consulting - Aidan Saunders; Tadpole
Collective - Kevin Cristiano; Tech To The People - Xavier Dutoit; Third Sector
Design - Michael McAndrew; Web Access - Kurund Jalmi
## <a name="feedback"></a>Feedback
These release notes are edited by Alice Frumin and Andie Hunt. If you'd like
to provide feedback on them, please log in to https://chat.civicrm.org/civicrm
and contact `@agh1`.