diff --git a/administrator/language/en-GB/en-GB.lib_joomla.ini b/administrator/language/en-GB/en-GB.lib_joomla.ini index 6ae1bcb52f403..a734af1633992 100644 --- a/administrator/language/en-GB/en-GB.lib_joomla.ini +++ b/administrator/language/en-GB/en-GB.lib_joomla.ini @@ -191,7 +191,7 @@ JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT="The Language parameter for this m JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT_DEFAULT="At least one menu item has to be set as Default." JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME="Can't unpublish default home." JLIB_DATABASE_ERROR_MENU_DEFAULT_CHECKIN_USER_MISMATCH="The current home menu for this language is checked out." -JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS="Another menu item with the same parent has this alias (remember it may be a trashed item)." +JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS="The alias %s is already being used by %s menu item in the %s menu (remember it may be a trashed item)." 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_HOME_NOT_COMPONENT="The home menu item must be a component." JLIB_DATABASE_ERROR_MENU_HOME_NOT_UNIQUE_IN_MENU="A menu should contain only one Default home." diff --git a/language/en-GB/en-GB.lib_joomla.ini b/language/en-GB/en-GB.lib_joomla.ini index 24a46013a2c7f..a40aae81f136a 100644 --- a/language/en-GB/en-GB.lib_joomla.ini +++ b/language/en-GB/en-GB.lib_joomla.ini @@ -191,7 +191,7 @@ JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT="The Language parameter for this m JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT_DEFAULT="At least one menu item has to be set as Default." JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME="Can't unpublish default home." JLIB_DATABASE_ERROR_MENU_DEFAULT_CHECKIN_USER_MISMATCH="The current home menu for this language is checked out." -JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS="Another menu item with the same parent has this alias (remember it may be a trashed item)." +JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS="The alias %s is already being used by %s menu item in the %s menu (remember it may be a trashed item)." 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_HOME_NOT_COMPONENT="The home menu item must be a component." JLIB_DATABASE_ERROR_MENU_HOME_NOT_UNIQUE_IN_MENU="A menu should contain only one Default home." diff --git a/libraries/legacy/table/menu.php b/libraries/legacy/table/menu.php index 38f2a564c3474..a44f286ad8be3 100644 --- a/libraries/legacy/table/menu.php +++ b/libraries/legacy/table/menu.php @@ -181,7 +181,7 @@ public function store($updateNulls = false) else { $itemSearch = array('alias' => $this->alias, 'parent_id' => $this->parent_id, 'client_id' => (int) $this->client_id); - $errorType = ''; + $error = false; // Check if the alias already exists. For multilingual site. if (JLanguageMultilang::isEnabled()) @@ -191,7 +191,7 @@ public function store($updateNulls = false) || ($table->load(array_replace($itemSearch, array('language' => $this->language))) && ($table->id != $this->id || $this->id == 0)) || ($this->language == '*' && $table->load($itemSearch) && ($table->id != $this->id || $this->id == 0))) { - $errorType = 'MULTILINGUAL'; + $error = true; } } // Check if the alias already exists. For monolingual site. @@ -200,15 +200,16 @@ public function store($updateNulls = false) // If not exists a menu item at the same level with the same alias (in any language). if ($table->load($itemSearch) && ($table->id != $this->id || $this->id == 0)) { - $errorType = 'MONOLINGUAL'; + $error = true; } } - // The alias already exists. Send an error message. - if ($errorType) + // The alias already exists. Enqueue a error message. + if ($error) { - $message = JText::_('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS' . ($this->menutype != $table->menutype ? '_ROOT' : '')); - $this->setError($message); + $menuTypeTable = JTable::getInstance('MenuType', 'JTable', array('dbo' => $this->getDbo())); + $menuTypeTable->load(array('menutype' => $table->menutype)); + $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS', $this->alias, $table->title, $menuTypeTable->title)); return false; }