diff --git a/administrator/components/com_contact/src/Table/ContactTable.php b/administrator/components/com_contact/src/Table/ContactTable.php index 85c248abbd28..95f74cabab5b 100644 --- a/administrator/components/com_contact/src/Table/ContactTable.php +++ b/administrator/components/com_contact/src/Table/ContactTable.php @@ -119,8 +119,13 @@ public function store($updateNulls = true) $table = Table::getInstance('ContactTable', __NAMESPACE__ . '\\', array('dbo' => $this->getDbo())); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { + // Is the existing contact trashed? $this->setError(Text::_('COM_CONTACT_ERROR_UNIQUE_ALIAS')); + if ($table->published === -2) { + $this->setError(Text::_('COM_CONTACT_ERROR_UNIQUE_ALIAS_TRASHED')); + } + return false; } diff --git a/administrator/components/com_finder/src/Table/FilterTable.php b/administrator/components/com_finder/src/Table/FilterTable.php index 621076fa65cc..932fb30caf88 100644 --- a/administrator/components/com_finder/src/Table/FilterTable.php +++ b/administrator/components/com_finder/src/Table/FilterTable.php @@ -157,7 +157,7 @@ public function store($updateNulls = true) $table = new static($this->getDbo()); if ($table->load(array('alias' => $this->alias)) && ($table->filter_id != $this->filter_id || $this->filter_id == 0)) { - $this->setError(Text::_('JLIB_DATABASE_ERROR_ARTICLE_UNIQUE_ALIAS')); + $this->setError(Text::_('COM_FINDER_FILTER_ERROR_UNIQUE_ALIAS')); return false; } diff --git a/administrator/components/com_newsfeeds/src/Table/NewsfeedTable.php b/administrator/components/com_newsfeeds/src/Table/NewsfeedTable.php index 0695082ad257..1765b9e6db31 100644 --- a/administrator/components/com_newsfeeds/src/Table/NewsfeedTable.php +++ b/administrator/components/com_newsfeeds/src/Table/NewsfeedTable.php @@ -173,8 +173,13 @@ public function store($updateNulls = true) $table = Table::getInstance('NewsfeedTable', __NAMESPACE__ . '\\', array('dbo' => $this->_db)); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { + // Is the existing newsfeed trashed? $this->setError(Text::_('COM_NEWSFEEDS_ERROR_UNIQUE_ALIAS')); + if ($table->published === -2) { + $this->setError(Text::_('COM_NEWSFEEDS_ERROR_UNIQUE_ALIAS_TRASHED')); + } + return false; } diff --git a/administrator/components/com_tags/src/Table/TagTable.php b/administrator/components/com_tags/src/Table/TagTable.php index ec039287a02b..5f69e8c09352 100644 --- a/administrator/components/com_tags/src/Table/TagTable.php +++ b/administrator/components/com_tags/src/Table/TagTable.php @@ -192,8 +192,13 @@ public function store($updateNulls = true) $table = new static($this->getDbo()); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { + // Is the existing tag trashed? $this->setError(Text::_('COM_TAGS_ERROR_UNIQUE_ALIAS')); + if ($table->published === -2) { + $this->setError(Text::_('COM_TAGS_ERROR_UNIQUE_ALIAS_TRASHED')); + } + return false; } diff --git a/administrator/language/en-GB/com_contact.ini b/administrator/language/en-GB/com_contact.ini index 5a5a2a1eaa44..463614f51682 100644 --- a/administrator/language/en-GB/com_contact.ini +++ b/administrator/language/en-GB/com_contact.ini @@ -20,7 +20,8 @@ COM_CONTACT_EMPTYSTATE_BUTTON_ADD="Add your first contact" COM_CONTACT_EMPTYSTATE_CONTENT="Contacts can be as simple as a contact form or as complex as a staff directory. You can use this component to create and manage your contacts." COM_CONTACT_EMPTYSTATE_TITLE="No Contacts have been created yet." COM_CONTACT_ERROR_ALL_LANGUAGE_ASSOCIATED="A contact item set to All languages can't be associated. Associations have not been set." -COM_CONTACT_ERROR_UNIQUE_ALIAS="Another Contact from this category has the same alias (remember it may be a trashed item)." +COM_CONTACT_ERROR_UNIQUE_ALIAS="Another Contact in this category has the same alias." +COM_CONTACT_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Contact in this category has the same alias." COM_CONTACT_FIELD_ARTICLES_DISPLAY_NUM_LABEL="# Articles to List" COM_CONTACT_FIELD_ARTICLES_SHOW_LABEL="User Articles" COM_CONTACT_FIELD_CAPTCHA_LABEL="Allow Captcha on Contact" diff --git a/administrator/language/en-GB/com_content.ini b/administrator/language/en-GB/com_content.ini index e7186424eeef..a733b70e7cd6 100644 --- a/administrator/language/en-GB/com_content.ini +++ b/administrator/language/en-GB/com_content.ini @@ -44,6 +44,8 @@ COM_CONTENT_ERROR_CANNOT_ARCHIVE="One or more of the selected articles can't be COM_CONTENT_ERROR_CANNOT_PUBLISH="One or more of the selected articles can't be set to published." COM_CONTENT_ERROR_CANNOT_TRASH="One or more of the selected articles can't be set to trashed." COM_CONTENT_ERROR_CANNOT_UNPUBLISH="One or more of the selected articles can't be set to unpublished." +COM_CONTENT_ERROR_UNIQUE_ALIAS="Another Article in this category has the same alias." +COM_CONTENT_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Article in this category has the same alias." COM_CONTENT_ERROR_UPDATE_STAGE="You cannot execute this transition and update the stage." COM_CONTENT_FEATURED_ARTICLES="Featured Articles" COM_CONTENT_FEATURED_CATEGORIES_LABEL="Select Categories" diff --git a/administrator/language/en-GB/com_finder.ini b/administrator/language/en-GB/com_finder.ini index 2251edd00a8a..ce5e0df1d17a 100644 --- a/administrator/language/en-GB/com_finder.ini +++ b/administrator/language/en-GB/com_finder.ini @@ -75,6 +75,7 @@ COM_FINDER_FIELDSET_SEARCH_OPTIONS_LABEL="Smart Search" COM_FINDER_FILTER_BRANCH_LABEL="Search by %s" COM_FINDER_FILTER_EDIT_TOOLBAR_TITLE="Smart Search: Edit Filter" COM_FINDER_FILTER_END_DATE_LABEL="End Date" +COM_FINDER_FILTER_ERROR_UNIQUE_ALIAS="Another Filter has the same alias." COM_FINDER_FILTER_FIELDSET_PARAMS="Filter Timeline" COM_FINDER_FILTER_FORM_TITLE_EDIT="Edit Filter" COM_FINDER_FILTER_FORM_TITLE_NEW="New Filter" diff --git a/administrator/language/en-GB/com_newsfeeds.ini b/administrator/language/en-GB/com_newsfeeds.ini index 77d889958389..2536bf402e53 100644 --- a/administrator/language/en-GB/com_newsfeeds.ini +++ b/administrator/language/en-GB/com_newsfeeds.ini @@ -17,7 +17,8 @@ COM_NEWSFEEDS_EMPTYSTATE_BUTTON_ADD="Add your first news feed" COM_NEWSFEEDS_EMPTYSTATE_CONTENT="Adding News Feeds to your sites is a way of integrating content from other web sites." COM_NEWSFEEDS_EMPTYSTATE_TITLE="No News Feeds have been created yet." COM_NEWSFEEDS_ERROR_ALL_LANGUAGE_ASSOCIATED="A news feed item set to All languages can't be associated. Associations have not been set." -COM_NEWSFEEDS_ERROR_UNIQUE_ALIAS="Another News feed from this category has the same alias (remember it may be a trashed item)." +COM_NEWSFEEDS_ERROR_UNIQUE_ALIAS="Another News feed from this category has the same alias." +COM_NEWSFEEDS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed News feed in this category has the same alias." COM_NEWSFEEDS_FIELD_CACHETIME_LABEL="Cache Time" COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC="0 will show all the text." COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_LABEL="Characters Count" diff --git a/administrator/language/en-GB/com_tags.ini b/administrator/language/en-GB/com_tags.ini index d2c361c4ad41..ca9196afc394 100644 --- a/administrator/language/en-GB/com_tags.ini +++ b/administrator/language/en-GB/com_tags.ini @@ -37,7 +37,8 @@ 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 has the same alias." +COM_TAGS_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Tag has the same alias." COM_TAGS_EXCLUDE="Exclude" COM_TAGS_FIELD_CONTENT_TYPE_LABEL="Content types" COM_TAGS_FIELD_FULL_LABEL="Full Image" diff --git a/administrator/language/en-GB/lib_joomla.ini b/administrator/language/en-GB/lib_joomla.ini index 4c6f31ee5d5b..acf419e7af34 100644 --- a/administrator/language/en-GB/lib_joomla.ini +++ b/administrator/language/en-GB/lib_joomla.ini @@ -111,7 +111,8 @@ JLIB_DATABASE_ERROR_ADAPTER_MYSQLI="The MySQL adapter 'mysqli' is not available. JLIB_DATABASE_ERROR_ARTICLE_UNIQUE_ALIAS="Another article from this category has the same alias (remember it may be a trashed item)." JLIB_DATABASE_ERROR_BIND_FAILED_INVALID_SOURCE_ARGUMENT="%s: :bind failed. Invalid source argument." JLIB_DATABASE_ERROR_CATEGORY_REQUIRED="Category is required." -JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS="Another category with the same parent category has the same alias (remember it may be a trashed item)." +JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS="Another category with the same parent category has the same alias." +JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS_TRASHED="A trashed category with the same parent category has the same alias." JLIB_DATABASE_ERROR_CHECK_FAILED="%s: :check Failed - %s" JLIB_DATABASE_ERROR_CHECKIN_FAILED="%s: :check-in failed - %s" JLIB_DATABASE_ERROR_CHECKOUT_FAILED="%s: :check-out failed - %s" @@ -149,8 +150,9 @@ JLIB_DATABASE_ERROR_MENU_HOME_NOT_COMPONENT="The home menu item must be a compon JLIB_DATABASE_ERROR_MENU_HOME_NOT_UNIQUE_IN_MENU="A menu should have only one Default home." JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_COMPONENT="A first level menu item alias can't be 'component'." JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_FOLDER="A first level menu item alias can't be '%s' because '%s' is a sub-folder of your Joomla installation folder." -JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS="The alias %1$s is already being used by %2$s menu item in the %3$s menu (remember it may be a trashed item)." +JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS="The alias %1$s is already being used by the %2$s menu item in the %3$s menu." JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS_ROOT="Another menu item has the same alias in Root (remember it may be a trashed item). Root is the top level parent." +JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS_TRASHED="The alias %1$s is already being used by the trashed %2$s menu item in the %3$s menu." JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME="Can't unpublish default home." JLIB_DATABASE_ERROR_MENUTYPE="Some menu items or some menu modules related to this menutype are checked out by another user or the default menu item is in this menu." JLIB_DATABASE_ERROR_MENUTYPE_CHECKOUT="The user checking out does not match the user who checked out this menu and/or its linked menu module." diff --git a/libraries/src/Table/Category.php b/libraries/src/Table/Category.php index 3c97183efa10..b207680887c2 100644 --- a/libraries/src/Table/Category.php +++ b/libraries/src/Table/Category.php @@ -257,8 +257,13 @@ public function store($updateNulls = true) $table->load(array('alias' => $this->alias, 'parent_id' => (int) $this->parent_id, 'extension' => $this->extension)) && ($table->id != $this->id || $this->id == 0) ) { + // Is the existing category trashed? $this->setError(Text::_('JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS')); + if ($table->published === -2) { + $this->setError(Text::_('JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS_TRASHED')); + } + return false; } diff --git a/libraries/src/Table/Content.php b/libraries/src/Table/Content.php index 9d9f6c71b907..8af5739afe6d 100644 --- a/libraries/src/Table/Content.php +++ b/libraries/src/Table/Content.php @@ -346,7 +346,12 @@ public function store($updateNulls = true) $table = Table::getInstance('Content', 'JTable', array('dbo' => $this->getDbo())); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { - $this->setError(Text::_('JLIB_DATABASE_ERROR_ARTICLE_UNIQUE_ALIAS')); + // Is the existing article trashed? + $this->setError(Text::_('COM_CONTENT_ERROR_UNIQUE_ALIAS')); + + if ($table->published === -2) { + $this->setError(Text::_('COM_CONTENT_ERROR_UNIQUE_ALIAS_TRASHED')); + } return false; } diff --git a/libraries/src/Table/Menu.php b/libraries/src/Table/Menu.php index 2c2d69aa847b..bb0f45a77fa0 100644 --- a/libraries/src/Table/Menu.php +++ b/libraries/src/Table/Menu.php @@ -14,6 +14,7 @@ use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; use Joomla\Database\DatabaseDriver; use Joomla\Database\ParameterType; use Joomla\Registry\Registry; @@ -241,7 +242,14 @@ public function store($updateNulls = true) if ($error) { $menuTypeTable = Table::getInstance('MenuType', 'JTable', array('dbo' => $db)); $menuTypeTable->load(array('menutype' => $table->menutype)); - $this->setError(Text::sprintf('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS', $this->alias, $table->title, $menuTypeTable->title)); + $url = Route::_('index.php?option=com_menus&task=item.edit&id=' . (int) $table->id); + + // Is the existing menu item trashed? + $this->setError(Text::sprintf('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS', $this->alias, $table->title, $menuTypeTable->title, $url)); + + if ($table->published === -2) { + $this->setError(Text::sprintf('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS_TRASHED', $this->alias, $table->title, $menuTypeTable->title, $url)); + } return false; }