mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
MDL-36640 Logging: Correct testing of log->info.
log->info sometimes contains additional information which can be looked up from other tables. This should only be attempted if the field is numeric, but the CSV, XLS, and ODS outputs were not making this check. There is an additional case for the print_mnet_log function which has not been covered - this is because the mnet logging is currently broken beyond the scope of this bug rendering this section untestable. These issues are raised in MDL-36642.
This commit is contained in:
parent
2d7c5eeeea
commit
3186c12412
1 changed files with 3 additions and 3 deletions
|
@ -594,7 +594,7 @@ function print_log_csv($course, $user, $date, $order='l.time DESC', $modname,
|
|||
$ld = $DB->get_record('log_display', array('module'=>$log->module, 'action'=>$log->action));
|
||||
$ldcache[$log->module][$log->action] = $ld;
|
||||
}
|
||||
if ($ld && !empty($log->info)) {
|
||||
if ($ld && is_numeric($log->info)) {
|
||||
// ugly hack to make sure fullname is shown correctly
|
||||
if (($ld->mtable == 'user') and ($ld->field == $DB->sql_concat('firstname', "' '" , 'lastname'))) {
|
||||
$log->info = fullname($DB->get_record($ld->mtable, array('id'=>$log->info)), true);
|
||||
|
@ -694,7 +694,7 @@ function print_log_xls($course, $user, $date, $order='l.time DESC', $modname,
|
|||
$ld = $DB->get_record('log_display', array('module'=>$log->module, 'action'=>$log->action));
|
||||
$ldcache[$log->module][$log->action] = $ld;
|
||||
}
|
||||
if ($ld && !empty($log->info)) {
|
||||
if ($ld && is_numeric($log->info)) {
|
||||
// ugly hack to make sure fullname is shown correctly
|
||||
if (($ld->mtable == 'user') and ($ld->field == $DB->sql_concat('firstname', "' '" , 'lastname'))) {
|
||||
$log->info = fullname($DB->get_record($ld->mtable, array('id'=>$log->info)), true);
|
||||
|
@ -808,7 +808,7 @@ function print_log_ods($course, $user, $date, $order='l.time DESC', $modname,
|
|||
$ld = $DB->get_record('log_display', array('module'=>$log->module, 'action'=>$log->action));
|
||||
$ldcache[$log->module][$log->action] = $ld;
|
||||
}
|
||||
if ($ld && !empty($log->info)) {
|
||||
if ($ld && is_numeric($log->info)) {
|
||||
// ugly hack to make sure fullname is shown correctly
|
||||
if (($ld->mtable == 'user') and ($ld->field == $DB->sql_concat('firstname', "' '" , 'lastname'))) {
|
||||
$log->info = fullname($DB->get_record($ld->mtable, array('id'=>$log->info)), true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue