From 71e27db713a3478d28d28ffcd2abc83a69542738 Mon Sep 17 00:00:00 2001 From: ethem Date: Wed, 14 Jun 2006 11:53:50 +0000 Subject: [PATCH] If admin set up 'Teachers can manage the payments of the course' and enabled 'Manual-Capture', course teachers are notified about pending orders expiring. Merged from MOODLE_16_STABLE. --- enrol/authorize/config.html | 7 +++++++ enrol/authorize/enrol.php | 29 ++++++++++++++++++++++++++++- lang/en_utf8/enrol_authorize.php | 23 ++++++++++------------- 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/enrol/authorize/config.html b/enrol/authorize/config.html index 8b7ddd3b5e..847d0e65d0 100755 --- a/enrol/authorize/config.html +++ b/enrol/authorize/config.html @@ -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)) { + + an_emailexpiredteacher: + an_emailexpiredteacher)) ?> + + + enrol_mailstudents: enrol_mailstudents)) ?> diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index 6a2eab3ac6..065f0f747c 100755 --- a/enrol/authorize/enrol.php +++ b/enrol/authorize/enrol.php @@ -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); + } + } + } + } } } } diff --git a/lang/en_utf8/enrol_authorize.php b/lang/en_utf8/enrol_authorize.php index 84c85ea0c9..edda017d98 100644 --- a/lang/en_utf8/enrol_authorize.php +++ b/lang/en_utf8/enrol_authorize.php @@ -1,4 +1,4 @@ -Cron must be enabled if you want to use scheduled-capture feature.
Enable \'Authorize.net plugin\' and setup cron properly; or uncheck an_review again.
If you disable scheduled-capture, transactions will be cancelled unless you review them within 30 days.
Check an_review and enter \'0\' to an_capture_day field
if you want to manually accept/deny payments within 30 days.'; $string['adminemailexpired'] = 'This is useful for \'Manual-Capture\'. Admins are notified $a days prior to pending orders expiring.'; +$string['adminemailexpiredteacher'] = 'If you have enabled manual-capture (see above) and teachers can manage the payments, teacher may also notified about pending orders expiring. This will send an email to each course teachers about how many pending orders expiring.'; $string['adminemailexpsetting'] = '(0=disable sending email, default=2, max=5)
(Manual capture settings for sending email: cron=enabled, an_review=checked, an_capture_day=0, an_emailexpired=1-5)'; $string['adminhelpcapturetitle'] = 'Scheduled-Capture Day'; $string['adminhelpreviewtitle'] = 'Order Review'; $string['adminneworder'] = 'Dear Admin, - + You have received a new pending order: Order ID: $a->orderid @@ -22,13 +23,13 @@ $string['adminneworder'] = 'Dear Admin, User: $a->user Course: $a->course Amount: $a->amount - + SCHEDULED-CAPTURE ENABLED?: $a->acstatus - + If scheduled-capture enabled the credit card will be captured on $a->captureon and then student will be enrolled to course, otherwise it will be expired on $a->expireon and cannot be captured after this day. - + Also you can accept/deny the payment to enrol the student immediately following this link: $a->url'; $string['adminnewordersubject'] = '$a->course: New Pending Order($a->orderid)'; @@ -78,12 +79,8 @@ $string['description'] = 'The Authorize.net module allows you to set up paid cou $string['enrolname'] = 'Authorize.net Payment Gateway'; $string['expired'] = 'Expired'; $string['howmuch'] = 'How much?'; -$string['httpsrequired'] = 'We are sorry to inform you that your request cannot be processed now. This site\'s configuration couldn\'t be set up correctly. -

-Please don\'t enter your credit card number unless you see a yellow lock at the bottom of the browser. If the symbol appears, it means the page encrypts all data sent between client and server. So the information during the transaction between the two computers is protected, hence your credit card number cannot be captured over the internet.'; -$string['logindesc'] = 'This option must be ON.

-Please ensure that you have turned url\">loginhttps ON in Admin >> Variables >> Security.

-Turning this on will make Moodle use a secure https connection just for the login and payment pages.'; +$string['httpsrequired'] = 'We are sorry to inform you that your request cannot be processed now. This site\'s configuration couldn\'t be set up correctly.

Please don\'t enter your credit card number unless you see a yellow lock at the bottom of the browser. If the symbol appears, it means the page encrypts all data sent between client and server. So the information during the transaction between the two computers is protected, hence your credit card number cannot be captured over the internet.'; +$string['logindesc'] = 'This option must be ON.

Please ensure that you have turned url\">loginhttps ON in Admin >> Variables >> Security.

Turning this on will make Moodle use a secure https connection just for the login and payment pages.'; $string['missingaddress'] = 'Missing address'; $string['missingcc'] = 'Missing card number'; $string['missingccexpire'] = 'Missing expiration date'; @@ -97,7 +94,7 @@ $string['notsettled'] = 'Not settled'; $string['orderid'] = 'Order ID'; $string['paymentmanagement'] = 'Payment Management'; $string['paymentpending'] = 'Your payment is pending for this course with this order number $a->orderid. See url\'>Order Details.'; -$string['pendingordersemail'] = ' Dear admin, +$string['pendingordersemail'] = 'Dear admin/teacher, $a->pending transactions will be expired unless you accept payment with in $a->days days. @@ -106,7 +103,7 @@ This is a warning message, because you didn\'t enable scheduled-capture. It mean To accept/deny pending payments go to: $a->url -To enable scheduled-capture, it means you will not receive any warning emails anymore, go to: +To enable scheduled-capture (for admins only), it means you will not receive any warning emails anymore, go to: $a->enrolurl'; $string['reason11'] = 'A duplicate transaction has been submitted.'; -- 2.39.5