MDL-31807 fix invalid nulls in cohort components

Credit goes to Stephen.
This commit is contained in:
Petr Skoda
2012-03-03 11:09:44 +01:00
parent f24a1a74e5
commit 1cb9ca1458
+3 -2
View File
@@ -71,8 +71,9 @@ function cohort_add_cohort($cohort) {
*/
function cohort_update_cohort($cohort) {
global $DB;
if (isset($cohort->component) and empty($cohort->component)) {
$cohort->component = NULL;
if (property_exists($cohort, 'component') and empty($cohort->component)) {
// prevent NULLs
$cohort->component = '';
}
$cohort->timemodified = time();
$DB->update_record('cohort', $cohort);