MDL-31807 fix invalid nulls in cohort components

Credit goes to Stephen.
This commit is contained in:
Petr Skoda 2012-02-29 07:58:11 +01:00
parent e356fb68fd
commit 0908a1a327

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);