No Code Attached Yet J3 Issue
avatar Flowman
Flowman
13 Oct 2017

Steps to reproduce the issue

If you create a component with multiple categories for example:

JHtmlSidebar::addEntry(
	JText::_('COM_HELLOWORLD_CAT1'),
	'index.php?option=com_categories&extension=com_helloworld.cat1',
	$vName == 'categories'
);
JHtmlSidebar::addEntry(
	JText::_('COM_HELLOWORLD_CAT2'),
	'index.php?option=com_categories&extension=com_helloworld.cat2',
	$vName == 'categories'
);

When Joomla\CMS\Table\Category::_getAssetParentId tries to find the parent asset it will fail as there is no com_helloworld.cat1 asset in the assets table. It should instead try to find the component asset com_helloworld.

Expected result

It should get the default ACL from the component asset.

Actual result

It get is ACL from the root asset.

System information (as much as possible)

Joomla 3.8.1
PHP 7.1.1
MySQL 5,7

Additional comments

This could easily be fixed by exploding $this->extension and only use the first part in

->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote($this->extension));

avatar Flowman Flowman - open - 13 Oct 2017
avatar joomla-cms-bot joomla-cms-bot - change - 13 Oct 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Oct 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 13 Oct 2017
Category ACL com_categories
avatar joomla-cms-bot joomla-cms-bot - edited - 13 Oct 2017
avatar brianteeman
brianteeman - comment - 16 Oct 2017

In your asset table do the two categories have a parent id?

avatar franz-wohlkoenig franz-wohlkoenig - change - 16 Oct 2017
Status New Information Required
avatar Flowman
Flowman - comment - 17 Oct 2017

They get the parent id of 1, so the root asset object.

avatar brianteeman
brianteeman - comment - 17 Oct 2017

So thats the problem - you need to give them the parent id of the component. See the assets for com_content for an example

avatar Flowman
Flowman - comment - 17 Oct 2017

Every time you save it, it reset to the root asset as it cannot find the component as the parent.

You need to understand its not like the com_content as com_content does not use two categories in one component.

Check the code in Joomla\CMS\Table\Category::_getAssetParentId and you will understand the problem.

As there is no com_helloworld.cat2 in the asset table it will always fallback to the root asset.

Even com_fields have fixed this

protected function _getAssetParentId(JTable $table = null, $id = null)

avatar franz-wohlkoenig franz-wohlkoenig - change - 22 Oct 2017
Status Information Required Discussion
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar jwaisner jwaisner - change - 11 Mar 2020
Status Discussion Information Required
avatar jwaisner
jwaisner - comment - 11 Mar 2020

@Flowman Can you please confirm this still exists in J3?

avatar Flowman
Flowman - comment - 12 Mar 2020

@jwaisner yes and I guess I will have to do a one liner pull request for it if none else has time to do it.

avatar Bakual
Bakual - comment - 12 Mar 2020

@Flowman If you know the solution, then plwase yes. Do a PR. That's exactly how things get fixed around here 😀

avatar brianteeman
brianteeman - comment - 23 Aug 2022

Thank you for raising this issue.

Joomla 3 is now in security only mode with no further bug fixes or new features.

As this issue doesn't relate to Joomla 4 it will now been closed.

If we are mistaken and this does apply to Joomla 4 please open a new issue (and reference this one if you wish) with updated details for testing in Joomla 4.
cc @zero-24

avatar zero-24 zero-24 - change - 23 Aug 2022
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2022-08-23 13:47:58
Closed_By zero-24
Labels Added: No Code Attached Yet
Removed: ?
avatar zero-24 zero-24 - close - 23 Aug 2022

Add a Comment

Login with GitHub to post a comment