fix check of Character groups-group title by using Seminary-ID (fixes #151)
This commit is contained in:
parent
4e7fdd973e
commit
67f92d6174
2 changed files with 9 additions and 7 deletions
|
@ -168,7 +168,7 @@
|
|||
// Get params and validate them
|
||||
$validation = $this->Validation->validateParams($this->request->getPostParams(), $fields);
|
||||
$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);
|
||||
}
|
||||
$preferred = !is_null($this->request->getPostParam('preferred'));
|
||||
|
|
|
@ -113,17 +113,19 @@
|
|||
/**
|
||||
* Check if a Character groups-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 $seminaryId ID of Seminary
|
||||
* @param string $name Name to check
|
||||
* @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(
|
||||
'SELECT id '.
|
||||
'FROM charactergroupsgroups '.
|
||||
'WHERE name = ? OR url = ?',
|
||||
'ss',
|
||||
'WHERE seminary_id = ? AND (name = ? OR url = ?)',
|
||||
'iss',
|
||||
$seminaryId,
|
||||
$name,
|
||||
\nre\core\Linker::createLinkParam($name)
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue