Merge branch 'MDL-66455-36' of git://github.com/lameze/moodle into MOODLE_36_STABLE

This commit is contained in:
Jake Dallimore
2019-11-05 11:43:31 +08:00
2 changed files with 37 additions and 4 deletions
+10 -4
View File
@@ -127,7 +127,8 @@ $searches = [];
$params = [];
$usedefaultfilters = true;
if (!empty($courseid) && $courseid == SITEID && !empty($types['site'])) {
if (!empty($types['site'])) {
$searches[] = "(eventtype = 'site')";
$usedefaultfilters = false;
}
@@ -144,9 +145,14 @@ if (!empty($courseid) && !empty($types['course'])) {
$usedefaultfilters = false;
}
if (!empty($categoryid) && !empty($types['category'])) {
$searches[] = "(eventtype = 'category' AND categoryid = :categoryid)";
$params += ['categoryid' => $categoryid];
if (!empty($types['category'])) {
if (!empty($categoryid)) {
$searches[] = "(eventtype = 'category' AND categoryid = :categoryid)";
$params += ['categoryid' => $categoryid];
} else {
$searches[] = "(eventtype = 'category')";
}
$usedefaultfilters = false;
}
@@ -47,3 +47,30 @@ Feature: Import and edit calendar events
And I view the calendar for "2" "2017"
And I should not see "Event on 2-25-2017"
And I should not see "Event on 2-20-2017"
Scenario: Import events using different event types.
Given I log in as "admin"
And I view the calendar for "1" "2016"
And I press "Manage subscriptions"
And I set the following fields to these values:
| Calendar name | Test Import |
| Import from | Calendar file (.ics) |
| Type of event | User |
And I upload "calendar/tests/fixtures/import.ics" file to "Calendar file (.ics)" filemanager
And I press "Add"
And I should see "User events"
And I set the following fields to these values:
| Calendar name | Test Import |
| Import from | Calendar file (.ics) |
| Type of event | Category |
| Category | Miscellaneous |
And I upload "calendar/tests/fixtures/import.ics" file to "Calendar file (.ics)" filemanager
And I press "Add"
And I should see "Category events"
And I set the following fields to these values:
| Calendar name | Test Import |
| Import from | Calendar file (.ics) |
| Type of event | Site |
And I upload "calendar/tests/fixtures/import.ics" file to "Calendar file (.ics)" filemanager
And I press "Add"
And I should see "Site events"