fix check of Character groups-group title by using Seminary-ID (fixes #151)
This commit is contained in:
parent
4e7fdd973e
commit
67f92d6174
|
@ -168,7 +168,7 @@
|
||||||
// Get params and validate them
|
// Get params and validate them
|
||||||
$validation = $this->Validation->validateParams($this->request->getPostParams(), $fields);
|
$validation = $this->Validation->validateParams($this->request->getPostParams(), $fields);
|
||||||
$charactergroupsgroupname = $this->request->getPostParam('charactergroupsgroupname');
|
$charactergroupsgroupname = $this->request->getPostParam('charactergroupsgroupname');
|
||||||
if($this->Charactergroups->characterGroupsgroupNameExists($charactergroupsgroupname)) {
|
if($this->Charactergroups->characterGroupsgroupNameExists($seminary['id'], $charactergroupsgroupname)) {
|
||||||
$validation = $this->Validation->addValidationResult($validation, 'charactergroupsgroupname', 'exist', true);
|
$validation = $this->Validation->addValidationResult($validation, 'charactergroupsgroupname', 'exist', true);
|
||||||
}
|
}
|
||||||
$preferred = !is_null($this->request->getPostParam('preferred'));
|
$preferred = !is_null($this->request->getPostParam('preferred'));
|
||||||
|
|
|
@ -113,17 +113,19 @@
|
||||||
/**
|
/**
|
||||||
* Check if a Character groups-group name already exists.
|
* Check if a Character groups-group name already exists.
|
||||||
*
|
*
|
||||||
* @param string $name Name to check
|
* @param int $seminaryId ID of Seminary
|
||||||
* @param int $groupsgroupId Do not check this ID (for editing)
|
* @param string $name Name to check
|
||||||
* @return boolean Whether name exists or not
|
* @param int $groupsgroupId Do not check this ID (for editing)
|
||||||
|
* @return boolean Whether name exists or not
|
||||||
*/
|
*/
|
||||||
public function characterGroupsgroupNameExists($name, $groupsgroupId=null)
|
public function characterGroupsgroupNameExists($seminaryId, $name, $groupsgroupId=null)
|
||||||
{
|
{
|
||||||
$data = $this->db->query(
|
$data = $this->db->query(
|
||||||
'SELECT id '.
|
'SELECT id '.
|
||||||
'FROM charactergroupsgroups '.
|
'FROM charactergroupsgroups '.
|
||||||
'WHERE name = ? OR url = ?',
|
'WHERE seminary_id = ? AND (name = ? OR url = ?)',
|
||||||
'ss',
|
'iss',
|
||||||
|
$seminaryId,
|
||||||
$name,
|
$name,
|
||||||
\nre\core\Linker::createLinkParam($name)
|
\nre\core\Linker::createLinkParam($name)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue