Development issueshttps://lab.civicrm.org/groups/dev/-/issues2024-02-23T15:32:47Zhttps://lab.civicrm.org/dev/core/-/issues/4975FormBuilder: Case Status field shows disabled statuses2024-02-23T15:32:47ZnoahFormBuilder: Case Status field shows disabled statusesThe Case Type admin screen (e.g. civicrm/a/#/caseType/1) allows you to disable some case statuses for a given case type.
When you create a Case submission form in FormBuilder, and add the Case Status field to the form, all case statuses...The Case Type admin screen (e.g. civicrm/a/#/caseType/1) allows you to disable some case statuses for a given case type.
When you create a Case submission form in FormBuilder, and add the Case Status field to the form, all case statuses are available in the resulting widget, regardless of whether they're enabled for the case type.
You can manually remove some of the status options, but they won't stay in sync with the Case Type admin screen.https://lab.civicrm.org/dev/core/-/issues/3128Cases dashlet sometimes gives error when sort by subject2023-12-04T13:49:19ZDaveDCases dashlet sometimes gives error when sort by subjectPulling this out from https://lab.civicrm.org/dev/core/-/issues/1624 as a separate issue.
_Sometimes_, sorting by the subject on a cases dashlet will give a datatables error. The actual error if you look at the network response is `Colu...Pulling this out from https://lab.civicrm.org/dev/core/-/issues/1624 as a separate issue.
_Sometimes_, sorting by the subject on a cases dashlet will give a datatables error. The actual error if you look at the network response is `Column 'subject' in order clause is ambiguous`.
```
Error Field Error Value
Type DB_Error
Code -1
Message DB Error: unknown error
Mode 16
UserInfo SELECT civicrm_case.id as case_id, civicrm_case.subject as case_subject, civicrm_contact.id as contact_id, civicrm_contact.sort_name as sort_name, civicrm_phone.phone as phone, civicrm_contact.contact_type as contact_type, civicrm_contact.contact_sub_type as contact_sub_type, t_act.activity_type_id as activity_type_id, civicrm_case.case_type_id as case_type_id, civicrm_case.status_id as case_status_id, t_act.status_id as status_id, civicrm_case.start_date as case_start_date, GROUP_CONCAT(DISTINCT IF(case_relationship.contact_id_b = 2, case_relation_type.label_a_b, case_relation_type.label_b_a) SEPARATOR ', ') as case_role, t_act.activity_date_time as activity_date_time, t_act.id as activity_id, case_status.label AS case_status, civicrm_case_type.title AS case_type FROM civicrm_case INNER JOIN civicrm_case_contact ON civicrm_case.id = civicrm_case_contact.case_id INNER JOIN civicrm_contact ON civicrm_case_contact.contact_id = civicrm_contact.id LEFT JOIN civicrm_case_type ON civicrm_case.case_type_id = civicrm_case_type.id LEFT JOIN civicrm_option_group option_group_case_status ON ( option_group_case_status.name = 'case_status' ) LEFT JOIN civicrm_option_value case_status ON ( civicrm_case.status_id = case_status.value AND option_group_case_status.id = case_status.option_group_id ) LEFT JOIN civicrm_case_activity ca4 ON civicrm_case.id = ca4.case_id LEFT JOIN civicrm_activity t_act ON t_act.id = ca4.activity_id AND t_act.is_current_revision = 1 LEFT JOIN civicrm_phone ON civicrm_phone.contact_id = civicrm_contact.id AND civicrm_phone.is_primary = 1 LEFT JOIN civicrm_relationship case_relationship ON ((case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = 2) OR (case_relationship.contact_id_b = civicrm_case_contact.contact_id AND case_relationship.contact_id_a = 2)) AND case_relationship.is_active AND case_relationship.case_id = civicrm_case.id LEFT JOIN civicrm_relationship_type case_relation_type ON case_relation_type.id = case_relationship.relationship_type_id AND case_relation_type.id = case_relationship.relationship_type_id WHERE (1) AND civicrm_case.is_deleted = 0 AND civicrm_contact.is_deleted <> 1 AND (case_relationship.contact_id_b = 2 OR case_relationship.contact_id_a = 2) AND case_relationship.is_active AND civicrm_case.status_id IN (1,3) GROUP BY case_id ORDER BY subject asc LIMIT 0, 10 [nativecode=1052 ** Column 'subject' in order clause is ambiguous]
DebugInfo SELECT civicrm_case.id as case_id, civicrm_case.subject as case_subject, civicrm_contact.id as contact_id, civicrm_contact.sort_name as sort_name, civicrm_phone.phone as phone, civicrm_contact.contact_type as contact_type, civicrm_contact.contact_sub_type as contact_sub_type, t_act.activity_type_id as activity_type_id, civicrm_case.case_type_id as case_type_id, civicrm_case.status_id as case_status_id, t_act.status_id as status_id, civicrm_case.start_date as case_start_date, GROUP_CONCAT(DISTINCT IF(case_relationship.contact_id_b = 2, case_relation_type.label_a_b, case_relation_type.label_b_a) SEPARATOR ', ') as case_role, t_act.activity_date_time as activity_date_time, t_act.id as activity_id, case_status.label AS case_status, civicrm_case_type.title AS case_type FROM civicrm_case INNER JOIN civicrm_case_contact ON civicrm_case.id = civicrm_case_contact.case_id INNER JOIN civicrm_contact ON civicrm_case_contact.contact_id = civicrm_contact.id LEFT JOIN civicrm_case_type ON civicrm_case.case_type_id = civicrm_case_type.id LEFT JOIN civicrm_option_group option_group_case_status ON ( option_group_case_status.name = 'case_status' ) LEFT JOIN civicrm_option_value case_status ON ( civicrm_case.status_id = case_status.value AND option_group_case_status.id = case_status.option_group_id ) LEFT JOIN civicrm_case_activity ca4 ON civicrm_case.id = ca4.case_id LEFT JOIN civicrm_activity t_act ON t_act.id = ca4.activity_id AND t_act.is_current_revision = 1 LEFT JOIN civicrm_phone ON civicrm_phone.contact_id = civicrm_contact.id AND civicrm_phone.is_primary = 1 LEFT JOIN civicrm_relationship case_relationship ON ((case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = 2) OR (case_relationship.contact_id_b = civicrm_case_contact.contact_id AND case_relationship.contact_id_a = 2)) AND case_relationship.is_active AND case_relationship.case_id = civicrm_case.id LEFT JOIN civicrm_relationship_type case_relation_type ON case_relation_type.id = case_relationship.relationship_type_id AND case_relation_type.id = case_relationship.relationship_type_id WHERE (1) AND civicrm_case.is_deleted = 0 AND civicrm_contact.is_deleted <> 1 AND (case_relationship.contact_id_b = 2 OR case_relationship.contact_id_a = 2) AND case_relationship.is_active AND civicrm_case.status_id IN (1,3) GROUP BY case_id ORDER BY subject asc LIMIT 0, 10 [nativecode=1052 ** Column 'subject' in order clause is ambiguous]
PEAR_Exception: DB Error: unknown error in ...\sites\all\modules\civicrm\vendor\pear\pear-core-minimal\src\PEAR.php on line 922
- DB_Error: DB Error: unknown error in unknown on line unknown
Exception trace
# Function Location
0 CRM_Core_Error::exceptionHandler(Object(DB_Error)) ...\sites\all\modules\civicrm\vendor\pear\pear-core-minimal\src\PEAR.php:922
1 PEAR_Error->__construct('DB Error: unknow…', -1, 16, Array, 'SELECT civicrm_c…') ...\sites\all\modules\civicrm\vendor\pear\db\DB.php:997
2 DB_Error->__construct(-1, 16, Array, 'SELECT civicrm_c…') ...\sites\all\modules\civicrm\vendor\pear\pear-core-minimal\src\PEAR.php:575
3 PEAR::_raiseError(Object(DB_mysqli), null, -1, 16, Array, 'SELECT civicrm_c…', 'DB_Error', true) ...\sites\all\modules\civicrm\vendor\pear\pear-core-minimal\src\PEAR.php:223
4 PEAR->__call('raiseError', Array) ...\sites\all\modules\civicrm\vendor\pear\db\DB\common.php:1928
5 DB_common->raiseError(-1, null, null, 'SELECT civicrm_c…', '1052 ** Column '…') ...\sites\all\modules\civicrm\vendor\pear\db\DB\mysqli.php:936
6 DB_mysqli->mysqliRaiseError() ...\sites\all\modules\civicrm\vendor\pear\db\DB\mysqli.php:406
7 DB_mysqli->simpleQuery('SELECT civicrm_c…') ...\sites\all\modules\civicrm\vendor\pear\db\DB\common.php:1234
8 DB_common->query('SELECT civicrm_c…') ...\sites\all\modules\civicrm\packages\DB\DataObject.php:2696
9 DB_DataObject->_query('SELECT civicrm_c…') ...\sites\all\modules\civicrm\packages\DB\DataObject.php:1829
10 DB_DataObject->query('SELECT civicrm_c…') ...\sites\all\modules\civicrm\CRM\Core\DAO.php:472
11 CRM_Core_DAO->query('SELECT civicrm_c…', true) ...\sites\all\modules\civicrm\CRM\Core\DAO.php:1637
12 CRM_Core_DAO::executeQuery('SELECT civicrm_c…') ...\sites\all\modules\civicrm\CRM\Case\BAO\Case.php:583
13 CRM_Case_BAO_Case::getCases(false, Array) ...\sites\all\modules\civicrm\CRM\Case\Page\AJAX.php:186
14 CRM_Case_Page_AJAX::getCases() ...\sites\all\modules\civicrm\CRM\Core\Invoke.php:285
15 CRM_Core_Invoke::runItem(Array) ...\sites\all\modules\civicrm\CRM\Core\Invoke.php:69
16 CRM_Core_Invoke::_invoke(Array) ...\sites\all\modules\civicrm\CRM\Core\Invoke.php:36
17 CRM_Core_Invoke::invoke(Array) ...\sites\all\modules\civicrm\drupal\civicrm.module:471
18 civicrm_invoke('ajax', 'get-cases') ...\includes\menu.inc:527
19 menu_execute_active_handler() ...\index.php:21
20 {main}
Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.
DB Error: unknown error
```https://lab.civicrm.org/dev/core/-/issues/3145CiviCase: if contact is an Organization or Household, cannot change Case Coor...2023-11-23T13:15:30ZAllenShawCiviCase: if contact is an Organization or Household, cannot change Case Coordinator (or, must edit Case Coordinator relationship type)# To reproduced on https://dmaster.demo.civicrm.org/ as of today ("Powered by CiviCRM 5.49.alpha1"):
1. Observe that the Homeless Services Coordinator role is defined as in a default installation (contact a type and contact b type are b...# To reproduced on https://dmaster.demo.civicrm.org/ as of today ("Powered by CiviCRM 5.49.alpha1"):
1. Observe that the Homeless Services Coordinator role is defined as in a default installation (contact a type and contact b type are both 'individual')
2. Create a new "Housing Support" case with an Organization contact for the Client.
3. Open Manage Case page for this case
4. Under Roles accordion, click the pencil icon to edit the "Homeless Services Coordinator is (Case Manager)" role
5. Observe pop-up overlay "Reassign Homeless Services Coordinator" where you would select an individual for this role
5. At this point:
* Expected behavior: This pop-up contains a contact reference field allowing me to type a contact name or email address
* Actual behavior: This pop-up may be displayed partially outside of the viewport, with no way to scroll to see all of it; in any case, you can see -- if you're able to use Developer Tools to make the thing display within the viewport -- that the expected contact reference field is just a plain text field; also the Save and Cancel buttons are non-functional, and the only thing I can do is to click the X control to close the pop-up:
![popup](/uploads/92a2aa68c67897f1da5b8ee4ee3e2a7d/popup.png)
# Workaround
1. Edit the Homeless Services Coordinator role to allow Organizations in the Contact A position.
2. Repease the repro steps above and observe expected behavior.
# Other thoughts:
* Testing on client sites indicates his is not limited to the "Homeless Services Coordinator" relationship type; instead, it's happening for any relationship type which is confiugured as the type for the Case Coordinator role.
* Not sure about how best to design a fix from the UX perspective. Prevent case creation? Warn in System Status?https://lab.civicrm.org/dev/core/-/issues/4749PHP8 Fatal error when adding files on Case custom field2023-11-08T20:40:37ZPradeep Nayakpradpnayak@gmail.comPHP8 Fatal error when adding files on Case custom fieldReplicated on https://dmaster.demo.civicrm.org/civicrm/case/cd/edit?cgcount=1&action=update&reset=1&type=Case&entityID=1&groupID=4&cid=160&subType=1
Error:
TypeError: strtolower(): Argument #1 ($string) must be of type string, array giv...Replicated on https://dmaster.demo.civicrm.org/civicrm/case/cd/edit?cgcount=1&action=update&reset=1&type=Case&entityID=1&groupID=4&cid=160&subType=1
Error:
TypeError: strtolower(): Argument #1 ($string) must be of type string, array given in strtolower() (line 1423 of /srv/buildkit/build/dmaster/web/sites/all/modules/civicrm/CRM/Core/DAO.php).
Steps to replicate:
1. Create custom sets for case, add file type custom field.
2. Create a case
3. On manage case screen, click on Edit button under custom group set, and try to upload a file
File is uploaded but system throws fatal error.
Backtrace:
````
#0 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Core/DAO.php(1418): CRM_Core_Error::backtrace()
#1 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Core/BAO/CustomField.php(1323): CRM_Core_DAO::getFieldValue("CRM_Core_DAO_File", (Array:2), "id", "uri")
#2 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Core/BAO/CustomField.php(1193): CRM_Core_BAO_CustomField::formatDisplayValue((Array:2), (Array:45), 100025185)
#3 /var/sites//drupal10/vendor/civicrm/civicrm-core/api/v3/CustomValue.php(425): CRM_Core_BAO_CustomField::displayValue((Array:2), Object(CRM_Core_BAO_CustomField), 100025185)
#4 /var/sites//drupal10/vendor/civicrm/civicrm-core/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_custom_value_getdisplayvalue((Array:4))
#5 /var/sites//drupal10/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(158): Civi\API\Provider\MagicFunctionProvider->invoke((Array:8))
#6 /var/sites//drupal10/vendor/civicrm/civicrm-core/Civi/API/Kernel.php(81): Civi\API\Kernel->runRequest((Array:8))
#7 /var/sites//drupal10/vendor/civicrm/civicrm-core/api/api.php(133): Civi\API\Kernel->runSafe("CustomValue", "getdisplayvalue", (Array:4))
#8 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Case/Form/CustomData.php(184): civicrm_api3("CustomValue", "getdisplayvalue", (Array:4))
#9 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Case/Form/CustomData.php(127): CRM_Case_Form_CustomData->formatCustomDataChangesForDetail((Array:20))
#10 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Core/Form.php(624): CRM_Case_Form_CustomData->postProcess()
#11 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Upload.php(153): CRM_Core_Form->mainProcess()
#12 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Upload.php(120): CRM_Core_QuickForm_Action_Upload->realPerform(Object(CRM_Case_Form_CustomData), "upload")
#13 /var/sites//drupal10/vendor/civicrm/civicrm-packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Case_Form_CustomData), "upload")
#14 /var/sites//drupal10/vendor/civicrm/civicrm-packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Case_Form_CustomData), "upload")
#15 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle("upload")
#16 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Utils/Wrapper.php(98): CRM_Core_Controller->run()
#17 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(292): CRM_Utils_Wrapper->run("CRM_Case_Form_CustomData", "Case Custom Set", (Array:0))
#18 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem((Array:18))
#19 /var/sites//drupal10/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:4))
#20 /var/sites//drupal10/web/modules/contrib/civicrm/src/Civicrm.php(88): CRM_Core_Invoke::invoke((Array:4))
#21 /var/sites//drupal10/web/modules/contrib/civicrm/src/Controller/CivicrmController.php(83): Drupal\civicrm\Civicrm->invoke((Array:4))
#22 [internal function](): Drupal\civicrm\Controller\CivicrmController->main((Array:4), "")
#23 /var/sites//drupal10/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array((Array:2), (Array:2))
#24 /var/sites//drupal10/web/core/lib/Drupal/Core/Render/Renderer.php(592): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#25 /var/sites//drupal10/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#26 /var/sites//drupal10/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext((Array:2), (Array:2))
#27 /var/sites//drupal10/vendor/symfony/http-kernel/HttpKernel.php(182): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#28 /var/sites//drupal10/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#29 /var/sites//drupal10/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE)
#30 /var/sites//drupal10/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE)
#31 /var/sites//drupal10/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE)
#32 /var/sites//drupal10/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE)
#33 /var/sites//drupal10/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE)
#34 /var/sites//drupal10/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE)
#35 /var/sites//drupal10/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE)
#36 /var/sites//drupal10/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE)
#37 /var/sites//drupal10/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#38 {main
````
API params for getdisplayvalue
````
Array ( [custom_field_id] => 30 [entity_id] => 100025185 [custom_field_value] => Array ( [id] => 201 [data] => ) )
````https://lab.civicrm.org/dev/core/-/issues/1948Print Report from Manage Case shows relationships from client's other cases2023-07-03T18:38:08ZDaveDPrint Report from Manage Case shows relationships from client's other casesNot sure yet when it started.
1. Create two cases for a client with different case managers assigned.
2. Click on Print Report on Manage Case for either case.
3. It lists the case manager from the other case in the Client Relationships ...Not sure yet when it started.
1. Create two cases for a client with different case managers assigned.
2. Click on Print Report on Manage Case for either case.
3. It lists the case manager from the other case in the Client Relationships section.https://lab.civicrm.org/dev/core/-/issues/2074Case activity assignees receive an email copy every time activity is edited2023-05-16T12:45:13ZDaveDCase activity assignees receive an email copy every time activity is editedNot sure yet when this changed. It used to only send newly added assignees an email. Investigating...Not sure yet when this changed. It used to only send newly added assignees an email. Investigating...https://lab.civicrm.org/dev/core/-/issues/1542Force urls for case tagset searches don't fill in the field on the search form2023-04-08T19:12:10ZDaveDForce urls for case tagset searches don't fill in the field on the search formI'm not sure this ever worked since I think it was part of the slew of changes for force url searches. The search itself works, but the field on the form doesn't get filled in. It works as expected for bare case tags, just not case tagse...I'm not sure this ever worked since I think it was part of the slew of changes for force url searches. The search itself works, but the field on the form doesn't get filled in. It works as expected for bare case tags, just not case tagsets.
1. Add a tagset for cases with some tags in it. (Not a bare tag, but a tag set.)
2. Create some cases that use it. Or not - it doesn't really matter to show what's wrong on the form, just if you wanted to see that the search itself is working.
3. Visit a url like https://dmaster.demo.civicrm.org/civicrm/case/search?reset=1&force=1&case_tags=4, where 4 is the id of one of the tags you created.
4. On the search form, you'd expect to see the tagset field filled in with the search parameter value but it's blank. The wordy output and results are correct.https://lab.civicrm.org/dev/core/-/issues/1793Using the schedule activity section at the bottom of an email sent from manag...2023-03-31T15:00:28ZDaveDUsing the schedule activity section at the bottom of an email sent from manage case doesn't file the scheduled activity on the caseNot so much a bug it's just my expectation would be that if I'm sending an email from manage case I'd expect the scheduled followup to also be filed on the case.
1. Go to the manage case screen for a case.
2. Expand the roles section.
3...Not so much a bug it's just my expectation would be that if I'm sending an email from manage case I'd expect the scheduled followup to also be filed on the case.
1. Go to the manage case screen for a case.
2. Expand the roles section.
3. Click the email icon to start an email to one of the people there.
4. Fill it out.
5. At the bottom expand the schedule followup section.
6. Fill it out. Can leave assignee blank it's not relevant.
7. Send the email.
8. Look at the activities on manage case - the scheduled activity is not there. Where is it? It's on the logged in user's contact on their activities tab (and the email recipient's activities tab).
Using the scheduled followup section when editing a case activity does file it on the case. So this is a little inconsistent.https://lab.civicrm.org/dev/core/-/issues/2669Target contact missing for automatically generated case activities2023-02-23T16:00:45ZAndreasandreas.howiller@civiservice.deTarget contact missing for automatically generated case activitiesOverview
----------------------------------------
Some actions on cases leave automatically generated activities in the case activity log, but have no target contacts. Examples: Change case title, change case tags. As a result, they cann...Overview
----------------------------------------
Some actions on cases leave automatically generated activities in the case activity log, but have no target contacts. Examples: Change case title, change case tags. As a result, they cannot be edited through the user interface. While this is a minor issue, some users may want to leave notes about the activity (for example, why they changed a case title) and therefore need to edit it.
Reproduction steps
----------------------------------------
1. Open any case in CiviCRM and change the case title.
2. Tap edit for the corresponding activity in the activity timeline.
3. Tap save.
Current behaviour
----------------------------------------
The dialog will freeze while the CiviCRM logo keeps turning. A fatal error "DB Error: constraint violation" will be filed in the logs.
If you add any contact as a target contact in the database or in the edit screen the error won't appear anymore.
What is confusing, too: When editing the activity the client contact already wrongly shows up as target contact in this dialog and if you'd like to change it there you need to search the contact (the link to choose the client contact below the search field won't do the change here).
Expected behaviour
----------------------------------------
The Client contact is filed as target contact by default and connected problems disappear. E.g. editable activities can be saved after edit through UI now.
Environment information
----------------------------------------
* __CiviCRM:__ _5.35.2_ and _5.38.0_
* __CMS:__ _WordPress 5.7.2_https://lab.civicrm.org/dev/core/-/issues/1116Changing a civicase activity's label breaks the max_instances check2023-02-23T14:16:28ZDaveDChanging a civicase activity's label breaks the max_instances check1. Configure a case type so that some activity type (other than open case) has a max_instances set.
2. Create a case.
3. Change the activity type's label.
4. On manage case, create a second activity of that type.
5. You should get the ma...1. Configure a case type so that some activity type (other than open case) has a max_instances set.
2. Create a case.
3. Change the activity type's label.
4. On manage case, create a second activity of that type.
5. You should get the max_instances warning but it doesn't.https://lab.civicrm.org/dev/core/-/issues/4078Mass SMS with many Contacts causes slow loading of Manage Case screen for ACL...2023-01-12T10:02:37ZjhungerfordMass SMS with many Contacts causes slow loading of Manage Case screen for ACL usersOverview
----------------------------------------
The combination of Mass SMS Activities with many recipients, and ACL access to Contacts for Users who do not have "view/edit all contacts", causes very long loading times for Manage Case ...Overview
----------------------------------------
The combination of Mass SMS Activities with many recipients, and ACL access to Contacts for Users who do not have "view/edit all contacts", causes very long loading times for Manage Case screens.
Mass SMS Activities apply to Contacts, not Cases. Due to the way the `$params` are converted to `$activityParams`, the `$case_id` is never passed to the final API call. This means that non-Case Activities go through permission checks when loading the Manage Case screen. These ACL checks can take quite a long time (e.g. 30 Mass SMS Activities with 2k recipients each means 60k ACL permission checks).
Bulk Email Activities are handled differently (possibly to avoid this type of issue). Changing the Activity Type from Mass SMS to Bulk Email with an SQL query provides a workaround, but not a great solution.
Reproduction steps
----------------------------------------
1. Set up ACL access to Contacts, so a User does not have "view all contacts" or "edit all contacts", but has ACL access to view and edit (at least some) Contacts
2. Enable CiviCase
3. Create a Case for a Contact who can be accessed by the ACL user
4. Create a few (dozen) Mass SMS Activities with thousands of Contacts including the Contact from step 3
5. Log in as the ACL user from step 1
6. Load the Manage Case screen for the Case from step 3
7. Observe that it takes longer than normal
8. Set is_deleted=1 or change the Activity Type to Bulk Email for all Activities created in step 4
9. Load the Manage Case screen again, and observe that it's much faster
Current behaviour
----------------------------------------
Most of the time is spent inside the `controller->run()` call here:
https://lab.civicrm.org/dev/core/-/blob/5.57.0/CRM/Case/Page/Tab.php#L98-112
That whole block can actually be removed, and superficially the page appears to work (without the speed issues), though I haven't tested much. Just noting that it doesn't have any immediately obvious effect on the page.
Looking into why it takes so long, I think it relates to the parameters prepared by this getActivites call:
https://lab.civicrm.org/dev/core/-/blob/5.57.0/CRM/Activity/BAO/Activity.php#L579-583
At that point, `$params["caseId"]` contains an integer. However, it doesn't make it into `$activityParams`. If you observe what happens here, I think `$activityParams["case_id"]` will always contain `['IS NULL' => 1]`.
https://lab.civicrm.org/dev/core/-/blob/5.57.0/CRM/Activity/BAO/Activity.php#L2287-2291
Since `self::activityComponents()` is called without arguments, it will never contain CiviCase:
https://lab.civicrm.org/dev/core/-/blob/5.57.0/CRM/Activity/BAO/Activity.php#L851-861
The comment "In practice this means should we include CiviCase in the results" seems to imply the reverse, but stepping through `activityComponents()` in the debugger, I see:
`$compInfo["CiviCase"]->info["showActivitiesInCore"] = (bool) 0`
Even if CiviCase were included in the results though, the case ID would not make its way from `$params` into `$activityParams`:
https://lab.civicrm.org/dev/core/-/blob/5.57.0/CRM/Activity/BAO/Activity.php#L2289-2291
The end result of all of this is that the controller is checking permissions for every Activity relating to this contact, not just the ones which will be displayed on the Case. When each Activity has thousands of Contacts (as with Mass SMS), these checks become very slow.
Also, the Activities section of the Manage Case screen seems to be populated by a subsequent process. Removing this controller has no obvious effect (except reducing the loading time), raising the question of whether it's needed at all.
Expected behaviour
----------------------------------------
Mass SMS Activities with many contacts should not slow down the loading of Manage Case screens (noting that a Mass SMS cannot be applied to a Case, only to a Contact).
Environment information
----------------------------------------
* __Browser:__ Chromium Version 108.0.5359.124 (Official Build) Arch Linux (64-bit)
* __CiviCRM:__ 5.57.0
* __PHP:__ 7.4
* __CMS:__ Drupal 7.92
* __Database:__ mysql Ver 15.1 Distrib 10.5.18-MariaDB
* __Web Server:__ Apache 2.4https://lab.civicrm.org/dev/core/-/issues/1275Batch update for cases gives a warning and then fatal error if only one case ...2022-09-20T11:04:16ZDaveDBatch update for cases gives a warning and then fatal error if only one case is in the listI also see this on dmaster.demo, and I'm still trying to see the exact triggers to reproduce and when it started, but what seems to be a consistent one is:
1. First set up a profile that has a case field in it, e.g. a profile that just ...I also see this on dmaster.demo, and I'm still trying to see the exact triggers to reproduce and when it started, but what seems to be a consistent one is:
1. First set up a profile that has a case field in it, e.g. a profile that just has case status.
2. Do a find cases that results in only one search result.
3. Select it and choose update multiple cases from the actions dropdown.
4. You'll get a warning like `Notice: Undefined property: CRM_Core_DAO::$case_id in CRM_Core_Form_Task::preProcessCommon() (line 139 of /srv/buildkit/build/dmaster/web/sites/all/modules/civicrm/CRM/Core/Form/Task.php)`.
5. If you continue and select your profile, you then get a fatal error where it's obvious the problem is that it wasn't able to obtain the case id (the `IN ()` part):
```
[message] => DB Error: syntax error
[mode] => 16
[debug_info] =>
SELECT contact.id as contactId, civicrm_case.id as componentId, contact.sort_name as sort_name, email as email
FROM civicrm_case as civicrm_case
INNER JOIN civicrm_case_contact ccs ON (ccs.case_id = civicrm_case.id)
INNER JOIN civicrm_contact contact ON ( contact.id = ccs.contact_id ) LEFT JOIN civicrm_email email ON ( contact.id = email.contact_id AND email.is_primary = 1 )
WHERE civicrm_case.id IN ()
GROUP BY civicrm_case.id, contact.id
```https://lab.civicrm.org/dev/core/-/issues/2899DB error on updating multiple cases from the search form2022-09-20T10:50:03ZjitendraDB error on updating multiple cases from the search formTo replicate -
1. Navigate to https://dmaster.demo.civicrm.org/civicrm/case/search?reset=1
2. Search for cases. Select all results (ts_all radio button) => Update multiple cases action
![image](/uploads/fcbb716228f064c5cde2f8231a534e15...To replicate -
1. Navigate to https://dmaster.demo.civicrm.org/civicrm/case/search?reset=1
2. Search for cases. Select all results (ts_all radio button) => Update multiple cases action
![image](/uploads/fcbb716228f064c5cde2f8231a534e15/image.png)
3. Select Profile on the next step and hit Continue;
![image](/uploads/cb5fb171efd98f5014e5c822f367f717/image.png)