calendar/lib.php Line 1652
function calendar_format_event_time($event, $now, $linkparams = null, $usecommonwords = true, $showtime=0) {
global $CFG, $DB;
require_once($CFG->dirroot . '/mod/facetoface/lib.php');
// Display timezone information for F2F sessions.
if ($event->modulename == 'facetoface' && $event->eventtype == 'facetofacesession') {
$sql = "SELECT fsd.id, fsd.sessiontimezone
FROM {facetoface_sessions_dates} fsd
INNER JOIN {facetoface_sessions} fs
ON fsd.sessionid = fs.id
AND fs.facetoface = ?
WHERE fsd.timestart = ?";
if ($sessiondata = $DB->get_record_sql($sql, array($event->instance, $event->timestart))) {
$sessionobj = facetoface_format_session_times($event->timestart,
$event->timestart + $event->timeduration,
$sessiondata->sessiontimezone);
return get_string('sessiondatetimecourseformat', 'facetoface', $sessionobj);
}
}
...
Causes this minor error (minor cause it doesn't break anything):
Error: mdb->get_record() found more than one record!
line 1417 of \lib\dml\moodle_database.php: call to debugging()
line 1663 of \calendar\lib.php: call to moodle_database->get_record_sql()
line 612 of \calendar\lib.php: call to calendar_format_event_time()
line 60 of \blocks\calendar_upcoming\block_calendar_upcoming.php: call to calendar_get_upcoming()
line 292 of \blocks\moodleblock.class.php: call to block_calendar_upcoming->get_content()
line 238 of \blocks\moodleblock.class.php: call to block_base->formatted_contents()
line 951 of \lib\blocklib.php: call to block_base->get_content_for_output()
line 1003 of \lib\blocklib.php: call to block_manager->create_block_contents()
line 353 of \lib\blocklib.php: call to block_manager->ensure_content_created()
line 34 of \theme\standardtotara\layout\frontpage.php: call to block_manager->region_has_content()
line 862 of \lib\outputrenderers.php: call to include()
line 790 of \lib\outputrenderers.php: call to core_renderer->render_page_layout()
line 104 of \index.php: call to core_renderer->header()
$DB->get_record_sql returns more than one record as it's only matching against fs.facetoface and fsd.timestart. You can have two sessions in two different rooms that start at the exact day and time.
Possible Resolutions:
a) add 'LIMIT 1'
b) use get_records_sql and pop the first result. You can't reference by [0] because the key is used to refer to the value of the results eg. $sessiondata[52343]->id = 52343
Low priority as the plugin continues to work as expected, but this error appears only when debugging is on.