Moodle
  1. Moodle
  2. MDL-29048

Copying Main Glossary Displays Error "Found more than one record!"

    Details

    • Testing Instructions:
      Hide
      1. Select a course.
      2. Add a main glossary to course.
      3. Import entries to glossary.
      4. Click duplicate on glossary.
      5. Click Continue.
      6. Click Edit the new copy.

      Expected - Glossary settings display without any error

      Show
      Select a course. Add a main glossary to course. Import entries to glossary. Click duplicate on glossary. Click Continue. Click Edit the new copy. Expected - Glossary settings display without any error
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:
      MDL-29048-master
    • Rank:
      18579

      Description

      When a main glossary is copied, an error displays. This does not seem to affect functionality but does display consistently.
      I believe this may be due to the copy trying to create another main glossary when only a single main glossary can exist within a course.
      When viewing the settings of the copy, this is created as a secondary glossary.

      Error reads:
      Error: mdb->get_record() found more than one record!

      line 1292 of /lib/dml/moodle_database.php: call to debugging()
      line 1252 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      line 1232 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 144 of /mod/glossary/mod_form.php: call to moodle_database->get_record()
      line 408 of /lib/formslib.php: call to mod_glossary_mod_form->definition_after_data()
      line 498 of /lib/formslib.php: call to moodleform->is_validated()
      line 188 of /mod/glossary/mod_form.php: call to moodleform->get_data()
      line 237 of /course/modedit.php: call to mod_glossary_mod_form->get_data()

      This is reproducible on qa.moodle.net.

      Steps to Reproduce

      1. Select a course.
      2. Add a main glossary to course.
      3. Import entries to glossary.
      4. Click duplicate on glossary.
      5. Click Continue.
      6. Click Edit the new copy.

      Expected - Glossary settings display.
      Actual - Glossary settings displays with error.

      If user saves at this point, error displays again and page is not automatically redirected.

      I found other tickets about this error but none were specific to Glossary.

        Activity

        Hide
        Michael de Raadt added a comment -

        I also encountered this error, however I went about things in a different order. I duplicated a main Glossary with existing entries. The new Glossary was created as a secondary Glossary without entries. I exported the entries from the first Glossary and imported them into the second at which point the same error with a different trace was shown...

        Error: mdb->get_record() found more than one record!

        line 1292 of \lib\dml\moodle_database.php: call to debugging()
        line 1252 of \lib\dml\moodle_database.php: call to moodle_database->get_record_sql()
        line 1232 of \lib\dml\moodle_database.php: call to moodle_database->get_record_select()
        line 144 of \mod\glossary\mod_form.php: call to moodle_database->get_record()
        line 821 of \lib\formslib.php: call to mod_glossary_mod_form->definition_after_data()
        line 597 of \course\modedit.php: call to moodleform->display()

        Show
        Michael de Raadt added a comment - I also encountered this error, however I went about things in a different order. I duplicated a main Glossary with existing entries. The new Glossary was created as a secondary Glossary without entries. I exported the entries from the first Glossary and imported them into the second at which point the same error with a different trace was shown... Error: mdb->get_record() found more than one record! line 1292 of \lib\dml\moodle_database.php: call to debugging() line 1252 of \lib\dml\moodle_database.php: call to moodle_database->get_record_sql() line 1232 of \lib\dml\moodle_database.php: call to moodle_database->get_record_select() line 144 of \mod\glossary\mod_form.php: call to moodle_database->get_record() line 821 of \lib\formslib.php: call to mod_glossary_mod_form->definition_after_data() line 597 of \course\modedit.php: call to moodleform->display()
        Hide
        Mark Nielsen added a comment -

        Attaching a proposed fix. This prevents a second main glossary from restoring into a course that already has a main glossary. Just demotes it to a secondary one. You might still want to make the error in mod/glossary/mod_form.php more forgiving as perhaps other use cases exist to create multiple main glossaries.

        Show
        Mark Nielsen added a comment - Attaching a proposed fix. This prevents a second main glossary from restoring into a course that already has a main glossary. Just demotes it to a secondary one. You might still want to make the error in mod/glossary/mod_form.php more forgiving as perhaps other use cases exist to create multiple main glossaries.
        Hide
        Sam Hemelryk added a comment -

        Changes look good thanks!

        Show
        Sam Hemelryk added a comment - Changes look good thanks!
        Hide
        Ankit Agarwal added a comment -

        Thanks Sam for the review
        up for integration!

        Show
        Ankit Agarwal added a comment - Thanks Sam for the review up for integration!
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Integrated, thanks! (20, 21, 22 and master)

        Show
        Eloy Lafuente (stronk7) added a comment - Integrated, thanks! (20, 21, 22 and master)
        Hide
        Jason Fowler added a comment -

        All working and in order

        Show
        Jason Fowler added a comment - All working and in order
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Whoever decided one week was worth 14 days had really one bad idea. Anyway, the nightmare is over, so thanks for your, once again, amazing contributions. Many, many thanks!

        Now... disconnect, relax and enjoy the next days, yay!

        Closing...ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Whoever decided one week was worth 14 days had really one bad idea. Anyway, the nightmare is over, so thanks for your, once again, amazing contributions. Many, many thanks! Now... disconnect, relax and enjoy the next days, yay! Closing...ciao

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: