Permalink
Browse files

get_users_by_capability('enrol/authorize:managepayments') and send em…

…ail for pending orders expiring.
  • Loading branch information...
ethem
ethem committed Aug 29, 2006
1 parent 0c10124 commit 70b1aa80718bc397db54065b42f9709455cadf17
Showing with 5 additions and 8 deletions.
  1. +5 −8 enrol/authorize/enrol.php
View
@@ -898,7 +898,8 @@ function cron_daily()
$courseinfos = get_records_sql($sql);
foreach($courseinfos as $courseinfo) {
$lastcourse = $courseinfo->courseid;
- if ($teachers = get_course_teachers($lastcourse)) {
+ $context = get_context_instance(CONTEXT_COURSE, $lastcourse);
+ if ($paymentmanagers = get_users_by_capability($context, 'enrol/authorize:managepayments')) {
$a = new stdClass;
$a->course = $courseinfo->shortname;
$a->pending = $courseinfo->cnt;
@@ -910,14 +911,10 @@ function cron_daily()
$a->currency = $courseinfo->currency;
$a->sumcost = $courseinfo->ttl;
$a->days = $CFG->an_emailexpired;
- $a->url = $CFG->wwwroot.'/enrol/authorize/index.php?course='.
- $lastcourse.'&status='.AN_STATUS_AUTH;
+ $a->url = $CFG->wwwroot.'/enrol/authorize/index.php?course='.$lastcourse.'&status='.AN_STATUS_AUTH;
$message = get_string('pendingordersemailteacher', 'enrol_authorize', $a);
- $context = get_context_instance(CONTEXT_COURSE, $lastcourse);
- foreach ($teachers as $teacher) {
- if (has_capability('enrol/authorize:managepayments', $context, $teacher->id)) {
- email_to_user($teacher, $adminuser, $subject, $message);
- }
+ foreach ($paymentmanagers as $paymentmanager) {
+ email_to_user($paymentmanager, $adminuser, $subject, $message);
}
}
}

0 comments on commit 70b1aa8

Please sign in to comment.