mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
Merge branch 'wip-MDL-45154-m26' of git://github.com/marinaglancy/moodle into MOODLE_26_STABLE
This commit is contained in:
commit
0574e41f62
1 changed files with 2 additions and 2 deletions
|
@ -37,13 +37,13 @@ class category_form extends moodleform {
|
|||
|
||||
$data = (object)$data;
|
||||
|
||||
$duplicate = $DB->record_exists('user_info_category', array('name'=>$data->name));
|
||||
$duplicate = $DB->get_field('user_info_category', 'id', array('name' => $data->name));
|
||||
|
||||
/// Check the name is unique
|
||||
if (!empty($data->id)) { // we are editing an existing record
|
||||
$olddata = $DB->get_record('user_info_category', array('id'=>$data->id));
|
||||
// name has changed, new name in use, new name in use by another record
|
||||
$dupfound = (($olddata->name !== $data->name) && $duplicate && ($data->id != $duplicate->id));
|
||||
$dupfound = (($olddata->name !== $data->name) && $duplicate && ($data->id != $duplicate));
|
||||
}
|
||||
else { // new profile category
|
||||
$dupfound = $duplicate;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue