Skip to content

Commit

Permalink
Daily echeck order notification
Browse files Browse the repository at this point in the history
  • Loading branch information
ethem committed Nov 20, 2006
1 parent b2a39ba commit a40fe0a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
21 changes: 19 additions & 2 deletions enrol/authorize/enrol.php
Expand Up @@ -677,6 +677,7 @@ function cron_daily()

$oneday = 86400;
$timenow = time();
$onepass = $timenow - $oneday;
$settlementtime = authorize_getsettletime($timenow);
$timediff30 = $settlementtime - (30 * $oneday);

Expand All @@ -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)) {
Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions lang/en_utf8/enrol_authorize.php
Expand Up @@ -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.
Expand Down

0 comments on commit a40fe0a

Please sign in to comment.