Development issueshttps://lab.civicrm.org/groups/dev/-/issues2021-01-15T05:31:02Zhttps://lab.civicrm.org/dev/core/-/issues/2297Undefined index when putting in a contribution thank-you date without a time2021-01-15T05:31:02ZDaveDUndefined index when putting in a contribution thank-you date without a time`Notice: Undefined index: thankyou_date_time in CRM_Contribute_Form_AdditionalInfo::postProcessCommon() (line 275 of .../web/sites/all/modules/civicrm/CRM/Contribute/Form/AdditionalInfo.php).`
It's straightforward but there's also a isN...`Notice: Undefined index: thankyou_date_time in CRM_Contribute_Form_AdditionalInfo::postProcessCommon() (line 275 of .../web/sites/all/modules/civicrm/CRM/Contribute/Form/AdditionalInfo.php).`
It's straightforward but there's also a isNull() in there that seems odd so I'm wondering why it's there. It might be because sometimes it's the literal word 'null' and so you don't want to process that.
```
if (!empty($params['thankyou_date']) && !CRM_Utils_System::isNull($params['thankyou_date'])) {
$formatted['thankyou_date'] = CRM_Utils_Date::processDate($params['thankyou_date'], $params['thankyou_date_time']);
}
```5.35.0https://lab.civicrm.org/dev/wordpress/-/issues/86List of groups in search form and create new contact screen not respecting ACLs2021-01-25T05:20:08ZseamusleeList of groups in search form and create new contact screen not respecting ACLsIf you have an ACL on your system and it limits access to one or a specific set of groups this is correctly reflected on the Manage Groups screen but not when you go to do an advanced search and click the list of groups nor when you go t...If you have an ACL on your system and it limits access to one or a specific set of groups this is correctly reflected on the Manage Groups screen but not when you go to do an advanced search and click the list of groups nor when you go to create a new Individual and expand the Tags and Groups Section.
To replicate
1. Grant the Subscriber role access to the CiviCRM backend
2. Create a new ACL group called test group
3. Create a new Individual Test Contact
4. Add Test Contact into ACL group created in item 2
5. Create new ACL role called Test ACL role
6. Assign the Test ACL role to the Test Group created In item 2
7. Create an ACL for the Test ACL role granting edit access to the contacts in the Newsletter Subscribers group
8. Create a new WordPress role for the Test Contact created in item 3 give them just the Subscriber role.
9. Now login at the new user account in a new private window
10. Navigate to the Contacts -> Manage Groups Screen and see that it only shows you Newsletter Subscriber
11. Navigate to Advanced Search and Click on groups and see you get more than just the Newsletter Subscriber group returned
ping @kcristiano @JoeMurray5.35.0Monish DebMonish Debhttps://lab.civicrm.org/dev/wordpress/-/issues/85WordPress releases being tagged 4.7 instead of 5.332021-01-17T19:31:58ZkcristianoWordPress releases being tagged 4.7 instead of 5.33I noticed that for versions 5.33.0 and 5.33.1 WordPress reports the version as 4.7.
Comparing to prior releases this is a change. 5.32.1 reported 5.32.1. WP reads from the main plugin file in `civicrm-wordpress` The Version is set i...I noticed that for versions 5.33.0 and 5.33.1 WordPress reports the version as 4.7.
Comparing to prior releases this is a change. 5.32.1 reported 5.32.1. WP reads from the main plugin file in `civicrm-wordpress` The Version is set in the [plugin header](https://github.com/civicrm/civicrm-wordpress/blob/master/civicrm.php#L5).
It's also [defined](https://github.com/civicrm/civicrm-wordpress/blob/master/civicrm.php#L57) to trigger css and js updates.
in Mattermost(https://chat.civicrm.org/civicrm/pl/kbj1dc913t8pfd7gwuwrmw4ndc) @totten mentioned the process for WP. Currently the automated process is not working.5.33.1https://lab.civicrm.org/dev/core/-/issues/2288Custom Field of type Integer that uses Radio Buttons as Input Type in combina...2021-01-19T03:23:54ZkainukCustom Field of type Integer that uses Radio Buttons as Input Type in combination with search range scrambles Case Report SearchOverview
----------------------------------------
https://civicrm.stackexchange.com/questions/38562/why-does-my-delete-case-action-in-the-case-search-report-not-work
Reproduction steps to create the testcase
----------------------------...Overview
----------------------------------------
https://civicrm.stackexchange.com/questions/38562/why-does-my-delete-case-action-in-the-case-search-report-not-work
Reproduction steps to create the testcase
----------------------------------------
1. Create a Custom Field on Cases of the type Integer
1. Start with display type 'Single Input Line'
1. Enable 'Is this Field Searchable?'
1. Now 'Search by Range' becomes visible.
1. Change the display type to Radio Buttons.
1. Add some Option Values and save the field.
Remark, some interface magic is required to create this situation. I think its more done by accident, than by intent.
Current behaviour
----------------------------------------
The behaviour is now as described in https://civicrm.stackexchange.com/questions/38562/why-does-my-delete-case-action-in-the-case-search-report-not-work .
Expected behaviour
----------------------------------------
The Case Search report should just work
Environment information
----------------------------------------
This issue can be reproduced on 5.34.alpha1 or on the https://dmaster.demo.civicrm.org
Comments
----------------------------------------
https://lab.civicrm.org/dev/core/-/issues/337 contains a discussion if the combination 'Radio Buttons' and 'Search by Range' should be allowed.5.35.0https://lab.civicrm.org/dev/core/-/issues/2287new contact via modal profile form: save matching contact doesn't work2021-01-06T21:47:07Zlcdwebnew contact via modal profile form: save matching contact doesn't workOverview
----------------------------------------
When using the New Contact profile in a modal context and entering the name of an existing record, the interface displays the duplicate contact warning and exposes the Save Matching Conta...Overview
----------------------------------------
When using the New Contact profile in a modal context and entering the name of an existing record, the interface displays the duplicate contact warning and exposes the Save Matching Contact button. Click that button does nothing. It simply retriggers and reloads the duplicate popup message.
Reproduction steps
----------------------------------------
1. Click on Contacts > New Activity
2. Click With Contact and select one of the new contact options
3. Enter values that match an existing record. e.g. click New Organization and enter the name of an existing organization in your system.
4. Click save.
5. The warning message appears and the option to Save Matching Contact is displayed. Click that button.
Current behaviour
----------------------------------------
The warning message is reloaded but no action is taken (the duplicate contact is not created).
Expected behaviour
----------------------------------------
The duplicate contact should be created and the modal closed.
Comments
----------------------------------------
I highly suspect this is related to the change to begin using button elements instead of input elements for form buttons. But I've compared the code between 5.29.1 (when I know for certain it was last working) and 5.32.2 and don't see how that shift would have impacted the behavior in this way.5.33.0https://lab.civicrm.org/dev/core/-/issues/2285The civicrm_alterReportVar hook is not working for contribute detail report2021-04-06T20:01:06Zahed_compucorpThe civicrm_alterReportVar hook is not working for contribute detail reportOverview
----------------------------------------
The `civicrm_alterReportVar` is not working for contribute detail report when the user select the new column or choose the new filter, and it will show an error message `DB Error: no such...Overview
----------------------------------------
The `civicrm_alterReportVar` is not working for contribute detail report when the user select the new column or choose the new filter, and it will show an error message `DB Error: no such field`
Here at [Detail.php#L956](https://github.com/civicrm/civicrm-core/blob/3662d5a75d79d6c259b632df748b1beb66db6faf/CRM/Report/Form/Contribute/Detail.php#L956) our changes to the `_form` attribute are lost and the error will be fired here [Detail.php#L576](https://github.com/civicrm/civicrm-core/blob/3662d5a75d79d6c259b632df748b1beb66db6faf/CRM/Report/Form/Contribute/Detail.php#L576)
Unknown column 'some_table.some_column' in 'where clause'
I believe this is a regression on soft credits.
Reproduction steps
----------------------------------------
Any suffecient use of this hook will face the error message.
[The code](https://gist.github.com/ahed-compucorp/672363f80c076a80c2804b78f61baaa9).
![Peek_2021-01-04_17-19](/uploads/4fef18053a65a947205d6540aa123552/Peek_2021-01-04_17-19.gif)
check the test case in the PR.
PR: https://github.com/civicrm/civicrm-core/pull/193175.37.0https://lab.civicrm.org/dev/core/-/issues/2284CRM_Member_Form_MembershipRenewalTest - Started failing circa Jan 1, 20212021-01-08T07:07:09ZtottenCRM_Member_Form_MembershipRenewalTest - Started failing circa Jan 1, 2021Overview
----------------------------------------
The unit-test was passing. When the new year started, it began failing. The test does have some calculations about current-year and next-year.
Reproduction steps
------------------------...Overview
----------------------------------------
The unit-test was passing. When the new year started, it began failing. The test does have some calculations about current-year and next-year.
Reproduction steps
----------------------------------------
1. Look at the test output on https://test.civicrm.org/ (For example, here's a test for a PR that has nothing to do with memberships https://test.civicrm.org/job/CiviCRM-Core-PR/38621/)5.34.0https://lab.civicrm.org/dev/core/-/issues/2282Use the proper content type for ICalendar link2021-01-04T19:47:08Zahed_compucorpUse the proper content type for ICalendar linkOverview
----------------------------------------
There is two ways to add an event to my calendar :
- Download `ICS` file and import it.
- Copy the `ICalendar` link directly but when you click it shows the contents and some users th...Overview
----------------------------------------
There is two ways to add an event to my calendar :
- Download `ICS` file and import it.
- Copy the `ICalendar` link directly but when you click it shows the contents and some users think it is a bug.
![2020-12-30_13-08](/uploads/0a267756da641d70ee44bf1b479ce4ff/2020-12-30_13-08.png)
Reproduction steps
----------------------------------------
Clicking on the second icon (ICalendar feed for this event.)
Current behaviour
----------------------------------------
When you click the `ICalendar` link it shows the `ICalendar` contents and some users think it is a bug.
![Screenshot_from_2020-12-30_13-16-28](/uploads/6eeaffd9998eb234505e8d264eee0a2b/Screenshot_from_2020-12-30_13-16-28.png)
![RPReplay_Final1609580895_2r](/uploads/5358f62f1b4e330c086def8362ebe477/RPReplay_Final1609580895_2r.gif)
Expected behaviour
----------------------------------------
When you click the `ICalendar` link the browser will start downloading the file.
![Screenshot_from_2020-12-30_09-45-20](/uploads/60a20ccf404754288dd6d940d2e050d7/Screenshot_from_2020-12-30_09-45-20.png)
![RPReplay_Final1609580895_1r](/uploads/74be3271114878f3ad1aecb7f9753433/RPReplay_Final1609580895_1r.gif)
Comments
----------------------------------------
Using the proper content type for ICalendar link is a good practice and the browsers will handle it properly by downloading it - UX improvement.
Changing the content type here to `text/calendar` will fix it
https://github.com/civicrm/civicrm-core/blob/3662d5a75d79d6c259b632df748b1beb66db6faf/CRM/Event/ICalendar.php#L73
So what do you think about this?
PR: https://github.com/civicrm/civicrm-core/pull/193165.34.0https://lab.civicrm.org/dev/core/-/issues/2273Contact type incorrectly set to Contribution due to 'Honoree Profile'2021-02-04T03:19:33ZyashodhaContact type incorrectly set to Contribution due to 'Honoree Profile'Steps to replicate:
- Create a contribution page with _Honoree Section Enabled_.
- Choose a profile that includes a contribution field.
- Make a contribution with this page with soft credit contact.
![Screenshot_from_2020-12-23_19_01_...Steps to replicate:
- Create a contribution page with _Honoree Section Enabled_.
- Choose a profile that includes a contribution field.
- Make a contribution with this page with soft credit contact.
![Screenshot_from_2020-12-23_19_01_36](/uploads/eb4c8c6a1efde56de24f54e82d7b6e8d/Screenshot_from_2020-12-23_19_01_36.png)
- Check contact type of the newly created soft credit contact in DB. It will be _Contribution_ which is why it will not show up in some places and throws errors on various screens.
![Screenshot_from_2020-12-23_19_01_14](/uploads/3757f53442f4c41e204e62fa222fac88/Screenshot_from_2020-12-23_19_01_14.png)
![Screenshot_from_2020-12-23_19_01_05](/uploads/be5efccbb45d14a6bb0c7c7306cb87eb/Screenshot_from_2020-12-23_19_01_05.png)
I was able to replicate the scenario on dmaster. We should restrict the profile type to Contact types when calculating for honoree profile.5.34.0yashodhayashodhahttps://lab.civicrm.org/dev/core/-/issues/2270Editing a smartgroup created through the search builder renders the new block...2020-12-23T20:07:07ZVangelisPEditing a smartgroup created through the search builder renders the new block by forceOverview
----------------------------------------
When you edit an **existing** smartgroup created with the Search Builder, the new block of record type/operator is always rendering by force. This causes inconvenience (and confusion) to ...Overview
----------------------------------------
When you edit an **existing** smartgroup created with the Search Builder, the new block of record type/operator is always rendering by force. This causes inconvenience (and confusion) to the end user, as they try to 'Search' to see the results but end up with the form rule validation informing them that they need to populate some parameters. In order to bypass this, they need to clear the new line (new block). This behaviour is there since a long time now, we just got complains lately about that.
Reproduction steps
----------------------------------------
Create a smartgroup through the searchbuilder and save it:
1. Search -> Search builder
1. Set some basic filters like : Contacts -> Contact type = Individual and do the search
1. All x records -> Action: Group: Create smartgroup and give it a temporary name
Now go to find your existing smartgroup:
1. Contacts -> Manage groups
1. on the 'Find', type your temporary name that you gave and once it's being displayed, go to 'Settings' (right part)
1. On the popup page, select the last link: 'Edit smart group criteria'
The '-select record type-' and '-operator-' are rendering by default. In order to search, you need to take them out first.
Current behaviour
----------------------------------------
The new record type/operator line is now appearing on either an existing smartgroup done via the searchbuilder or on a new searchbuilder form
Expected/suggested behaviour
----------------------------------------
The new record type + operator line should appear only on the new searchbuilder form
Comments
----------------------------------------
I believe the easiest way to fix this is to check if we have any ssID value [here](https://lab.civicrm.org/dev/core/-/blob/master/CRM/Contact/Form/Search/Builder.php#L54). If we do have an ssID then this means that we are editing an existing smartgroup and not creating a new one.
for example this:
```php
// Initialize new form
if (!$this->_blockCount) {
$this->_blockCount = 4;
$this->set('newBlock', 1);
}
```
should be something like this:
```php
// Initialize new form
if (!$this->_blockCount) {
$this->_blockCount = 4;
if (!$this->_ssID) {
$this->set('newBlock', 1);
}
}
```
Can anyone see a downside on doing this?
[PR added - 19257](https://github.com/civicrm/civicrm-core/pull/19257)5.34.0https://lab.civicrm.org/dev/core/-/issues/2269Default currency shown on invoices if payment is made with different currency2020-12-30T21:47:07Zahed_compucorpDefault currency shown on invoices if payment is made with different currencyOverview
----------------------------------------
Default currency shown on invoices if payment is made with different currency
Reproduction steps
----------------------------------------
1. Go to CiviContribute Component Settings and ...Overview
----------------------------------------
Default currency shown on invoices if payment is made with different currency
Reproduction steps
----------------------------------------
1. Go to CiviContribute Component Settings and check Enable Tax and Invoicing.
2. Go to any contact with contributions.
3. Choose a contribution in currency other than the default one.
4. Press "Print Invoice".
Current behaviour
----------------------------------------
For this contribution (USD is the default currency)
![Screenshot_from_2020-12-22_12-34-58](/uploads/778c80626ef5f77dedefb704fdad82ec/Screenshot_from_2020-12-22_12-34-58.png)
Invoice shows default currency rather than contribution's currency.
![Screenshot_from_2020-12-22_12-35-12](/uploads/5dbf627a12e19a2484196b862b83ef0a/Screenshot_from_2020-12-22_12-35-12.png)
Expected behaviour
----------------------------------------
Invoice shows contribution's currency.
![103090962-52037c00-45fb-11eb-88f9-74f58c707371](/uploads/f326c539297792606c2e985bb9cea9f2/103090962-52037c00-45fb-11eb-88f9-74f58c707371.png)
Ref https://github.com/civicrm/civicrm-core/pull/192905.34.0https://lab.civicrm.org/dev/core/-/issues/2264Remove never-used IMAP_XOAUTH2 option value before it gets more confusing2021-01-08T13:21:25ZDaveDRemove never-used IMAP_XOAUTH2 option value before it gets more confusingBefore we knew the full ~~wackiness~~ splendor of OAUTH2, there was an attempt to model it as its own protocol. This never worked so as the 5.23 release was going to press the as-yet-unreleased mail protocol option value was disabled, bu...Before we knew the full ~~wackiness~~ splendor of OAUTH2, there was an attempt to model it as its own protocol. This never worked so as the 5.23 release was going to press the as-yet-unreleased mail protocol option value was disabled, but left in the database.
Now that (inbound) OAUTH2 is working using a different mechanism, remove this option value before it starts causing confusion.5.34.0https://lab.civicrm.org/dev/core/-/issues/2263Multiple available languages disables kcfinder2020-12-23T23:11:04ZkainukMultiple available languages disables kcfinderOverview
----------------------------------------
In instances that have multiple languages available the kcfinder throws an error and cannot be used. I have described this on
https://civicrm.stackexchange.com/questions/38473/browsing-...Overview
----------------------------------------
In instances that have multiple languages available the kcfinder throws an error and cannot be used. I have described this on
https://civicrm.stackexchange.com/questions/38473/browsing-for-images-in-the-editor-leads-to-an-unexpected-error
Reproduction steps as done on the dmaster (5.34.alpha1)
----------------------------------------
1. Login as demo/demo
1. Go to Settings Localisations Settings - Localization (https://dmaster.demo.civicrm.org/civicrm/admin/setting/localization?reset=1)
1. Add an extra language under available languages.
![multipleLanguages](/uploads/4c26d20419158320a2b803d712653b6f/multipleLanguages.png)
1. Add a message template (https://dmaster.demo.civicrm.org/civicrm/admin/messageTemplates/add?action=add&reset=1)
1. Click on the add image button.
1. Click on the browse server button.
1. An error shows up:
![unexpectedError](/uploads/bb222a4c1734b1aa7f76d5b6ff8742d3/unexpectedError.png)
Expected behaviour
----------------------------------------
The number of available languages should not matter. The file browser must just show up.
Environment information
----------------------------------------
* __CiviCRM:__ _Master_
* __PHP:__ __7.3__
* __CMS:__ __Drupal 7.77__5.33.0https://lab.civicrm.org/dev/core/-/issues/2262Rebuild Triggers (and views) should also rebuild CiviCase views2021-03-06T19:41:33ZbnagorckaRebuild Triggers (and views) should also rebuild CiviCase viewsOverview
----------------------------------------
When moving CiviCRM's database to a new server and/or setting up a new database user, the views which are a part of CiviCase are not rebuilt with the new credentials after running the co...Overview
----------------------------------------
When moving CiviCRM's database to a new server and/or setting up a new database user, the views which are a part of CiviCase are not rebuilt with the new credentials after running the command `civicrm-sql-rebuild-triggers` :
```
VIEWS
civicrm_view_case_activity_upcoming
civicrm_view_case_activity_recent
```
Reproduction steps
----------------------------------------
1. Change the database user name and credentials
1. rebuild triggers
1. DB Error when accessing CiviCase components
Environment information
----------------------------------------
* __CiviCRM:__ 5.32.2
* __PHP:__ 7.3
* __CMS:__ Drupal 7.x
* __Database:__ MariaDB
Comments
----------------------------------------
Also relates to #12145.37.0https://lab.civicrm.org/dev/financial/-/issues/163Fully remove contributionTypeID2020-12-23T11:07:08ZeileenFully remove contributionTypeIDThere are few remaining references in the code to very-old-legacy contributionTypeID
This seems to be passed out to payment processors and assigned to the templates in some cases
I feel like we could remove these in 5.34 and simply com...There are few remaining references in the code to very-old-legacy contributionTypeID
This seems to be passed out to payment processors and assigned to the templates in some cases
I feel like we could remove these in 5.34 and simply communicate the fact via the dev-digest and release notes.5.34.0https://lab.civicrm.org/dev/core/-/issues/2243Add created_date column to the civicrm_note table2021-03-28T16:44:34ZjasonmAdd created_date column to the civicrm_note tableOverview
----------------------------------------
After merging contacts, we noticed that when viewing the notes of the merged contact, the notes merged from the duplicated contact display the timestamp of when the merge happened. It wou...Overview
----------------------------------------
After merging contacts, we noticed that when viewing the notes of the merged contact, the notes merged from the duplicated contact display the timestamp of when the merge happened. It would be helpful for note records to store both the created date and the last modified date and to display both dates in the notes list view at /civicrm/contact/view?reset=1&cid=xxxxxx
Example use-case
----------------------------------------
The user wants to see the date that a note was created in addition to when a note was last modified.
Current behaviour
----------------------------------------
Currently the civicrm_note table has only a modified_date field so the date a note is created is lost upon any update.
Proposed behaviour
----------------------------------------
Add a created_date column to the civicrm_note table and display both created and modified dates at /civicrm/contact/view?reset=1&cid=xxxxxx
![screenshot-a](/uploads/99cabcdde44fa725841c2d5de5afd28a/screenshot-a.png)
![screenshot-b](/uploads/003327183320ec3af790840cbe835393/screenshot-b.png)
![screenshot-c](/uploads/d8ecdc89bb06f23037df82ea81e4974e/screenshot-c.png)5.37.0https://lab.civicrm.org/dev/core/-/issues/2242CiviCRM Export, Saved Export Field Mapping that contains custom fields which ...2021-02-01T22:03:53Zjustinfreeman (Agileware)CiviCRM Export, Saved Export Field Mapping that contains custom fields which have been disabled or deleted are still loaded as "clear" values and cause the export download to fail with "DB Error: no such field"CiviCRM Export, Saved Export Field Mapping that contains custom fields which have been disabled or deleted are still loaded as "clear" values and cause the export download to fail with "DB Error: no such field".
This is complicated furt...CiviCRM Export, Saved Export Field Mapping that contains custom fields which have been disabled or deleted are still loaded as "clear" values and cause the export download to fail with "DB Error: no such field".
This is complicated further because the **user cannot remove the "clear" fields from the field export list at all** and as a result, renders the Saved Export Field Mapping defunct.
The disabled or deleted fields are listed on the field export page as "clear", see screenshot below.
![Screenshot_20201210_165641](/uploads/099da3249d6eb3734fab60d6adaacf58/Screenshot_20201210_165641.png)
Agileware Ref: CIVICRM-16275.35.0https://lab.civicrm.org/dev/core/-/issues/2241Don't check for .git in the isDevelopment() function2021-01-11T22:35:28ZDaveDDon't check for .git in the isDevelopment() functionThe function isDevelopment() checks if there's a .git folder present. The function controls for example mysql strict mode and whether deprecations throw errors (more about deprecations in ticket dev/core#2240). But it's not crazy for a l...The function isDevelopment() checks if there's a .git folder present. The function controls for example mysql strict mode and whether deprecations throw errors (more about deprecations in ticket dev/core#2240). But it's not crazy for a live site to have a .git folder.
Previous discussion at https://github.com/civicrm/civicrm-core/pull/17276. Where it stalled was not really on whether using .git is wrong, it was on what it should do instead. Summary of alternates:
1. Use the Environment setting at System Settings - Debugging.
* There may be some differences between what that setting is actually for and what this function gets used for.
* Also switching to this setting has some side effects which aren't blockers but would need to be dealt with (test suite, buildkit defaults).
1. Instead of "is dev", have a way to tell "for testing" and "not for testing".
* CIVICRM_UF(?)
1. Use whatever the symfony environment is set to.
@mattwire @AlanDixon @MikeyMJCO @artfulrobot5.35.0https://lab.civicrm.org/dev/core/-/issues/2240Deprecation warnings are implemented backwards2021-01-06T20:47:07ZDaveDDeprecation warnings are implemented backwardsSpecifically, they piggyback on the logging system by calling logging first and then triggering errors, whereas they should simply call trigger_error, and leave it up to the site's error handling config or custom error_handlers whether t...Specifically, they piggyback on the logging system by calling logging first and then triggering errors, whereas they should simply call trigger_error, and leave it up to the site's error handling config or custom error_handlers whether that gets logged or not.
Also note that throwing an error from within CRM_Core_Error_Log technically makes that class a non-compliant PSR-3 implementation. Quoting from https://github.com/php-fig/fig-standards/blob/75d5769d235ceff12e5c850f54d7d43266e62769/accepted/PSR-3-logger-interface.md#13-context
> A given value in the context MUST NOT throw an exception nor raise any php error, warning or notice.
Example:
_Current_: `Civi::log()->warning('something', ['civi.tag' => 'deprecated']);`
_Proposed_: `trigger_error('something', E_USER_DEPRECATED);` (or call a wrapper function which does this - exact implementation doesn't matter, just don't call logging).5.34.0https://lab.civicrm.org/dev/financial/-/issues/160Allocation of "fee amount" is incorrect if fee is added after contribution is...2020-12-11T17:11:37ZJonGoldAllocation of "fee amount" is incorrect if fee is added after contribution is created#### Steps to replicate:
* Go to **Administer » CiviContribute » Payment Methods**. Note the default payment method.
* Also note a payment method that doesn't have the same financial account.
On a clean install, "Check" is the default ...#### Steps to replicate:
* Go to **Administer » CiviContribute » Payment Methods**. Note the default payment method.
* Also note a payment method that doesn't have the same financial account.
On a clean install, "Check" is the default method, and "Credit Card" has a different financial account. I'll use those in my example below.
* Create a contribution with payment method of credit card. Enter a fee amount, save, and note the contribution ID.
* Run the following SQL to view the financial account IDs of the transaction (my contribution ID is 96 below):
```sql
mysql> SELECT entity_id, amount, from_financial_account_id, to_financial_account_id, total_amount, fee_amount FROM civicrm_entity_financial_trxn ceft JOIN civicrm_financial_trxn cft ON ceft.financial_trxn_id = cft.id WHERE entity_table = 'civicrm_contribution' AND entity_id = 96;
+-----------+--------+---------------------------+-------------------------+--------------+------------+
| entity_id | amount | from_financial_account_id | to_financial_account_id | total_amount | fee_amount |
+-----------+--------+---------------------------+-------------------------+--------------+------------+
| 96 | 18.00 | NULL | 12 | 18.00 | 4.00 |
| 96 | 4.00 | 12 | 5 | 4.00 | 0.00 |
+-----------+--------+---------------------------+-------------------------+--------------+------------+
```
* The above is correct - the `from_financial_account_id` of the fee trxn matches the `to_financial_account_id` of the main trxn.
* Create a second contribution with payment method of credit card, but do *not* enter the fee.
* Save the contribution, then immediately edit it to add the fee.
* When you run the SQL above, it will look like this:
```sql
mysql> SELECT entity_id, amount, from_financial_account_id, to_financial_account_id, total_amount, fee_amount FROM civicrm_entity_financial_trxn ceft JOIN civicrm_financial_trxn cft ON ceft.financial_trxn_id = cft.id WHERE entity_table = 'civicrm_contribution' AND entity_id = 95;
+-----------+--------+---------------------------+-------------------------+--------------+------------+
| entity_id | amount | from_financial_account_id | to_financial_account_id | total_amount | fee_amount |
+-----------+--------+---------------------------+-------------------------+--------------+------------+
| 95 | 11.00 | NULL | 12 | 11.00 | 0.00 |
| 95 | 3.00 | 6 | 5 | 3.00 | 0.00 |
+-----------+--------+---------------------------+-------------------------+--------------+------------+
```
Note that the fee's `from_financial_account_id` no longer matches the account of the main transaction - it matches the financial account ID of the **default** payment method, not the payment method of this contribution.
**tl;dr:** The financial transaction for a fee amount is calculated incorrectly if you edit the fee after the contribution is saved.
I haven't written a patch/test yet, but I intend to in the next day or two.5.34.0JonGoldJonGold