Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions administrator/components/com_tags/src/Table/TagTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ public function store($updateNulls = true)

// Verify that the alias is unique
$table = new static($this->getDbo());

if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) {
if (
$table->load(array('alias' => $this->alias, 'parent_id' => (int) $this->parent_id))
&& ($table->id != $this->id || $this->id == 0)
) {
$this->setError(Text::_('COM_TAGS_ERROR_UNIQUE_ALIAS'));

return false;
Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/com_tags.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ COM_TAGS_COUNT_UNPUBLISHED_ITEMS="Unpublished items"
COM_TAGS_EMPTYSTATE_BUTTON_ADD="Add your first tag"
COM_TAGS_EMPTYSTATE_CONTENT="Tags in Joomla! provide a flexible way of organizing content. The same tag can be applied to many different content items across content types."
COM_TAGS_EMPTYSTATE_TITLE="No Tags have been created yet."
COM_TAGS_ERROR_UNIQUE_ALIAS="Another Tag has the same alias (remember it may be a trashed item)."
COM_TAGS_ERROR_UNIQUE_ALIAS="Another Tag with the same parent tag has the same alias (remember it may be a trashed item)."
COM_TAGS_EXCLUDE="Exclude"
COM_TAGS_FIELD_CONTENT_TYPE_LABEL="Content types"
COM_TAGS_FIELD_FULL_LABEL="Full Image"
Expand Down
5 changes: 4 additions & 1 deletion libraries/src/Table/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ public function store($updateNulls = false)
// Verify that the alias is unique
$table = Table::getInstance('Contenttype', 'JTable', array('dbo' => $this->getDbo()));

if ($table->load(array('type_alias' => $this->type_alias)) && ($table->type_id != $this->type_id || $this->type_id == 0)) {
if (
$table->load(array('alias' => $this->alias, 'parent_id' => (int) $this->parent_id))
&& ($table->id != $this->id || $this->id == 0)
) {
Comment on lines -84 to +87
Copy link
Contributor

Choose a reason for hiding this comment

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

@brianteeman Are you sure this change is correct?. The alias and parent_id fields do not exist in #__content_types table and I think using the lang key COM_TAGS_ERROR_UNIQUE_ALIAS does not belong here and was wrong even before this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm currently testing the Joomla 4.3 Beta 4 with HikaShop. During the installation process, we use this store function to add the tags capability on the products from HikaShop. We get the error:
Missing field in database: Joomla\CMS\Table\ContentType   alias.
https://i.imgur.com/yRGq5wK.png
Reverting this change does fix the problem. But I'm not familiar enough with the tag system to know if the code change is ok and we should change something in HikaShop (but what ?) or if another kind of modification should be necessary in Joomla 4.3 to fix the tag alias issue while preventing this error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes this PR is wrong

$this->setError(Text::_('COM_TAGS_ERROR_UNIQUE_ALIAS'));

return false;
Expand Down