Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5156

Appointment Location field length is too short in scheduler_slots table

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.6, 2.6.3, 2.7
    • Fix Version/s: 2.7
    • Component/s: Module: Scheduler
    • Labels:
      None
    • Plugin Version:
      2014052800
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE

      Description

      The appointmentlocation field in the scheduler_slots table is too short.

      The reason this is an issue for me is because I need to be able to specify the appointment location in multiple languages in this field and the 50 characters defined in the scheduler_slots table schema for this purpose doesn't allow me to do that. Even if I didn't need multiple languages, I also need to specify address, city and province in this field as courses are offered across the country.

      For example, I use the Moodle multi-lingual content filter. In the "Location" field, I would enter the following string:

      {mlang en}123 Mountain street, Montreal, Quebec{mlang}{mlang fr}123 rue de la Montagne, Montréal, Québec{mlang}
      

      This example requires 112 characters. When I enter this string and click either of the Save buttons, I get a non-descriptive "error" for this field.

      Fixing the issue will require the following 3 changes:

      CHANGE #1 - Please expand the size of the appointmentlocation field in the scheduler_slots database table to 255 characters.

      CHANGE #2 - To enable more than 50 characters to be entered in the field, please modify the function add_base_fields() in /mod/scheduler/slotforms.php:

      Is currently:

      $mform->addRule('appointmentlocation', get_string('error'), 'maxlength', 50);
      

      Should be:

      $mform->addRule('appointmentlocation', get_string('error'), 'maxlength', 255);
      

      CHANGE #3 - To enable multilingual filtering of text entered in field, modify the function scheduler_get_mail_variables() in /mod/scheduler/locallib.php:

      Is currently:

      $vars ['LOCATION'] = $slot->appointmentlocation;
      

      Should be:

      $vars ['LOCATION'] = format_string($slot->appointmentlocation);
      

      Please let me know if you have any questions or concerns regarding these changes.

      Best regards,

      Michael Milette

        Attachments

          Activity

            People

            Assignee:
            bostelm Henning Bostelmann
            Reporter:
            michael-milette Michael Milette
            Participants:
            Component watchers:
            Valery Fremaux
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              12/May/14