Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#27196] Unable to add a trashed Content Language again #18

Closed
wants to merge 13 commits into from
Next Next commit
[#27196] Unable to add a trashed Content Language again
  • Loading branch information
Michael Babker committed Nov 18, 2011
commit cedbd92c2ea0e6c116c13bb9eb6b3d054c5ce86d
2 changes: 1 addition & 1 deletion administrator/components/com_languages/models/language.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function save($data)

// Store the data
if (!$table->store()) {
$this->setError($this->_db->getErrorMsg());
$this->setError($table->getError());
return false;
}

Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ JLIB_DATABASE_ERROR_INVALID_LOCATION="%s: :setLocation - Invalid location"
JLIB_DATABASE_ERROR_INVALID_NODE_RECURSION="%s: :move Failed - Cannot move the node to be a child of itself"
JLIB_DATABASE_ERROR_INVALID_PARENT_ID="Invalid parent id."
JLIB_DATABASE_ERROR_LANGUAGE_NO_TITLE="The language should have a title"
JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_SEF="The language must have a unique language code"
JLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER="Unable to load Database Driver: %s"
JLIB_DATABASE_ERROR_MENUTYPE_EMPTY="Menu type empty"
JLIB_DATABASE_ERROR_MENUTYPE_EXISTS="Menu type exists: %s"
Expand Down
1 change: 1 addition & 0 deletions language/en-GB/en-GB.lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ JLIB_DATABASE_ERROR_INVALID_LOCATION="%s: :setLocation - Invalid location"
JLIB_DATABASE_ERROR_INVALID_NODE_RECURSION="%s: :move Failed - Cannot move the node to be a child of itself"
JLIB_DATABASE_ERROR_INVALID_PARENT_ID="Invalid parent id."
JLIB_DATABASE_ERROR_LANGUAGE_NO_TITLE="The language should have a title"
JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_SEF="The language must have a unique language code"
JLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER="Unable to load Database Driver: %s"
JLIB_DATABASE_ERROR_MENUTYPE_EMPTY="Menu type empty"
JLIB_DATABASE_ERROR_MENUTYPE_EXISTS="Menu type exists: %s"
Expand Down
21 changes: 21 additions & 0 deletions libraries/joomla/database/table/language.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,25 @@ public function check()

return true;
}

/**
* Overrides JTable::store to set modified data and user id.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 11.3
*/
public function store($updateNulls = false)
{
// Verify that the sef field is unique
$table = JTable::getInstance('Language', 'JTable');
if ($table->load(array('sef' => $this->sef)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_SEF'));
return false;
}
return parent::store($updateNulls);
}
}