Moodle
  1. Moodle
  2. MDL-39463

Some usages of the date_selector do not use the optional parameter but use another checkbox meaning the calendar image is never disabled by the JS.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5
    • Component/s: Forms Library
    • Labels:
      None
    • Testing Instructions:
      Hide

      Test 1

      1. Go to Site administration ► Users ► Accounts ► Browse list of users
      2. Click "Show more"
      3. Next to a date field click on Calender icon and ensure it pops up.
      4. Select a date in the calendar and ensure the pop-up closes and the select boxes update to this date.
      5. Choose a new date in the select boxes and then click on the calendar icon and ensure the pop-up shows this date.
      6. Ensure you can filter by these dates and they work as expected.
      7. Disable some of the dates and ensure the select boxes and calendar image become disabled.
      8. Submit the form and ensure these dates are not used in the filter as they have been disabled.

      Test 2

      1. Create a feedback module.
      2. On the settings page alter the 'Open the feedback at' and 'Close the feedback at'.
      3. Next to a date field click on Calender icon and ensure it pops up.
      4. Select a date in the calendar and ensure the pop-up closes and the select boxes update to this date.
      5. Choose a new date in the select boxes and then click on the calendar icon and ensure the pop-up shows this date.
      6. Ensure you can save these dates and they work as expected.
      7. Disable some of the dates and ensure the select boxes and calendar image become disabled.
      8. Submit the form and ensure the disabled dates are saved in the database as 0.

      Test 3

      1. Repeat the steps in MDL-26649 (sorry)
      Show
      Test 1 Go to Site administration ► Users ► Accounts ► Browse list of users Click "Show more" Next to a date field click on Calender icon and ensure it pops up. Select a date in the calendar and ensure the pop-up closes and the select boxes update to this date. Choose a new date in the select boxes and then click on the calendar icon and ensure the pop-up shows this date. Ensure you can filter by these dates and they work as expected. Disable some of the dates and ensure the select boxes and calendar image become disabled. Submit the form and ensure these dates are not used in the filter as they have been disabled. Test 2 Create a feedback module. On the settings page alter the 'Open the feedback at' and 'Close the feedback at'. Next to a date field click on Calender icon and ensure it pops up. Select a date in the calendar and ensure the pop-up closes and the select boxes update to this date. Choose a new date in the select boxes and then click on the calendar icon and ensure the pop-up shows this date. Ensure you can save these dates and they work as expected. Disable some of the dates and ensure the select boxes and calendar image become disabled. Submit the form and ensure the disabled dates are saved in the database as 0. Test 3 Repeat the steps in MDL-26649 (sorry)
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull Master Branch:
      MDL-39463_master
    • Rank:
      50126

      Description

      In 2.x when date_selectors are added to a form group their own disabledIf (the 'optional' parameter) logic does not work, meaning when the element was added to a group developers created their own disabledIf logic.

      The date_selector and date_time_selector elements come with the ability to pass an 'optional' parameter. If this parameter is set to true, then an enabled checkbox is displayed next to the date selects. 2.5 introduced a calendar image next to the date that would trigger the calendar pop-up. When the enable checkbox was present this image would be disabled (ie. you could not click on it for the pop-up to display) if the box was not checked. However, some forms have created their own checkbox to disable the time as the 'optional' parameter disable functionality was not working when the date element was added to a group, which means the JS event to disable calendar image never gets executed as it is only triggered when the checkbox that comes with the element is checked.

        Issue Links

          Activity

          Hide
          Mark Nelson added a comment -

          The file user/filters/date.php was not using the optional parameter when adding the date_selector boxes, it used it's own disableif logic by adding another checkbox. This should not be the case, it should be using the inbuilt functionality in date_selector and date_time_selector.

          Show
          Mark Nelson added a comment - The file user/filters/date.php was not using the optional parameter when adding the date_selector boxes, it used it's own disableif logic by adding another checkbox. This should not be the case, it should be using the inbuilt functionality in date_selector and date_time_selector.
          Hide
          Mark Nelson added a comment -

          The same occurs for mod/feedback/mod_form.php

          Show
          Mark Nelson added a comment - The same occurs for mod/feedback/mod_form.php
          Hide
          Jérôme Mouneyrac added a comment - - edited

          After talking to Mark, I didn't find anything blocking. Sending to integration.
          PS: MDL-39187 code is required.

          Show
          Jérôme Mouneyrac added a comment - - edited After talking to Mark, I didn't find anything blocking. Sending to integration. PS: MDL-39187 code is required.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
          Hide
          Rajesh Taneja added a comment -

          As shown to Mark, calendar event is affecting select boxes in group.
          Selecting last one automatically updates value on previous date-time selector.

          Sorry Mark failing it as discussed.

          Show
          Rajesh Taneja added a comment - As shown to Mark, calendar event is affecting select boxes in group. Selecting last one automatically updates value on previous date-time selector. Sorry Mark failing it as discussed.
          Hide
          Mark Nelson added a comment -

          I thought we were friends Raj, I guess not ...

          Show
          Mark Nelson added a comment - I thought we were friends Raj, I guess not ...
          Hide
          Damyon Wiese added a comment -

          Sending back to testing - Raj and Mark are creating a new issue for this newly discovered regression.

          Show
          Damyon Wiese added a comment - Sending back to testing - Raj and Mark are creating a new issue for this newly discovered regression.
          Hide
          Mark Nelson added a comment -

          Ok, so the issue Raj discovered is very peculiar, but is not related to this patch. Creating a separate issue to fix this.

          Show
          Mark Nelson added a comment - Ok, so the issue Raj discovered is very peculiar, but is not related to this patch. Creating a separate issue to fix this.
          Hide
          Rajesh Taneja added a comment -

          Thanks Mark,

          As discussed you will open another issue to fix this.
          Also, in addition to values being updated automatically, you might want to consider re-ordering calendar icon next to year rather then after enable.

          Show
          Rajesh Taneja added a comment - Thanks Mark, As discussed you will open another issue to fix this. Also, in addition to values being updated automatically, you might want to consider re-ordering calendar icon next to year rather then after enable.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Did you think this day was not going to arrive ever?

          Your patience has been rewarded, yay, sent upstream, thanks!

          Closing...ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Did you think this day was not going to arrive ever? Your patience has been rewarded, yay, sent upstream, thanks! Closing...ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: