english/libraries/joomla/database/table/usergroup.php
/**
	 * Method to check the current record to save
	 *
	 * @return  boolean  True on success
	 *
	 * @since   11.1
	 */
Method to check the current record to save
@return  boolean  True on success


Method to check the current record to save @return boolean True on success
public function check()
	{
		if ((trim($this->title)) == '') {
			$this->setError(JText::_('JLIB_DATABASE_ERROR_USERGROUP_TITLE'));
			return false;
		}
		$db = $this->getDbo();
		$query = $db->getQuery(true)
			->select('COUNT(title)')
			->from($this->_tbl)
			->where('title = '.$db->quote(trim($this->title)))
			->where('parent_id = '.(int) $this->parent_id)
			->where('id <> '.(int) $this->id);
		$db->setQuery($query);
		if ($db->loadResult() > 0) {
			$this->setError(JText::_('JLIB_DATABASE_ERROR_USERGROUP_TITLE_EXISTS'));
			return false;
		}
		return true;
	}
public function check ( ) { if ( ( trim ( $ this -> title ) ) == '' ) { $ this -> setError ( JText :: _ ( 'JLIB_DATABASE_ERROR_USERGROUP_TITLE' ) ) ; return false ; } $ db = $ this -> getDbo ( ) ; $ query = $ db -> getQuery ( true ) -> select ( 'COUNT(title)' ) -> from ( $ this -> _tbl ) -> where ( 'title = ' . $ db -> quote ( trim ( $ this -> title ) ) ) -> where ( 'parent_id = ' . ( int ) $ this -> parent_id ) -> where ( 'id <> ' . ( int ) $ this -> id ) ; $ db -> setQuery ( $ query ) ; if ( $ db -> loadResult ( ) > 0 ) { $ this -> setError ( JText :: _ ( 'JLIB_DATABASE_ERROR_USERGROUP_TITLE_EXISTS' ) ) ; return false ; } return true ; }
Method to check the current record to save
 @return  boolean  True on success
Method to check the current record to save @return boolean True on success
// Validate the title. // Check for a duplicate parent_id, title. // There is a unique index on the (parend_id, title) field in the table.