MDL-25418 glossary - fix incorrect LOWER() call also present in glossary import & entry export functionalities

This commit is contained in:
Eloy Lafuente 2010-12-09 22:50:23 +00:00
parent fda6946eb2
commit 20d3bf6100
2 changed files with 12 additions and 3 deletions

View File

@ -69,7 +69,10 @@ $entryalreadyexist = get_string('entryalreadyexist','glossary');
$entryexported = get_string('entryexported','glossary');
if (!$mainglossary->allowduplicatedentries) {
if ($DB->get_record('glossary_entries', array('glossaryid'=>$mainglossary->id, 'lower(concept)'=>moodle_strtolower($entry->concept)))) {
if ($DB->record_exists_select('glossary_entries',
'glossaryid = :glossaryid AND LOWER(concept) = :concept', array(
'glossaryid' => $mainglossary->id,
'concept' => moodle_strtolower($entry->concept)))) {
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();

View File

@ -204,9 +204,15 @@ if ($xml = glossary_read_imported_file($result)) {
if ( !$glossary->allowduplicatedentries ) {
// checking if the entry is valid (checking if it is duplicated when should not be)
if ( $newentry->casesensitive ) {
$dupentry = $DB->get_record("glossary_entries", array("concept"=>$newentry->concept, "glossaryid"=>$glossary->id));
$dupentry = $DB->record_exists_select('glossary_entries',
'glossaryid = :glossaryid AND concept = :concept', array(
'glossaryid' => $glossary->id,
'concept' => $newentry->concept));
} else {
$dupentry = $DB->get_record("glossary_entries", array("lower(concept)"=>moodle_strtolower($newentry->concept), "glossaryid"=>$glossary->id));
$dupentry = $DB->record_exists_select('glossary_entries',
'glossaryid = :glossaryid AND LOWER(concept) = :concept', array(
'glossaryid' => $glossary->id,
'concept' => moodle_strtolower($newentry->concept)));
}
if ($dupentry) {
$permissiongranted = 0;