? ? Pending

User tests: Successful: Unsuccessful:

avatar JamesNGarrett
JamesNGarrett
11 Feb 2023

Pull Request for Issue #39768

Summary of Changes

Allow subform field value to be an array when prepared for output. The PlgFieldsSubform->onCustomFieldsBeforePrepareField() method assumes that the subform data will be coming from the database as json, whereas the data (for contact.mail custom fields) is coming from direct from the input passed to the FieldHelpers $valuesToOverride param as an array. Hence, the change allows the json_decode to be skipped if the value is already an array.

Also removed the redundant comment ("Check if the field should be processed by us") which has already been removed from some of the other field plugins.

Testing Instructions

  1. Go to Admin > Components > Contacts > Fields and switch the context select to Mail (ie. com_contact.mail)
  2. Create a standard field, eg. text, within the mail context (set it to subform just for normalcy)
  3. Create a subform with the standard field within the mail context
  4. Add a contact
  5. Add a single contact menu item to the front end and select the contact
  6. Go to the menu item in the front end with a user that has permission to edit custom field values, eg. super admin (you can also set the field permissions to allow other groups to edit custom field values)
  7. Submit the contact form with any values in the subform

Actual result BEFORE applying this Pull Request

500 Error: json_decode(): Argument #1 ($json) must be of type string, array given
Location: JROOT/plugins/fields/subform/subform.php:128

Expected result AFTER applying this Pull Request

No error. The subform values are included in the email to the contact as html.

avatar joomla-cms-bot joomla-cms-bot - change - 11 Feb 2023
Category Front End Plugins
avatar JamesNGarrett JamesNGarrett - open - 11 Feb 2023
avatar JamesNGarrett JamesNGarrett - change - 11 Feb 2023
Status New Pending
avatar JamesNGarrett JamesNGarrett - change - 12 Feb 2023
Labels Added: ?
avatar viocassel viocassel - test_item - 15 Feb 2023 - Tested successfully
avatar viocassel
viocassel - comment - 15 Feb 2023

I have tested this item successfully on ae840fc


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39842.

avatar Quy Quy - test_item - 15 Feb 2023 - Tested successfully
avatar Quy
Quy - comment - 15 Feb 2023

I have tested this item successfully on ae840fc


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39842.

avatar Quy Quy - change - 15 Feb 2023
Status Pending Ready to Commit
avatar Quy
Quy - comment - 15 Feb 2023

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39842.

avatar laoneo laoneo - change - 17 Feb 2023
Labels Added: ?
avatar fancyFranci fancyFranci - change - 22 Feb 2023
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-02-22 17:42:10
Closed_By fancyFranci
avatar fancyFranci fancyFranci - close - 22 Feb 2023
avatar fancyFranci fancyFranci - merge - 22 Feb 2023
avatar fancyFranci
fancyFranci - comment - 22 Feb 2023

Thanks a lot!

Add a Comment

Login with GitHub to post a comment