Development issueshttps://lab.civicrm.org/groups/dev/-/issues2022-01-07T13:49:52Zhttps://lab.civicrm.org/dev/core/-/issues/2587Editing a mailing triggers two autosaves instead of one2022-01-07T13:49:52ZromainEditing a mailing triggers two autosaves instead of oneWhen editing a mailing or an A/B mailing, any change to the content triggers an autosave after 5 seconds, as expected. But 5 seconds after the first autosave, another one gets triggered even if nothing was changed after the first save.
...When editing a mailing or an A/B mailing, any change to the content triggers an autosave after 5 seconds, as expected. But 5 seconds after the first autosave, another one gets triggered even if nothing was changed after the first save.
This is no big deal in most situations, but when saving a mailing is slow on the server side to a point it's longer than 5 seconds (because of overloading or contention at that moment), this actually makes things worse.
I debugged the JS code, and found out that it's because [the autoSave controller stores a copy of the mailing before calling the server](https://lab.civicrm.org/dev/core/-/blob/master/ang/crmAutosave.js#L36), and when the server replies [the modified date of the mailing is updated by the `crmMailingMgr`](https://lab.civicrm.org/dev/core/-/blob/master/ang/crmMailing/services.js#L378) with the one coming from the server. As a result, the mailing object and "last seen" copy differ by the modified date, and the autoSave controller detects a change.
Not too sure what would be the best way to solve this as I'm not familiar at all with this part of the code. Maybe the `options.save` promise of the autoSave should allow for a result when resolving, that would replace the lastSeen copy? But replacing lastSeen after the save may also be a risk of conflicting with any change that the user did?5.47.0https://lab.civicrm.org/dev/core/-/issues/2586CiviContribute: Cannot clear the Thank-you Date (does not set to null on save)2021-05-06T01:47:07ZpbarmakCiviContribute: Cannot clear the Thank-you Date (does not set to null on save)Overview
----------------------------------------
When editing a Contribution in version 5.36.1, we click on the x to clear the Thank-you Date field. It removes the date and time. But, when we click Save, the field remains with the last-...Overview
----------------------------------------
When editing a Contribution in version 5.36.1, we click on the x to clear the Thank-you Date field. It removes the date and time. But, when we click Save, the field remains with the last-used data/time. It does not saved the cleared/null value. This is true on the latest demo as well.
Reproduction steps
----------------------------------------
1. Find any contribution. Click View. Then click Edit.
2. Click the small x next to the time field to clear out the date and time (or simply erase/delete what is there)
3. Click Save.
4. View the contribution, and the Thank-you Date is still set to the old value.
Expected behaviour
----------------------------------------
It should clear out the value of that field.
Environment information
----------------------------------------
<!-- Some of the items below may not be relevant for every bug - if in doubt please include more information than you think is neccessary. -->
* __Browser:__ _Firefox 88
* __CiviCRM:__ 5.36.1
* __PHP:__ 7.3
* __CMS:__ Drupal 75.37.1https://lab.civicrm.org/dev/core/-/issues/2585GroupContact pre/post hooks have inconsistent signatures2023-08-08T05:03:21ZJonGoldGroupContact pre/post hooks have inconsistent signaturesFixing this is going to require breaking the extension contract, so I think it needs core team approval.
I think the inconsistency was introduced as an unintended side effect of...introducing consistency (for API4).
Looking at [CRM_Con...Fixing this is going to require breaking the extension contract, so I think it needs core team approval.
I think the inconsistency was introduced as an unintended side effect of...introducing consistency (for API4).
Looking at [CRM_Contact_BAO_GroupContact](https://github.com/civicrm/civicrm-core/blob/master/CRM/Contact/BAO/GroupContact.php), the `pre` and `post` hooks are called three times each - once in `add()`, once in `addContactsToGroup()`, once in `removeContactsFromGroup`.
Compare signatures:
```php
// add()
CRM_Utils_Hook::pre($hook, 'GroupContact', CRM_Utils_Array::value('id', $params), $params);
// addContactsToGroup() and removeContactsFromGroup()
CRM_Utils_Hook::pre('create', 'GroupContact', $groupId, $contactIds);
```
The second one is obviously incorrect, but has existed since SVN times. The `add()` hook was introduced by @colemanw in 5.6 in [PR 12382](https://github.com/civicrm/civicrm-core/pull/12832).
In addition to the change in signature (which will require communication with extension devs) this will probably also introduce a performance hit when removing folks from groups, but that's unavoidable(?).
@jaapjansma this will break CiviRules: `CRM_CivirulesPostTrigger_GroupContact::triggerTrigger()` relies on the old signature, which is how I found this.https://lab.civicrm.org/dev/core/-/issues/2584Proposal - Separation of Default Language for contacts from the default Language2023-08-05T05:03:23ZVangelisPProposal - Separation of Default Language for contacts from the default Language## Scenario
Right now, the preferred communication language for new contacts is bound to what the site's default language is in or to 'use language in use at the time' is in but as it seems, neither of them fits the scenario below:
A m...## Scenario
Right now, the preferred communication language for new contacts is bound to what the site's default language is in or to 'use language in use at the time' is in but as it seems, neither of them fits the scenario below:
A multinational organization in country A has 2 (or more) enabled languages in their Drupal configuration, thus into each user's profile. They want to have the preferred communication language for each of their contacts set to country A's language while the menus needs to be retained in English by force.
## How to replicate
1. On a Drupal 7 site, allow 2 languages, set the English as default
1. In CiviCRM > Administer > Localisation, set:
* the default language to the non-English
* Inherit CMS language to 'Yes'
* Available Languages: Add the 2 languages that you've added in Drupal
* Default Language for contacts: Any (I tried all options)
* Logout and login again
1. Try to create a new contact
## Possible solution
The suggestion is besides what already is in the selector, to add also a list of available languages to the field 'Default Language for contacts' so that we can enforce a language.
I've already worked on a patch that does the above, I'm not sure if my approach of this idea hides any potentials flaws.
Selector before:
![image](/uploads/f19b2c389213236f81e0df86a5335d33/image.png)
Selector after:
![image](/uploads/75e42b33fe04528f1e2b0d298b03ac30/image.png)
Example: Danish
![Screenshot_from_2021-05-03_09-58-12](/uploads/b12950fd7f96ee0604c839ee1bcbb61e/Screenshot_from_2021-05-03_09-58-12.png)
![Screenshot_from_2021-05-03_09-56-50](/uploads/96302b55f8779875e89b5b565cdd07d0/Screenshot_from_2021-05-03_09-56-50.png)
---
PR is [here - 20214](https://github.com/civicrm/civicrm-core/pull/20214)https://lab.civicrm.org/dev/core/-/issues/2582system workflow template uses backend URL2021-05-03T07:11:08Zphilmorbrusystem workflow template uses backend URLOverview
----------------------------------------
The default Pledge Reminder system workflow template is configured to send out public-facing messages that include backend URLs. In Joomla this means the URL in the message is "domain.org...Overview
----------------------------------------
The default Pledge Reminder system workflow template is configured to send out public-facing messages that include backend URLs. In Joomla this means the URL in the message is "domain.org/administrator/" rather than "domain.org/index.php". See [SE question](https://civicrm.stackexchange.com/questions/39414/configure-urls-in-system-workflow-messages).
Reproduction steps
----------------------------------------
1. N/a
Current behaviour
----------------------------------------
Public users of the pledge system get reminders with links that don't work (go to administrator site, not public site).
Expected behaviour
----------------------------------------
Link should go to front end.
Environment information
----------------------------------------
* __CiviCRM:__ 5.33.2
* __CMS:__ Joomla 3.9.24 (unsure of other CMS)
Comments
----------------------------------------
Simple fix of adding param "fe=1" to the crmURL in the smarty code. Have not evaluated other templates which might have the same problem. Do not know if this is only Joomla, or if the fe=1 fix will cause any problems with other CMSs.5.38.0https://lab.civicrm.org/dev/core/-/issues/2580API4: Smart group parameters with booleans result in incorrect sql2023-08-03T05:03:25ZAndrew WestAPI4: Smart group parameters with booleans result in incorrect sqlOverview
----------------------------------------
API4 smart groups with a boolean parameter result in sql of "where field_name = 'true'" instead of 'where field_name = 1'.
Reproduction steps
----------------------------------------
1. ...Overview
----------------------------------------
API4 smart groups with a boolean parameter result in sql of "where field_name = 'true'" instead of 'where field_name = 1'.
Reproduction steps
----------------------------------------
1. Run [this API4 search](https://wpmaster.demo.civicrm.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fapi4#/explorer/RelationshipCache/get?where=%5B%5B%22is_active%22,%22%3D%22,%22true%22%5D%5D&limit=0&select=%5B%22far_contact_id%22%5D&groupBy=%5B%22far_contact_id%22%5D). Currently this returns about 123 contact IDs.
2. Remove the GroupBy and save the search as a smart group
3. Open the smart group. It only has 27 people in it.
If you log the sql from CRM_Contact_BAO_GroupContactCache::getApiSQL() you can see the SQL call uses 'true' rather than '1'.
This has unpredictable results! The query doesn't fail - it just returns...something. I've seen it return a subset of the correct results, and sometimes the exact inverse.
Environment information
----------------------------------------
Tested in latest master (5.38 alpha 1).
Comments
----------------------------------------
I _think_ this applies to all booleans. The above RelationshipCache was where we hit it, and tests on 'is_deleted' in the more-usual contact entity do the same thing.https://lab.civicrm.org/dev/core/-/issues/2579What is the purpose/meaning of `_single`, e.g. when used in core classes as `...2023-10-06T05:03:15ZDaveDWhat is the purpose/meaning of `_single`, e.g. when used in core classes as `if ($this->_single)`The purpose of this is to help clear something up that I'm not clear on. There's no specific proposal right now. And this is also a bit of a brain dump so may not even be discussable (is that word? - I seem to keep making up new words la...The purpose of this is to help clear something up that I'm not clear on. There's no specific proposal right now. And this is also a bit of a brain dump so may not even be discussable (is that word? - I seem to keep making up new words lately).
I'm thinking the meaning of `single` has gotten confused a bit over time - there appear to be two interpretations:
* There's only one id. Period. It doesn't mean anything else.
* We were viewing/doing something in the context of a single entity, like we we're viewing a contribution and now we're doing something related to it.
The first situation is confusing because why would it require a whole other variable and separate handling, but seems to be how it's being interpreted in some places.
The second is more like how "context" is used in various places (particularly context=search), so is also confusing because it seems to duplicate it, but seems to match the uses of it in the code in some places.
@eileenhttps://lab.civicrm.org/dev/core/-/issues/2578Angular $location interferes with the Drupal7 Overlay Module2023-08-05T05:03:24ZCésarAngular $location interferes with the Drupal7 Overlay ModuleHello, I have detected a strange behaviour that I cannot reproduce in dmaster. Maybe something is interfering, but I have detected that since **CiviCRM 5.33.0** the links of the Drupal 7 toolbar-menu with "Garland 7.78" do not work the s...Hello, I have detected a strange behaviour that I cannot reproduce in dmaster. Maybe something is interfering, but I have detected that since **CiviCRM 5.33.0** the links of the Drupal 7 toolbar-menu with "Garland 7.78" do not work the same in the dashboard as in other places of CiviCRM.
I attach an example:
![menu-dashboard-issue__1_](/uploads/85c5564a9efc29c90ef2788b1deea605/menu-dashboard-issue__1_.gif)
Reviewing the changes from version 5.33.0 onwards, I have seen that this part has changed: https://github.com/civicrm/civicrm-core/pull/18971 Maybe it's related, but I'm not sure.https://lab.civicrm.org/dev/core/-/issues/2576Trigger on civicrm_activity causing performance problems2023-09-11T05:03:23ZErikHommelTrigger on civicrm_activity causing performance problemsWhile looking for the root cause of a performance issue for a client, I tracked it down to a couple of triggers performing an inefficient UPDATE statement:
civicrm_activity_before_update civicrm_activity_before_delete
Original SQL (~4 ...While looking for the root cause of a performance issue for a client, I tracked it down to a couple of triggers performing an inefficient UPDATE statement:
civicrm_activity_before_update civicrm_activity_before_delete
Original SQL (~4 seconds):
`UPDATE civicrm_case SET modified_date = CURRENT_TIMESTAMP WHERE id IN (SELECT ca.case_id FROM civicrm_case_activity ca WHERE ca.activity_id = OLD.id);`
~1000x faster SQL to do the same thing:
`UPDATE civicrm_case, civicrm_case_activity SET civicrm_case.modified_date = CURRENT_TIMESTAMP WHERE civicrm_case.id = civicrm_case_activity.case_id AND civicrm_case_activity.activity_id = OLD.id;`
I tracked this down to the following PHP file: sites/all/modules/civicrm/Civi/Core/Container.php
The patch to fix the SQL payload in the file:
`--- Container.php.orig 2021-04-12 11:30:35.039270421 +0100
+++ Container.php 2021-04-12 11:32:00.485650901 +0100
@@ -286,7 +286,7 @@
'table' => 'civicrm_activity',
'when' => 'BEFORE',
'event' => ['UPDATE', 'DELETE'],
- 'sql' => "\nUPDATE civicrm_case SET modified_date = CURRENT_TIMESTAMP WHERE id IN (SELECT ca.case_id FROM civicrm_case_activity ca WHERE ca.activity_id = OLD.id);\n",
+ 'sql' => "\nUPDATE civicrm_case, civicrm_case_activity SET civicrm_case.modified_date = CURRENT_TIMESTAMP WHERE civicrm_case.id = civicrm_case_activity.case_id AND civicrm_case_activity.activity_id = OLD.id;\n",
],
],
]
`
The bug doesn't manifest if you rewrite the UPDATE as a SELECT, but in the UPDATE form it takes an absurdly long time when a sub-select is used. Tested on MariaDB 10.4 and 10.5.
(SE issue [Performance bug in trigger](https://civicrm.stackexchange.com/questions/39303/performance-bug-in-trigger-causing-1000x-slowdown))https://lab.civicrm.org/dev/core/-/issues/2575Redundant indexes2022-05-16T23:19:04ZErikHommelRedundant indexesIssue reported by Gordan Bobic on SE: https://civicrm.stackexchange.com/questions/39409/redundant-indexes
It looks like there are several redundant or partly redundant indexes that civicrm creates on the database. Some of this may be st...Issue reported by Gordan Bobic on SE: https://civicrm.stackexchange.com/questions/39409/redundant-indexes
It looks like there are several redundant or partly redundant indexes that civicrm creates on the database. Some of this may be storage engine specific (e.g. InnoDB), but some isn't.
(see SE issue for more information)https://lab.civicrm.org/dev/core/-/issues/2574Grant report: Grant details not showing properly state/province and country2021-04-28T05:32:44ZVangelisPGrant report: Grant details not showing properly state/province and country## Issue
This issue is similar to the one reported [here - #220](https://lab.civicrm.org/dev/core/-/issues/220)
On the Detailed Grant report, the state/province shows the numeric values instead of the actual text labels.
## How to rep...## Issue
This issue is similar to the one reported [here - #220](https://lab.civicrm.org/dev/core/-/issues/220)
On the Detailed Grant report, the state/province shows the numeric values instead of the actual text labels.
## How to replicate
On https://dmaster.demo.civicrm.org create 1-2 grants. Then go to Grants - Grant Reports -> Allow state/province in the list of columns and render the report.
![image](/uploads/dea83dd0ab256d3fcea7b7d017b9ac14/image.png)
`Country` and `state/province` show numeric values instead.
## How to fix
Adding the following line:
`$entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, NULL, NULL) ? TRUE : $entryFound;`
before [here](https://lab.civicrm.org/dev/core/-/blob/master/CRM/Report/Form/Grant/Detail.php#L248) seems to be solving the issue (code replicated from issue #220)
Edit: PR is [here - 20169](https://github.com/civicrm/civicrm-core/pull/20169)5.38.0https://lab.civicrm.org/dev/core/-/issues/2573api4: CaseActivity requires "administer CiviCRM" permission2021-04-29T03:37:13ZDaveDapi4: CaseActivity requires "administer CiviCRM" permissionI think the easiest way to see this is:
1. Add a user that has view all contacts, edit all contacts, view all activities, "all" the case permissions, add contacts, access CiviCRM, etc just don't give it administer CiviCRM.
1. Create a c...I think the easiest way to see this is:
1. Add a user that has view all contacts, edit all contacts, view all activities, "all" the case permissions, add contacts, access CiviCRM, etc just don't give it administer CiviCRM.
1. Create a case, doesn't matter which user creates it.
1. Note the activity id of any of the activities on the case.
1. Replace 1234 in this command with the id:
* `cv ev --user=the_user "$r = \Civi\Api4\Activity::get(TRUE)->addSelect('id', 'case_activity.case_id')->setJoin([['CaseActivity AS case_activity', 'LEFT']])->addWhere('id', '=', 1234)->execute()->first(); var_dump($r);"`
1. Note the case id is not returned.
1. Now run the same thing but replace with --user=admin, where admin has administer CiviCRM.
1. The case id is returned.
It was suggested in chat that the class maybe needs a permission override somewhere.
A similar thing happens if I use a chain instead of join.
I don't think this strictly counts as a regression since CaseActivity was just added recently.5.37.0https://lab.civicrm.org/dev/core/-/issues/2569afform - how to refresh display on submit2023-08-01T05:03:26Zeileenafform - how to refresh display on submitI'm not sure if this is a feature request of a documentation request but I seem close to having configuration & display working via afform & search kit for my custom entity 'Monolog' 'out of the box'.
eg git clone https://github.com/ei...I'm not sure if this is a feature request of a documentation request but I seem close to having configuration & display working via afform & search kit for my custom entity 'Monolog' 'out of the box'.
eg git clone https://github.com/eileenmcnaughton/monolog.git
enable & go to
civicrm/monolog
You can see I have a display of configured monologs below a form that allows you to add a new monolog. What I'd like is that the bottom display refreshes once the first is submitted
![image](/uploads/677229d37558e2fca0d18224378f3bc9/image.png)
@totten @colemanwhttps://lab.civicrm.org/dev/core/-/issues/2568Undefined index: contribution in CRM_Contribute_BAO_Contribution::getContribu...2021-05-03T17:47:09Zchris_bluejacUndefined index: contribution in CRM_Contribute_BAO_Contribution::getContributionTokenValues()Overview
----------------------------------------
After sending thank-you emails/letters for contributions, generates an error, for each contribution thank you generated:
Notice: Undefined index: contribution in CRM_Contribute_BAO_Contri...Overview
----------------------------------------
After sending thank-you emails/letters for contributions, generates an error, for each contribution thank you generated:
Notice: Undefined index: contribution in CRM_Contribute_BAO_Contribution::getContributionTokenValues() ...
Warning: array_search() expects parameter 2 to be array, null given in CRM_Contribute_BAO_Contribution::getContributionTokenValues()
Using CiviCRM 5.36.1 | Drupal 7.80
Reproduction steps
----------------------------------------
1. Contributions -> Find Contributions -> Search
2. Select contributions without "Thank-you Sent" (Error occurs whether one or more contacts/contributions selected.
3. Select Actions -> Thank-you letters print or email"
4. Error occurs regardless of "group contributions by", "Print and email options" settings
5. Use template (error occurs regardless of template selection)
6. Click "Make Thank-you Letters" button
Current behaviour
----------------------------------------
If the Print and email options mean a PDF is generated (i.e. Print PDF, Send emails where possible generate pdfs where no email possible, Send emails and generate pdf etc) then a pdf is downloaded and emails are sent. The error message appears the next time a page is loaded (i.e after clicking "done"). Message that thank you letters sent.
If no pdfs are generated, but emails are sent. Emails are sent. Message that thank you letters are sent, but also error message.
Error message only. The functionality is okay.
```
Notice: Undefined index: contribution in CRM_Contribute_BAO_Contribution::getContributionTokenValues() (line 5293 of /bitnami/drupal/modules/contrib/civicrm/CRM/Contribute/BAO/Contribution.php).
Warning: array_search() expects parameter 2 to be array, null given in CRM_Contribute_BAO_Contribution::getContributionTokenValues() (line 5293 of /bitnami/drupal/modules/contrib/civicrm/CRM/Contribute/BAO/Contribution.php).
```
Expected behaviour
----------------------------------------
No error information
Environment information
----------------------------------------
<!-- Some of the items below may not be relevant for every bug - if in doubt please include more information than you think is neccessary. -->
* __CiviCRM:__ 5.36.1
* __PHP:__ 7.3.27
* __CMS:__ Drupal 7.78 and 7.80
* __Database:__ _MySQL 5.7.33
* __Web Server:__ _Apache 2.4.46
![Screenshot_2021-04-26_103104_-_civicrm_contrib_thank_you_error](/uploads/29c186ac256aeae9e8ef9a355cafd5ed/Screenshot_2021-04-26_103104_-_civicrm_contrib_thank_you_error.png)5.38.0https://lab.civicrm.org/dev/core/-/issues/2567Afform - how to edit not obvious2022-03-17T02:43:51ZeileenAfform - how to edit not obviousAfter several attempts I'm still completely mystified as to how to create a simple afform and open in edit mode for a contact. I have tried on demo.dmaster.civicrm.org creating a basic individual form but cannot figure out how to add an ...After several attempts I'm still completely mystified as to how to create a simple afform and open in edit mode for a contact. I have tried on demo.dmaster.civicrm.org creating a basic individual form but cannot figure out how to add an id to the url
The biggest part of this is there is no documentation.
However I suspect this should be addressed with notes / links in the UI as well
@colemanw @totten @MikeyMJCO @seamusleecolemanwcolemanwhttps://lab.civicrm.org/dev/core/-/issues/2564Error: Undefined class constant 'MODE_CBC' in Civi\Crypto\PhpseclibCipherSuit...2021-04-27T00:46:24ZhansrosselError: Undefined class constant 'MODE_CBC' in Civi\Crypto\PhpseclibCipherSuite->__construct() (line 51 of /vendor/civicrm/civicrm-core/Civi/Crypto/PhpseclibCipherSuite.php)In case of phpseclib v1 the constants MODE_CBC and MODE_CTR are used in line 51 of /vendor/civicrm/civicrm-core/Civi/Crypto/PhpseclibCipherSuite.php
```
elseif (class_exists('Crypt_AES')) {
// phpseclib v1
$this->ciphers['aes-cbc']...In case of phpseclib v1 the constants MODE_CBC and MODE_CTR are used in line 51 of /vendor/civicrm/civicrm-core/Civi/Crypto/PhpseclibCipherSuite.php
```
elseif (class_exists('Crypt_AES')) {
// phpseclib v1
$this->ciphers['aes-cbc'] = new \Crypt_AES(\Crypt_AES::MODE_CBC);
$this->ciphers['aes-cbc']->setKeyLength(256);
$this->ciphers['aes-ctr'] = new \Crypt_AES(\Crypt_AES::MODE_CTR);
$this->ciphers['aes-ctr']->setKeyLength(256);
```
But following https://github.com/phpseclib/phpseclib/blob/1.0.19/phpseclib/Crypt/AES.php#L99
the constants should be CRYPT_MODE_CBC and CRYPT_MODE_CTR
I'm also not sure is this piece of code is needed as normally you should not have phpseclib v1 as civicrm/civicrm-cxn-rpc requires version 2. In my case composer had not run that update so I'm just updating to phpseclib v2 to fix this issue.5.37.0https://lab.civicrm.org/dev/core/-/issues/2563Crypto token string not parsing correctly for saved passwords2021-05-03T18:00:46ZdarrickCrypto token string not parsing correctly for saved passwordsOverview
----------------------------------------
I'm having an issue with 5.36.1. `Notice: Undefined index: t in parse() (line 204 of /sites/all/modules/civicrm/Civi/Crypto/CryptoToken.php).`
The token string is in the format
```
"^C...Overview
----------------------------------------
I'm having an issue with 5.36.1. `Notice: Undefined index: t in parse() (line 204 of /sites/all/modules/civicrm/Civi/Crypto/CryptoToken.php).`
The token string is in the format
```
"^CTK?k=<ID>&t=<base64>" instead of "^CTK?k=<ID>&t=<base64>".
```
So the array keys are "k" and "amp;t" instead of "k" and "t";
Reproduction steps
----------------------------------------
1. at civicrm/admin/setting/smtp?reset=1 I added my smtp username, password.
2. Save and Test correctly sent a test email.
3. I went to a contact record and chose Actions: Send an Email.
4. I got the following error: "authentication failure [SMTP: Invalid response code received from SMTP server while sending email. This is often caused by a misconfiguration in Outbound Email settings. Please verify the settings at Administer CiviCRM >> Global Settings >> Outbound Email"
5. at admin/reports/dblog I got the following error: `Notice: Undefined index: t in parse() (line 204 of /sites/all/modules/civicrm/Civi/Crypto/CryptoToken.php).`
Current behaviour
----------------------------------------
In the civicrm_setting table the smtpPassword is being saved as
```
CTK?k=<ID>&t=<base64>
```
```
/**
* Parse the content of a token (without decrypting it).
*
* @param string $token
*
* @return array
* @throws \Civi\Crypto\Exception\CryptoException
*/
public function parse($token): array {
$fmt = substr($token, 1, 4);
switch ($fmt) {
case self::FMT_QUERY:
dpm($token);
$tokenData = [];
parse_str(substr($token, 5), $tokenData);
dpm($tokenData);
$tokenData['t'] = \CRM_Utils_String::base64UrlDecode($tokenData['t']);
break;
default:
throw new CryptoException("Cannot decrypt token. Invalid format.");
}
return $tokenData;
}
```
parse_str is returning the following keys: "k" and "amp;t".
Expected behaviour
----------------------------------------
parse_str should return "k" and "t" keys.
In the above parse function I made the following change:
```
parse_str(substr(html_entity_decode($token), 5), $tokenData);
```
based off of https://www.php.net/manual/en/function.parse-str.php#74818
And it worked as expected.
Environment information
----------------------------------------
<!-- Some of the items below may not be relevant for every bug - if in doubt please include more information than you think is neccessary. -->
* __CiviCRM:__ 5.36.1
* __PHP:__ 7.3.27
* __CMS:__ Drupal 7.80
* __Database:__ 5.5.5-10.5.9-MariaDB
* __Web Server:__ Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.3.27https://lab.civicrm.org/dev/core/-/issues/2561Merge Contacts fails when custom Contact Reference field allows Multi-Select2021-04-26T23:26:25Zwil_SRQMerge Contacts fails when custom Contact Reference field allows Multi-SelectOverview
----------------------------------------
After creating a custom field for events, Merge Contacts no longer works. The custom field is Contact Reference with Multi-Select. During the merge process, the query `UPDATE civicrm_valu...Overview
----------------------------------------
After creating a custom field for events, Merge Contacts no longer works. The custom field is Contact Reference with Multi-Select. During the merge process, the query `UPDATE civicrm_value_custom_group_# SET custom_field_# = individual_cid_2 WHERE custom_field_# = individual_cid_1` fails because custom_field_# is a varchar.
Reproduction steps
----------------------------------------
1. Create a custom field group for Events with a Contact Reference field set to Multi-Select
2. Create an Event and add two Organization contacts to the custom field
3. Select any two Individual contacts and Merge
Current behaviour
----------------------------------------
Browser - `DB Error: unknown error`
Log - `[nativecode=1292 ** Truncated incorrect DOUBLE value: '�org_cid_1�org_cid_2�']`
Expected behaviour
----------------------------------------
Contacts merged
Environment information
----------------------------------------
* __Browser:__ _Firefox 88.0 (64 bit)_
* __CiviCRM:__ _5.36.1_
* __PHP:__ _7.3.27__
* __CMS:__ _Drupal 7.80_
* __Database:__ _MySQL 5.7.34_
* __Web Server:__ _Apache_
Comments
----------------------------------------
My use case is recording organizations that partner with us on events, hence the use of organization contacts in the custom field when reproducing the issue.https://lab.civicrm.org/dev/core/-/issues/2560When editing a membership with no existing payments, checking the box to reco...2021-05-06T05:50:26ZFrancis (Agileware)When editing a membership with no existing payments, checking the box to record payments results in a total amount of NaN.NOverview
----------------------------------------
When editing a membership with no existing payments, checking the box to record payments results in a total amount of NaN.N
Reproduction steps
----------------------------------------
1....Overview
----------------------------------------
When editing a membership with no existing payments, checking the box to record payments results in a total amount of NaN.N
Reproduction steps
----------------------------------------
1. Find or create a new membership of a paid type without recording any payment / contribution
2. As an admin, edit the membership
3. Check the box "Record Membership Payment?"
Current behaviour
----------------------------------------
The "Amount" Text box shows NaN.N
Expected behaviour
----------------------------------------
Based on the most likely use case we could come up with (unapproved membership is being paid for and moved to an approved status), should show the amount for 1 term of the current membership
Environment information
----------------------------------------
* __Browser:__ Any browser
* __CiviCRM:__ 5.36.0+ (Worked in 5.35.1)
Comments
----------------------------------------
Reproduced on dmaster before reporting
Related issue dev/core#2543 (dev/core#632 shows the same symptom, but has an entirely different cause that should already be working)
PR is incoming.
Agileware Ref CIVICRM-17185.37.0https://lab.civicrm.org/dev/core/-/issues/2558DB crash when copying event scheduled reminders2021-08-18T01:52:59ZufundoDB crash when copying event scheduled remindersOverview
----------------------------------------
I am experiencing a crash when creating a new event from a template that has scheduled reminders, or trying to copy an event which has scheduled reminders.
The DB error suggests it is t...Overview
----------------------------------------
I am experiencing a crash when creating a new event from a template that has scheduled reminders, or trying to copy an event which has scheduled reminders.
The DB error suggests it is trying to put 0s in the effective_start_date / effective_end_date columns when creating the new scheduled reminders, but this is not allowed.
After the crash, the new event has been created but doesn't have the scheduled reminders it should.
Reproduction steps
----------------------------------------
1. **Events -> New Event**.
1. Choose a template with scheduled reminders
1. Click Continue
1. Fatal db error page :(
OR
1. **Events -> Manage Events**
1. Pick an event with scheduled reminders
1. **More -> Copy**
1. Fatal db error page :(
Current behaviour
----------------------------------------
Error from logs is:
```
.../sites/all/modules/civicrm/vendor/pear/db/DB.php(997): PEAR_Error->__construct("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO `civicrm_action_schedule` (`name` , `title` , `recipient` , `enti...")
#3 .../sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-1, 16, (Array:2), "INSERT INTO `civicrm_action_schedule` (`name` , `title` , `recipient` , `enti...")
#4 .../sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, 16, (Array:2), "INSERT INTO `civicrm_action_schedule` (`name` , `title` , `recipient` , `enti...", "DB_Error", TRUE)
#5 .../sites/all/modules/civicrm/vendor/pear/db/DB/common.php(1928): PEAR->__call("raiseError", (Array:7))
#6 .../sites/all/modules/civicrm/vendor/pear/db/DB/mysqli.php(936): DB_common->raiseError(-1, NULL, NULL, "INSERT INTO `civicrm_action_schedule` (`name` , `title` , `recipient` , `enti...", "1292 ** Incorrect datetime value: '0' for column 'effective_start_date' at row 1")
```
After the crash, new/copied event is created but without scheduled reminders.
Expected behaviour
----------------------------------------
No error and new/copied event created with copies of scheduled reminders
Environment information
----------------------------------------
* __CiviCRM:__ 5.35
* __PHP:__ 7.3.17
* __CMS:__ Drupal 7.8
* __Database:__ MySQL 5.7.30
Comments
----------------------------------------
I see effective_start_date and effective_end_date columns were added in 5.34 and I wonder if something around the database schema constraints/defaults wasn't set correctly in the/my upgrade?5.37.0