Release Blocker bug PR-6.0-dev Pending

User tests: Successful: Unsuccessful:

avatar rdeutz
rdeutz
2 Oct 2025

Pull Request for Issue #46211 and #46213.

Summary of Changes

Custom field data is not part of the item data we get from getItem(), we get this data from the form. I have added form handeling into the prozess to decide if the data has changed and what is the currently used version.

Testing Instructions

Check the issues for instructions

Actual result BEFORE applying this Pull Request

Not expected behaviour

Expected result AFTER applying this Pull Request

Works as expected.

avatar rdeutz rdeutz - open - 2 Oct 2025
avatar rdeutz rdeutz - change - 2 Oct 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Oct 2025
Category Administration com_content com_contenthistory Libraries
avatar richard67 richard67 - change - 2 Oct 2025
Title
[6.0] Fix custom fields handeling
[6.0] Fix custom fields handling
avatar richard67 richard67 - edited - 2 Oct 2025
avatar tecpromotion tecpromotion - test_item - 2 Oct 2025 - Tested successfully
avatar tecpromotion
tecpromotion - comment - 2 Oct 2025

I have tested this item ✅ successfully on fd764b5

In general, it now works as expected.

What is not displayed is the star in the current version when I only change custom field values.
2025-10-02_19-41-38

However, if I change something in the content or the alt text of the intro image, I get a star in the current entry.
2025-10-02_19-42-24


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46221.
avatar softforge
softforge - comment - 2 Oct 2025

I will try and get some more tests on this tomorrow at jd nl. Thank you for your prompt action @rdeutz and @tecpromotion for testing

avatar cyrez
cyrez - comment - 3 Oct 2025

So, i've tested, but an issue.

Info: tested by applying this patch only on a 6.0.0-rc1 install.

If i only edit custom field, and click on Save, the new value is not stored in history com_fields and no star next to last store.
If i click again on save, without other change, then the star is displayed and the custom field is stored.

i've found a way to make it work, but needs review to check if it's the best way, as issue is the new hash with com_fields is not stored in the item on first save.

i've added your code form HistoryModel and adapted it in libraries/src/Versioning/VersionableModelTrait.php after line 380 in storeHistory()

This way, the hash is updated in $item on save with custom fields included in the hash.

        $model = Factory::getApplication()->bootComponent($extension)->getMVCFactory()->createModel($type, 'Administrator');

        if ($model instanceof VersionableModelInterface) {
            $path = JPATH_BASE . '/components/' . $extension;

            Form::addFormPath($path . '/forms');
            Form::addFormPath($path . '/models/forms');
            Form::addFieldPath($path . '/models/fields');
            Form::addFormPath($path . '/model/form');
            Form::addFieldPath($path . '/model/field');

            // This is needed to make sure the model has called populateState
            $tmp = $model->getState();

            // Now we can set the article.id and it is not overwritten later by populateState
            $model->setState('article.id', $id);

            $item   = $model->getItem();
            $form   = $model->getForm();

            $cf = $form->getData()->get('com_fields', null);

            if (!empty($cf)) {
                $item->com_fields = $cf;
            }

            $hash = $model->getSha1($item);
        }

And now, it's working prefectly.

The star is present as well.

avatar RickR2H
RickR2H - comment - 4 Oct 2025

@RobertDeutz I'm testing this PR and I noticed this behavior which is probably not correct.

I create an article and a custom field and add content to both and save
Next create a new custom field, open the same article, fill a value in the new custom field and save.
If I the go back to the version which did not have the second custom field, the value of the second custom field will still be there.
It probably should be empty as the field was not there before.

avatar rdeutz rdeutz - change - 4 Oct 2025
Labels Added: Release Blocker bug PR-6.0-dev
avatar rdeutz
rdeutz - comment - 4 Oct 2025

@RickR2H good finding, I am not sure if this is a bug. There might be arguments to say not existing is not the same as empty. I will not change it for now. I want to hear some more ideas what is the expected behaivour.

avatar rdeutz
rdeutz - comment - 4 Oct 2025

I have added the suggestion from @cyrez. retest would be great.

avatar RickR2H
RickR2H - comment - 4 Oct 2025

@RickR2H good finding, I am not sure if this is a bug. There might be arguments to say not existing is not the same as empty. I will not change it for now. I want to hear some more ideas what is the expected behaivour.

Thanks @RobertDeutz I'll ignore the behavior for now as I get that it's not clear in what the behavior should be.

avatar RickR2H RickR2H - test_item - 4 Oct 2025 - Tested successfully
avatar RickR2H
RickR2H - comment - 4 Oct 2025

I have tested this item ✅ successfully on 11989e3

The star is now working when a custom field value is changed. Values are present in history table.


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

avatar cyrez
cyrez - comment - 4 Oct 2025

I have added the suggestion from @cyrez. retest would be great.

I realize that in my version, i've added use Joomla\CMS\Versioning\VersionableModelInterface; in libraries/src/Versioning/VersionableModelTrait.php but it seems not needed when VersionableModelTrait is called from the librairie... Good to know.

@RobertDeutz I'm testing this PR and I noticed this behavior which is probably not correct.

I create an article and a custom field and add content to both and save Next create a new custom field, open the same article, fill a value in the new custom field and save. If I the go back to the version which did not have the second custom field, the value of the second custom field will still be there. It probably should be empty as the field was not there before.

It seems to me that with update PR, this issue is fixed as well? At least, i don't have it.

avatar cyrez cyrez - test_item - 4 Oct 2025 - Tested successfully
avatar cyrez
cyrez - comment - 4 Oct 2025

I have tested this item ✅ successfully on 11989e3

Updated PR is working fine!

Thanks @rdeutz


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

avatar RickR2H RickR2H - change - 4 Oct 2025
Status Pending Ready to Commit
avatar RickR2H
RickR2H - comment - 4 Oct 2025

RTC


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

avatar tecpromotion tecpromotion - test_item - 4 Oct 2025 - Tested successfully
avatar tecpromotion
tecpromotion - comment - 4 Oct 2025

I have tested this item ✅ successfully on 11989e3


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

Add a Comment

Login with GitHub to post a comment