If admin set up 'Teachers can manage the payments of the course' and enabled 'Manual-Capture', course teachers are notified about pending orders expiring.
This commit is contained in:
@@ -15,6 +15,7 @@ if (!isset($frm->an_test)) $frm->an_test = '';
|
||||
if (!isset($frm->an_review)) $frm->an_review = '';
|
||||
if (!isset($frm->an_capture_day)) $frm->an_capture_day = '5';
|
||||
if (!isset($frm->an_emailexpired)) $frm->an_emailexpired = '2';
|
||||
if (!isset($frm->an_emailexpiredteacher)) $frm->an_emailexpiredteacher = '';
|
||||
if (!isset($frm->an_teachermanagepay)) $frm->an_teachermanagepay = '';
|
||||
|
||||
if (isset($CFG->an_cutoff)) {
|
||||
@@ -160,6 +161,12 @@ if (!isset($frm->acceptccs)) {
|
||||
<?php print_string("adminemailexpsetting", "enrol_authorize") ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right">an_emailexpiredteacher:</td>
|
||||
<td><?php print_checkbox('an_emailexpiredteacher', '1', !empty($frm->an_emailexpiredteacher)) ?></td>
|
||||
<td><?php print_string("adminemailexpiredteacher", "enrol_authorize") ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right">enrol_mailstudents:</td>
|
||||
<td><?php print_checkbox('enrol_mailstudents', '1', !empty($frm->enrol_mailstudents)) ?></td>
|
||||
|
||||
@@ -526,6 +526,7 @@ class enrolment_plugin_authorize
|
||||
$reviewval = optional_param('an_review', 0, PARAM_BOOL);
|
||||
$captureday = optional_param('an_capture_day', 5, PARAM_INT);
|
||||
$emailexpired = optional_param('an_emailexpired', 2, PARAM_INT);
|
||||
$emailexpiredteacher = optional_param('an_emailexpiredteacher', 0, PARAM_BOOL);
|
||||
|
||||
$captureday = ($captureday > 29) ? 29 : (($captureday < 0) ? 0 : $captureday);
|
||||
$emailexpired = ($emailexpired > 5) ? 5 : (($emailexpired < 0) ? 0 : $emailexpired);
|
||||
@@ -540,6 +541,7 @@ class enrolment_plugin_authorize
|
||||
set_config('an_review', $reviewval);
|
||||
set_config('an_capture_day', $captureday);
|
||||
set_config('an_emailexpired', $emailexpired);
|
||||
set_config('an_emailexpiredteacher', $emailexpiredteacher);
|
||||
|
||||
// required fields
|
||||
$loginval = optional_param('an_login', '');
|
||||
@@ -658,7 +660,32 @@ class enrolment_plugin_authorize
|
||||
$a->url = $CFG->wwwroot."/enrol/authorize/index.php?status=".AN_STATUS_AUTH;
|
||||
$message = get_string('pendingordersemail', 'enrol_authorize', $a);
|
||||
$adminuser = get_admin();
|
||||
email_to_user($adminuser, $adminuser, "WARNING: PENDING PAYMENTS", $a);
|
||||
email_to_user($adminuser, $adminuser, "WARNING: PENDING PAYMENTS", $message);
|
||||
if (!empty($CFG->an_teachermanagepay) and !empty($CFG->an_emailexpiredteacher)) {
|
||||
$sql = "SELECT DISTINCT E.courseid, COUNT(E.courseid) AS count " .
|
||||
"FROM {$CFG->prefix}enrol_authorize E " .
|
||||
"WHERE $select GROUP BY E.courseid";
|
||||
$message = ''; $lastcourse = 0; $lastcount = 0;
|
||||
$courseidandcounts = get_records_sql($sql);
|
||||
foreach($courseidandcounts as $courseidandcount) {
|
||||
if ($lastcourse != $courseidandcount->courseid) {
|
||||
$lastcourse = $courseidandcount->courseid;
|
||||
$lastcount = $courseidandcount->count;
|
||||
$a = new stdClass;
|
||||
$a->pending = $lastcount;
|
||||
$a->days = $CFG->an_emailexpired;
|
||||
$a->enrolurl = "$CFG->wwwroot/$CFG->admin/users.php";
|
||||
$a->url = $CFG->wwwroot.'/enrol/authorize/index.php?course='.
|
||||
$lastcourse.'&status='.AN_STATUS_AUTH;
|
||||
$message = get_string('pendingordersemail', 'enrol_authorize', $a);
|
||||
}
|
||||
if ($teachers = get_course_teachers($lastcourse)) {
|
||||
foreach ($teachers as $teacher) {
|
||||
email_to_user($teacher, $adminuser, "WARNING: PENDING PAYMENTS", $message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user