Development issueshttps://lab.civicrm.org/groups/dev/-/issues2023-01-20T00:07:09Zhttps://lab.civicrm.org/dev/core/-/issues/4083Cannot fill in FormBuilder fields when using Existing Contact autocomplete2023-01-20T00:07:09ZbrienneCannot fill in FormBuilder fields when using Existing Contact autocompleteOverview
----------------------------------------
On FormBuilder forms that use autocomplete option "Existing Contact", users cannot fill in other fields. If it is a text box that was not filled in by the autocomplete, then the user is u...Overview
----------------------------------------
On FormBuilder forms that use autocomplete option "Existing Contact", users cannot fill in other fields. If it is a text box that was not filled in by the autocomplete, then the user is unable to type anything. If the text box was filled out by the autocomplete, then any changes made to that field are temporarily visible, but disappear. Selects and checkboxes may be clicked, but those changes are also temporary. Even if the user does not search/select a contact, then they still cannot fill out the form.
Reproduction steps
----------------------------------------
1. Create a FormBuilder form based on a contact (i.e. Organization)
1. Add an "Existing Contact" field, as well as one text box field for testing (i.e Email)
1. Save, and click **View Page**
2. Try to type into the text box field, both before and after selecting a contact
Here is the markup for the form that I tested on in dmaster:
```html
<af-form ctrl="afform">
<af-entity data="{contact_type: 'Organization', source: 'Test'}" type="Contact" name="Organization1" label="Organization 1" actions="{create: true, update: true}" security="RBAC" />
<fieldset af-fieldset="Organization1" class="af-container" af-title="Organization 1">
<div class="af-container">
<af-field name="id" />
<div class="af-container af-layout-inline"></div>
</div>
<div af-join="Email">
<div class="af-container af-layout-inline">
<af-field name="email" />
</div>
</div>
</fieldset>
<button class="af-button btn btn-primary" crm-icon="fa-check" ng-click="afform.submit()">Submit</button>
</af-form>
```
![Selection_185](/uploads/00187e18cc7b108e67f9e341b6a3b7f1/Selection_185.png)
Current behaviour
----------------------------------------
When a FormBuilder form has an "Existing Contact" autocomplete, users cannot fill in or edit fields.
Expected behaviour
----------------------------------------
Users should be able to fill out or edit fields with an "Existing Contact" autocomplete on the form.
Environment information
----------------------------------------
This type of form does not work on 5.57.1, but does work on 5.56.2.
I did a `git bisect` and located the first bad commit as 2aaaa86bb041d6214c17a0d2a85f9f28838b2904, which is PR [24974](https://github.com/civicrm/civicrm-core/pull/24974) (Use APIv4-based Autocomplete widget throughout SearchKit, Afform & API Explorer)https://lab.civicrm.org/dev/core/-/issues/4082Event participant role import inconsistency2023-06-30T14:06:52ZguitarmanEvent participant role import inconsistencyOverview
----------------------------------------
Event participant role import doesn't respect submitted values.
Reproduction steps
----------------------------------------
1. Import a list of event participants, role = non-default val...Overview
----------------------------------------
Event participant role import doesn't respect submitted values.
Reproduction steps
----------------------------------------
1. Import a list of event participants, role = non-default value
2. Import runs through without showing any errors/warnings
3. Check DB-records, whatever has been submitted, the participant role value will always be set to "1" i.e. the default value set in the event configuration.
Current behaviour
----------------------------------------
Whatever is submitted, the participant role value will be set to "1" (default value).
Expected behaviour
----------------------------------------
The correct/submitted participant role value should be imported.https://lab.civicrm.org/dev/core/-/issues/4081API v.3 Event.create used for update will change Event Template to ordinary E...2023-01-16T15:26:05Zniels_erik_andersenAPI v.3 Event.create used for update will change Event Template to ordinary EventWhen API v.3 Event.create is used for update event template, it will set is_template to false so that the template is changed to an ordinary event.
To reproduce:
cv api Event.create id=nnn template_title="New Title"
Where nnn is id for...When API v.3 Event.create is used for update event template, it will set is_template to false so that the template is changed to an ordinary event.
To reproduce:
cv api Event.create id=nnn template_title="New Title"
Where nnn is id for Event Template
To fix:
In
CRM_Event_BAO_Event::create(&$params) {
$transaction = new CRM_Core_Transaction();
if (empty($params['is_template'])) {
$params['is_template'] = 0;
}
Change
if (empty($params['is_template'])) {
to:
if (empty($params['id']) && empty($params['is_template'])) {5.59.0https://lab.civicrm.org/dev/core/-/issues/4080system workflow templates do not respect the selected pdf format anymore2023-02-15T05:27:10ZMariaVsystem workflow templates do not respect the selected pdf format anymoreI have noticed that system workflow templates no longer respect the formats.
pdf formats can be configured via communication > pdf formats.
In my case there are 2 pdf formats (and the default_invoice_pdf_format came together with an upd...I have noticed that system workflow templates no longer respect the formats.
pdf formats can be configured via communication > pdf formats.
In my case there are 2 pdf formats (and the default_invoice_pdf_format came together with an update probably a few months ago):
![grafik](/uploads/e7bce57400c26a7488c20f64a1d2b64d/grafik.png)
When I edit a system workflow template and choose - Standard - or DIN A4 it still chooses the default_invoice_pdf_format.
![grafik](/uploads/07affeecea4693e191b517e16700a854/grafik.png)
It is hardcoded in the code as you can see here:
https://lab.civicrm.org/dev/core/-/blob/master/CRM/Contribute/Form/Task/Invoice.php (line 236).
I do not know why this has been implemented. There might be a reason for it.
But it seems like a bug for me.
If I choose - Standard - in the system workflow templates I expect that this format will be choosed.
Such a change (without notice) could also led to major problems when sending invoices automatically.
Workaround for us for now was to change the default_invoice_pdf_format to the same values as our standard format.
(noticed on CiviCRM version 5.56.2)5.58.1https://lab.civicrm.org/dev/core/-/issues/4079Add support for pledge tokens2023-03-23T22:48:23ZyashodhaAdd support for pledge tokensAdd support for pledge tokensAdd support for pledge tokens5.61.0yashodhayashodhahttps://lab.civicrm.org/dev/core/-/issues/4076Split up CRM_Utils_System_Base::theme2023-02-14T01:13:59ZherbdoolSplit up CRM_Utils_System_Base::themeSplit up this method into the different classes so it's specific per CMS.Split up this method into the different classes so it's specific per CMS.https://lab.civicrm.org/dev/core/-/issues/4074CRM_Core_BAO_CMSUser - use system specific method rather than checking userFr...2023-01-30T17:18:08ZherbdoolCRM_Core_BAO_CMSUser - use system specific method rather than checking userFrameworkIn `CRM_Core_BAO_CMSUser::formRule()` there is a bunch of logic for specific CMSes that should be in the userSystem for each CMS. This helps make CiviCRM more CMS agnostic.In `CRM_Core_BAO_CMSUser::formRule()` there is a bunch of logic for specific CMSes that should be in the userSystem for each CMS. This helps make CiviCRM more CMS agnostic.https://lab.civicrm.org/dev/financial/-/issues/213Imported has completed successfully, but that's not true2023-01-15T21:04:15ZKarinGImported has completed successfully, but that's not trueCiviCRM 5.56.2
Contributions -> Import via UI ->
Client also noted (and I confirmed) that Contact Type appears to be no longer relevant/required.
Previous behaviour: CiviCRM generates an import_error file noting the contributions which...CiviCRM 5.56.2
Contributions -> Import via UI ->
Client also noted (and I confirmed) that Contact Type appears to be no longer relevant/required.
Previous behaviour: CiviCRM generates an import_error file noting the contributions which could not be imported and the reason - in this case Contact ID does not exist.
Screenshots (really awesome client report):
![image](/uploads/e569fd7fac5fb380e64318731aab5925/image.png)
![image](/uploads/713ee8a4cb0112b052a82fac53fe98e7/image.png)
![image](/uploads/736818ab47519bee7944120f5d577097/image.png)
![image](/uploads/1162ab9a29299db21546bf2e295a3d22/image.png)
![image](/uploads/9e3a4cf72ead03397d48542c24baa751/image.png)
![image](/uploads/60a57e3362cadf8710e9a194331a4159/image.png)5.57.0https://lab.civicrm.org/dev/core/-/issues/4070FlexMailer: Default Return Path not respected2023-02-27T13:47:09ZJonGoldFlexMailer: Default Return Path not respectedIn **Administer » CiviMail » Mail Accounts**, you can specify a default return path for your CiviMail mailings. This is important when, for instance, your bounce address's mailhost does not support VERP. This forces the `Return-Path` h...In **Administer » CiviMail » Mail Accounts**, you can specify a default return path for your CiviMail mailings. This is important when, for instance, your bounce address's mailhost does not support VERP. This forces the `Return-Path` header to a specific email address. The bounce processing code will find the `X-CiviMail-Bounce` header and process that instead of the bounce address.
However, this functionality was not ported to Flexmailer. You can see it at the very top of `CRM_Utils_Mail::send()` but not in `Civi\FlexMailer\Listener\BounceTracker::onCompose()`.
This causes the return-path to have the VERP address.JonGoldJonGoldhttps://lab.civicrm.org/dev/core/-/issues/4069Broken event confirmation emails with multiple participants and external paym...2023-01-15T23:27:12ZJKingsnorthBroken event confirmation emails with multiple participants and external payment gateways (contribution.sendconfirmation)Raised on StackExchange here: https://civicrm.stackexchange.com/questions/34004/event-email-receipt-doesnt-have-the-profile-information
We have also hit this issue.
This is an old regression from late 2019 by the looks of it.
When boo...Raised on StackExchange here: https://civicrm.stackexchange.com/questions/34004/event-email-receipt-doesnt-have-the-profile-information
We have also hit this issue.
This is an old regression from late 2019 by the looks of it.
When booking on to an event with multiple participants (ie lead booker and a guest), and using an external payment gateway using IPN, the confirmation email is missing the total amount, and all of the participant information.
Actual: [image](/uploads/b55b515da0be99cc4806c4f0cc3a3b96/image.png)
Expected: [image](/uploads/60ff3fdfc56fc6dc7765210628870ae4/image.png)
Another way to recreate this issue is to call the contribution.sendconfirmation API on any contribution record linked to a lead booker that has additional participants.
IPN-based payment gateways call completetransaction API, which in turn calls the sendconfirmation API, which explains.
---
Tracking through the code, it looks like the sendconfirmation API call only has the participant information for the 'last' participant ID associated with the booking?
It looks like @eileen you've been doing some refactoring in this area (rightly so - it looks like a bit of a swamp!).
I'm struggling to track down exactly where the issue is coming from.https://lab.civicrm.org/dev/core/-/issues/4068Running a Contact Summary report as a limited access user granted gives DB Er...2023-03-18T05:12:26ZtiminaustRunning a Contact Summary report as a limited access user granted gives DB Error: no such fieldOverview
----------------------------------------
Running a report as a limited access user based on a group that has ACL permissions granted gives ...
```
Sorry, due to an error, we are unable (etc)... DB Error: no such field
```
My par...Overview
----------------------------------------
Running a report as a limited access user based on a group that has ACL permissions granted gives ...
```
Sorry, due to an error, we are unable (etc)... DB Error: no such field
```
My particular use case was a Contact Summary report based on a smartgroup being run by a locked-down user who has acl access to that group (ie not all groups).
Reproduction steps (simplified from my actual use case).
----------------------------------------
1. Create a smart-group and set up ACL for a specific user that doesn't have global access to all contacts/groups.
2. Login as that user, create the report, select a couple of fields AND the smart-group.
3. Attempt to run the report.
Current behaviour
----------------------------------------
Report fails with DB Error: no such field as limited access user, but runs fine for full access user.
The following SQL was generated for the limited access user ...
```
SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name AS civicrm_contact_sort_name,
contact_civireport.id AS civicrm_contact_id,
email_civireport.email AS civicrm_email_email,
(address_civireport.street_number % 2) AS civicrm_address_address_odd_street_number,
address_civireport.postal_code AS civicrm_address_address_postal_code
FROM civicrm_contact contact_civireport
LEFT JOIN civicrm_address address_civireport ON
(contact_civireport.id = address_civireport.contact_id)
AND address_civireport.is_primary = 1
LEFT JOIN civicrm_email email_civireport ON
contact_civireport.id = email_civireport.contact_id
AND email_civireport.is_primary = 1
WHERE ((contact_civireport.contact_type IN ('Individual')))
AND contact_civireport.id IN
(SELECT DISTINCT cgroup_civireport.contact_id
FROM civicrm_group_contact cgroup_civireport
WHERE cgroup_civireport.group_id IN (11)
AND cgroup_civireport.status = 'Added'
UNION DISTINCT SELECT DISTINCT smartgroup_contact.contact_id
FROM civicrm_group_contact_cache smartgroup_contact
WHERE smartgroup_contact.group_id IN (11) )
AND (`contact_civireport`.`id` IS NULL
OR (`contact_civireport`.`id` IN
(SELECT contact_id FROM civicrm_acl_contact_cache WHERE user_id = 6)))
AND (`contact_civireport`.`is_deleted` IS NULL
OR (`contact_civireport`.`is_deleted` != 1))
AND (`cgroup_civireport`.`id` IS NULL
OR (`cgroup_civireport`.`id` IN (3, 7, 9, 11)))
ORDER BY contact_civireport.sort_name ASC
LIMIT 0, 50
```
The error is caused by the last where clause which is generated from buildPermissionClause(), which is trying to access 'contact_civireport' that only exists in the nested where/filter subquery.
The last 3 where clauses are not present for the full access user (ie buildPermissionsClause() return empty string).
Expected behaviour
----------------------------------------
The report should run correctly without the last where clause for limited access use.
Environment information
----------------------------------------
* __Browser: Firefox 108
* __CiviCRM: 5.57.0
* __PHP: 8.1
* __CMS: WordPress 6.1.1
* __Database: MariaDB 10.5
* __Web Server: Apache 2.4
Comments
----------------------------------------
The problem appears to be in civicrm/CRM/report/form.php.
From what I read ...
The last three where clauses in the above are generated by the function buildPermissionClause() which uses a BAO call to generate a user-specific clause for each table in the query where the user does not have full access.
This relies on function selectedTables() to generate the list of tables. The last part of selectedTables function searches all the filters an adds them to the list of tables, however for filters using $filterop 'in' or 'notin', the tables referenced by these clauses may not exist in the main query. It would seem likely that the selected tables list should not include tables where the filter uses these two constructs.
I am not sure apart from 'group' filter (which has specific handling), if any report filters would use 'in/not in (select...)' rather than 'in/out (value list)' so I am not sure the best way to fix this as I have only investigated my usage.
The solution may be to explicitly excluding contact group table (cgroup_civireport), or by updating to selecttables to exclude all 'in' and 'notin' filters as there is no guarantee the table exists in the main query for these types of filters.
Change in function selecttables (line ~4388) with
```
$this->_selectedTables[] = $tableName;"
```
to:
```
if ( ! in_array($filterOp, ["in","notin"] )) $this->_selectedTables[] = $tableName;
```
If the intent is to restrict access to acl enabled groups this would need the same clause added in function joinGroupTempTable(). There may be other places where this should apply.
(On a side issue as I am new here - in my sql query, civicrm_address_address_odd_street_number is not a column that is selectable - it seems to be preset as required and hidden for some reason and limited to a 'Walking Report' template. Having this would cause an unnecessary join to the address table if no address fields are being reported - only a little performance thing but should this be another problem or improvement request?).5.59.0https://lab.civicrm.org/dev/core/-/issues/4065Upgrade Error 5.56.1 to 5.57.0 duplicate Search Kit UI_name2023-01-10T12:26:09ZkcristianoUpgrade Error 5.56.1 to 5.57.0 duplicate Search Kit UI_nameEnviornment:
WP 6.1.1
php 7.4
apache 2.4
Search Kit has a search created in 2021 called 'Top Donors'
on upgrade I get the error:
`[nativecode=1062 ** Duplicate entry 'Top_Donors' for key 'UI_name']`
```
[Error: Finish core DB update...Enviornment:
WP 6.1.1
php 7.4
apache 2.4
Search Kit has a search created in 2021 called 'Top Donors'
on upgrade I get the error:
`[nativecode=1062 ** Duplicate entry 'Top_Donors' for key 'UI_name']`
```
[Error: Finish core DB updates 5.57.0]
Error Field Error Value
Type DB_Error
Code -5
Message DB Error: already exists
Mode 16
UserInfo INSERT INTO `civicrm_saved_search` (`name` , `label` , `form_values` , `mapping_id` , `search_custom_id` , `api_entity` , `api_params` , `created_id` , `modified_id` , `expires_date` , `description` ) VALUES ('Top_Donors' , 'Top Donors' , NULL , NULL , NULL , 'Contribution' , '{\"version\":4,\"select\":[\"GROUP_CONCAT(DISTINCT Contribution_Contact_contact_id_01.display_name) AS GROUP_CONCAT_Contribution_Contact_contact_id_01_display_name\",\"SUM(total_amount) AS SUM_total_amount\",\"COUNT(id) AS COUNT_id\",\"AVG(total_amount) AS AVG_total_amount\"],\"orderBy\":[],\"where\":[[\"contribution_status_id:name\",\"=\",\"Completed\"]],\"groupBy\":[\"contact_id.display_name\"],\"join\":[[\"Contact AS Contribution_Contact_contact_id_01\",\"LEFT\",[\"contact_id\",\"=\",\"Contribution_Contact_contact_id_01.id\"]]],\"having\":[]}' , 202 , 202 , NULL , NULL ) [nativecode=1062 ** Duplicate entry 'Top_Donors' for key 'UI_name']
DebugInfo INSERT INTO `civicrm_saved_search` (`name` , `label` , `form_values` , `mapping_id` , `search_custom_id` , `api_entity` , `api_params` , `created_id` , `modified_id` , `expires_date` , `description` ) VALUES ('Top_Donors' , 'Top Donors' , NULL , NULL , NULL , 'Contribution' , '{\"version\":4,\"select\":[\"GROUP_CONCAT(DISTINCT Contribution_Contact_contact_id_01.display_name) AS GROUP_CONCAT_Contribution_Contact_contact_id_01_display_name\",\"SUM(total_amount) AS SUM_total_amount\",\"COUNT(id) AS COUNT_id\",\"AVG(total_amount) AS AVG_total_amount\"],\"orderBy\":[],\"where\":[[\"contribution_status_id:name\",\"=\",\"Completed\"]],\"groupBy\":[\"contact_id.display_name\"],\"join\":[[\"Contact AS Contribution_Contact_contact_id_01\",\"LEFT\",[\"contact_id\",\"=\",\"Contribution_Contact_contact_id_01.id\"]]],\"having\":[]}' , 202 , 202 , NULL , NULL ) [nativecode=1062 ** Duplicate entry 'Top_Donors' for key 'UI_name']
PEAR_Exception: DB Error: already exists in /home/wpmaybe/public_html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php on line 945
DB_Error: DB Error: already exists in unknown on line unknown
```
I edited the label and name in DB and re-ran the upgrade:
Success
I also now have a packaged Search with the same label and name as one that was created previously. Perhaps we should have a more unique name (not label) to indicated it's a core/packaged search?
EDIT: The affected sites all have the extension 'SearchKit Reports' enabled.https://lab.civicrm.org/dev/core/-/issues/4063Pagination and counts for soft credits on contact contribution tab are broken2023-01-31T04:22:10ZlarsssandergreenPagination and counts for soft credits on contact contribution tab are broken![image](/uploads/bb821970b38d324542ed222f854986c7/image.png)
![image](/uploads/6f7546327ec73b18a8811048bcf59d92/image.png)
If the total number of soft credits on a contact's contribution tab exceeds the number set in Show N entries, th...![image](/uploads/bb821970b38d324542ed222f854986c7/image.png)
![image](/uploads/6f7546327ec73b18a8811048bcf59d92/image.png)
If the total number of soft credits on a contact's contribution tab exceeds the number set in Show N entries, then the count is broken as above and the Next and Last links are disabled. You can use the page numbers to get to other pages, but it will always show five pages no matter how many actual soft credits are found.
Is this something that's worth digging into or is it anticipated that this will be replaced with SearchKit relatively soon?
To reproduce, add soft credit for 11 contributions to one contact, then go to that contact's contributions tab and select Show 10 entries.https://lab.civicrm.org/dev/core/-/issues/4062Emojis submitted to CiviCRM API cause issues2023-10-22T12:20:26ZfkohrtEmojis submitted to CiviCRM API cause issues## Problem/Motivation
Emojis that are submitted to custom fields cause an issue upon webform submission.
## Detailed steps to reproduce
1. Set up a simple webform event registration form, e.g. first name, last name, and a custom atten...## Problem/Motivation
Emojis that are submitted to custom fields cause an issue upon webform submission.
## Detailed steps to reproduce
1. Set up a simple webform event registration form, e.g. first name, last name, and a custom attendee-specific custom field (multi-line text box / textarea).
2. Put 👍🏻 into the custom field
3. Error message: The website encountered an unexpected error. Please try again later.
Alongside every form submission with emojis, the log contains two related entries:
__webform_submission__
```
CRM_Core_Exception: DB Error: unknown error in civicrm_api3() (line 135 of /var/www/[SITE]/vendor/civicrm/civicrm-core/api/api.php).
```
__php__
```
Drupal\Core\Entity\EntityStorageException: DB Error: unknown error in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of /var/www/[SITE]/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
```
## Proposed resolution
Successful submission of text that contains emojis.
## Further context
Moved from `webform_civicrm` issue [3331605](https://www.drupal.org/project/webform_civicrm/issues/3331605).https://lab.civicrm.org/dev/core/-/issues/4060On 5.57.0 Joomla3, cv fails with 'Failed to start application'2023-01-11T13:56:44Zaydunsaidan.saunders@squiffle.ukOn 5.57.0 Joomla3, cv fails with 'Failed to start application'Overview
----------------------------------------
On a 5.57.0 Joomla 3.10.9 system, the `cv` command fails with 'Failed to start application'
(Logging against core rather than cv since the problem appears to be here)
Reproduction steps...Overview
----------------------------------------
On a 5.57.0 Joomla 3.10.9 system, the `cv` command fails with 'Failed to start application'
(Logging against core rather than cv since the problem appears to be here)
Reproduction steps
----------------------------------------
1. Try running various commands such as `cv vars:show`, `cv api Contact.get`
Current behaviour
----------------------------------------
```
In Factory.php line 137:
Failed to start application
vars:show [--out OUT] [--flat [FLAT]] [--level LEVEL] [--hostname HOSTNAME] [-t|--test] [-U|--user USER]
```
Expected behaviour
----------------------------------------
No error!
Environment information
----------------------------------------
* __CiviCRM:__ _5.57.0_ <!-- If this problem relates to an upgrade, then specify both old and new versions -->
* __PHP:__ _7.3__
* __CMS:__ _Joomla 3.10.9._5.57.1aydunsaidan.saunders@squiffle.ukaydunsaidan.saunders@squiffle.ukhttps://lab.civicrm.org/dev/core/-/issues/4059CiviEvent: API3/4 deletes event is_template flag on event update2023-01-16T15:22:16ZBjörn EndresCiviEvent: API3/4 deletes event is_template flag on event updateOverview
----------------------------------------
The CiviCRM API resets(!) the ``is_template`` flag on an event entity when manipulating unrelated attributes. Tested on APIv3 and APIv4.
Reproduction steps
------------------------------...Overview
----------------------------------------
The CiviCRM API resets(!) the ``is_template`` flag on an event entity when manipulating unrelated attributes. Tested on APIv3 and APIv4.
Reproduction steps
----------------------------------------
1. Create a new event template (not a message template)
1. Go to the API explorer (3 or 4)
1. Run ``Event.get`` with the ID of the given template. Observe that the ``is_template`` parameter is set to 1/true.
1. Run ``Event.create/update`` with parameters:
* ``id`` = ID of the given template
* ``title`` = "just want to trigger a change"
1. Run ``Event.get`` with the ID of the given template.
Current behaviour
----------------------------------------
Observe that the ``is_template`` parameter is set to 0/false - **the flag has been deleted!**
Expected behaviour
----------------------------------------
API call should leave the ``is_template`` parameter alone, i.e. the return value of then ``is_template`` parameter should be 1/true
Environment information
----------------------------------------
Tested on current [DMASTER](https://dmaster.demo.civicrm.org) running 5.59.alpha1, but has definitely been around for longer.
Comments
----------------------------------------
A unit test to cover that should be pretty straightforward with these instructions.5.59.0https://lab.civicrm.org/dev/core/-/issues/4056Replace hard-coded call to legacyCustomSearch framework with a hook2023-06-25T18:31:24ZeileenReplace hard-coded call to legacyCustomSearch framework with a hookWe should get the legacy custom search frame work out of our `GroupContactCache` BAO and eventually out of core code (and unhide the extension, with a view to not shipping enabled).
In order to do this I think we need a hook to get the ...We should get the legacy custom search frame work out of our `GroupContactCache` BAO and eventually out of core code (and unhide the extension, with a view to not shipping enabled).
In order to do this I think we need a hook to get the sql when loading a contact group
![image](/uploads/9ca4de13d7127a957e988ccea1a5c43b/image.png)
It might potentially wind up like this
![image](/uploads/6eebfb49b84cb35210c17de5a7eaf5e2/image.png)
I see there is handling for the sql being empty - which seems weird - but we could probably assume that if anything ever needs no sql it is not a custom search
Note that `CRM_Contact_BAO_SearchCustom` could be moved to the extension with the hook once as part of this as nothing else calls it
The other place where the legacy custom search framework returns sql is
![image](/uploads/e99dfdf4ba2fb66ac6e78c9f1cffc3b6/image.png)
Internally the first query calls the same `contactIDs`
![image](/uploads/88c6ff1481188c0f666b6309cb01b25b/image.png)
@colemanw @seamuslee @DaveDhttps://lab.civicrm.org/dev/core/-/issues/4055Extension cannot found its own classes during install when opcache is enabled2023-03-16T13:12:50ZkainukExtension cannot found its own classes during install when opcache is enabledI start with the following configuration:
* PHP 8.1.7 _Using the docker image FROM php:8.1.7-apache-buster_
* OPCache enabled _standard configuration_
* Buildkit _CiviCRM install for Drupal 9_ see below:
````
civibuild create patch \
...I start with the following configuration:
* PHP 8.1.7 _Using the docker image FROM php:8.1.7-apache-buster_
* OPCache enabled _standard configuration_
* Buildkit _CiviCRM install for Drupal 9_ see below:
````
civibuild create patch \
--type drupal9-demo \
--civi-ver master \
--url http://patch.kainuk \
--cms-ver 9.5
````
Now, when I enable the Action Provider extension (just from the extension screen), the following error is thrown.
````
Error: Class "Civi\ActionProvider\Symfony\Component\DependencyInjection\DefinitionAdapter" not found in action_provider_civicrm_container() (line 15 of /buildkit/build/patch/web/sites/default/files/civicrm/ext/action-provider/action_provider.php)
````
`cv flush` lets the problem disappear, and for the Action Provider that is no problem because only code is installed (it does not change the database). However, other extensions can have more problems because the installation is interrupted, and possible incomplete.
The problem is, however, reproducible. When I disable the extension, and uninstall it, the error reappears after installing.
I did some duty time in the debugger and found the following code in the extension class loader (CRM_Extension_ClassLoader)
````php
$file = $this->getCacheFile();
if (file_exists($file)) {
$this->loader = require $file;
}
else {
$this->loader = $this->buildClassLoader();
$ser = serialize($this->loader);
file_put_contents($file,
sprintf("<?php\nreturn unserialize(%s);", var_export($ser, 1))
);
}
````
`$this->buildClassLoader()` is an expensive procedure, so after calculation the result is saved for reuse. When a new extension is installed, the saved file is removed because it does not contain the new extension configuration. A new classloader with all the extension stuff is calculated and an updated file is written.
For loading the class, the PHP construct `require` is used. This construct was designed for loading PHP code. The assumption is that PHP code does not change much, and OPCache used this assumption, to store the file in memory. The risk is here is that not the newly written configuration is used, but an old one from memory. On my configuration, I observed with the PHP debugger, that when the `hook_civicrm_container` the old classloader is loaded with require. Just put a breakpoint before the `$this->loader = require $file` line.
When the OPCache is disabled, the problem does not appear.5.59.0https://lab.civicrm.org/dev/core/-/issues/4053Standalone: users and roles2023-08-11T16:23:42ZbgmStandalone: users and rolesGeneral issue to discuss user management, roles and permissions.
There was a discussion in Manchester about this. At first we explored the idea of using CiviCRM groups to manage permissions, but there was a lot of discomfort because of ...General issue to discuss user management, roles and permissions.
There was a discussion in Manchester about this. At first we explored the idea of using CiviCRM groups to manage permissions, but there was a lot of discomfort because of the (lack of) security around groups and how it could end up adding a lot of extra complexity. Of course, maybe an implement or another might prove one way or another.
So far one [WIP branch](https://github.com/civicrm/civicrm-core/compare/master...demeritcowboy:civicrm-core:user-storage?expand=1) by @DaveD proposes creating `civicrm_user` with an ID, username, password and maybe email. While testing, I managed to get it working by also adding a record in the `civicrm_uf_match` table (for authx http logins), to link that user to a contact.
Presumably we would also have `civicrm_user_role` (ex: admin, staff, member) and `civicrm_user_permission` (ex: "admin" has the "Administer CiviCRM" permission).
And then we would have the same permission grid similar to what CiviCRM has for WordPress role management (in that case, it adds WordPress capabilities, but in this case, it would add records in `civicrm_user_permission`).
cc @DaveD @artfulrobot @JoeMurray
Related meta: #2998https://lab.civicrm.org/dev/core/-/issues/4052Problem with custom group fields when cache get returns NULL from 'CRM_Core_D...2024-03-18T23:41:32ZLeanderJCCProblem with custom group fields when cache get returns NULL from 'CRM_Core_DAO_CustomGroup_QueryMultipleFields *' cache keyOverview
----------------------------------------
We had a problem where we did an APIv3 call on participants where it would cause an error resulting in a 500 response.
Some stack tracing showed us that in CRM/Core/BAO/CustomGroup.php t...Overview
----------------------------------------
We had a problem where we did an APIv3 call on participants where it would cause an error resulting in a 500 response.
Some stack tracing showed us that in CRM/Core/BAO/CustomGroup.php the code `$multipleFieldGroups = $cache->get($multipleFieldGroupCacheKey);` returned NULL (line 576). Since there is no check that says that it should not be NULL the code continues and errors on `if (in_array($table, $multipleFieldGroups) &&` because
> Argument #2 ($haystack) must be of type array, null given in in_array().
Reproduction steps
----------------------------------------
Could not specifically reproduce this with a clean install.
Current behaviour
----------------------------------------
Our page where the APIv3 Participant call was made would return a 500.
```
TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 611 of /var/www/html/vendor/civicrm/civicrm-core/CRM/Core/BAO/CustomGroup.php)
#0 /var/www/html/vendor/civicrm/civicrm-core/CRM/Core/BAO/CustomGroup.php(611): in_array('civicrm_value_r...', NULL)
#1 /var/www/html/vendor/civicrm/civicrm-core/api/v3/utils.php(1449): CRM_Core_BAO_CustomGroup::getTree('Participant', Array, 1982, NULL, Array, NULL, true, NULL, true, false)
#2 /var/www/html/vendor/civicrm/civicrm-core/api/v3/Participant.php(154): _civicrm_api3_custom_data_get(Array, NULL, 'Participant', '1982', NULL)
#3 /var/www/html/vendor/civicrm/civicrm-core/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_participant_get(Array)
#4 /var/www/html/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(149): Civi\API\Provider\MagicFunctionProvider->invoke(Array)
#5 /var/www/html/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(81): Civi\API\Kernel->runRequest(Array)
#6 /var/www/html/vendor/civicrm/civicrm-core/api/api.php(133): Civi\API\Kernel->runSafe('Participant', 'get', Array)
```
Expected behaviour
----------------------------------------
The page should load as normal.
Environment information
----------------------------------------
* __CiviCRM:__ _5.55.1_
* __PHP:__ _8.0.24_
* __CMS:__ _Drupal 9.4.8_
* __Database:__ _8.0.26_
* __Web Server:__ _nginx/1.20.2_
Comments
----------------------------------------
We fixed this issue by switching to APIv4 so it would no longer automatically get the custom groups and fields for the participant, but this still seemed a general issue to report.
I believe an if, at line 578 after settings the variable, would fix this issue.
```
if ($multipleFieldGroups === NULL) {
$multipleFieldGroups = [];
}
```