correctly use Character groups-group context for checking titles of Character groups and Quests (fixes #96)

This commit is contained in:
oliver 2015-05-12 10:39:50 +02:00
commit 9b05e7400e
4 changed files with 20 additions and 16 deletions

View file

@ -372,17 +372,19 @@
/**
* Check if a Character group name already exists.
*
* @param string $name Name to check
* @param int $groupsgroupId Do not check this ID (for editing)
* @return boolean Whether name exists or not
* @param int $groupsgroupId ID of Character groups-group
* @param string $name Name to check
* @param int $groupId Do not check this ID (for editing)
* @return boolean Whether name exists or not
*/
public function characterGroupNameExists($name, $groupId=null)
public function characterGroupNameExists($groupsgroupId, $name, $groupId=null)
{
$data = $this->db->query(
'SELECT id '.
'FROM charactergroups '.
'WHERE name = ? OR url = ?',
'ss',
'WHERE charactergroupsgroup_id = ? AND (name = ? OR url = ?)',
'iss',
$groupsgroupId,
$name,
\nre\core\Linker::createLinkParam($name)
);

View file

@ -213,17 +213,19 @@
/**
* Check if a Character groups Quest title already exists.
*
* @param string $name Character groups Quest title to check
* @param int $questId Do not check this ID (for editing)
* @return boolean Whether Character groups Quest title exists or not
* @param int $groupsgroupId ID of Character groups-group
* @param string $name Character groups Quest title to check
* @param int $questId Do not check this ID (for editing)
* @return boolean Whether Character groups Quest title exists or not
*/
public function characterGroupsQuestTitleExists($title, $questId=null)
public function characterGroupsQuestTitleExists($groupsgroupId, $title, $questId=null)
{
$data = $this->db->query(
'SELECT id '.
'FROM charactergroupsquests '.
'WHERE title = ? OR url = ?',
'ss',
'WHERE charactergroupsgroup_id = ? AND (title = ? OR url = ?)',
'iss',
$groupsgroupId,
$title,
\nre\core\Linker::createLinkParam($title)
);