From c33e8ec8f7c7d22f4253b1697ec3438c11ca79c2 Mon Sep 17 00:00:00 2001 From: ethem <ethem> Date: Mon, 20 Nov 2006 14:48:16 +0000 Subject: [PATCH] Daily echeck order notification --- enrol/authorize/enrol.php | 21 +++++++++++++++++++-- lang/en_utf8/enrol_authorize.php | 9 ++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index 44474e97109..f2cc02a5638 100755 --- a/enrol/authorize/enrol.php +++ b/enrol/authorize/enrol.php @@ -689,6 +689,7 @@ class enrolment_plugin_authorize $oneday = 86400; $timenow = time(); + $onepass = $timenow - $oneday; $settlementtime = authorize_getsettletime($timenow); $timediff30 = $settlementtime - (30 * $oneday); @@ -705,7 +706,24 @@ class enrolment_plugin_authorize $select = "(status='".AN_STATUS_EXPIRE."') AND (timecreated<'$timediff60')"; delete_records_select('enrol_authorize', $select); - // XXX TODO SEND EMAIL to uploadcsv user + // XXX TODO SEND EMAIL to 'enrol/authorize:uploadcsv' + // get_users_by_capability() does not handling user level resolving + // After user resolving, get_admin() to get_users_by_capability() + $adminuser = get_admin(); + $select = "status IN(".AN_STATUS_UNDERREVIEW.",".AN_STATUS_APPROVEDREVIEW.") " . + "AND (timecreated<'$onepass') AND (timecreated>'$timediff60')"; + $count = count_records_select('enrol_authorize', $select); + if ($count) { + $a = new stdClass; + $a->count = $count; + $a->course = $SITE->shortname; + $subject = get_string('pendingechecksubject', 'enrol_authorize', $a); + $a = new stdClass; + $a->count = $count; + $a->url = $CFG->wwwroot.'/enrol/authorize/uploadcsv.php'; + $message = get_string('pendingecheckemail', 'enrol_authorize', $a); + @email_to_user($adminuser, $adminuser, $subject, $message); + } // Daily warning email for pending orders expiring. if (empty($CFG->an_emailexpired)) { @@ -733,7 +751,6 @@ class enrolment_plugin_authorize $a->enrolurl = "$CFG->wwwroot/$CFG->admin/enrol_config.php?enrol=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, $subject, $message); // Email to teachers diff --git a/lang/en_utf8/enrol_authorize.php b/lang/en_utf8/enrol_authorize.php index 621bfa7ab78..ed4cd794ff4 100644 --- a/lang/en_utf8/enrol_authorize.php +++ b/lang/en_utf8/enrol_authorize.php @@ -1,5 +1,5 @@ <?PHP // $Id$ - // enrol_authorize.php - created with Moodle 1.8 dev (2006102600) + // enrol_authorize.php - created with Moodle 1.8 dev (2006112000) $string['adminacceptccs'] = 'Which credit card types will be accepted?'; @@ -126,6 +126,13 @@ $string['orderid'] = 'OrderID'; $string['paymentmanagement'] = 'Payment Management'; $string['paymentmethod'] = 'Payment Method'; $string['paymentpending'] = 'Your payment is pending for this course with this order number $a->orderid. See <a href=\'$a->url\'>Order Details</a>.'; +$string['pendingecheckemail'] = 'Dear manager, + +There are $a->count pending echecks now and you have to upload a csv file to get the users enrolled. + +Click the link and read the help file on the page seen: +$a->url'; +$string['pendingechecksubject'] = '$a->course: Pending eChecks($a->count)'; $string['pendingordersemail'] = 'Dear admin, $a->pending transactions for course \"$a->course\" will expire unless you accept payment within $a->days days.