Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-20665

error on add new user profile category

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.6
    • Fix Version/s: 1.9.7
    • Component/s: Other
    • Labels:
      None
    • Database:
      PostgreSQL
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      when logged in as admin using the "user profile fields" administration screen /user/profile/index.php when I use the "create new profile category" button, enter a text string and save I get an sql error:

      ERROR: invalid input syntax for integer: ""

      SELECT * FROM dcfs_user_info_category WHERE id = ''

      • line 796 of lib/dmllib.php: call to debugging()
      • line 591 of lib/dmllib.php: call to get_recordset_sql()
      • line 531 of lib/dmllib.php: call to get_record_sql()
      • line 34 of user/profile/index_category_form.php: call to get_record()
      • line 333 of lib/formslib.php: call to category_form->validation()
      • line 378 of lib/formslib.php: call to moodleform->is_validated()
      • line 415 of user/profile/definelib.php: call to moodleform->get_data()
      • line 88 of user/profile/index.php: call to profile_edit_category()

      This is caused by the form validation which aims to avoid you creating profile categories with duplicate names. MySQL doesn't complain about this SQL statement and so does the validation succesfully. Postgres does not like the SQL, as shown above, and ultimately allows you to enter duplicates.

      I discussed this with Eloy in the HQ chat http://moodle.org/mod/cvsadmin/view.php?conversationid=3510#c154302 where we agreed the code needs a minor tweak to only check the current name of the category if you're editing an existing category rather than adding a new one.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Nov/09