Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPS-166: Fix case settings #464

Merged
merged 4 commits into from
May 13, 2020
Merged

CPS-166: Fix case settings #464

merged 4 commits into from
May 13, 2020

Conversation

reneolivo
Copy link
Member

Overview

This PR fixes a regression issue that was introduced after we upgraded to a new CiviCRM version.

The Webform URL fields stopped showing and hiding when they were enabled or disabled for a particular case category.

Before

gif

After

gif

Technical Details

As pointed by @tunbola, this core PR made it possible to automatically append settings to the form without having to alter the template of the admin.

The upgrade of CiviCRM version also updated the admin settings page, and the path that we were relying on was updated and we were not able to add the manual fields and the script needed to hide and show them. This is the only reason why the fields were not duplicated.

To take advantage of the new behaviour introduced by core and to fix the issue, the following changes have been made:

  • We removed the alterContent hook to add custom fields. We don't need to alter the form in order to display our custom fields and this is unreliable in case the form's HTML structure changed.
  • The script that was used to hide and show the webform URL fields was moved to a standalone JS file. We also modified the script so we didn't need to rely on passing the whole settings object to the FE. Now we append the case category to both, the toggle field, and the webform URL field (see CRM/Civicase/Service/CaseCategorySetting.php) and we use this information to toggle the visibility of the corresponding field.
  • We still need to update the form to add the CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME data to each one of the custom fields we are appending. Instead of adding a new line each time we create a new field we have made it so that the list of settings is read from the settings/CiviCase.setting.php and for each one of them we add this required value.

@reneolivo reneolivo added enhancement New feature or request regression regression labels May 13, 2020
Copy link

@tunbola tunbola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@reneolivo reneolivo merged commit d02788a into master May 13, 2020
@deb1990 deb1990 deleted the CPS-166-fix-case-settings branch June 3, 2020 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request regression regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants