MDL-28980 fix notification defaults to use new expirynotify combo logic

This commit is contained in:
Petr Škoda
2012-10-10 11:19:10 +02:00
parent da6cf13f00
commit 9f4a3c73cd
+9 -2
View File
@@ -150,12 +150,19 @@ class enrol_manual_plugin extends enrol_plugin {
* @return int id of new instance, null if can not be created
*/
public function add_default_instance($course) {
$expirynotify = $this->get_config('expirynotify', 0);
if ($expirynotify == 2) {
$expirynotify = 1;
$notifyall = 1;
} else {
$notifyall = 0;
}
$fields = array(
'status' => $this->get_config('status'),
'roleid' => $this->get_config('roleid', 0),
'enrolperiod' => $this->get_config('enrolperiod', 0),
'expirynotify' => $this->get_config('expirynotify', 0),
'notifyall' => $this->get_config('notifyall', 0),
'expirynotify' => $expirynotify,
'notifyall' => $notifyall,
'expirythreshold' => $this->get_config('expirythreshold', 86400),
);
return $this->add_instance($course, $fields);