Skip to content
Browse files

Daily echeck order notification

  • Loading branch information...
1 parent b2a39ba commit a40fe0a7666a7edd833c18dd3a81dc3507289946 ethem committed Nov 20, 2006
Showing with 26 additions and 2 deletions.
  1. +19 −2 enrol/authorize/enrol.php
  2. +7 −0 lang/en_utf8/enrol_authorize.php
View
21 enrol/authorize/enrol.php
@@ -677,6 +677,7 @@ function cron_daily()
$oneday = 86400;
$timenow = time();
+ $onepass = $timenow - $oneday;
$settlementtime = authorize_getsettletime($timenow);
$timediff30 = $settlementtime - (30 * $oneday);
@@ -693,7 +694,24 @@ function cron_daily()
$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)) {
@@ -721,7 +739,6 @@ function cron_daily()
$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
View
7 lang/en_utf8/enrol_authorize.php
@@ -122,6 +122,13 @@
$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.

0 comments on commit a40fe0a

Please sign in to comment.
Something went wrong with that request. Please try again.